Commit f5cf58cb authored by David黄金龙's avatar David黄金龙

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

* 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  强制升级 token 失效的errorBlock 引出
  时间选择器修改
  // 配偶标识
  //  去掉OCR loading
parents db1668dd 52564d3e
......@@ -301,7 +301,7 @@ class YHFormTitleItem : YHFormItemProtocol {
func getSubTitle() -> String {
switch self.type {
case .sponse:
return String(format: " (%@)", "如未婚、离婚、丧偶可不填".local)
return "".local
case .parent:
return String(format: " (%@)", "包含已故".local)
case .brother:
......
......@@ -305,6 +305,9 @@ class YHIdentityCardCell: UITableViewCell {
self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return }
self.viewModel.updateModel(self.type, isFront: true, url: url)
self.frontImageButton.setBackgroundImage(image, for: .normal)
......@@ -312,24 +315,18 @@ class YHIdentityCardCell: UITableViewCell {
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
} else {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
......@@ -361,6 +358,9 @@ class YHIdentityCardCell: UITableViewCell {
self.backSurfaceImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
guard let url = success else { return }
self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
self.viewModel.updateModel(self.type, isFront: false, url: url)
......@@ -371,22 +371,14 @@ class YHIdentityCardCell: UITableViewCell {
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 1) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
} else {
self.viewModel.requestHkIDCardMessage(url, isBack: 1 ) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
......
......@@ -34,32 +34,17 @@ class YHDatePickView: UIView {
var pickerView: UIPickerView!
var lastIsTaday: Bool = false {
didSet {
if lastIsTaday {
guard let type = type else { return }
switch type {
case .yyyymmdd:
pickerView.selectRow(0, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
case .yyyymm:
pickerView.selectRow(0, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
case .yyyy:
pickerView.selectRow(0, inComponent: 0, animated: true)
}
} else {
guard let type = type else { return }
switch type {
case .yyyymmdd:
pickerView.selectRow(100, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
case .yyyymm:
pickerView.selectRow(100, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
case .yyyy:
pickerView.selectRow(100, inComponent: 0, animated: true)
}
guard let type = type else { return }
switch type {
case .yyyymmdd:
pickerView.selectRow(99, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
pickerView.selectRow(self.currentDateCom.day! - 1, inComponent: 2, animated: true)
case .yyyymm:
pickerView.selectRow(99, inComponent: 0, animated: true)
pickerView.selectRow(self.currentDateCom.month! - 1, inComponent: 1, animated: true)
case .yyyy:
pickerView.selectRow(99, inComponent: 0, animated: true)
}
}
}
......@@ -226,23 +211,11 @@ class YHDatePickView: UIView {
var date = ""
switch type {
case .yyyymmdd:
if lastIsTaday {
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0),Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
} else {
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
}
date = String(format: "%02ld%@%02ld%@%02ld", (self.currentDateCom.year!) + self.pickerView.selectedRow(inComponent: 0) - 99, Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1,Self.separator, self.pickerView.selectedRow(inComponent: 2) + 1)
case .yyyymm:
if lastIsTaday {
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) ,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
} else {
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100 ,Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
}
date = String(format: "%02ld%@%02ld", (self.currentDateCom.year!) + self.pickerView.selectedRow(inComponent: 0) - 99, Self.separator, self.pickerView.selectedRow(inComponent: 1) + 1)
case .yyyy:
if lastIsTaday {
date = String(format: "%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0))
} else {
date = String(format: "%02ld", (self.currentDateCom.year!) - self.pickerView.selectedRow(inComponent: 0) + 100)
}
date = String(format: "%02ld", (self.currentDateCom.year!) + self.pickerView.selectedRow(inComponent: 0) - 99)
}
if self.backDate != nil {
self.backDate!(date)
......@@ -279,7 +252,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
}
return 200
} else if component == 1 {
if self.pickerView.selectedRow(inComponent: 0) == 0 {
if self.pickerView.selectedRow(inComponent: 0) == 99 {
if lastIsTaday {
return self.currentDateCom.month!
}
......@@ -290,7 +263,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
if type == .yyyy {
return 0
}
if self.pickerView.selectedRow(inComponent: 0) == 0 && self.pickerView.selectedRow(inComponent: 1) == self.currentDateCom.month! - 1 {
if self.pickerView.selectedRow(inComponent: 0) == 99 && self.pickerView.selectedRow(inComponent: 1) == self.currentDateCom.month! - 1 {
if lastIsTaday {
return self.currentDateCom.day!
}
......@@ -338,10 +311,7 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
if component == 0 {
if lastIsTaday {
return "\((currentDateCom.year!) - row)"
}
return "\((currentDateCom.year!) - row + 100)"
return "\((currentDateCom.year!) + row - 99)"
} else if component == 1 {
return "\(row + 1)"
} else {
......@@ -351,11 +321,18 @@ extension YHDatePickView: UIPickerViewDelegate,UIPickerViewDataSource {
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if component == 1, self.type == .yyyymmdd {
pickerView.reloadComponent(2)
pickerView.reloadComponent(1)
}
if component == 0, lastIsTaday {
pickerView.reloadComponent(1)
if self.type == .yyyymmdd {
pickerView.reloadComponent(2)
}
}
if component == 1, lastIsTaday, self.type == .yyyymmdd {
pickerView.reloadComponent(2)
}
}
}
......@@ -313,31 +313,27 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.frontImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
guard let url = success else { return }
self.viewModel.updateModel(self.type, isFront: true, url: url)
self.frontImageButton.setBackgroundImage(image, for: .normal)
self.frontDeleteButton.isHidden = false
self.viewModel.getPublicImageUrl(url) {[weak self] success, error in
guard let self = self else { return }
guard let url = success else { return }
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
} else {
self.viewModel.requestHkIDCardMessage(url, isBack: 0) {[weak self] success, error in
guard let self = self else { return }
self.frontImageButton.stopRotationAnimation()
self.frontImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
......@@ -369,6 +365,9 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
self.backSurfaceImageButton.startRotationAnimation()
self.viewModel.uploadImage(image) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
guard let url = success else { return }
self.backSurfaceImageButton.setBackgroundImage(image, for: .normal)
self.viewModel.updateModel(self.type, isFront: false, url: url)
......@@ -378,23 +377,13 @@ class YHMainInformationCardTableViewCell: UITableViewCell {
guard let url = success else { return }
if self.type == .identity {
self.viewModel.requestCnIDCardMessage(url, isBack: 1) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
} else {
self.viewModel.requestHkIDCardMessage(url, isBack: 1 ) {[weak self] success, error in
guard let self = self else { return }
self.backSurfaceImageButton.stopRotationAnimation()
self.backSurfaceImageButton.setContent("", "")
if success {
} else {
if !success {
YHHUD.flash(message: error?.errorMsg ?? "")
}
}
......
......@@ -320,6 +320,9 @@ class YHNetRequest: NSObject {
// 发送强制更新通知
NotificationCenter.default.post(name: YhConstant.YhNotification.didForceUpgradeNotifiction, object: nil)
YHHUD.hide()
guard let errorBlock = self.failure else { return }
let errorModel = YHErrorModel(errorCode: Int32(statusCode), errorMsg: errorResponseMsg)
errorBlock(errorModel)
}
return
}
......@@ -333,6 +336,9 @@ class YHNetRequest: NSObject {
UIViewController.current?.navigationController?.popToRootViewController(animated: false)
goTabBarBy(tabType: .home)
YHHUD.hide()
guard let errorBlock = self.failure else { return }
let errorModel = YHErrorModel(errorCode: Int32(statusCode), errorMsg: errorResponseMsg)
errorBlock(errorModel)
}
return
}
......
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