|
|
@ -74,17 +74,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
|
|
|
} |
|
|
|
|
|
|
|
// Move push notification's destination |
|
|
|
if let userInfo = launchOptions?[.remoteNotification] as? [String: AnyObject], |
|
|
|
let aps = userInfo["aps"] as? [String: AnyObject], |
|
|
|
let destination = aps["destination"] as? String, |
|
|
|
let destinationType = PushNotificationDestination(rawValue: destination) { |
|
|
|
|
|
|
|
print(destinationType) |
|
|
|
|
|
|
|
self.window?.rootViewController = LauncherScreenWireframe().getMainView(destination: destinationType) |
|
|
|
} else { |
|
|
|
self.window?.rootViewController = LauncherScreenWireframe().getMainView() |
|
|
|
} |
|
|
|
let useInfo = launchOptions?[.remoteNotification] as? [String: AnyObject] |
|
|
|
let destinationType = extractDestination(userInfo: useInfo) |
|
|
|
self.window?.rootViewController = LauncherScreenWireframe().getMainView(destination: destinationType) |
|
|
|
|
|
|
|
ChannelIO.initialize() |
|
|
|
|
|
|
@ -95,6 +87,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { |
|
|
|
|
|
|
|
StoreReviewHelper.shared.incrementAppOpenedCount() |
|
|
|
|
|
|
|
// XCODE 11.2 BUG |
|
|
|
UITextViewWorkaround.executeWorkaround() |
|
|
|
return true |
|
|
|
} |
|
|
@ -180,7 +173,9 @@ extension AppDelegate: UNUserNotificationCenterDelegate { |
|
|
|
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void |
|
|
|
) { |
|
|
|
let userInfo = notification.request.content.userInfo |
|
|
|
|
|
|
|
print("Message ID: \(userInfo["gcm_message_id"] ?? "nil")") |
|
|
|
print(userInfo) |
|
|
|
|
|
|
|
completionHandler([ |
|
|
|
UNNotificationPresentationOptions.alert, |
|
|
@ -201,34 +196,41 @@ extension AppDelegate: UNUserNotificationCenterDelegate { |
|
|
|
ChannelIO.handlePushNotification(userInfo) |
|
|
|
} |
|
|
|
|
|
|
|
print(userInfo) |
|
|
|
completionHandler() |
|
|
|
|
|
|
|
// open push notification's destination |
|
|
|
if let aps = userInfo["aps"] as? [String: AnyObject] { |
|
|
|
guard let destination = aps["destination"] as? String else { return } |
|
|
|
|
|
|
|
print(destination) |
|
|
|
|
|
|
|
if window?.rootViewController is LGSideMenuController { |
|
|
|
let baseVC = window?.rootViewController?.presentedViewController ?? window?.rootViewController |
|
|
|
guard |
|
|
|
window?.rootViewController is LGSideMenuController, |
|
|
|
let destination = extractDestination(userInfo: userInfo as? [String: AnyObject]) else { return } |
|
|
|
|
|
|
|
let baseVC = window?.rootViewController?.presentedViewController ?? window?.rootViewController |
|
|
|
|
|
|
|
DispatchQueue.main.async { |
|
|
|
switch destination { |
|
|
|
case .trasactionHistory: |
|
|
|
let vc = TransactionHistoryGroupWireframe().getMainView() |
|
|
|
let naviVC = UINavigationController(rootViewController: vc) |
|
|
|
baseVC?.present(naviVC, animated: true) |
|
|
|
|
|
|
|
DispatchQueue.main.async { |
|
|
|
switch destination { |
|
|
|
case "TransactionHistory": |
|
|
|
let vc = TransactionHistoryGroupWireframe().getMainView() |
|
|
|
let naviVC = UINavigationController(rootViewController: vc) |
|
|
|
baseVC?.present(naviVC, animated: true) |
|
|
|
|
|
|
|
case "RechargeHistory": |
|
|
|
let vc = RechargeHistoryWireframe().getMainView() |
|
|
|
let naviVC = UINavigationController(rootViewController: vc) |
|
|
|
baseVC?.present(naviVC, animated: true) |
|
|
|
default: () |
|
|
|
} |
|
|
|
} |
|
|
|
case .rechargeHistory: |
|
|
|
let vc = RechargeHistoryWireframe().getMainView() |
|
|
|
let naviVC = UINavigationController(rootViewController: vc) |
|
|
|
baseVC?.present(naviVC, animated: true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
completionHandler() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
extension AppDelegate { |
|
|
|
private func extractDestination(userInfo: [String : AnyObject]?) -> PushNotificationDestination? { |
|
|
|
guard |
|
|
|
let param = userInfo?["gcm.notification.param"] as? String, |
|
|
|
let destination = PushNotificationParam(JSONString: param)?.destination, |
|
|
|
let destinationType = PushNotificationDestination(rawValue: destination) else { |
|
|
|
return nil |
|
|
|
} |
|
|
|
|
|
|
|
return destinationType |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|