diff --git a/OrderScheduling.xcodeproj/project.pbxproj b/OrderScheduling.xcodeproj/project.pbxproj index 753f34a..9bb92b3 100644 --- a/OrderScheduling.xcodeproj/project.pbxproj +++ b/OrderScheduling.xcodeproj/project.pbxproj @@ -48,11 +48,11 @@ 79CECC242A8B16D400B95D8B /* VehicleMonitoringListController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CECC232A8B16D400B95D8B /* VehicleMonitoringListController.swift */; }; 79CECC262A8C749B00B95D8B /* VehicleMonitorVideoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CECC252A8C749B00B95D8B /* VehicleMonitorVideoController.swift */; }; 79CECC282A8CADEA00B95D8B /* VehicleMonitoringVideoDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CECC272A8CADEA00B95D8B /* VehicleMonitoringVideoDetailController.swift */; }; - 79DD0DA82A9480D000768FE7 /* NotificationAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DD0DA72A9480D000768FE7 /* NotificationAuthView.swift */; }; 79DD0DAA2A9481BC00768FE7 /* NotificationAuthTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DD0DA92A9481BC00768FE7 /* NotificationAuthTool.swift */; }; 79DD0DB12A94B3DB00768FE7 /* EmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DD0DB02A94B3DB00768FE7 /* EmptyView.swift */; }; 79DD0DB42A95F00B00768FE7 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DD0DB32A95F00B00768FE7 /* Extension.swift */; }; 79DD0DBB2A971EB300768FE7 /* ZDViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79DD0DBA2A971EB300768FE7 /* ZDViewController.swift */; }; + 79E434252AA1919400AEB16C /* CommonAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E434242AA1919400AEB16C /* CommonAlertView.swift */; }; 79EAD8142A7B86610036E093 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 79EAD8132A7B86610036E093 /* Assets.xcassets */; }; 79EAD8172A7B86610036E093 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 79EAD8152A7B86610036E093 /* LaunchScreen.storyboard */; }; 79FB75EC2A988EC000DB00A4 /* MessageCenterTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FB75EB2A988EC000DB00A4 /* MessageCenterTool.swift */; }; @@ -160,11 +160,11 @@ 79DD0DA12A94501500768FE7 /* OrderScheduling-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "OrderScheduling-Bridging-Header.h"; sourceTree = ""; }; 79DD0DA52A945D9E00768FE7 /* OrderSchedulingRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OrderSchedulingRelease.entitlements; sourceTree = ""; }; 79DD0DA62A946B2500768FE7 /* OrderSchedulingDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OrderSchedulingDebug.entitlements; sourceTree = ""; }; - 79DD0DA72A9480D000768FE7 /* NotificationAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationAuthView.swift; sourceTree = ""; }; 79DD0DA92A9481BC00768FE7 /* NotificationAuthTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationAuthTool.swift; sourceTree = ""; }; 79DD0DB02A94B3DB00768FE7 /* EmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyView.swift; sourceTree = ""; }; 79DD0DB32A95F00B00768FE7 /* Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = ""; }; 79DD0DBA2A971EB300768FE7 /* ZDViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZDViewController.swift; sourceTree = ""; }; + 79E434242AA1919400AEB16C /* CommonAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonAlertView.swift; sourceTree = ""; }; 79EAD8072A7B86600036E093 /* OrderScheduling.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OrderScheduling.app; sourceTree = BUILT_PRODUCTS_DIR; }; 79EAD8132A7B86610036E093 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 79EAD8162A7B86610036E093 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -486,9 +486,9 @@ 794FBB182A8F4AF000D57BB8 /* MessageCount.swift */, 794FBB202A934E0A00D57BB8 /* AppUpdateView.swift */, 794FBB222A93519800D57BB8 /* AppUpdateTool.swift */, - 79DD0DA72A9480D000768FE7 /* NotificationAuthView.swift */, 79DD0DA92A9481BC00768FE7 /* NotificationAuthTool.swift */, 79DD0DB02A94B3DB00768FE7 /* EmptyView.swift */, + 79E434242AA1919400AEB16C /* CommonAlertView.swift */, ); path = View; sourceTree = ""; @@ -932,13 +932,13 @@ 7918877B2A7CDD1A007EA0C1 /* Initial.swift in Sources */, 791887C42A84BFDB007EA0C1 /* Tool.swift in Sources */, 794FBB162A8F1A3300D57BB8 /* RescuePhotoController.swift in Sources */, + 79E434252AA1919400AEB16C /* CommonAlertView.swift in Sources */, 7918878F2A809E37007EA0C1 /* TimerStrings.swift in Sources */, 7918878B2A7CE9E0007EA0C1 /* main.swift in Sources */, 791887A02A80CA10007EA0C1 /* RequestList.swift in Sources */, 79FB761C2A9EEC3700DB00A4 /* GroupData.swift in Sources */, 79FB76172A9DFC9600DB00A4 /* NotificationSetUpController.swift in Sources */, 79CECC262A8C749B00B95D8B /* VehicleMonitorVideoController.swift in Sources */, - 79DD0DA82A9480D000768FE7 /* NotificationAuthView.swift in Sources */, 794FBB212A934E0A00D57BB8 /* AppUpdateView.swift in Sources */, 79DD0DB42A95F00B00768FE7 /* Extension.swift in Sources */, 791887802A7CE6F1007EA0C1 /* UserDefaultStrings.swift in Sources */, diff --git a/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/UserInterfaceState.xcuserstate b/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/UserInterfaceState.xcuserstate index 2784eb5..9ff966c 100644 Binary files a/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/UserInterfaceState.xcuserstate and b/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 9bce785..395282b 100644 --- a/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -46,8 +46,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "240" - endingLineNumber = "240" + startingLineNumber = "291" + endingLineNumber = "291" landmarkName = "textView(_:shouldInteractWith:in:interaction:)" landmarkType = "7"> @@ -62,8 +62,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "244" - endingLineNumber = "244" + startingLineNumber = "295" + endingLineNumber = "295" landmarkName = "textView(_:shouldInteractWith:in:interaction:)" landmarkType = "7"> @@ -78,8 +78,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "121" - endingLineNumber = "121" + startingLineNumber = "125" + endingLineNumber = "125" landmarkName = "addActions()" landmarkType = "7"> @@ -141,8 +141,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "107" - endingLineNumber = "107" + startingLineNumber = "111" + endingLineNumber = "111" landmarkName = "addActions()" landmarkType = "7"> @@ -157,54 +157,6 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "79" - endingLineNumber = "79" - landmarkName = "addActions()" - landmarkType = "7"> - - - - - - - - - - - - + + + + + + + + + + + + @@ -1365,8 +1365,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "134" - endingLineNumber = "134" + startingLineNumber = "138" + endingLineNumber = "138" landmarkName = "jpushNotificationAuthorization(_:withInfo:)" landmarkType = "7"> @@ -1381,8 +1381,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "125" - endingLineNumber = "125" + startingLineNumber = "129" + endingLineNumber = "129" landmarkName = "jpushNotificationCenter(_:didReceive:withCompletionHandler:)" landmarkType = "7"> @@ -1429,8 +1429,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "155" - endingLineNumber = "155" + startingLineNumber = "206" + endingLineNumber = "206" landmarkName = "addActions()" landmarkType = "7"> @@ -1445,8 +1445,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "159" - endingLineNumber = "159" + startingLineNumber = "210" + endingLineNumber = "210" landmarkName = "addActions()" landmarkType = "7"> @@ -1461,8 +1461,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "162" - endingLineNumber = "162" + startingLineNumber = "213" + endingLineNumber = "213" landmarkName = "addActions()" landmarkType = "7"> @@ -1477,8 +1477,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "174" - endingLineNumber = "174" + startingLineNumber = "225" + endingLineNumber = "225" landmarkName = "addActions()" landmarkType = "7"> @@ -1493,8 +1493,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "163" - endingLineNumber = "163" + startingLineNumber = "214" + endingLineNumber = "214" landmarkName = "addActions()" landmarkType = "7"> @@ -1557,8 +1557,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "164" - endingLineNumber = "164" + startingLineNumber = "215" + endingLineNumber = "215" landmarkName = "addActions()" landmarkType = "7"> @@ -2032,8 +2032,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "127" - endingLineNumber = "127" + startingLineNumber = "131" + endingLineNumber = "131" landmarkName = "jpushNotificationCenter(_:didReceive:withCompletionHandler:)" landmarkType = "7"> @@ -2253,8 +2253,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "123" - endingLineNumber = "123" + startingLineNumber = "127" + endingLineNumber = "127" landmarkName = "addActions()" landmarkType = "7"> @@ -2333,8 +2333,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "122" - endingLineNumber = "122" + startingLineNumber = "126" + endingLineNumber = "126" landmarkName = "addActions()" landmarkType = "7"> @@ -2381,8 +2381,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "125" - endingLineNumber = "125" + startingLineNumber = "129" + endingLineNumber = "129" landmarkName = "addActions()" landmarkType = "7"> @@ -2397,8 +2397,8 @@ filePath = "OrderScheduling/Login/ViewController/LoginController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "127" - endingLineNumber = "127" + startingLineNumber = "131" + endingLineNumber = "131" landmarkName = "addActions()" landmarkType = "7"> @@ -2764,69 +2764,6 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/OrderScheduling/.DS_Store b/OrderScheduling/.DS_Store index e012a07..6021d9e 100644 Binary files a/OrderScheduling/.DS_Store and b/OrderScheduling/.DS_Store differ diff --git a/OrderScheduling/Common/.DS_Store b/OrderScheduling/Common/.DS_Store index 344ca47..7022d87 100644 Binary files a/OrderScheduling/Common/.DS_Store and b/OrderScheduling/Common/.DS_Store differ diff --git a/OrderScheduling/Common/View/NotificationAuthView.swift b/OrderScheduling/Common/View/CommonAlertView.swift similarity index 72% rename from OrderScheduling/Common/View/NotificationAuthView.swift rename to OrderScheduling/Common/View/CommonAlertView.swift index bef5213..468e1d7 100644 --- a/OrderScheduling/Common/View/NotificationAuthView.swift +++ b/OrderScheduling/Common/View/CommonAlertView.swift @@ -1,25 +1,23 @@ // -// NotificationAuthView.swift +// CommonAlertView.swift // OrderScheduling // -// Created by 中道 on 2023/8/22. +// Created by 中道 on 2023/9/1. // import Foundation import DDControlsKit_Private import DDAutoUIKit_Private -import DDColorKit_Private -import DDFontKit_Private -open class NotificationAuthView : DDView{ +open class CommonAlertView : DDView{ private let radiusView : DDView private let scrollView : DDScrollView private let scrollContentView : DDView public let contentLabel : DDLabel public let horizontalLine : DDView public let verticalLine : DDView - public let ignoreButton : DDButton - public let setButton : DDButton + public let cancelButton : DDButton + public let sureButton : DDButton public override init(frame: CGRect) { radiusView = DDView.init() scrollView = DDScrollView() @@ -27,8 +25,8 @@ open class NotificationAuthView : DDView{ contentLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(17)), textColor: .black.alpha(0.5)) horizontalLine = DDView() verticalLine = DDView() - ignoreButton = DDButton.dd_initCustom() - setButton = DDButton.dd_initCustom() + cancelButton = DDButton.dd_initCustom() + sureButton = DDButton.dd_initCustom() super.init(frame: frame) radiusView.layer.cornerRadius = auto(10) radiusView.layer.masksToBounds = true @@ -37,23 +35,23 @@ open class NotificationAuthView : DDView{ scrollView.addSubview(scrollContentView) contentLabel.numberOfLines = 0 contentLabel.textAlignment = .center - contentLabel.text = "当前应用未开启通知,建议开启" + contentLabel.text = "" scrollContentView.addSubview(contentLabel) horizontalLine.backgroundColor = .hex("979797").alpha(0.35) radiusView.addSubview(horizontalLine) verticalLine.backgroundColor = .hex("979797").alpha(0.35) verticalLine.isHidden = true radiusView.addSubview(verticalLine) - ignoreButton.setTitle("取消", for: .normal) - ignoreButton.titleLabel?.font = .mediumFont(auto(14)) - ignoreButton.backgroundColor = .white - ignoreButton.setTitleColor(.black.alpha(0.3), for: .normal) - radiusView.addSubview(ignoreButton) - setButton.setTitle("去设置", for: .normal) - setButton.setTitleColor(.white, for: .normal) - setButton.titleLabel?.font = .mediumFont(auto(14)) - setButton.backgroundColor = .hex("1C62D9") - radiusView.addSubview(setButton) + cancelButton.setTitle("取消", for: .normal) + cancelButton.titleLabel?.font = .mediumFont(auto(14)) + cancelButton.backgroundColor = .white + cancelButton.setTitleColor(.black.alpha(0.3), for: .normal) + radiusView.addSubview(cancelButton) + sureButton.setTitle("确定", for: .normal) + sureButton.setTitleColor(.white, for: .normal) + sureButton.titleLabel?.font = .mediumFont(auto(14)) + sureButton.backgroundColor = .hex("1C62D9") + radiusView.addSubview(sureButton) radiusView.snp.makeConstraints { make in make.edges.equalToSuperview() @@ -61,19 +59,20 @@ open class NotificationAuthView : DDView{ scrollView.snp.makeConstraints { make in make.top.left.right.equalToSuperview() - make.bottom.equalToSuperview().offset(-auto(70)) + make.bottom.equalTo(horizontalLine.snp.top) } scrollContentView.snp.makeConstraints { make in make.edges.equalToSuperview() make.width.equalToSuperview() + make.height.greaterThanOrEqualToSuperview() } contentLabel.snp.makeConstraints { make in make.left.equalToSuperview().offset(auto(20)) make.top.equalToSuperview().offset(auto(20)) make.right.equalTo(-auto(20)) - make.bottom.equalTo(scrollContentView) + make.bottom.equalTo(scrollContentView).offset(-auto(20)) } horizontalLine.snp.makeConstraints { make in @@ -89,14 +88,14 @@ open class NotificationAuthView : DDView{ make.width.equalTo(1) } - ignoreButton.snp.makeConstraints { make in + cancelButton.snp.makeConstraints { make in make.left.equalToSuperview() make.right.equalTo(verticalLine.snp.left) make.top.equalTo(horizontalLine.snp.bottom) make.bottom.equalToSuperview() } - setButton.snp.makeConstraints { make in + sureButton.snp.makeConstraints { make in make.bottom.equalToSuperview() make.right.equalToSuperview() make.top.equalTo(horizontalLine.snp.top) diff --git a/OrderScheduling/Common/View/NotificationAuthTool.swift b/OrderScheduling/Common/View/NotificationAuthTool.swift index af963ce..b140094 100644 --- a/OrderScheduling/Common/View/NotificationAuthTool.swift +++ b/OrderScheduling/Common/View/NotificationAuthTool.swift @@ -17,11 +17,14 @@ open class NotificationAuthTool : NSObject { public let requestNotiAuthRelay = ReplayRelay.create(bufferSize: 1) public let cancelNotiAuthRelay = ReplayRelay.create(bufferSize: 1) private let disposeBag = DisposeBag() - public let notificationAuthView = NotificationAuthView() + public let notificationAuthView = CommonAlertView() public override init() { super.init() + notificationAuthView.sureButton.setTitle("去设置", for: .normal) + notificationAuthView.contentLabel.text = "当前应用未开启通知,建议开启" + requestNotiAuthRelay .subscribe(onNext: {[weak self] _ in if let notificationAuthView = self?.notificationAuthView { @@ -36,13 +39,13 @@ open class NotificationAuthTool : NSObject { }) .disposed(by: disposeBag) - notificationAuthView.setButton.rx.tap + notificationAuthView.sureButton.rx.tap .subscribe(onNext: {[weak self] _ in self?.openSetting() }) .disposed(by: disposeBag) - notificationAuthView.ignoreButton.rx.tap + notificationAuthView.cancelButton.rx.tap .subscribe(onNext: { _ in ENTRY.dismiss(name: notificationAuthViewEntry) }) diff --git a/OrderScheduling/Entry/Entry.swift b/OrderScheduling/Entry/Entry.swift index 7821608..dd8c799 100644 --- a/OrderScheduling/Entry/Entry.swift +++ b/OrderScheduling/Entry/Entry.swift @@ -14,6 +14,50 @@ public let ENTRY = Entry.default open class Entry { public static let `default` = Entry() + func showLoginNoticeEntry(view:UIView,name:String? = nil) { + var attributes = EKAttributes() + attributes = .centerFloat + attributes.name = name + attributes.precedence = .override(priority: .min, dropEnqueuedEntries: false) + attributes.displayMode = .inferred + attributes.displayDuration = .infinity + attributes.screenBackground = .color(color: .clear) + attributes.entryBackground = .color(color: .white) + attributes.screenInteraction = .absorbTouches + attributes.entryInteraction = .absorbTouches + attributes.scroll = .disabled + attributes.entranceAnimation = .init( + translate: .init( + duration: 0.25, + spring: .init(damping: 1, initialVelocity: 0) + ) + ) + attributes.exitAnimation = .init( + translate: .init(duration: 0.25) + ) + attributes.popBehavior = .animated( + animation: .init( + translate: .init(duration: 0.25) + ) + ) + attributes.shadow = .active( + with: .init( + color: .black, + opacity: 0.3, + radius: 6 + ) + ) + attributes.positionConstraints.size = .init( + width: .constant(value: auto(280)), + height: .constant(value: auto(130)) + ) + attributes.positionConstraints.verticalOffset = 0 + attributes.positionConstraints.safeArea = .overridden + attributes.positionConstraints.rotation.isEnabled = false + attributes.statusBar = .light + SwiftEntryKit.display(entry: view, using: attributes) + } + public func showRefuseOrderConfirmEntry(view:UIView,name:String? = nil){ var attributes = EKAttributes() attributes = .centerFloat diff --git a/OrderScheduling/HttpRequestCenter/ApiList.swift b/OrderScheduling/HttpRequestCenter/ApiList.swift index 93334d5..898559e 100644 --- a/OrderScheduling/HttpRequestCenter/ApiList.swift +++ b/OrderScheduling/HttpRequestCenter/ApiList.swift @@ -51,4 +51,6 @@ open class ApiList { public let messageReminderList = "/supplierAppV2/dispatchApp/toDoMessage/messageReminderList" public let readMessageReminder = "/supplierAppV2/dispatchApp/toDoMessage/readMessageReminder" + + public let checkLogin = "/supplierAppV2/open/checkLogin" } diff --git a/OrderScheduling/HttpRequestCenter/ParametersList.swift b/OrderScheduling/HttpRequestCenter/ParametersList.swift index 53d49d7..59efa83 100644 --- a/OrderScheduling/HttpRequestCenter/ParametersList.swift +++ b/OrderScheduling/HttpRequestCenter/ParametersList.swift @@ -21,6 +21,14 @@ public struct LoginCodeParameters : Encodable { var phone : String } +public struct CheckLoginParameters : Encodable { + var supplierLoginCode : String + var phone : String + var code : String + var clientType : String = "rescueApp" + var deviceId : String +} + public struct LoginParameters : Encodable { var app_login_json : String var client_id : Bool diff --git a/OrderScheduling/HttpRequestCenter/RequestList.swift b/OrderScheduling/HttpRequestCenter/RequestList.swift index 864b144..f563609 100644 --- a/OrderScheduling/HttpRequestCenter/RequestList.swift +++ b/OrderScheduling/HttpRequestCenter/RequestList.swift @@ -24,6 +24,10 @@ open class RequestList { return DDAF.post(urlString: HOST+API.verifyCode,parameters: parameters,encoding: JSONParameterEncoder.default,responseType: ResponseModel.self) } + func checkLogin(parameters:Encodable) -> Single?> { + return DDAF.post(urlString: HOST+API.checkLogin,parameters: parameters,encoding: JSONParameterEncoder.default,headers: [],responseType: ResponseModel.self) + } + func login(parameters:Encodable) -> Single?> { return DDAF.post(urlString: HOST+API.login,parameters: parameters,headers: ["Authorization":"Basic c3VwcGxpZXItYXBwOiQyYSQxMCRXZ1pIdzVSamoxcGpIYnJucG00YlYuTWlTZ0o2aWpzYWlNeHN2OUhwZWlYR094UWtWRWVaNg=="],responseType: ResponseModel.self) } diff --git a/OrderScheduling/Login/ViewController/LoginController.swift b/OrderScheduling/Login/ViewController/LoginController.swift index 88f8122..2544fa9 100644 --- a/OrderScheduling/Login/ViewController/LoginController.swift +++ b/OrderScheduling/Login/ViewController/LoginController.swift @@ -19,8 +19,10 @@ import CocoaDebug class LoginController : ZDViewController { private let disposeBag = DisposeBag() private let loginView = LoginView.init() + private let loginNoticeView = CommonAlertView() private let agreeSub = ReplaySubject.create(bufferSize: 1) - + private let loginSub = ReplaySubject.create(bufferSize: 1) + override func viewDidLoad() { super.viewDidLoad() dd_navigationBarBackgroundColor = .clear @@ -66,6 +68,8 @@ extension LoginController { loginView.loginButton.backgroundColor = .hex("1C6CCE").alpha(0.4) loginView.loginButton.setTitle("登录", for: .normal) + + loginNoticeView.sureButton.setTitle("登录", for: .normal) } } extension LoginController { @@ -131,6 +135,53 @@ extension LoginController { .disposed(by: disposeBag) loginView.loginButton.rx.tap + .observe(on: MainScheduler.instance) + .do(onNext: {[weak self] _ in + self?.view.dd_showHUD() + }) + .map({[weak self] _ in + CheckLoginParameters(supplierLoginCode: self?.loginView.serviceProviderView.textfield.text ?? "", phone: self?.loginView.phoneView.textfield.text ?? "", code: self?.loginView.codeView.textfield.text ?? "", deviceId: USER.deviceToken ?? "") + }) + .flatMapLatest({ checkLoginParameters in + return RQ.checkLogin(parameters: checkLoginParameters) + }) + .observe(on: MainScheduler.instance) + .do(onNext: {[weak self] _ in + self?.view.dd_hideHUD() + }) + .observe(on: MainScheduler.instance) + .subscribe(onNext: {[weak self] response in + if response?.code == 200 { + self?.loginSub.onNext(true) + }else if response?.code == 500 { + if let loginNoticeView = self?.loginNoticeView { + loginNoticeView.contentLabel.text = response?.msg + ENTRY.showLoginNoticeEntry(view: loginNoticeView,name: loginNoticeEntry) + } + }else{ + self?.view.dd_makeToast(response?.msg) + } + }) + .disposed(by: disposeBag) + + loginNoticeView.sureButton.rx.tap + .observe(on: MainScheduler.instance) + .subscribe(onNext: {[weak self] in + ENTRY.dismiss(name: loginNoticeEntry) {[weak self] in + self?.loginSub.onNext(true) + } + }) + .disposed(by: disposeBag) + + loginNoticeView.cancelButton.rx.tap + .observe(on: MainScheduler.instance) + .subscribe(onNext: { + ENTRY.dismiss(name: loginNoticeEntry) { + } + }) + .disposed(by: disposeBag) + + loginSub .observe(on: MainScheduler.instance) .do(onNext: {[weak self] _ in self?.view.dd_showHUD() diff --git a/OrderScheduling/Main/AppDelegate.swift b/OrderScheduling/Main/AppDelegate.swift index ca514f5..c37dbf9 100644 --- a/OrderScheduling/Main/AppDelegate.swift +++ b/OrderScheduling/Main/AppDelegate.swift @@ -105,14 +105,18 @@ extension AppDelegate : JPUSHRegisterDelegate { JPUSHService.handleRemoteNotification(userInfo) if GROUP.isOrderPushNotification(userInfo: userInfo) == true { - // 只有订单类型才会弹窗和声音 - TOOL.dealWithOrderPushNotification { userInfo in - TOOL.playAlertWith(userInfo: userInfo) - TOOL.playVoiceWith(userInfo: userInfo) + if USER.isLogin == true { + // 只有订单类型才会弹窗和声音 + TOOL.dealWithOrderPushNotification { userInfo in + TOOL.playAlertWith(userInfo: userInfo) + TOOL.playVoiceWith(userInfo: userInfo) + } } }else{ - MCOUNT.newestMessage() - completionHandler(1 << 1 | 1 << 2) + if USER.isLogin == true { + MCOUNT.newestMessage() + completionHandler(1 << 1 | 1 << 2) + } } } completionHandler(0) diff --git a/OrderScheduling/Main/SceneDelegate.swift b/OrderScheduling/Main/SceneDelegate.swift index d4fa42a..f84e29b 100644 --- a/OrderScheduling/Main/SceneDelegate.swift +++ b/OrderScheduling/Main/SceneDelegate.swift @@ -37,12 +37,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // 后台收到通知后或者不点击通知打开app,激活时消除badge JPUSHService.resetBadge() UIApplication.shared.applicationIconBadgeNumber = 0 - // 只有订单类型才会弹窗和声音 - TOOL.dealWithOrderPushNotification { userInfo in - TOOL.playAlertWith(userInfo: userInfo) + + if USER.isLogin == true { + // 只有订单类型才会弹窗和声音 + TOOL.dealWithOrderPushNotification { userInfo in + TOOL.playAlertWith(userInfo: userInfo) + } + // app激活就要获取最新消息个数 + MCOUNT.newestMessage() } - // app激活就要获取最新消息个数 - MCOUNT.newestMessage() } func sceneWillResignActive(_ scene: UIScene) { diff --git a/OrderScheduling/Strings/EntryStrings.swift b/OrderScheduling/Strings/EntryStrings.swift index 7482ad5..de823f2 100644 --- a/OrderScheduling/Strings/EntryStrings.swift +++ b/OrderScheduling/Strings/EntryStrings.swift @@ -7,6 +7,8 @@ import Foundation +public let loginNoticeEntry = "loginNoticeEntry" + public let refuseOrderEntry = "refuseOrderEntry" public let refuseOrderConfirmEntry = "refuseOrderConfirmEntry"