同步操作将从 兰德网络O2OA平台软件/O2OA 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//// AppDelegate.swift// O2Platform//// Created by 刘振兴 on 16/6/14.// Copyright © 2016年 zoneland. All rights reserved.//import UIKitimport CocoaLumberjackimport AlamofireNetworkActivityIndicatorimport UserNotificationsimport O2OA_Auth_SDKimport Flutterimport IQKeyboardManagerSwiftlet isProduction = true@UIApplicationMainclass AppDelegate: FlutterAppDelegate, JPUSHRegisterDelegate, UNUserNotificationCenterDelegate {var _mapManager: BMKMapManager?//中心服务器节点类public static let o2Collect = O2Collect()//网络监听public let o2ReachabilityManager = O2ReachabilityManager.sharedInstance// flutter enginevar flutterEngine : FlutterEngine?override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {if #available(iOS 13.0, *) {window.overrideUserInterfaceStyle = .light}let themeName = AppConfigSettings.shared.themeNameif themeName != "" {//主题print("主题色:\(themeName)")O2ThemeManager.setTheme(plistName: themeName, path: .mainBundle)}else {O2ThemeManager.setTheme(plistName: "red", path: .mainBundle)}//搜索框UISearchBar.appearance().theme_barTintColor = ThemeColorPicker(keyPath: "Base.base_color")UISearchBar.appearance().tintColor = UIColor.whiteUITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).theme_tintColor = ThemeColorPicker(keyPath: "Base.base_color")//启动日志管理器O2Logger.startLogManager()//日志文件_ = O2Logger.getLogFiles()O2Logger.debug("设置运行版本==========,\(PROJECTMODE)")//网络检查o2ReachabilityManager.startListening()//AlamofireNetworkActivityIndicatorManager.shared.isEnabled = true//dblet _ = DBManager.shared//设置一个是否第一授权的标志if #available(iOS 10.0, *){let center = UNUserNotificationCenter.current()center.delegate = selflet options:UNAuthorizationOptions = [.badge,.alert,.sound]center.requestAuthorization(options: options, completionHandler: { (granted, err) inif granted == true {//记录已经打开授权//print("aaaaaaaaaaaa")AppConfigSettings.shared.notificationGranted = trueAppConfigSettings.shared.firstGranted = trueNotificationCenter.default.post(name: NSNotification.Name.init("SETTING_NOTI"), object: nil)}else{//记录禁用授权AppConfigSettings.shared.notificationGranted = falseAppConfigSettings.shared.firstGranted = trueNotificationCenter.default.post(name: NSNotification.Name.init("SETTING_NOTI"), object: nil)}})}else{let types:UIUserNotificationType = [.badge,.alert,.sound]let setting = UIUserNotificationSettings(types: types, categories: nil)UIApplication.shared.registerUserNotificationSettings(setting)}//Buglyy异常上报Bugly.start(withAppId: BUGLY_ID)//JPush_setupJPUSH()JPUSHService.setup(withOption: launchOptions, appKey: JPUSH_APP_KEY, channel: JPUSH_channel, apsForProduction: isProduction)_mapManager = BMKMapManager()BMKMapManager.setCoordinateTypeUsedInBaiduMapSDK(.COORDTYPE_BD09LL)_mapManager?.start(BAIDU_MAP_KEY, generalDelegate: nil)JPUSHService.registrationIDCompletionHandler { (resCode, registrationID) inif resCode == 0 {O2Logger.debug("registrationID获取成功\(registrationID ?? "")")O2AuthSDK.shared.setDeviceToken(token: registrationID ?? "registrationIDerror0x0x")}else{O2Logger.debug("registrationID获取失败,code:\(resCode)")O2AuthSDK.shared.setDeviceToken(token: registrationID ?? "registrationIDerror0x0x")}}// OOPlusButtonSubclass.register()OOTabBarHelper.initTabBarStyle()//IQKeyboardManager.shared.enable = truereturn super.application(application, didFinishLaunchingWithOptions: launchOptions)}// MARK:- private func Jpushprivate func _setupJPUSH() {let entity = JPUSHRegisterEntity()entity.types = NSInteger(UNAuthorizationOptions.alert.rawValue) |NSInteger(UNAuthorizationOptions.sound.rawValue) |NSInteger(UNAuthorizationOptions.badge.rawValue)JPUSHService.register(forRemoteNotificationConfig: entity, delegate: self)}//注册 APNs 获得device tokenoverride func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)DDLogDebug("get the deviceToken \(deviceToken)")NotificationCenter.default.post(name: Notification.Name(rawValue: "DidRegisterRemoteNotification"), object: deviceToken)JPUSHService.registerDeviceToken(deviceToken)}override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {DDLogDebug("open url :\(url.absoluteString)")return true}override func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {if notificationSettings.types.rawValue == 0 {AppConfigSettings.shared.notificationGranted = falseAppConfigSettings.shared.firstGranted = trueNotificationCenter.default.post(name: NSNotification.Name.init("SETTING_NOTI"), object: nil)}else{AppConfigSettings.shared.notificationGranted = trueAppConfigSettings.shared.firstGranted = trueNotificationCenter.default.post(name: NSNotification.Name.init("SETTING_NOTI"), object: nil)}}//实现注册 APNs 失败接口override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {DDLogError("didFailToRegisterForRemoteNotificationsWithError: \(error.localizedDescription)")}override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {JPUSHService.handleRemoteNotification(userInfo)DDLogDebug("收到通知,\(userInfo)")NotificationCenter.default.post(name: Notification.Name(rawValue: "AddNotificationCount"), object: nil)}override func applicationWillEnterForeground(_ application: UIApplication) {application.applicationIconBadgeNumber = 0application.cancelAllLocalNotifications()}override func applicationDidBecomeActive(_ application: UIApplication) {}override func applicationDidEnterBackground(_ application: UIApplication) {application.applicationIconBadgeNumber = 0application.cancelAllLocalNotifications()}deinit {o2ReachabilityManager.stopListening()}// iOS 12 Support@available(iOS 12.0, *)func jpushNotificationCenter(_ center: UNUserNotificationCenter!, openSettingsFor notification: UNNotification!) {// openif (notification != nil && (notification?.request.trigger?.isKind(of: UNPushNotificationTrigger.self) == true) ) {//从通知界面直接进入应用DDLogInfo("从通知界面直接进入应用............")}else{//从通知设置界面进入应用DDLogInfo("从通知设置界面进入应用............")}}@available(iOS 10.0, *)func jpushNotificationCenter(_ center: UNUserNotificationCenter!, willPresent notification: UNNotification!,withCompletionHandler completionHandler: ((Int) -> Void)!) {let userInfo = notification.request.content.userInfolet request = notification.request // 收到推送的请求let content = request.content // 收到推送的消息内容let badge = content.badge // 推送消息的角标let body = content.body // 推送消息体let sound = content.sound // 推送消息的声音let subtitle = content.subtitle // 推送消息的副标题let title = content.title // 推送消息的标题if (notification.request.trigger?.isKind(of: UNPushNotificationTrigger.self))! {JPUSHService.handleRemoteNotification(userInfo)}else{//判断为本地通知O2Logger.debug("iOS10 前台收到本地通知:{\nbody:\(body),\ntitle:\(title),\nsubtitle:\(subtitle),\nbadge:\(badge ?? 0),\nsound:\(sound.debugDescription)")}UIApplication.shared.applicationIconBadgeNumber = 0JPUSHService.setBadge(0)completionHandler(Int(UNNotificationPresentationOptions.alert.rawValue|UNNotificationPresentationOptions.badge.rawValue|UNNotificationPresentationOptions.sound.rawValue))}@available(iOS 10.0, *)func jpushNotificationCenter(_ center: UNUserNotificationCenter!, didReceive response: UNNotificationResponse!, withCompletionHandler completionHandler: (() -> Void)!) {let userInfo = response.notification.request.content.userInfolet request = response.notification.request // 收到推送的请求let content = request.content // 收到推送的消息内容let badge = content.badge // 推送消息的角标let body = content.body // 推送消息体let sound = content.sound // 推送消息的声音let subtitle = content.subtitle // 推送消息的副标题let title = content.title // 推送消息的标题if (response.notification.request.trigger?.isKind(of: UNPushNotificationTrigger.self))! {JPUSHService.handleRemoteNotification(userInfo)}else{//判断为本地通知O2Logger.debug("iOS10 前台收到本地通知:{\nbody:\(body),\ntitle:\(title),\nsubtitle:\(subtitle),\nbadge:\(badge ?? 0),\nsound:\(sound.debugDescription)")}UIApplication.shared.applicationIconBadgeNumber = 0JPUSHService.setBadge(0)completionHandler()}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。