diff --git a/.DS_Store b/.DS_Store index e06cec5..e41ab3a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/OrderScheduling.xcodeproj/project.pbxproj b/OrderScheduling.xcodeproj/project.pbxproj index 1d71ada..e07dc84 100644 --- a/OrderScheduling.xcodeproj/project.pbxproj +++ b/OrderScheduling.xcodeproj/project.pbxproj @@ -63,6 +63,7 @@ 79FB76102A9C6CAF00DB00A4 /* newJuheOrderAudio.wav in Resources */ = {isa = PBXBuildFile; fileRef = 79FB760E2A9C6CAF00DB00A4 /* newJuheOrderAudio.wav */; }; 79FB76132A9C6CC100DB00A4 /* newOrderAudio.wav in Resources */ = {isa = PBXBuildFile; fileRef = 79FB76122A9C6CC100DB00A4 /* newOrderAudio.wav */; }; 79FB76152A9DEE7400DB00A4 /* RefuseOrderConfirmView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FB76142A9DEE7400DB00A4 /* RefuseOrderConfirmView.swift */; }; + 79FB76172A9DFC9600DB00A4 /* NotificationSetUpController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FB76162A9DFC9600DB00A4 /* NotificationSetUpController.swift */; }; A64E95F00B82DC28C2B9306E /* libPods-OrderScheduling.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 98784A61C325B3D6C408016C /* libPods-OrderScheduling.a */; }; /* End PBXBuildFile section */ @@ -171,6 +172,7 @@ 79FB760E2A9C6CAF00DB00A4 /* newJuheOrderAudio.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = newJuheOrderAudio.wav; sourceTree = ""; }; 79FB76122A9C6CC100DB00A4 /* newOrderAudio.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = newOrderAudio.wav; sourceTree = ""; }; 79FB76142A9DEE7400DB00A4 /* RefuseOrderConfirmView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefuseOrderConfirmView.swift; sourceTree = ""; }; + 79FB76162A9DFC9600DB00A4 /* NotificationSetUpController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSetUpController.swift; sourceTree = ""; }; 9758FDE3BEDA5A983CAE2DED /* Pods-OrderSchedulingNotificationService.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OrderSchedulingNotificationService.debug.xcconfig"; path = "Target Support Files/Pods-OrderSchedulingNotificationService/Pods-OrderSchedulingNotificationService.debug.xcconfig"; sourceTree = ""; }; 98784A61C325B3D6C408016C /* libPods-OrderScheduling.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OrderScheduling.a"; sourceTree = BUILT_PRODUCTS_DIR; }; BD034FA1DD7C17CCBA6B0E5D /* Pods-OrderScheduling.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OrderScheduling.release.xcconfig"; path = "Target Support Files/Pods-OrderScheduling/Pods-OrderScheduling.release.xcconfig"; sourceTree = ""; }; @@ -451,6 +453,7 @@ isa = PBXGroup; children = ( 794FBB132A8F045F00D57BB8 /* MineController.swift */, + 79FB76162A9DFC9600DB00A4 /* NotificationSetUpController.swift */, ); path = ViewController; sourceTree = ""; @@ -902,6 +905,7 @@ 7918878F2A809E37007EA0C1 /* TimerStrings.swift in Sources */, 7918878B2A7CE9E0007EA0C1 /* main.swift in Sources */, 791887A02A80CA10007EA0C1 /* RequestList.swift in Sources */, + 79FB76172A9DFC9600DB00A4 /* NotificationSetUpController.swift in Sources */, 79CECC262A8C749B00B95D8B /* VehicleMonitorVideoController.swift in Sources */, 79DD0DA82A9480D000768FE7 /* NotificationAuthView.swift in Sources */, 794FBB212A934E0A00D57BB8 /* AppUpdateView.swift in Sources */, diff --git a/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/UserInterfaceState.xcuserstate b/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/UserInterfaceState.xcuserstate index a0c8822..4ada88d 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 d2e09c8..2435b8a 100644 --- a/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/OrderScheduling.xcworkspace/xcuserdata/zd.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -523,8 +523,8 @@ filePath = "OrderScheduling/Rescue/ViewController/RescueController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "801" - endingLineNumber = "801" + startingLineNumber = "800" + endingLineNumber = "800" landmarkName = "collectionView(_:cellForItemAt:)" landmarkType = "7"> @@ -539,8 +539,8 @@ filePath = "OrderScheduling/Rescue/ViewController/RescueController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "802" - endingLineNumber = "802" + startingLineNumber = "801" + endingLineNumber = "801" landmarkName = "collectionView(_:cellForItemAt:)" landmarkType = "7"> @@ -874,8 +874,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "37" - endingLineNumber = "37" + startingLineNumber = "35" + endingLineNumber = "35" landmarkName = "application(_:supportedInterfaceOrientationsFor:)" landmarkType = "7"> @@ -890,8 +890,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "38" - endingLineNumber = "38" + startingLineNumber = "36" + endingLineNumber = "36" landmarkName = "application(_:supportedInterfaceOrientationsFor:)" landmarkType = "7"> @@ -906,8 +906,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "40" - endingLineNumber = "40" + startingLineNumber = "38" + endingLineNumber = "38" landmarkName = "application(_:supportedInterfaceOrientationsFor:)" landmarkType = "7"> @@ -1312,54 +1312,6 @@ landmarkType = "7"> - - - - - - - - - - + + + + @@ -1449,8 +1431,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "133" - endingLineNumber = "133" + startingLineNumber = "127" + endingLineNumber = "127" landmarkName = "jpushNotificationAuthorization(_:withInfo:)" landmarkType = "7"> @@ -1465,8 +1447,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "120" - endingLineNumber = "120" + startingLineNumber = "118" + endingLineNumber = "118" landmarkName = "jpushNotificationCenter(_:didReceive:withCompletionHandler:)" landmarkType = "7"> @@ -2084,8 +2066,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "45" - endingLineNumber = "45" + startingLineNumber = "43" + endingLineNumber = "43" landmarkName = "applicationDidBecomeActive(_:)" landmarkType = "7"> @@ -2100,8 +2082,8 @@ filePath = "OrderScheduling/Main/SceneDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "38" - endingLineNumber = "38" + startingLineNumber = "39" + endingLineNumber = "39" landmarkName = "sceneDidBecomeActive(_:)" landmarkType = "7"> @@ -2116,8 +2098,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "125" - endingLineNumber = "125" + startingLineNumber = "120" + endingLineNumber = "120" landmarkName = "jpushNotificationCenter(_:didReceive:withCompletionHandler:)" landmarkType = "7"> @@ -2198,6 +2180,36 @@ endingLineNumber = "113" offsetFromSymbolStart = "580"> + + + + @@ -2211,8 +2223,8 @@ filePath = "OrderScheduling/Main/AppDelegate.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "70" - endingLineNumber = "70" + startingLineNumber = "69" + endingLineNumber = "69" landmarkName = "application(_:didReceiveRemoteNotification:fetchCompletionHandler:)" landmarkType = "7"> @@ -2361,166 +2373,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2771,8 +2559,8 @@ filePath = "OrderScheduling/Rescue/ViewController/RescueController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "796" - endingLineNumber = "796" + startingLineNumber = "795" + endingLineNumber = "795" landmarkName = "collectionView(_:cellForItemAt:)" landmarkType = "7"> @@ -2787,8 +2575,8 @@ filePath = "OrderScheduling/Rescue/ViewController/RescueController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "797" - endingLineNumber = "797" + startingLineNumber = "796" + endingLineNumber = "796" landmarkName = "collectionView(_:cellForItemAt:)" landmarkType = "7"> @@ -2963,8 +2751,8 @@ filePath = "OrderScheduling/Rescue/ViewController/RescueController.swift" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "814" - endingLineNumber = "814" + startingLineNumber = "813" + endingLineNumber = "813" landmarkName = "collectionView(_:didSelectItemAt:)" landmarkType = "7"> @@ -3067,7 +2855,7 @@ BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OrderScheduling/Common/WebView/WebViewTool.swift b/OrderScheduling/Common/WebView/WebViewTool.swift index 676d843..fdef71c 100644 --- a/OrderScheduling/Common/WebView/WebViewTool.swift +++ b/OrderScheduling/Common/WebView/WebViewTool.swift @@ -78,10 +78,10 @@ open class WebViewTool : NSObject { } break case .workOrderReconciliation: - vc = WebViewController(showNavBar:false, title: WebViewNameEnum.workOrderReconciliation.rawValue, url: "http://192.168.14.126:8080/dev/h5/supplier/dispatch/workOrderReconciliation?token=\((USER.token)!)") + vc = WebViewController(showNavBar:false, title: WebViewNameEnum.workOrderReconciliation.rawValue, url: "\((h5Models?.workOrderReconciliation)!)?token=\((USER.token)!)") break case .vehicleManage: - vc = WebViewController(showNavBar:false, title: WebViewNameEnum.vehicleManage.rawValue, url: "http://192.168.14.126:8080/dev/h5/supplier/dispatch/vehicleManage?token=\((USER.token)!)") + vc = WebViewController(showNavBar:false, title: WebViewNameEnum.vehicleManage.rawValue, url: "\((h5Models?.vehicleManage)!)?token=\((USER.token)!)") break case .driverManage: vc = WebViewController(showNavBar:false, title: WebViewNameEnum.driverManage.rawValue, url: "\((h5Models?.driverManage)!)?token=\((USER.token)!)") diff --git a/OrderScheduling/Global/Tool/Tool.swift b/OrderScheduling/Global/Tool/Tool.swift index e1c0a46..b93a793 100644 --- a/OrderScheduling/Global/Tool/Tool.swift +++ b/OrderScheduling/Global/Tool/Tool.swift @@ -138,7 +138,30 @@ open class Tool { return "未知" } + func dealAppExtension(completionHandler:(([AnyHashable:Any]) -> Void)?) { + let userDefault = UserDefaults.init(suiteName: GROUPID) + let userInfo = userDefault?.object(forKey: bestAttemptContentUserInfo_key) as? [AnyHashable:Any] + if let userInfo { + if completionHandler != nil { + completionHandler!(userInfo) + } + userDefault?.setValue(nil, forKey: bestAttemptContentUserInfo_key) + } + } + + func playAlertWith(userInfo:[AnyHashable:Any]?) { + if USER.newMessageAlert != true { + return + } + + ACCEPTORDERTOOL.open(userInfo: userInfo) + } + func playVoiceWith(userInfo:[AnyHashable:Any]?) { + if USER.newMessageSound != true { + return + } + if let userInfo { let aps = userInfo["aps"] as? [String:Any] diff --git a/OrderScheduling/Global/User/UserData.swift b/OrderScheduling/Global/User/UserData.swift index ab7d2d0..0704818 100644 --- a/OrderScheduling/Global/User/UserData.swift +++ b/OrderScheduling/Global/User/UserData.swift @@ -82,6 +82,24 @@ open class UserData { UserDefaults.standard.set(userId, forKey: userId_key) } + // 不需要记录 + public var newMessageSound : Bool { + return (UserDefaults.standard.object(forKey: newMessageSound_key) as? Bool) ?? true + } + + func setNewMessageSound(newMessageSound:Bool?) { + UserDefaults.standard.set(newMessageSound, forKey: newMessageSound_key) + } + + // 不需要记录 + public var newMessageAlert : Bool { + return (UserDefaults.standard.object(forKey: newMessageAlert_key) as? Bool) ?? true + } + + func setNewMessageAlert(newMessageAlert:Bool?) { + UserDefaults.standard.set(newMessageAlert, forKey: newMessageAlert_key) + } + public var deviceToken : String? public var regId : String? @@ -92,5 +110,7 @@ open class UserData { setSupplierType(supplierType: nil) setUserId(userId: nil) setSupplierId(supplierId: nil) + setNewMessageSound(newMessageSound: nil) + setNewMessageAlert(newMessageAlert: nil) } } diff --git a/OrderScheduling/HttpResponseModel/ResponseModel.swift b/OrderScheduling/HttpResponseModel/ResponseModel.swift index 30f5438..2392fd6 100644 --- a/OrderScheduling/HttpResponseModel/ResponseModel.swift +++ b/OrderScheduling/HttpResponseModel/ResponseModel.swift @@ -69,6 +69,7 @@ class OrderListDataModel: Decodable { var environmentPic : String? var userOrderId : Int var taskOrderId : Int + var taskFlowId : Int var userPhone : String var auditFailReason : String? var isSupplierSettle : SupplierSettleModel? diff --git a/OrderScheduling/Main/AppDelegate.swift b/OrderScheduling/Main/AppDelegate.swift index c7c1a59..8525245 100644 --- a/OrderScheduling/Main/AppDelegate.swift +++ b/OrderScheduling/Main/AppDelegate.swift @@ -11,9 +11,7 @@ import CocoaDebug class AppDelegate: UIResponder, UIApplicationDelegate { public var allowOrentitaionRotation : Bool = false - - public var userInfo : [AnyHashable:Any]? - + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. // 通知 @@ -48,12 +46,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // 注册通知 func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { - let tokenString = deviceToken.map { String(format: "%02.2hhx", $0) }.joined() - print("deviceToken:\(tokenString)") JPUSHService.registerDeviceToken(deviceToken) + + let tokenString = deviceToken.map { String(format: "%02.2hhx", $0) }.joined() USER.deviceToken = tokenString - print("registrationID:\(JPUSHService.registrationID())") USER.regId = JPUSHService.registrationID() + + print("deviceToken:\(tokenString)") + print("registrationID:\(JPUSHService.registrationID())") } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { @@ -62,7 +62,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { JPUSHService.handleRemoteNotification(userInfo) - print("收到通知", userInfo) } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { @@ -100,29 +99,24 @@ extension AppDelegate : JPUSHRegisterDelegate { @available(iOS 10.0, *) func jpushNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: ((Int) -> Void)) { + // 前台收到通知 let userInfo = notification.request.content.userInfo if notification.request.trigger?.isKind(of: UNPushNotificationTrigger.self) == true { JPUSHService.handleRemoteNotification(userInfo) - let userDefault = UserDefaults.init(suiteName: "group.com.sino.supplier") - if let userInfo = userDefault?.object(forKey: "bestAttemptContentUserInfo") as? [AnyHashable:Any] { - ACCEPTORDERTOOL.open(userInfo: userInfo) + TOOL.dealAppExtension { userInfo in + TOOL.playAlertWith(userInfo: userInfo) TOOL.playVoiceWith(userInfo: userInfo) - userDefault?.setValue(nil, forKey: "bestAttemptContentUserInfo") } - print("ios10 前台") } completionHandler(0) } @available(iOS 10.0, *) func jpushNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: (() -> Void)) { + // 后台收到通知 let userInfo = response.notification.request.content.userInfo if response.notification.request.trigger?.isKind(of: UNPushNotificationTrigger.self) == true { -// self.userInfo = userInfo - JPUSHService.resetBadge() - UIApplication.shared.applicationIconBadgeNumber = 0 JPUSHService.handleRemoteNotification(userInfo) - print("ios10 后台") } completionHandler() } diff --git a/OrderScheduling/Main/SceneDelegate.swift b/OrderScheduling/Main/SceneDelegate.swift index e14e084..a4c50b6 100644 --- a/OrderScheduling/Main/SceneDelegate.swift +++ b/OrderScheduling/Main/SceneDelegate.swift @@ -34,13 +34,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } func sceneDidBecomeActive(_ scene: UIScene) { + // 后台收到通知后或者不点击通知打开app,激活时消除badge JPUSHService.resetBadge() UIApplication.shared.applicationIconBadgeNumber = 0 - let userDefault = UserDefaults.init(suiteName: "group.com.sino.supplier") - if let userInfo = userDefault?.object(forKey: "bestAttemptContentUserInfo") as? [AnyHashable:Any] { - ACCEPTORDERTOOL.open(userInfo: userInfo) - userDefault?.setValue(nil, forKey: "bestAttemptContentUserInfo") + TOOL.dealAppExtension { userInfo in + TOOL.playAlertWith(userInfo: userInfo) } } diff --git a/OrderScheduling/Mine/ViewController/MineController.swift b/OrderScheduling/Mine/ViewController/MineController.swift index f5cbe90..ccb29b1 100644 --- a/OrderScheduling/Mine/ViewController/MineController.swift +++ b/OrderScheduling/Mine/ViewController/MineController.swift @@ -122,8 +122,10 @@ extension MineController { mineView.tongzhitixingGes.rx.event .observe(on: MainScheduler.instance) - .subscribe(onNext: { _ in - NOTIAUTHTOOL.openSetting() + .subscribe(onNext: {[weak self] _ in +// NOTIAUTHTOOL.openSetting() + let vc = NotificationSetUpController() + self?.navigationController?.pushViewController(vc, animated: true) }) .disposed(by: disposeBag) diff --git a/OrderScheduling/Mine/ViewController/NotificationSetUpController.swift b/OrderScheduling/Mine/ViewController/NotificationSetUpController.swift new file mode 100644 index 0000000..c738d8a --- /dev/null +++ b/OrderScheduling/Mine/ViewController/NotificationSetUpController.swift @@ -0,0 +1,174 @@ +// +// NotificationSetUpController.swift +// OrderScheduling +// +// Created by 中道 on 2023/8/29. +// + +import Foundation +import DDControlsKit_Private +import SnapKit +import DDAutoUIKit_Private +import RxSwift +import RxCocoa + +class NotificationSetUpModel { + enum typeEnum : Int { + case sound = 0 + case alert + } + var name : String + var type : typeEnum + var isOn : Bool + init(name: String, type:typeEnum, isOn: Bool) { + self.name = name + self.type = type + self.isOn = isOn + } +} + +extension NotificationSetUpController { + func addActions() { + + } +} + +// MARK: UITableViewDelegate,UITableViewDataSource +extension NotificationSetUpController : UITableViewDelegate,UITableViewDataSource { + public func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return resultArr.count + } + + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + var cell = tableView.dequeueReusableCell(withIdentifier: "cell") as? NotificationSetUpCell + if cell == nil { + cell = NotificationSetUpCell(style: .default, reuseIdentifier: "cell") + } + let model = resultArr[indexPath.item] + cell?.nameLabel.text = model.name + cell?.switchButton.isOn = model.isOn + cell?.switchButton.rx.isOn + .subscribe(onNext: { isOn in + if model.type == .sound { + USER.setNewMessageSound(newMessageSound: isOn) + }else if model.type == .alert { + USER.setNewMessageAlert(newMessageAlert: isOn) + } + }) + .disposed(by: disposeBag) + + return cell! + } + + public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return auto(44) + } +} + +open class NotificationSetUpController : ZDViewController { + private let notificationSetUpView = NotificationSetUpView() + private var resultArr : [NotificationSetUpModel] = [] + private let disposeBag = DisposeBag() + + open override func viewDidLoad() { + super.viewDidLoad() + dd_navigationItemTitle = "通知提醒" + dd_navigationBarBackgroundColor = .hex("354683") + dd_navigationBarTitleTextAttributes = [.foregroundColor : UIColor.white(alpha: 0.7),.font:UIFont.mediumFont(17)] + dd_navigationBarBarButtonItemAttributes = [.foregroundColor : UIColor.white] + + let soundModel = NotificationSetUpModel(name: "新消息声音", type: .sound, isOn: USER.newMessageSound) + let alertModel = NotificationSetUpModel(name: "新消息弹窗", type: .alert, isOn: USER.newMessageAlert) + resultArr.append(soundModel) + resultArr.append(alertModel) + + addSubviews() + addActions() + } + + func addSubviews() { + view.backgroundColor = .hex("F4F5F7") + view.addSubview(notificationSetUpView) + notificationSetUpView.snp.makeConstraints { make in + make.top.left.right.equalToSuperview() + make.bottom.equalTo(-view.safeAreaInsets.bottom) + } + + notificationSetUpView.tableView.delegate = self + notificationSetUpView.tableView.dataSource = self + } + + open override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } +} + +open class NotificationSetUpView : DDView { + public let tableView : DDTableView + public override init(frame: CGRect) { + tableView = DDTableView(frame: CGRectZero, style: .plain) + super.init(frame: frame) + + tableView.backgroundColor = .white + tableView.separatorStyle = .none + addSubview(tableView) + tableView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +class NotificationSetUpCell : DDTableViewCell { + public let radiusView : DDView + public let nameLabel : DDLabel + public let switchButton : UISwitch + public let line : DDView + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + radiusView = DDView() + nameLabel = DDLabel.dd_init(withText: "", font: .mediumFont(auto(14)), textColor: .hex("000000").alpha(0.8)) + switchButton = UISwitch() + line = DDView.init() + super.init(style: style, reuseIdentifier: reuseIdentifier) + + selectionStyle = .none + + contentView.addSubview(radiusView) + radiusView.addSubview(nameLabel) + radiusView.addSubview(switchButton) + line.backgroundColor = .hex("F1F2F5") + radiusView.addSubview(line) + + radiusView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + nameLabel.snp.makeConstraints { make in + make.left.equalTo(auto(20)) + make.centerY.equalToSuperview() + } + + switchButton.snp.makeConstraints { make in + make.right.equalTo(-auto(20)) + make.centerY.equalToSuperview() + } + + line.snp.makeConstraints { make in + make.bottom.equalToSuperview() + make.left.equalTo(auto(20)) + make.right.equalTo(-auto(20)) + make.height.equalTo(1) + } + } + + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/OrderScheduling/Rescue/View/AcceptOrderTool.swift b/OrderScheduling/Rescue/View/AcceptOrderTool.swift index c796df2..0382e19 100644 --- a/OrderScheduling/Rescue/View/AcceptOrderTool.swift +++ b/OrderScheduling/Rescue/View/AcceptOrderTool.swift @@ -16,6 +16,9 @@ open class AcceptOrderTool : NSObject { private let disposeBag = DisposeBag() func open(userInfo:[AnyHashable:Any]?) { + if USER.newMessageAlert != true { + return + } let acceptOrderView = AcceptOrderView() acceptOrderView.titleLabel.text = "新订单" acceptOrderView.contentLabel.text = TOOL.getOrderString(userInfo: userInfo) diff --git a/OrderScheduling/Rescue/ViewController/RescueController.swift b/OrderScheduling/Rescue/ViewController/RescueController.swift index aa7de51..fa0a66b 100644 --- a/OrderScheduling/Rescue/ViewController/RescueController.swift +++ b/OrderScheduling/Rescue/ViewController/RescueController.swift @@ -461,9 +461,9 @@ extension RescuePendingOrderController : UITableViewDelegate,UITableViewDataSour }) } cell?.serviceLabel.text = model.vehiclePointAddress - if model.destinationAddress?.isEmpty == false { + if model.destinationAddress?.isEmpty == false || (model.taskFlowId != 1) { cell?.destinationTitleLabel.text = "目的地:" - cell?.destinationLabel.text = model.destinationAddress + cell?.destinationLabel.text = model.destinationAddress ?? " " cell?.destinationTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.serviceLabel.snp.bottom).offset(auto(8)) }) @@ -569,7 +569,7 @@ extension RescuePendingDispatchController : UITableViewDelegate,UITableViewDataS cell?.destinationNoticeView.isHidden = false cell?.serviceNoticeLabel.text = "备注:"+(model.vehiclePointRemark ?? "") cell?.serviceNoticeView.snp.updateConstraints({ make in - make.top.equalTo(cell!.serviceLabel.snp.bottom).offset(auto(2.5)) + make.top.equalTo(cell!.serviceLabel.snp.bottom).offset(auto(4)) }) cell?.serviceNoticeLabel.snp.updateConstraints({ make in make.top.equalTo(auto(5)) @@ -586,11 +586,11 @@ extension RescuePendingDispatchController : UITableViewDelegate,UITableViewDataS make.bottom.equalTo(0) }) } - if model.destinationAddress?.isEmpty == false { + if model.destinationAddress?.isEmpty == false || (model.taskFlowId != 1) { cell?.destinationTitleLabel.text = "目的地:" - cell?.destinationLabel.text = model.destinationAddress + cell?.destinationLabel.text = model.destinationAddress ?? " " cell?.destinationTitleLabel.snp.updateConstraints({ make in - make.top.equalTo(cell!.serviceNoticeView.snp.bottom).offset(auto(2.5)) + make.top.equalTo(cell!.serviceNoticeView.snp.bottom).offset(auto(4)) }) }else{ cell?.destinationTitleLabel.text = nil @@ -624,7 +624,7 @@ extension RescuePendingDispatchController : UITableViewDelegate,UITableViewDataS cell?.reserveTitleLabel.text = "预约时间:" cell?.reserveLabel.text = model.appointTime cell?.reserveTitleLabel.snp.updateConstraints({ make in - make.top.equalTo(cell!.destinationNoticeView.snp.bottom).offset(auto(2.5)) + make.top.equalTo(cell!.destinationNoticeView.snp.bottom).offset(auto(4)) }) }else{ cell?.reserveTitleLabel.text = nil @@ -640,7 +640,6 @@ extension RescuePendingDispatchController : UITableViewDelegate,UITableViewDataS cell?.photoCollectionView.register(RescuePendingDispatchPhotoCell.self, forCellWithReuseIdentifier: "cell") if model.environmentPic?.isEmpty == false { - let environmentPics = model.environmentPic?.components(separatedBy: ",") cell?.photoTitleLabel.text = "查看照片:" cell?.photoView.isHidden = false cell?.photoTitleLabel.snp.updateConstraints({ make in @@ -707,7 +706,7 @@ extension RescueIsIngController : UITableViewDelegate,UITableViewDataSource { cell?.serviceTitleLabel.text = "故障地:" cell?.destinationTitleLabel.text = "目的地:" cell?.reportButton.setTitle("报备", for: .normal) - cell?.dispatchButton.setTitle("改派单", for: .normal) + cell?.dispatchButton.setTitle("改派", for: .normal) } let model = resultArr[indexPath.row] @@ -727,9 +726,9 @@ extension RescueIsIngController : UITableViewDelegate,UITableViewDataSource { } cell?.serviceLabel.text = model.vehiclePointAddress - if model.destinationAddress?.isEmpty == false { + if model.destinationAddress?.isEmpty == false || (model.taskFlowId != 1) { cell?.destinationTitleLabel.text = "目的地:" - cell?.destinationLabel.text = model.destinationAddress + cell?.destinationLabel.text = model.destinationAddress ?? " " cell?.destinationTitleLabel.snp.updateConstraints({ make in make.top.equalTo(cell!.serviceLabel.snp.bottom).offset(auto(8)) }) @@ -1408,7 +1407,7 @@ class RescuePendingDispatchCell : DDTableViewCell { } serviceNoticeView.snp.makeConstraints { make in - make.top.equalTo(serviceLabel.snp.bottom).offset(auto(2.5)) + make.top.equalTo(serviceLabel.snp.bottom).offset(auto(4)) make.left.equalTo(auto(10)) make.right.equalTo(-auto(10)) } @@ -1419,7 +1418,7 @@ class RescuePendingDispatchCell : DDTableViewCell { } destinationTitleLabel.snp.makeConstraints { make in - make.top.equalTo(serviceNoticeView.snp.bottom).offset(auto(2.5)) + make.top.equalTo(serviceNoticeView.snp.bottom).offset(auto(4)) make.left.equalTo(typeLabel) make.width.equalTo(merchantTitleLabel) } @@ -1431,7 +1430,7 @@ class RescuePendingDispatchCell : DDTableViewCell { } destinationNoticeView.snp.makeConstraints { make in - make.top.equalTo(destinationLabel.snp.bottom).offset(auto(2.5)) + make.top.equalTo(destinationLabel.snp.bottom).offset(auto(4)) make.left.equalTo(auto(10)) make.right.equalTo(-auto(10)) } @@ -1442,7 +1441,7 @@ class RescuePendingDispatchCell : DDTableViewCell { } reserveTitleLabel.snp.makeConstraints { make in - make.top.equalTo(destinationNoticeView.snp.bottom).offset(auto(2.5)) + make.top.equalTo(destinationNoticeView.snp.bottom).offset(auto(4)) make.left.equalTo(typeLabel) make.width.equalTo(merchantTitleLabel) } @@ -1631,7 +1630,7 @@ class RescueIsIngCell : DDTableViewCell { } orderStatusTitleLabel.snp.makeConstraints { make in - make.top.equalTo(driverLabel.snp.bottom).offset(auto(8)) + make.top.equalTo(orderDateLabel.snp.bottom).offset(auto(8)) make.left.equalTo(typeLabel) make.width.equalTo(auto(60)) } diff --git a/OrderScheduling/Strings/EnvironmentStrings.swift b/OrderScheduling/Strings/EnvironmentStrings.swift index 7cad2eb..c20383e 100644 --- a/OrderScheduling/Strings/EnvironmentStrings.swift +++ b/OrderScheduling/Strings/EnvironmentStrings.swift @@ -12,3 +12,7 @@ public let HOST = "https://api1.sino-assist.com" #else public let HOST = "https://api1.sino-assist.com" #endif + + +public let GROUPID = "group.com.sino.supplier" + diff --git a/OrderScheduling/Strings/UserDefaultStrings.swift b/OrderScheduling/Strings/UserDefaultStrings.swift index 0d85a08..187caf4 100644 --- a/OrderScheduling/Strings/UserDefaultStrings.swift +++ b/OrderScheduling/Strings/UserDefaultStrings.swift @@ -26,3 +26,9 @@ public let appUpdateIgnore_key = "appUpdateIgnore_key" public let deviceToken_key = "deviceToken_key" public let regId_key = "regId_key" + +public let newMessageSound_key = "newMessageSound_key" + +public let newMessageAlert_key = "newMessageAlert_key" + +public let bestAttemptContentUserInfo_key = "bestAttemptContentUserInfo_key" diff --git a/OrderSchedulingNotificationService/NotificationService.swift b/OrderSchedulingNotificationService/NotificationService.swift index b6080d7..7b00ad2 100644 --- a/OrderSchedulingNotificationService/NotificationService.swift +++ b/OrderSchedulingNotificationService/NotificationService.swift @@ -33,7 +33,7 @@ class NotificationService: UNNotificationServiceExtension { } let userDefault = UserDefaults.init(suiteName: "group.com.sino.supplier") - userDefault?.setValue(userInfo, forKey: "bestAttemptContentUserInfo") + userDefault?.setValue(userInfo, forKey: "bestAttemptContentUserInfo_key") JPushNotificationExtensionService.jpushSetAppkey("259b546bb2aaf5f02ffa2547") JPushNotificationExtensionService.jpushReceive(request) {