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 @@ ...@@ -8470,7 +8470,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxyTestEnv.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -8616,7 +8616,7 @@ ...@@ -8616,7 +8616,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -8824,7 +8824,7 @@ ...@@ -8824,7 +8824,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxyDebug.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
...@@ -8872,7 +8872,7 @@ ...@@ -8872,7 +8872,7 @@
CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements; CODE_SIGN_ENTITLEMENTS = galaxy/galaxy.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = RXHYW88XR7; DEVELOPMENT_TEAM = RXHYW88XR7;
ENABLE_USER_SCRIPT_SANDBOXING = NO; ENABLE_USER_SCRIPT_SANDBOXING = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
......
...@@ -628,12 +628,6 @@ extension YHMyNewViewController { ...@@ -628,12 +628,6 @@ extension YHMyNewViewController {
} }
func clickItem(_ item: PersonalModuleItem) { func clickItem(_ item: PersonalModuleItem) {
// do {
// let vc = YHPlanViewController()
// self.navigationController?.pushViewController(vc)
// return
// }
if !checkLogin() { if !checkLogin() {
return return
} }
......
...@@ -83,15 +83,15 @@ class YHPlanPolicyDetailViewController: YHBaseViewController { ...@@ -83,15 +83,15 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
if 0 <= currentIndex, currentIndex < arr.count { if 0 <= currentIndex, currentIndex < arr.count {
let model = arr[currentIndex] let model = arr[currentIndex]
if type == .wechat { if type == .wechat {
sendImageToWechat(model.img_url) sendImageToWechat(model.image_poster)
} else if type == .copyLink { } else if type == .copyLink {
let pasteBoard = UIPasteboard.general let pasteBoard = UIPasteboard.general
pasteBoard.string = model.img_url pasteBoard.string = model.image_poster
YHHUD.flash(message: "复制成功") YHHUD.flash(message: "复制成功")
} else if type == .saveImg { } else if type == .saveImg {
saveImgFromUrl(model.img_url) saveImgFromUrl(model.image_poster)
} }
} }
} }
...@@ -137,7 +137,7 @@ class YHPlanPolicyDetailViewController: YHBaseViewController { ...@@ -137,7 +137,7 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
func showBgImage(index: Int) { func showBgImage(index: Int) {
if 0 <= index, index < arr.count { if 0 <= index, index < arr.count {
let model = arr[index] 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) bgImgView.kf.setImage(with: url)
} }
} }
...@@ -155,13 +155,14 @@ class YHPlanPolicyDetailViewController: YHBaseViewController { ...@@ -155,13 +155,14 @@ class YHPlanPolicyDetailViewController: YHBaseViewController {
let ossGroup = DispatchGroup() let ossGroup = DispatchGroup()
for item in imgs { for item in imgs {
ossGroup.enter() 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 { switch result {
case let .success(value): case let .success(value):
let size = value.image.size let size = value.image.size
let scale = size.height > 0 ? Double(size.width / size.height) : 1.0 let scale = size.height > 0 ? Double(size.width / size.height) : 1.0
if scale > 0 { if scale > 0 {
item.width = scale * item.height item.width = scale * item.height
printLog("IMG_SIZE: \(item.width), \(item.height)")
} }
case let .failure(error): case let .failure(error):
print("Job failed: \(error.localizedDescription)") print("Job failed: \(error.localizedDescription)")
......
...@@ -143,15 +143,15 @@ class YHPlanShareViewController: YHBaseViewController { ...@@ -143,15 +143,15 @@ class YHPlanShareViewController: YHBaseViewController {
let fileName = destinationURL.lastPathComponent let fileName = destinationURL.lastPathComponent
let fileExtension = destinationURL.pathExtension let fileExtension = destinationURL.pathExtension
YHShareManager.shared.shareFileToWeChat(fileUrl: destinationURL, filename: fileName, ext: fileExtension) YHShareManager.shared.shareFileToWeChat(fileUrl: destinationURL, filename: fileName, ext: fileExtension)
} }
} else if eventType == .saveImg { } 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 { if pdfDownloadUrl.isEmpty {
requestPDF() requestPDF()
...@@ -238,7 +238,9 @@ class YHPlanShareViewController: YHBaseViewController { ...@@ -238,7 +238,9 @@ class YHPlanShareViewController: YHBaseViewController {
} }
YHHUD.show(.progress(message: "下载中...")) 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 { DispatchQueue.main.async {
YHHUD.hide() YHHUD.hide()
guard let self = self else { return } guard let self = self else { return }
...@@ -247,6 +249,9 @@ class YHPlanShareViewController: YHBaseViewController { ...@@ -247,6 +249,9 @@ class YHPlanShareViewController: YHBaseViewController {
YHHUD.flash(message: "下载PDF失败") YHHUD.flash(message: "下载PDF失败")
return return
} }
if let res = response {
printLog(res.suggestedFilename)
}
self.savePDF(sourceUrl: url, locationUrl: locationUrl) self.savePDF(sourceUrl: url, locationUrl: locationUrl)
} }
} }
...@@ -257,17 +262,6 @@ class YHPlanShareViewController: YHBaseViewController { ...@@ -257,17 +262,6 @@ class YHPlanShareViewController: YHBaseViewController {
let fileManager = FileManager.default 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 目录 // 保存文件到 plan 目录
let lastComponent = sourceUrl.lastPathComponent let lastComponent = sourceUrl.lastPathComponent
let destinationURL = self.planDocumentFileUrl.appendingPathComponent(lastComponent) let destinationURL = self.planDocumentFileUrl.appendingPathComponent(lastComponent)
...@@ -278,6 +272,7 @@ class YHPlanShareViewController: YHBaseViewController { ...@@ -278,6 +272,7 @@ class YHPlanShareViewController: YHBaseViewController {
} }
try fileManager.moveItem(at: locationUrl, to: destinationURL) try fileManager.moveItem(at: locationUrl, to: destinationURL)
print("文件已保存到: \(destinationURL.path)") print("文件已保存到: \(destinationURL.path)")
print("文件源地址: \(locationUrl.path)")
YHHUD.flash(message: "下载PDF成功") YHHUD.flash(message: "下载PDF成功")
} catch { } catch {
......
...@@ -15,7 +15,7 @@ class YHPlanShareImageCell: UICollectionViewCell { ...@@ -15,7 +15,7 @@ class YHPlanShareImageCell: UICollectionViewCell {
var model: YHPlanPolicyImageInfo = YHPlanPolicyImageInfo() { var model: YHPlanPolicyImageInfo = YHPlanPolicyImageInfo() {
didSet { 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")) imgView.kf.setImage(with: url, placeholder: UIImage(named: "global_default_image"))
} else { } else {
imgView.image = UIImage(named: "global_default_image") 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