Commit 3e48cc3b authored by pete谢兆麟's avatar pete谢兆麟

Merge branch 'plan' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into plan

# Conflicts:
#	galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyNewViewController.swift
parents d97c3985 8acee64f
......@@ -8470,7 +8470,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -8616,7 +8616,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -8824,7 +8824,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -8872,7 +8872,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = (
......
......@@ -628,12 +628,6 @@ extension YHMyNewViewController {
}
func clickItem(_ item: PersonalModuleItem) {
// do {
// let vc = YHPlanViewController()
// self.navigationController?.pushViewController(vc)
// return
// }
if !checkLogin() {
return
}
......
......@@ -83,15 +83,15 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
if 0 <= currentIndex, currentIndex < arr.count {
let model = arr[currentIndex]
if type == .wechat {
sendImageToWechat(model.img_url)
sendImageToWechat(model.image_poster)
} else if type == .copyLink {
let pasteBoard = UIPasteboard.general
pasteBoard.string = model.img_url
pasteBoard.string = model.image_poster
YHHUD.flash(message: "复制成功")
} else if type == .saveImg {
saveImgFromUrl(model.img_url)
saveImgFromUrl(model.image_poster)
}
}
}
......@@ -137,7 +137,7 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
func showBgImage(index: Int) {
if 0 <= index, index < arr.count {
let model = arr[index]
if let url = URL(string: model.img_url) {
if let url = URL(string: model.image_poster) {
bgImgView.kf.setImage(with: url)
}
}
......@@ -155,13 +155,14 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
let ossGroup = DispatchGroup()
for item in imgs {
ossGroup.enter()
item.imgView.kf.setImage(with: URL(string: item.model.img_url)) { result in
item.imgView.kf.setImage(with: URL(string: item.model.image_poster)) { result in
switch result {
case let .success(value):
let size = value.image.size
let scale = size.height > 0 ? Double(size.width / size.height) : 1.0
if scale > 0 {
item.width = scale * item.height
printLog("IMG_SIZE: \(item.width), \(item.height)")
}
case let .failure(error):
print("Job failed: \(error.localizedDescription)")
......
......@@ -143,15 +143,15 @@ class YHPlanShareViewController: YHBaseViewController {
let fileName = destinationURL.lastPathComponent
let fileExtension = destinationURL.pathExtension
YHShareManager.shared.shareFileToWeChat(fileUrl: destinationURL, filename: fileName, ext: fileExtension)
}
} else if eventType == .saveImg {
if FileManager.default.fileExists(atPath: destinationURL.path) {
YHHUD.flash(message: "已下载PDF")
return
}
// if FileManager.default.fileExists(atPath: destinationURL.path) {
// YHHUD.flash(message: "已下载PDF")
// return
// }
//
if pdfDownloadUrl.isEmpty {
requestPDF()
......@@ -238,7 +238,9 @@ class YHPlanShareViewController: YHBaseViewController {
}
YHHUD.show(.progress(message: "下载中..."))
let task = URLSession.shared.downloadTask(with: url) { [weak self] (locationUrl, _, error) in
let configuration = URLSessionConfiguration.default
let session = URLSession(configuration: configuration)
let task = session.downloadTask(with: url) { [weak self] (locationUrl, response, error) in
DispatchQueue.main.async {
YHHUD.hide()
guard let self = self else { return }
......@@ -247,6 +249,9 @@ class YHPlanShareViewController: YHBaseViewController {
YHHUD.flash(message: "下载PDF失败")
return
}
if let res = response {
printLog(res.suggestedFilename)
}
self.savePDF(sourceUrl: url, locationUrl: locationUrl)
}
}
......@@ -256,17 +261,6 @@ class YHPlanShareViewController: YHBaseViewController {
func savePDF(sourceUrl: URL, locationUrl: URL) {
let fileManager = FileManager.default
// 创建子文件夹如果不存在
if !fileManager.fileExists(atPath: self.planDocumentFileUrl.path) {
do {
try fileManager.createDirectory(at: self.planDocumentFileUrl, withIntermediateDirectories: true, attributes: nil)
print("目录已创建: \(self.planDocumentFileUrl.path)")
} catch {
print("创建目录失败: \(error.localizedDescription)")
return
}
}
// 保存文件到 plan 目录
let lastComponent = sourceUrl.lastPathComponent
......@@ -278,6 +272,7 @@ class YHPlanShareViewController: YHBaseViewController {
}
try fileManager.moveItem(at: locationUrl, to: destinationURL)
print("文件已保存到: \(destinationURL.path)")
print("文件源地址: \(locationUrl.path)")
YHHUD.flash(message: "下载PDF成功")
} catch {
......
......@@ -15,7 +15,7 @@ class YHPlanShareImageCell: UICollectionViewCell {
var model: YHPlanPolicyImageInfo = YHPlanPolicyImageInfo() {
didSet {
if let url = URL(string: model.model.img_url) {
if let url = URL(string: model.model.image_poster) {
imgView.kf.setImage(with: url, placeholder: UIImage(named: "global_default_image"))
} else {
imgView.image = UIImage(named: "global_default_image")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment