Commit f270d916 authored by lujunye's avatar lujunye

11.0适配版本(1.1b1.10)

parent e3993eea
......@@ -13,7 +13,6 @@
E00CDE732474BBB60018AEF8 /* EPViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00CDE712474BBB60018AEF8 /* EPViewController.swift */; };
E00CDE742474BBB60018AEF8 /* EPViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E00CDE722474BBB60018AEF8 /* EPViewController.xib */; };
E00D85DF244561FD00F5F816 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00D85DE244561FD00F5F816 /* AppDelegate.swift */; };
E00D85E1244561FD00F5F816 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00D85E0244561FD00F5F816 /* SceneDelegate.swift */; };
E00D85E5244561FE00F5F816 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E00D85E4244561FE00F5F816 /* Assets.xcassets */; };
E00D85E8244561FE00F5F816 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E00D85E7244561FE00F5F816 /* Preview Assets.xcassets */; };
E00D85EB244561FE00F5F816 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E00D85E9244561FE00F5F816 /* LaunchScreen.storyboard */; };
......@@ -490,7 +489,6 @@
E00CDE722474BBB60018AEF8 /* EPViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EPViewController.xib; sourceTree = "<group>"; };
E00D85DB244561FD00F5F816 /* 格利商户端.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "格利商户端.app"; sourceTree = BUILT_PRODUCTS_DIR; };
E00D85DE244561FD00F5F816 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
E00D85E0244561FD00F5F816 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
E00D85E4244561FE00F5F816 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
E00D85E7244561FE00F5F816 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
E00D85EA244561FE00F5F816 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
......@@ -1454,7 +1452,6 @@
isa = PBXGroup;
children = (
E00D85DE244561FD00F5F816 /* AppDelegate.swift */,
E00D85E0244561FD00F5F816 /* SceneDelegate.swift */,
);
name = Appdelegate;
sourceTree = "<group>";
......@@ -2837,7 +2834,6 @@
F9171F0224513C5B00359C2B /* UpDataModel.swift in Sources */,
F950FDAD245163E500C40530 /* GoodsListModel.swift in Sources */,
E0D197BD2448431C002B080C /* BabySpeaker.m in Sources */,
E00D85E1244561FD00F5F816 /* SceneDelegate.swift in Sources */,
F9956B22246408A6001A617D /* GoodsClassViewController.swift in Sources */,
F950FDDA24518B9500C40530 /* FSCalendarCell.m in Sources */,
F96E9D5D246656A700B5B94A /* HGImagePickerController.swift in Sources */,
......@@ -3058,7 +3054,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
......@@ -3112,7 +3108,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
......@@ -3131,7 +3127,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.9;
CURRENT_PROJECT_VERSION = 1.10;
DEFINES_MODULE = NO;
DEVELOPMENT_ASSET_PATHS = "\"GeliBusinessPlatform/Preview Content\"";
DEVELOPMENT_TEAM = K48346UACH;
......@@ -3176,6 +3172,7 @@
"$(PROJECT_DIR)/GeliBusinessPlatform/Define/融云",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/JPush/Lib",
);
MARKETING_VERSION = 1.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
......@@ -3262,7 +3259,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.9;
CURRENT_PROJECT_VERSION = 1.10;
DEFINES_MODULE = NO;
DEVELOPMENT_ASSET_PATHS = "\"GeliBusinessPlatform/Preview Content\"";
DEVELOPMENT_TEAM = K48346UACH;
......@@ -3307,6 +3304,7 @@
"$(PROJECT_DIR)/GeliBusinessPlatform/Define/融云",
"$(PROJECT_DIR)/GeliBusinessPlatform/Other/JPush/Lib",
);
MARKETING_VERSION = 1.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
......
//
// AppDelegate.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/14.
// Copyright © 2020 junye lu. All rights reserved.
//
//融云账号&融云密码
//18924107259
//81338860geLI
// GeLiLaiGeWan
//
//苹果账号&密码
//notice@gelifood.com
//81338860^geLi
//极光密码
//GeliFood
//81338860geLI
// Created by geli on 2018/6/22.
// Copyright © 2018年 geli. All rights reserved.
//
import UIKit
//import RongIMKit
import ESTabBarController_swift
@available(iOS 10.0, *)
@UIApplicationMain
class AppDelegate: UIResponder,UIApplicationDelegate,UNUserNotificationCenterDelegate{
class AppDelegate: UIResponder, UIApplicationDelegate,loginDelegate, UITabBarControllerDelegate{
var window:UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// setting_Jpush(application: application, launchOptions: launchOptions)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
return true
if UserToken == nil {
addLoginVc(isAgain: false)
}else{
addTabBarVcs(isAgain: false)
}
func setting_Jpush(application:UIApplication,launchOptions:[UIApplication.LaunchOptionsKey: Any]?) {
if #available(iOS 10.0, *){
let entiity = JPUSHRegisterEntity()
entiity.types = Int(UNAuthorizationOptions.alert.rawValue |
UNAuthorizationOptions.badge.rawValue |
UNAuthorizationOptions.sound.rawValue)
// JPUSHService.register(forRemoteNotificationConfig: entiity, delegate: self)
} else if #available(iOS 8.0, *) {
let types = UIUserNotificationType.badge.rawValue |
UIUserNotificationType.sound.rawValue |
UIUserNotificationType.alert.rawValue
JPUSHService.register(forRemoteNotificationTypes: types, categories: nil)
}else {
let type = UIRemoteNotificationType.badge.rawValue |
UIRemoteNotificationType.sound.rawValue |
UIRemoteNotificationType.alert.rawValue
JPUSHService.register(forRemoteNotificationTypes: type, categories: nil)
return true
}
// 根据环境的不同,设置不同的apsForProduction值,具体看下面参数说明
JPUSHService.setup(withOption: launchOptions,
appKey: "3ecbdeacab51eb48e1219a96",
channel: "App Store",
apsForProduction: true)
//注册别名
//MARK:--成功登录并反馈
func successLogin() {
addTabBarVcs(isAgain: true)
}
func jpushNotificationCenter(_ center: UNUserNotificationCenter!, openSettingsFor notification: UNNotification?) {
_ = notification?.request.content.userInfo
//MARK:--退出登录并反馈
@objc func popLogout() {
addLoginVc(isAgain: true)
}
//MARK:--loginVC
func addLoginVc (isAgain:Bool){
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))!{
JPUSHService.handleRemoteNotification(userInfo)
let vc = LoginViewController()
vc.delegate = self
let contentView = vc
//
// let vc = PersonCenterViewController()
// let contentView = vc
if isAgain {
let transtition = CATransition()
transtition.duration = 0.5
transtition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
UIApplication.shared.keyWindow?.layer.add(transtition, forKey: "animation")
let rootV = NavViewController(rootViewController: contentView)
UIApplication.shared.keyWindow?.rootViewController = rootV
}else{
let window = UIWindow.init(frame: UIScreen.main.bounds)
self.window = window
let rootV = NavViewController(rootViewController: contentView)
self.window!.rootViewController = rootV;
self.window!.makeKeyAndVisible()
}
completionHandler(Int(UNAuthorizationOptions.alert.rawValue))// 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
}
//ios 10 以上接受数据
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))!{
JPUSHService.handleRemoteNotification(userInfo)
jpushLocationNotic(userInfo: userInfo as NSDictionary)
}
completionHandler()
}
func jpushLocationNotic(userInfo: NSDictionary) {
func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
}
//监测通知授权状态返回的结果
func jpushNotificationAuthorization(_ status: JPAuthorizationStatus, withInfo info: [AnyHashable : Any]!) {
return true
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
//TODO: 注册失败后的结果, 可以在这里记录失败结果, 以后再伺机弹框给用户打开通知
return true
}
// 注册deviceToken
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// JPUSHService.registerDeviceToken(deviceToken)
func application(_ application: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error) {
//可选
NSLog("did Fail To Register For Remote Notifications With Error: \(error)")
}
// 接受数据
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print("1",userInfo)
// JPUSHService.handleRemoteNotification(userInfo)
completionHandler(.newData)
}
// 接受数据
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("2",userInfo)
// JPUSHService.handleRemoteNotification(userInfo)
}
}
// 进入前台的时候,清空角标
func applicationWillEnterForeground(_ application: UIApplication) {
UIApplication.shared.applicationIconBadgeNumber = 0
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
UIApplication.shared.applicationIconBadgeNumber = 0
// JPUSHService.setBadge(0)
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
// var RY_App_Key = "3argexb63sxae"
func RCINMC (){
// RCIM.shared()?.initWithAppKey(RY_App_Key)
//
// registerNotification(application)
// RCIMClient.shared()?.connect(withToken: "SMJo9B9AUTIHHcHCuZq8soPnFqzfPZJIh7xoVOlRtu8=@ta3m.cn.rongnav.com;ta3m.cn.rongcfg.com", success: { (userId) in
// print("userid = \(userId)")
// }, error: { (status) in
// print("status = \(status)")
// }, tokenIncorrect: {
// print("错误")
// })
//didRegisterForRemoteNotificationsWithDeviceToken
//// RCIMClient.shared()?.setDeviceTokenData(deviceToken)
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
UIApplication.shared.applicationIconBadgeNumber = 0
JPUSHService.setBadge(0)
}
}
extension AppDelegate{
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
func registerNotification(_ application: UIApplication) {
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted: Bool, error: Error?) in
DispatchQueue.main.async {
if granted { application.registerForRemoteNotifications() }
}
}
} else {
let settings = UIUserNotificationSettings(types: [.alert, .sound, .badge], categories: nil)
application.registerForRemoteNotifications()
application.registerUserNotificationSettings(settings)
//MARK:--tabbarVCs
func addTabBarVcs (isAgain:Bool) {
let tabBarController = ESTabBarController()
tabBarController.delegate = self
tabBarController.tabBar.backgroundColor = UIColor.white
tabBarController.tabBar.shadowImage = UIImage(named: "transparent")
let img = imageWithColor(UIColor.white)
tabBarController.tabBar.backgroundImage = img
NotificationCenter.default.addObserver(self, selector: #selector(popLogout), name: NSNotification.Name(rawValue: "logout"), object: nil)
let v1 = OrderListViewController()
let v2 = GoodsManageListVC()
// let v3 = WorkCViewController()
let v4 = WarehoseMangementListVC()
let v5 = PersonCenterViewController()
v1.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "订单管理", image: UIImage(named: "tab_btn_dingdao_nor"), selectedImage: UIImage(named: "tab_btn_dingdan_hig"))
v2.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "商品管理", image: UIImage(named: "tab_btn_shangpin_nor"), selectedImage: UIImage(named: "tab_btn_shangpin_hig"))
// v3.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "工作中心", image: UIImage(named: "tab_btn_gongzuo_nor"), selectedImage: UIImage(named: "tab_btn_gongzuo_hig"))
v4.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "仓库管理", image: UIImage(named: "tab_btn_cangku_nor"), selectedImage: UIImage(named: "tab_btn_cangku_hig"))
v5.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "个人中心", image: UIImage(named: "tab_btn_geren_nor"), selectedImage: UIImage(named: "tab_btn_geren_hig"))
// Create the SwiftUI view that provides the window contents.
// tabBarController.viewControllers = [v1, v2, v3, v4, v5]
tabBarController.viewControllers = [v1, v2, v4, v5]
// tabBarController.selectedIndex = 2
let contentView = tabBarController
// if let windowScene = sceneC as? UIWindowScene {
if isAgain {
let transtition = CATransition()
transtition.duration = 0.5
transtition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
UIApplication.shared.keyWindow?.layer.add(transtition, forKey: "animation")
let rootV = NavViewController(rootViewController: contentView)
UIApplication.shared.keyWindow?.rootViewController = rootV
}else{
let window = UIWindow.init(frame: UIScreen.main.bounds)
let rootV = NavViewController(rootViewController: contentView)
window.rootViewController = rootV;
self.window = window
window.makeKeyAndVisible()
}
// }
//测试代码
// if let tabBarItem = v2.tabBarItem as? ESTabBarItem {
// DispatchQueue.main.asyncAfter(deadline: .now() + 2 ) {
// tabBarItem.badgeValue = "1"
// }
// }
}
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
//添加通知,才加载数据
print(viewController)
}
}
////
//// AppDelegate.swift
//// GeliBusinessPlatform
////
//// Created by junye lu on 2020/4/14.
//// Copyright © 2020 junye lu. All rights reserved.
////
////融云账号&融云密码
////18924107259
////81338860geLI
////
////苹果账号&密码
////notice@gelifood.com
////81338860^geLi
////极光密码
////GeliFood
////81338860geLI
////
//import UIKit
////import RongIMKit
//
//
//@UIApplicationMain
//class AppDelegate: UIResponder,UIApplicationDelegate,UNUserNotificationCenterDelegate{
//
//
//
// func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// // Override point for customization after application launch.
//// setting_Jpush(application: application, launchOptions: launchOptions)
//
//
// return true
// }
// func setting_Jpush(application:UIApplication,launchOptions:[UIApplication.LaunchOptionsKey: Any]?) {
//
// if #available(iOS 10.0, *){
// let entiity = JPUSHRegisterEntity()
// entiity.types = Int(UNAuthorizationOptions.alert.rawValue |
// UNAuthorizationOptions.badge.rawValue |
// UNAuthorizationOptions.sound.rawValue)
//// JPUSHService.register(forRemoteNotificationConfig: entiity, delegate: self)
// } else if #available(iOS 8.0, *) {
// let types = UIUserNotificationType.badge.rawValue |
// UIUserNotificationType.sound.rawValue |
// UIUserNotificationType.alert.rawValue
// JPUSHService.register(forRemoteNotificationTypes: types, categories: nil)
// }else {
// let type = UIRemoteNotificationType.badge.rawValue |
// UIRemoteNotificationType.sound.rawValue |
// UIRemoteNotificationType.alert.rawValue
// JPUSHService.register(forRemoteNotificationTypes: type, categories: nil)
// }
//
// // 根据环境的不同,设置不同的apsForProduction值,具体看下面参数说明
// JPUSHService.setup(withOption: launchOptions,
// appKey: "3ecbdeacab51eb48e1219a96",
// channel: "App Store",
// apsForProduction: true)
//
// //注册别名
//
//
// }
// func jpushNotificationCenter(_ center: UNUserNotificationCenter!, openSettingsFor notification: UNNotification?) {
// _ = notification?.request.content.userInfo
// }
//
// 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))!{
// JPUSHService.handleRemoteNotification(userInfo)
// }
// completionHandler(Int(UNAuthorizationOptions.alert.rawValue))// 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以选择设置
// }
//
// //ios 10 以上接受数据
// 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))!{
// JPUSHService.handleRemoteNotification(userInfo)
// jpushLocationNotic(userInfo: userInfo as NSDictionary)
// }
// completionHandler()
// }
// func jpushLocationNotic(userInfo: NSDictionary) {
//
//
// }
// //监测通知授权状态返回的结果
// func jpushNotificationAuthorization(_ status: JPAuthorizationStatus, withInfo info: [AnyHashable : Any]!) {
// }
//
//
// func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
// //TODO: 注册失败后的结果, 可以在这里记录失败结果, 以后再伺机弹框给用户打开通知
// }
// // 注册deviceToken
//
// func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
//// JPUSHService.registerDeviceToken(deviceToken)
//
// }
// // 接受数据
// func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
// print("1",userInfo)
//// JPUSHService.handleRemoteNotification(userInfo)
// completionHandler(.newData)
//
// }
//
// // 接受数据
// func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
// print("2",userInfo)
//// JPUSHService.handleRemoteNotification(userInfo)
// }
//
//
// // 进入前台的时候,清空角标
// func applicationWillEnterForeground(_ application: UIApplication) {
// UIApplication.shared.applicationIconBadgeNumber = 0
// }
// func applicationDidBecomeActive(_ application: UIApplication) {
// // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
// UIApplication.shared.applicationIconBadgeNumber = 0
//// JPUSHService.setBadge(0)
//
// }
// // MARK: UISceneSession Lifecycle
//
// func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// // Called when a new scene session is being created.
// // Use this method to select a configuration to create the new scene with.
// return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
// }
//
// func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// // Called when the user discards a scene session.
// // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
// }
//
// // var RY_App_Key = "3argexb63sxae"
//
// func RCINMC (){
// // RCIM.shared()?.initWithAppKey(RY_App_Key)
// //
// // registerNotification(application)
// // RCIMClient.shared()?.connect(withToken: "SMJo9B9AUTIHHcHCuZq8soPnFqzfPZJIh7xoVOlRtu8=@ta3m.cn.rongnav.com;ta3m.cn.rongcfg.com", success: { (userId) in
// // print("userid = \(userId)")
// // }, error: { (status) in
// // print("status = \(status)")
// // }, tokenIncorrect: {
// // print("错误")
// // })
//
// //didRegisterForRemoteNotificationsWithDeviceToken
// //// RCIMClient.shared()?.setDeviceTokenData(deviceToken)
//
// }
//}
//
//extension AppDelegate{
//
//
// func registerNotification(_ application: UIApplication) {
// if #available(iOS 10.0, *) {
// let center = UNUserNotificationCenter.current()
// center.delegate = self
// center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted: Bool, error: Error?) in
// DispatchQueue.main.async {
// if granted { application.registerForRemoteNotifications() }
// }
// }
// } else {
// let settings = UIUserNotificationSettings(types: [.alert, .sound, .badge], categories: nil)
// application.registerForRemoteNotifications()
// application.registerUserNotificationSettings(settings)
// }
//
// }
//}
//
//
......@@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
......@@ -45,23 +45,6 @@
<string>我们需要通过您同意使用麦克风,才能与你进行语音交流</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>我们需要通过您同意使用相册,才能获取相关数据</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array/>
<key>UILaunchImageFile</key>
......@@ -73,8 +56,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
......
//
// SceneDelegate.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/4/14.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
import SwiftUI
import ESTabBarController_swift
class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDelegate, loginDelegate {
var window: UIWindow?
var sceneC: UIScene?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
sceneC = scene
let UserToken = UserDefaults.standard.value(forKey: "user_token")
if UserToken == nil {
addLoginVc(isAgain: false)
}else{
addTabBarVcs(isAgain: false)
}
}
//MARK:--成功登录并反馈
func successLogin() {
addTabBarVcs(isAgain: true)
}
//MARK:--退出登录并反馈
@objc func popLogout() {
addLoginVc(isAgain: true)
}
//MARK:--loginVC
func addLoginVc (isAgain:Bool){
let vc = LoginViewController()
vc.delegate = self
let contentView = vc
//
// let vc = PersonCenterViewController()
// let contentView = vc
if let windowScene = sceneC as? UIWindowScene {
if isAgain {
let transtition = CATransition()
transtition.duration = 0.5
transtition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
UIApplication.shared.keyWindow?.layer.add(transtition, forKey: "animation")
let rootV = NavViewController(rootViewController: contentView)
UIApplication.shared.keyWindow?.rootViewController = rootV
}else{
let window = UIWindow(windowScene: windowScene)
let rootV = NavViewController(rootViewController: contentView)
window.rootViewController = rootV;
self.window = window
window.makeKeyAndVisible()
}
}
}
//MARK:--tabbarVCs
func addTabBarVcs (isAgain:Bool) {
let tabBarController = ESTabBarController()
tabBarController.delegate = self
tabBarController.tabBar.backgroundColor = UIColor.white
tabBarController.tabBar.shadowImage = UIImage(named: "transparent")
let img = imageWithColor(UIColor.white)
tabBarController.tabBar.backgroundImage = img
NotificationCenter.default.addObserver(self, selector: #selector(popLogout), name: NSNotification.Name(rawValue: "logout"), object: nil)
let v1 = OrderListViewController()
let v2 = GoodsManageListVC()
// let v3 = WorkCViewController()
let v4 = WarehoseMangementListVC()
let v5 = PersonCenterViewController()
v1.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "订单管理", image: UIImage(named: "tab_btn_dingdao_nor"), selectedImage: UIImage(named: "tab_btn_dingdan_hig"))
v2.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "商品管理", image: UIImage(named: "tab_btn_shangpin_nor"), selectedImage: UIImage(named: "tab_btn_shangpin_hig"))
// v3.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "工作中心", image: UIImage(named: "tab_btn_gongzuo_nor"), selectedImage: UIImage(named: "tab_btn_gongzuo_hig"))
v4.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "仓库管理", image: UIImage(named: "tab_btn_cangku_nor"), selectedImage: UIImage(named: "tab_btn_cangku_hig"))
v5.tabBarItem = ESTabBarItem.init(ExampleBouncesContentView(), title: "个人中心", image: UIImage(named: "tab_btn_geren_nor"), selectedImage: UIImage(named: "tab_btn_geren_hig"))
// Create the SwiftUI view that provides the window contents.
// tabBarController.viewControllers = [v1, v2, v3, v4, v5]
tabBarController.viewControllers = [v1, v2, v4, v5]
// tabBarController.selectedIndex = 2
let contentView = tabBarController
if let windowScene = sceneC as? UIWindowScene {
if isAgain {
let transtition = CATransition()
transtition.duration = 0.5
transtition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
UIApplication.shared.keyWindow?.layer.add(transtition, forKey: "animation")
let rootV = NavViewController(rootViewController: contentView)
UIApplication.shared.keyWindow?.rootViewController = rootV
}else{
let window = UIWindow(windowScene: windowScene)
let rootV = NavViewController(rootViewController: contentView)
window.rootViewController = rootV;
self.window = window
window.makeKeyAndVisible()
}
}
//测试代码
// if let tabBarItem = v2.tabBarItem as? ESTabBarItem {
// DispatchQueue.main.asyncAfter(deadline: .now() + 2 ) {
// tabBarItem.badgeValue = "1"
// }
// }
}
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
//添加通知,才加载数据
print(viewController)
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
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