|
@ -35,35 +35,24 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD |
|
|
firstTranscationStatusForHome = true |
|
|
firstTranscationStatusForHome = true |
|
|
firstTranscationStatusForProfileForm = true |
|
|
firstTranscationStatusForProfileForm = true |
|
|
|
|
|
|
|
|
// Override point for customization after application launch. |
|
|
|
|
|
// [START set_messaging_delegate] |
|
|
|
|
|
Messaging.messaging().delegate = self |
|
|
|
|
|
// [END set_messaging_delegate] |
|
|
|
|
|
// Register for remote notifications. This shows a permission dialog on first run, to |
|
|
|
|
|
// show the dialog at a more appropriate time move this registration accordingly. |
|
|
|
|
|
// [START register_for_notifications] |
|
|
|
|
|
|
|
|
|
|
|
NetworkActivityLogger.shared.startLogging() |
|
|
NetworkActivityLogger.shared.startLogging() |
|
|
NetworkActivityLogger.shared.level = .debug |
|
|
NetworkActivityLogger.shared.level = .debug |
|
|
IQKeyboardManager.shared.enable = true |
|
|
IQKeyboardManager.shared.enable = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
registerForNotification(application: application) |
|
|
|
|
|
FirebaseApp.configure() |
|
|
FirebaseApp.configure() |
|
|
Fabric.with([Crashlytics.self]) |
|
|
Fabric.with([Crashlytics.self]) |
|
|
|
|
|
Messaging.messaging().delegate = self |
|
|
|
|
|
registerForNotification(application: application) |
|
|
|
|
|
setUUID() |
|
|
|
|
|
setupNavBar() |
|
|
|
|
|
setEntryPoint() |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func setUUID() { |
|
|
if UserDefaults.standard.string(forKey: AppConstants.uuid) == nil { |
|
|
if UserDefaults.standard.string(forKey: AppConstants.uuid) == nil { |
|
|
let uuid = UUID().uuidString |
|
|
let uuid = UUID().uuidString |
|
|
UserDefaults.standard.set(uuid, forKey: AppConstants.uuid) |
|
|
UserDefaults.standard.set(uuid, forKey: AppConstants.uuid) |
|
|
} |
|
|
} |
|
|
setupNavBar() |
|
|
|
|
|
setEntryPoint() |
|
|
|
|
|
|
|
|
|
|
|
// if (UserDefaults.standard.object(forKey: "com.gmeremit.loginStatus")) != nil{ |
|
|
|
|
|
// redirectToApp() |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func setupNavBar() { |
|
|
private func setupNavBar() { |
|
@ -150,19 +139,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { |
|
|
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { |
|
|
// print("Firebase registration token: \(fcmToken)") |
|
|
|
|
|
cmRegistrationId = fcmToken |
|
|
cmRegistrationId = fcmToken |
|
|
|
|
|
|
|
|
notificationSet.value = true |
|
|
notificationSet.value = true |
|
|
// TODO: If necessary send token to application server. |
|
|
|
|
|
// Note: This callback is fired at each app startup and whenever a new token is generated. |
|
|
|
|
|
|
|
|
print(fcmToken) |
|
|
} |
|
|
} |
|
|
// [END refresh_token] |
|
|
|
|
|
// [START ios_10_data_message] |
|
|
|
|
|
// Receive data messages on iOS 10+ directly from FCM (bypassing APNs) when the app is in the foreground. |
|
|
|
|
|
// To enable direct data messages, you can set Messaging.messaging().shouldEstablishDirectChannel to true. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) { |
|
|
func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) { |
|
|
// print("Received data message: \(remoteMessage.appData)") |
|
|
|
|
|
|
|
|
print(remoteMessage.appData) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) { |
|
|
public func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) { |
|
@ -175,9 +159,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD |
|
|
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { |
|
|
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { |
|
|
var userInfo = notification.request.content.userInfo |
|
|
var userInfo = notification.request.content.userInfo |
|
|
|
|
|
|
|
|
// With swizzling disabled you must let Messaging know about the message, for Analytics |
|
|
|
|
|
// Messaging.messaging().appDidReceiveMessage(userInfo) |
|
|
|
|
|
// Print message ID. |
|
|
|
|
|
if userInfo[gcmMessageIDKey] != nil { |
|
|
if userInfo[gcmMessageIDKey] != nil { |
|
|
// print("Message ID: def \(messageID)") |
|
|
// print("Message ID: def \(messageID)") |
|
|
} |
|
|
} |
|
@ -216,83 +197,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD |
|
|
// print("Unable to register for remote notifications: \(error.localizedDescription)") |
|
|
// print("Unable to register for remote notifications: \(error.localizedDescription)") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// This function is added here only for debugging purposes, and can be removed if swizzling is enabled. |
|
|
|
|
|
// If swizzling is disabled then this function must be implemented so that the APNs token can be paired to |
|
|
|
|
|
// the FCM registration token. |
|
|
|
|
|
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { |
|
|
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { |
|
|
// print("APNs token retrieved: \(deviceToken)") |
|
|
|
|
|
|
|
|
|
|
|
// With swizzling disabled you must set the APNs token here. |
|
|
|
|
|
// Messaging.messaging().apnsToken = deviceToken |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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 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. |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func applicationWillEnterForeground(_ application: UIApplication) { |
|
|
|
|
|
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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. |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func applicationWillTerminate(_ application: UIApplication) { |
|
|
|
|
|
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. |
|
|
|
|
|
|
|
|
|
|
|
// print("App terminate") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
redirection to home page if user is already login to app otherwise redirect to KYC form. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
func redirectToApp() { |
|
|
|
|
|
|
|
|
|
|
|
let nav = UINavigationController() |
|
|
|
|
|
|
|
|
|
|
|
if (UserDefaults.standard.object(forKey: "com.gmeremit.loginStatus") as! Bool) { |
|
|
|
|
|
// login cha |
|
|
|
|
|
guard (UserDefaults.standard.object(forKey: UserKeys.kyc) as? Bool) ?? false == true else { |
|
|
|
|
|
let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle.main) |
|
|
|
|
|
if let KYCPersonalInfoViewController = storyboard.instantiateViewController(withIdentifier: "KYCPersonalInfoViewController") as? KYCPersonalInfoViewController { |
|
|
|
|
|
|
|
|
|
|
|
nav.viewControllers = [KYCPersonalInfoViewController] |
|
|
|
|
|
|
|
|
|
|
|
window?.rootViewController = nav |
|
|
|
|
|
} |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let mainWireFrame = MainWireframe.shared |
|
|
|
|
|
let tabbarViewController = mainWireFrame?.getMainView() |
|
|
|
|
|
window?.rootViewController = tabbarViewController |
|
|
|
|
|
window?.makeKeyAndVisible() |
|
|
|
|
|
// let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle.main) |
|
|
|
|
|
// if let tabViewController = storyboard.instantiateViewController(withIdentifier: "TabBarController") as? UITabBarController { |
|
|
|
|
|
// |
|
|
|
|
|
// nav.viewControllers = [tabViewController] |
|
|
|
|
|
// |
|
|
|
|
|
// window?.rootViewController = nav |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
let storyboard = UIStoryboard.init(name: "Main", bundle: Bundle.main) |
|
|
|
|
|
if let splashScreenViewController = storyboard.instantiateViewController(withIdentifier: "SplashScreenViewController") as? SplashScreenViewController { |
|
|
|
|
|
|
|
|
|
|
|
// nav.viewControllers = [splashScreenViewController] |
|
|
|
|
|
|
|
|
|
|
|
window?.rootViewController = splashScreenViewController |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -445,23 +351,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//extension AppDelegate : MessagingDelegate { |
|
|
|
|
|
// // [START refresh_token] |
|
|
|
|
|
// func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { |
|
|
|
|
|
// print("Firebase registration token: \(fcmToken)") |
|
|
|
|
|
// |
|
|
|
|
|
// // TODO: If necessary send token to application server. |
|
|
|
|
|
// // Note: This callback is fired at each app startup and whenever a new token is generated. |
|
|
|
|
|
// } |
|
|
|
|
|
// // [END refresh_token] |
|
|
|
|
|
// // [START ios_10_data_message] |
|
|
|
|
|
// // Receive data messages on iOS 10+ directly from FCM (bypassing APNs) when the app is in the foreground. |
|
|
|
|
|
// // To enable direct data messages, you can set Messaging.messaging().shouldEstablishDirectChannel to true. |
|
|
|
|
|
// func messaging(_ messaging: Messaging, didReceive remoteMessage: MessagingRemoteMessage) { |
|
|
|
|
|
// print("Received data message: \(remoteMessage.appData)") |
|
|
|
|
|
// } |
|
|
|
|
|
// // [END ios_10_data_message] |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|