Compare commits
3 Commits
develop
...
refactoring
| Author | SHA1 | Date | |
|---|---|---|---|
| c564f69b82 | |||
| 52919cde7f | |||
| c07fb77ce5 |
@@ -93,3 +93,4 @@ iOSInjectionProject/
|
||||
Info.plist
|
||||
/PayCash.entitlements
|
||||
/PayCash.xcodeproj
|
||||
*.pbxproj
|
||||
|
||||
@@ -0,0 +1,451 @@
|
||||
//
|
||||
// PluggableApplicationDelegate.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import CloudKit
|
||||
|
||||
/// This is only a tagging protocol.
|
||||
/// It doesn't add more functionalities yet.
|
||||
public protocol ApplicationService: UIApplicationDelegate { }
|
||||
|
||||
open class PluggableApplicationDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
public var window: UIWindow?
|
||||
|
||||
open var services: [ApplicationService] { return [] }
|
||||
private lazy var __services: [ApplicationService] = {
|
||||
return self.services
|
||||
}()
|
||||
|
||||
@discardableResult
|
||||
private func apply<T, S>(_ work: (ApplicationService, @escaping (T) -> Void) -> S?, completionHandler: @escaping ([T]) -> Swift.Void) -> [S] {
|
||||
let dispatchGroup = DispatchGroup()
|
||||
var results: [T] = []
|
||||
var returns: [S] = []
|
||||
|
||||
for service in __services {
|
||||
dispatchGroup.enter()
|
||||
let returned = work(service, { result in
|
||||
results.append(result)
|
||||
dispatchGroup.leave()
|
||||
})
|
||||
if let returned = returned {
|
||||
returns.append(returned)
|
||||
} else { // delegate doesn't impliment method
|
||||
dispatchGroup.leave()
|
||||
}
|
||||
if returned == nil {
|
||||
}
|
||||
}
|
||||
|
||||
dispatchGroup.notify(queue: .main) {
|
||||
completionHandler(results)
|
||||
}
|
||||
|
||||
return returns
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func applicationDidFinishLaunching(_ application: UIApplication) {
|
||||
__services.forEach { $0.applicationDidFinishLaunching?(application) }
|
||||
}
|
||||
|
||||
@available(iOS 6.0, *)
|
||||
open func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, willFinishLaunchingWithOptions: launchOptions) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS 3.0, *)
|
||||
open func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, didFinishLaunchingWithOptions: launchOptions) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationDidBecomeActive?(application)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func applicationWillResignActive(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationWillResignActive?(application)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS, introduced: 2.0, deprecated: 9.0, message: "Please use application:openURL:options:")
|
||||
open func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, handleOpen: url) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS, introduced: 4.2, deprecated: 9.0, message: "Please use application:openURL:options:")
|
||||
open func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, open: url, sourceApplication: sourceApplication, annotation: annotation) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS 9.0, *)
|
||||
open func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(app, open: url, options: options) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationDidReceiveMemoryWarning?(application)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func applicationWillTerminate(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationWillTerminate?(application)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func applicationSignificantTimeChange(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationSignificantTimeChange?(application)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func application(_ application: UIApplication, willChangeStatusBarOrientation newStatusBarOrientation: UIInterfaceOrientation, duration: TimeInterval) {
|
||||
for service in __services {
|
||||
service.application?(application, willChangeStatusBarOrientation: newStatusBarOrientation, duration: duration)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 2.0, *)
|
||||
open func application(_ application: UIApplication, didChangeStatusBarOrientation oldStatusBarOrientation: UIInterfaceOrientation) {
|
||||
for service in __services {
|
||||
service.application?(application, didChangeStatusBarOrientation: oldStatusBarOrientation)
|
||||
}
|
||||
}
|
||||
|
||||
// open func application(_ application: UIApplication, willChangeStatusBarFrame newStatusBarFrame: CGRect) {
|
||||
// for service in __services {
|
||||
// service.application?(application, willChangeStatusBarFrame: newStatusBarFrame)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// open func application(_ application: UIApplication, didChangeStatusBarFrame oldStatusBarFrame: CGRect) {
|
||||
// for service in __services {
|
||||
// service.application?(application, didChangeStatusBarFrame: oldStatusBarFrame)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// This callback will be made upon calling -[UIApplication registerUserNotificationSettings:]. The settings the user has granted to the application will be passed in as the second argument.
|
||||
@available(iOS, introduced: 8.0, deprecated: 10.0, message: "Use UserNotification UNNotification Settings instead")
|
||||
open func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
|
||||
for service in __services {
|
||||
service.application?(application, didRegister: notificationSettings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 3.0, *)
|
||||
open func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
||||
for service in __services {
|
||||
service.application?(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 3.0, *)
|
||||
open func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
||||
for service in __services {
|
||||
service.application?(application, didFailToRegisterForRemoteNotificationsWithError: error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS, introduced: 3.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:] or -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:] for user visible notifications and -[UIApplicationDelegate application:didReceiveRemoteNotification:fetchCompletionHandler:] for silent remote notifications")
|
||||
open func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
|
||||
for service in __services {
|
||||
service.application?(application, didReceiveRemoteNotification: userInfo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS, introduced: 4.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenterDelegate willPresentNotification:withCompletionHandler:] or -[UNUserNotificationCenterDelegate didReceiveNotificationResponse:withCompletionHandler:]")
|
||||
open func application(_ application: UIApplication, didReceive notification: UILocalNotification) {
|
||||
for service in __services {
|
||||
service.application?(application, didReceive: notification)
|
||||
}
|
||||
}
|
||||
|
||||
/*! This delegate method offers an opportunity for applications with the "remote-notification" background mode to fetch appropriate new data in response to an incoming remote notification. You should call the fetchCompletionHandler as soon as you're finished performing that operation, so the system can accurately estimate its power and data cost.
|
||||
|
||||
This method will be invoked even if the application was launched or resumed because of the remote notification. The respective delegate methods will be invoked first. Note that this behavior is in contrast to application:didReceiveRemoteNotification:, which is not called in those cases, and which will not be invoked if this method is implemented. !*/
|
||||
@available(iOS 7.0, *)
|
||||
open func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Swift.Void) {
|
||||
apply({ (service, completionHandler) -> Void? in
|
||||
service.application?(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
|
||||
}, completionHandler: { results in
|
||||
let result = results.min(by: { $0.rawValue < $1.rawValue }) ?? .noData
|
||||
completionHandler(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/// Applications with the "fetch" background mode may be given opportunities to fetch updated content in the background or when it is convenient for the system. This method will be called in these situations. You should call the fetchCompletionHandler as soon as you're finished performing that operation, so the system can accurately estimate its power and data cost.
|
||||
@available(iOS 7.0, *)
|
||||
open func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Swift.Void) {
|
||||
apply({ (service, completionHandler) -> Void? in
|
||||
service.application?(application, performFetchWithCompletionHandler: completionHandler)
|
||||
}, completionHandler: { results in
|
||||
let result = results.min(by: { $0.rawValue < $1.rawValue }) ?? .noData
|
||||
completionHandler(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Called when the user activates your application by selecting a shortcut on the home screen,
|
||||
// except when -application:willFinishLaunchingWithOptions: or -application:didFinishLaunchingWithOptions returns NO.
|
||||
@available(iOS 9.0, *)
|
||||
open func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Swift.Void) {
|
||||
apply({ (service, completionHandler) -> Void? in
|
||||
service.application?(application, performActionFor: shortcutItem, completionHandler: completionHandler)
|
||||
}, completionHandler: { results in
|
||||
// if any service handled the shortcut, return true
|
||||
let result = results.reduce(false, { $0 || $1 })
|
||||
completionHandler(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// Applications using an NSURLSession with a background configuration may be launched or resumed in the background in order to handle the
|
||||
// completion of tasks in that session, or to handle authentication. This method will be called with the identifier of the session needing
|
||||
// attention. Once a session has been created from a configuration object with that identifier, the session's delegate will begin receiving
|
||||
// callbacks. If such a session has already been created (if the app is being resumed, for instance), then the delegate will start receiving
|
||||
// callbacks without any action by the application. You should call the completionHandler as soon as you're finished handling the callbacks.
|
||||
@available(iOS 7.0, *)
|
||||
open func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Swift.Void) {
|
||||
apply({ (service, completionHandler) -> Void? in
|
||||
service.application?(application, handleEventsForBackgroundURLSession: identifier, completionHandler: completionHandler)
|
||||
}, completionHandler: { _ in
|
||||
completionHandler()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 8.2, *)
|
||||
open func application(_ application: UIApplication, handleWatchKitExtensionRequest userInfo: [AnyHashable : Any]?, reply: @escaping ([AnyHashable : Any]?) -> Swift.Void) {
|
||||
for service in __services {
|
||||
service.application?(application, handleWatchKitExtensionRequest: userInfo, reply: reply)
|
||||
}
|
||||
apply({ (service, reply) -> Void? in
|
||||
service.application?(application, handleWatchKitExtensionRequest: userInfo, reply: reply)
|
||||
}, completionHandler: { results in
|
||||
let result = results.reduce([:], { initial, next in
|
||||
var initial = initial
|
||||
for (key, value) in next ?? [:] {
|
||||
initial[key] = value
|
||||
}
|
||||
return initial
|
||||
})
|
||||
reply(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 9.0, *)
|
||||
open func applicationShouldRequestHealthAuthorization(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationShouldRequestHealthAuthorization?(application)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 4.0, *)
|
||||
open func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationDidEnterBackground?(application)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 4.0, *)
|
||||
open func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationWillEnterForeground?(application)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 4.0, *)
|
||||
open func applicationProtectedDataWillBecomeUnavailable(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationProtectedDataWillBecomeUnavailable?(application)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 4.0, *)
|
||||
open func applicationProtectedDataDidBecomeAvailable(_ application: UIApplication) {
|
||||
for service in __services {
|
||||
service.applicationProtectedDataDidBecomeAvailable?(application)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Applications may reject specific types of extensions based on the extension point identifier.
|
||||
// Constants representing common extension point identifiers are provided further down.
|
||||
// If unimplemented, the default behavior is to allow the extension point identifier.
|
||||
@available(iOS 8.0, *)
|
||||
open func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplication.ExtensionPointIdentifier) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, shouldAllowExtensionPointIdentifier: extensionPointIdentifier) ?? true {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 6.0, *)
|
||||
open func application(_ application: UIApplication, viewControllerWithRestorationIdentifierPath identifierComponents: [String], coder: NSCoder) -> UIViewController? {
|
||||
for service in __services {
|
||||
if let viewController = service.application?(application, viewControllerWithRestorationIdentifierPath: identifierComponents, coder: coder) {
|
||||
return viewController
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@available(iOS 6.0, *)
|
||||
open func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, shouldSaveApplicationState: coder) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS 6.0, *)
|
||||
open func application(_ application: UIApplication, shouldRestoreApplicationState coder: NSCoder) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, shouldRestoreApplicationState: coder) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@available(iOS 6.0, *)
|
||||
open func application(_ application: UIApplication, willEncodeRestorableStateWith coder: NSCoder) {
|
||||
for service in __services {
|
||||
service.application?(application, willEncodeRestorableStateWith: coder)
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOS 6.0, *)
|
||||
open func application(_ application: UIApplication, didDecodeRestorableStateWith coder: NSCoder) {
|
||||
for service in __services {
|
||||
service.application?(application, didDecodeRestorableStateWith: coder)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Called on the main thread as soon as the user indicates they want to continue an activity in your application. The NSUserActivity object may not be available instantly,
|
||||
// so use this as an opportunity to show the user that an activity will be continued shortly.
|
||||
// For each application:willContinueUserActivityWithType: invocation, you are guaranteed to get exactly one invocation of application:continueUserActivity: on success,
|
||||
// or application:didFailToContinueUserActivityWithType:error: if an error was encountered.
|
||||
@available(iOS 8.0, *)
|
||||
open func application(_ application: UIApplication, willContinueUserActivityWithType userActivityType: String) -> Bool {
|
||||
var result = false
|
||||
for service in __services {
|
||||
if service.application?(application, willContinueUserActivityWithType: userActivityType) ?? false {
|
||||
result = true
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
// Called on the main thread after the NSUserActivity object is available. Use the data you stored in the NSUserActivity object to re-create what the user was doing.
|
||||
// You can create/fetch any restorable objects associated with the user activity, and pass them to the restorationHandler. They will then have the UIResponder restoreUserActivityState: method
|
||||
// invoked with the user activity. Invoking the restorationHandler is optional. It may be copied and invoked later, and it will bounce to the main thread to complete its work and call
|
||||
// restoreUserActivityState on all objects.
|
||||
@available(iOS 8.0, *)
|
||||
open func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Swift.Void) -> Bool {
|
||||
let returns = apply({ (service, restorationHandler) -> Bool? in
|
||||
service.application?(application, continue: userActivity, restorationHandler: restorationHandler)
|
||||
}, completionHandler: { results in
|
||||
let result = results.reduce([], { $0 + ($1 ?? []) })
|
||||
restorationHandler(result)
|
||||
})
|
||||
|
||||
return returns.reduce(false, { $0 || $1 })
|
||||
}
|
||||
|
||||
|
||||
// If the user activity cannot be fetched after willContinueUserActivityWithType is called, this will be called on the main thread when implemented.
|
||||
@available(iOS 8.0, *)
|
||||
open func application(_ application: UIApplication, didFailToContinueUserActivityWithType userActivityType: String, error: Error) {
|
||||
for service in __services {
|
||||
service.application?(application, didFailToContinueUserActivityWithType: userActivityType, error: error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is called on the main thread when a user activity managed by UIKit has been updated. You can use this as a last chance to add additional data to the userActivity.
|
||||
@available(iOS 8.0, *)
|
||||
open func application(_ application: UIApplication, didUpdate userActivity: NSUserActivity) {
|
||||
for service in __services {
|
||||
service.application?(application, didUpdate: userActivity)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This will be called on the main thread after the user indicates they want to accept a CloudKit sharing invitation in your application.
|
||||
// You should use the CKShareMetadata object's shareURL and containerIdentifier to schedule a CKAcceptSharesOperation, then start using
|
||||
// the resulting CKShare and its associated record(s), which will appear in the CKContainer's shared database in a zone matching that of the record's owner.
|
||||
@available(iOS 10.0, *)
|
||||
open func application(_ application: UIApplication, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {
|
||||
for service in __services {
|
||||
service.application?(application, userDidAcceptCloudKitShareWith: cloudKitShareMetadata)
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,320 +0,0 @@
|
||||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "abseil-cpp-swiftpm",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/abseil-cpp-SwiftPM.git",
|
||||
"state" : {
|
||||
"revision" : "d302de612e3d57c6f4afaf087da18fba8eac72a7",
|
||||
"version" : "0.20220203.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "alamofire",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/Alamofire/Alamofire.git",
|
||||
"state" : {
|
||||
"revision" : "354dda32d89fc8cd4f5c46487f64957d355f53d8",
|
||||
"version" : "5.6.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "alamofireimage",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/Alamofire/AlamofireImage.git",
|
||||
"state" : {
|
||||
"revision" : "98cbb00ce0ec5fc8e52a5b50a6bfc08d3e5aee10",
|
||||
"version" : "4.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "apollo-ios",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apollographql/apollo-ios.git",
|
||||
"state" : {
|
||||
"revision" : "08a41bad4ebf76ae8e4efebf26862a42084b7786",
|
||||
"version" : "0.51.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "bigint",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/attaswift/BigInt.git",
|
||||
"state" : {
|
||||
"revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6",
|
||||
"version" : "5.3.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "boringssl-swiftpm",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/boringssl-SwiftPM.git",
|
||||
"state" : {
|
||||
"revision" : "79db6516894a932d0ddaff3b05b9da1e4f6c4069",
|
||||
"version" : "0.9.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "cryptoswift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
|
||||
"state" : {
|
||||
"revision" : "039f56c5d7960f277087a0be51f5eb04ed0ec073",
|
||||
"version" : "1.5.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "eosio-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/EOSIO/eosio-swift.git",
|
||||
"state" : {
|
||||
"revision" : "4e0f706aa62dc16ec1d7073b5b37a57375f0d231",
|
||||
"version" : "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "firebase-ios-sdk",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
|
||||
"state" : {
|
||||
"revision" : "111d8d6ad1a1afd6c8e9561d26e55ab1e74fcb42",
|
||||
"version" : "8.15.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "foundation",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/PromiseKit/Foundation",
|
||||
"state" : {
|
||||
"revision" : "985f17fa69ee0e5b7eb3ff9be87ffc4e05fc0927",
|
||||
"version" : "3.4.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "googleappmeasurement",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/GoogleAppMeasurement.git",
|
||||
"state" : {
|
||||
"revision" : "ef819db8c58657a6ca367322e73f3b6322afe0a2",
|
||||
"version" : "8.15.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "googledatatransport",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/GoogleDataTransport.git",
|
||||
"state" : {
|
||||
"revision" : "b905c49326b72211531ed9d7baa02d724828a8dc",
|
||||
"version" : "9.1.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "googleutilities",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/GoogleUtilities.git",
|
||||
"state" : {
|
||||
"revision" : "f4abe56ce62a779e64b525eb133c8fc2a84bbc1f",
|
||||
"version" : "7.7.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "grpc-ios",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/grpc/grpc-ios.git",
|
||||
"state" : {
|
||||
"revision" : "2af4f6e9c2b18beae228f50b1198c641be859d2b",
|
||||
"version" : "1.44.2-grpc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "gtm-session-fetcher",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/gtm-session-fetcher.git",
|
||||
"state" : {
|
||||
"revision" : "4e9bbf2808b8fee444e84a48f5f3c12641987d3e",
|
||||
"version" : "1.7.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "inputbaraccessoryview",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/nathantannar4/InputBarAccessoryView",
|
||||
"state" : {
|
||||
"revision" : "2843b4454cfb6de5b4d1e5939fef2dd6257b69ee",
|
||||
"version" : "5.5.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "ios-branch-deep-linking-attribution",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/BranchMetrics/ios-branch-deep-linking-attribution.git",
|
||||
"state" : {
|
||||
"revision" : "ac9422150d33839b19952111592085ea67b7a412",
|
||||
"version" : "1.41.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "iqkeyboardmanager",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/hackiftekhar/IQKeyboardManager.git",
|
||||
"state" : {
|
||||
"revision" : "9ab144a1a6c6ae8dad25840610c072709b15d8b5",
|
||||
"version" : "6.5.10"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "leveldb",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/leveldb.git",
|
||||
"state" : {
|
||||
"revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
|
||||
"version" : "1.22.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "marqueelabel",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/cbpowell/MarqueeLabel.git",
|
||||
"state" : {
|
||||
"revision" : "f2c72a5f8568579dade6350dc26a482076d3d346",
|
||||
"version" : "4.3.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "messagekit",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/MessageKit/MessageKit.git",
|
||||
"state" : {
|
||||
"revision" : "84236d91ac5783e3ecbefc15b82d854476720115",
|
||||
"version" : "3.8.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "nanopb",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/nanopb.git",
|
||||
"state" : {
|
||||
"revision" : "7ee9ef9f627d85cbe1b8c4f49a3ed26eed216c77",
|
||||
"version" : "2.30908.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "promisekit",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/mxcl/PromiseKit",
|
||||
"state" : {
|
||||
"revision" : "c946b7561fbe11379a874e59faa2c5f8077ae0e1",
|
||||
"version" : "6.17.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "promises",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/promises.git",
|
||||
"state" : {
|
||||
"revision" : "46c1e6b5ac09d8f82c991061c659f67e573d425d",
|
||||
"version" : "2.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "reachability.swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/ashleymills/Reachability.swift.git",
|
||||
"state" : {
|
||||
"revision" : "c01bbdf2d633cf049ae1ed1a68a2020a8bda32e2",
|
||||
"version" : "5.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "realm-core",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-core",
|
||||
"state" : {
|
||||
"revision" : "d97eed3ae7dff2f2e2ffbda83fa8f3b8c445c6ba",
|
||||
"version" : "11.17.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "realm-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-swift.git",
|
||||
"state" : {
|
||||
"revision" : "7f123e48ec12926bb5080e449df360127ee0352d",
|
||||
"version" : "10.26.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "resolver",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/hmlongco/Resolver.git",
|
||||
"state" : {
|
||||
"revision" : "97de0b0320036607564af4a60025b48f8d041221",
|
||||
"version" : "1.5.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "skeletonview",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/Juanpe/SkeletonView.git",
|
||||
"state" : {
|
||||
"revision" : "9e61ff3a85a3780a2cdfceae0257ad32fa8ae4d3",
|
||||
"version" : "1.29.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "sqlite.swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/stephencelis/SQLite.swift.git",
|
||||
"state" : {
|
||||
"revision" : "4d543d811ee644fa4cc4bfa0be996b4dd6ba0f54",
|
||||
"version" : "0.13.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "starscream",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/daltoniam/Starscream.git",
|
||||
"state" : {
|
||||
"revision" : "e6b65c6d9077ea48b4a7bdda8994a1d3c6969c8d",
|
||||
"version" : "3.1.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-collections",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-collections",
|
||||
"state" : {
|
||||
"revision" : "9d8719c8bebdc79740b6969c912ac706eb721d7a",
|
||||
"version" : "0.0.7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-nio-zlib-support",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-nio-zlib-support.git",
|
||||
"state" : {
|
||||
"revision" : "37760e9a52030bb9011972c5213c3350fa9d41fd",
|
||||
"version" : "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-protobuf",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-protobuf.git",
|
||||
"state" : {
|
||||
"revision" : "e1499bc69b9040b29184f7f2996f7bab467c1639",
|
||||
"version" : "1.19.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swiftgraph",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/davecom/SwiftGraph.git",
|
||||
"state" : {
|
||||
"revision" : "76b5180a5cc32eda7f5236a756f4c1e0936311c6",
|
||||
"version" : "3.1.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES"
|
||||
runPostActionsOnFailure = "NO">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C3AD27530EC84F7BE5787A74"
|
||||
BuildableName = "JMalinkaWallet.app"
|
||||
BlueprintName = "JMalinkaWallet"
|
||||
ReferencedContainer = "container:Wallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
onlyGenerateCoverageForSpecifiedTargets = "NO"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C3AD27530EC84F7BE5787A74"
|
||||
BuildableName = "JMalinkaWallet.app"
|
||||
BlueprintName = "JMalinkaWallet"
|
||||
ReferencedContainer = "container:Wallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C3AD27530EC84F7BE5787A74"
|
||||
BuildableName = "JMalinkaWallet.app"
|
||||
BlueprintName = "JMalinkaWallet"
|
||||
ReferencedContainer = "container:Wallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
<StoreKitConfigurationFileReference
|
||||
identifier = "../../Assets/Configuration.storekit">
|
||||
</StoreKitConfigurationFileReference>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "C3AD27530EC84F7BE5787A74"
|
||||
BuildableName = "JMalinkaWallet.app"
|
||||
BlueprintName = "JMalinkaWallet"
|
||||
ReferencedContainer = "container:Wallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
</CommandLineArguments>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,161 +0,0 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// List
|
||||
//
|
||||
// Created by Igor Danich on 25.06.2020.
|
||||
// Copyright © 2020 Igor Danich. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import CoreData
|
||||
import IQKeyboardManagerSwift
|
||||
import Firebase
|
||||
import FirebaseMessaging
|
||||
import Branch
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
configureUI()
|
||||
IQKeyboardManager.shared.enable = true
|
||||
FirebaseApp.configure()
|
||||
Messaging.messaging().delegate = self
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
_ = Account.Service.History.shared
|
||||
window?.tintColor = Asset.deepWater.color
|
||||
|
||||
if UserDefaults.standard.object(forKey: "dafaultCityId") == nil {
|
||||
UserDefaults.standard.setValue(16 /* Moscow */, forKey: "dafaultCityId")
|
||||
}
|
||||
|
||||
Cards.Service() //this line will migrate old Bank cards to new format
|
||||
|
||||
AccountOnboarding.Service.IAP.shared.startObserving()
|
||||
AccountOnboarding.Service.IAP.shared.getProducts()
|
||||
|
||||
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
|
||||
UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { _, _ in }
|
||||
application.registerForRemoteNotifications()
|
||||
|
||||
StoreReviewHelper.incrementAppOpenedCount()
|
||||
|
||||
Branch.getInstance().initSession(launchOptions: launchOptions) { [unowned self] (params,error) in
|
||||
guard
|
||||
let action = DeepLinkAction(rawValue: params?["action"] as? String ?? ""),
|
||||
let data = (params?["params"] as? String)?.data(using: .utf8)
|
||||
?? (try? JSONSerialization.data(withJSONObject: params?["params"] as? [String: Any], options: []))
|
||||
else { return }
|
||||
(window?.rootViewController as? MainController)?.process(action: action, data: data)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private func configureUI() {
|
||||
UIActivityIndicatorView.appearance().color = Asset.deepWater.color
|
||||
UINavigationBar.appearance().shadowImage = UIImage()
|
||||
UINavigationBar.appearance().barTintColor = .white
|
||||
UINavigationBar.appearance().tintColor = #colorLiteral(red: 0.282, green: 0.322, blue: 0.3803921569, alpha: 1)
|
||||
UINavigationBar.appearance().isTranslucent = false
|
||||
UINavigationBar.appearance().titleTextAttributes = [
|
||||
.font: UIFont.font(style: .medium, size: 20),
|
||||
.foregroundColor: Asset.textCoal.color
|
||||
]
|
||||
UIActivityIndicatorView.appearance().color = Asset.deepWater.color
|
||||
UISegmentedControl.appearance().setTitleTextAttributes([
|
||||
.font: UIFont.font(style: .medium, size: 14),
|
||||
.foregroundColor: Asset.textGranite.color
|
||||
], for: .normal)
|
||||
if #available(iOS 13, *) {
|
||||
UISegmentedControl.appearance().setTitleTextAttributes([
|
||||
.font: UIFont.font(style: .medium, size: 14),
|
||||
.foregroundColor: Asset.textSnow.color
|
||||
], for: .selected)
|
||||
UISegmentedControl.appearance().selectedSegmentTintColor = Asset.deepWater.color
|
||||
}
|
||||
UITabBar.appearance().tintColor = Asset.deepWater.color
|
||||
UITabBarItem.appearance().setTitleTextAttributes([
|
||||
.font : UIFont.font(style: .medium, size: 12)
|
||||
], for: .normal)
|
||||
UISwitch.appearance().onTintColor = Asset.deepWater.color
|
||||
|
||||
}
|
||||
|
||||
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
|
||||
Accounts().isPushEnabled = true
|
||||
}
|
||||
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
blurView.frame = window?.bounds ?? .zero
|
||||
blurView.alpha = 0
|
||||
window?.addSubview(blurView)
|
||||
UIView.animate(withDuration: Animation.slow) { self.blurView.alpha = 1 }
|
||||
Account.Service.Authorize.shared.saveUptime()
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
UIView.animate(withDuration: Animation.slow) {
|
||||
self.blurView.alpha = 0
|
||||
} completion: { _ in
|
||||
self.blurView.removeFromSuperview()
|
||||
}
|
||||
Account.Service.Authorize.shared.clearUptime()
|
||||
if let controller = window?.rootViewController,
|
||||
Accounts().isPasswordExists,
|
||||
UserDefaults.standard.bool(forKey: "isPinPwdMode") {
|
||||
guard !((controller.presentedViewController as? UINavigationController)?.topViewController is AccountControllerPin) else { return }
|
||||
guard !(controller.presentedViewController is AccountControllerPin) else { return }
|
||||
guard !((controller.presentedViewController?.presentedViewController as? UINavigationController)?.topViewController is AccountControllerPin) else { return }
|
||||
if (Account.Service.Authorize.shared.password ?? "").isEmpty {
|
||||
if controller.presentedViewController != nil {
|
||||
controller.dismiss(animated: false, completion: {
|
||||
AccountViewAuthorize.showGetPassword(in: controller, showPinBackButton: false, { _ in })
|
||||
})
|
||||
} else {
|
||||
AccountViewAuthorize.showGetPassword(in: controller, showPinBackButton: false, {
|
||||
Accounts().migrateAccountIfNeeded(password: $0)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
AccountViewAuthorize.showGetPassword(in: controller, showPinBackButton: false, { _ in })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func application(
|
||||
_ application: UIApplication,
|
||||
continue userActivity: NSUserActivity,
|
||||
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
|
||||
) -> Bool {
|
||||
Branch.getInstance().continue(userActivity)
|
||||
}
|
||||
|
||||
func application(
|
||||
_ app: UIApplication,
|
||||
open url: URL,
|
||||
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
|
||||
) -> Bool {
|
||||
Branch.getInstance().application(app, open: url, options: options)
|
||||
}
|
||||
|
||||
func application(
|
||||
_ application: UIApplication,
|
||||
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
|
||||
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
|
||||
) {
|
||||
Branch.getInstance().handlePushNotification(userInfo)
|
||||
guard UIApplication.shared.applicationState != .active else { return }
|
||||
if let info = userInfo as? [String:Any], let action = DeepLinkAction(rawValue: (userInfo["action"] as? String) ?? "") {
|
||||
(window?.rootViewController as? MainController)?.process(action: action, info: info)
|
||||
}
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
AccountOnboarding.Service.IAP.shared.stopObserving()
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// AppDelegate+Injection.swift
|
||||
// WalletApplicationDelegate+Injection.swift
|
||||
// PayCash
|
||||
//
|
||||
// Created by Saveliy Stavitsky on 8/4/21.
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// BranchApplicationService.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Branch
|
||||
import UIKit
|
||||
|
||||
final class BranchApplicationService: NSObject, ApplicationService {
|
||||
|
||||
func application(_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
Branch.getInstance().initSession(launchOptions: launchOptions) { [weak self] params, error in
|
||||
guard let self = self,
|
||||
let action = DeepLinkAction(rawValue: params?["action"] as? String ?? ""),
|
||||
let data = (params?["params"] as? String)?.data(using: .utf8)
|
||||
?? (try? JSONSerialization.data(withJSONObject: params?["params"] as? [String: Any], options: [])),
|
||||
let mainController = self.window?.rootViewController as? MainController else {
|
||||
return
|
||||
}
|
||||
|
||||
mainController.process(action: action, data: data)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication,
|
||||
continue userActivity: NSUserActivity,
|
||||
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
|
||||
Branch.getInstance().continue(userActivity)
|
||||
}
|
||||
|
||||
func application(
|
||||
_ app: UIApplication,
|
||||
open url: URL,
|
||||
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
|
||||
Branch.getInstance().application(app, open: url, options: options)
|
||||
}
|
||||
|
||||
func application(
|
||||
_ application: UIApplication,
|
||||
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
|
||||
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
|
||||
Branch.getInstance().handlePushNotification(userInfo)
|
||||
guard UIApplication.shared.applicationState != .active else { return }
|
||||
if let info = userInfo as? [String:Any],
|
||||
let action = DeepLinkAction(rawValue: (userInfo["action"] as? String) ?? "") {
|
||||
(self.window?.rootViewController as? MainController)?.process(action: action, info: info)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// CommonApplicationService.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
final class CommonApplicationService: NSObject, ApplicationService {
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
_ = Account.Service.History.shared
|
||||
|
||||
if UserDefaults.standard.object(forKey: "dafaultCityId") == nil {
|
||||
UserDefaults.standard.setValue(16 /* Moscow */, forKey: "dafaultCityId")
|
||||
}
|
||||
|
||||
let _ = Cards.Service() //this line will migrate old Bank cards to new format
|
||||
|
||||
AccountOnboarding.Service.IAP.shared.startObserving()
|
||||
AccountOnboarding.Service.IAP.shared.getProducts()
|
||||
|
||||
StoreReviewHelper.incrementAppOpenedCount()
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
AccountOnboarding.Service.IAP.shared.stopObserving()
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
Account.Service.Authorize.shared.saveUptime()
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
|
||||
Account.Service.Authorize.shared.clearUptime()
|
||||
if let controller = window?.rootViewController,
|
||||
Accounts().isPasswordExists,
|
||||
UserDefaults.standard.bool(forKey: "isPinPwdMode") {
|
||||
|
||||
guard !((controller.presentedViewController as? UINavigationController)?.topViewController is AccountControllerPin) else { return }
|
||||
guard !(controller.presentedViewController is AccountControllerPin) else { return }
|
||||
guard !((controller.presentedViewController?.presentedViewController as? UINavigationController)?.topViewController is AccountControllerPin) else { return }
|
||||
if (Account.Service.Authorize.shared.password ?? "").isEmpty {
|
||||
if controller.presentedViewController != nil {
|
||||
controller.dismiss(animated: false, completion: {
|
||||
AccountViewAuthorize.showGetPassword(in: controller, showPinBackButton: false, { _ in })
|
||||
})
|
||||
} else {
|
||||
AccountViewAuthorize.showGetPassword(in: controller, showPinBackButton: false, {
|
||||
Accounts().migrateAccountIfNeeded(password: $0)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
AccountViewAuthorize.showGetPassword(in: controller, showPinBackButton: false, { _ in })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// FirebaseApplicationService.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Firebase
|
||||
import FirebaseMessaging
|
||||
|
||||
final class FirebaseApplicationService: NSObject, ApplicationService, MessagingDelegate {
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
FirebaseApp.configure()
|
||||
Messaging.messaging().delegate = self
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// MARK: - MessagingDelegate
|
||||
|
||||
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
|
||||
Accounts().isPushEnabled = true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// IQKeyboardAppicationService.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import IQKeyboardManagerSwift
|
||||
|
||||
final class IQKeyboardAppicationService: NSObject, ApplicationService {
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
IQKeyboardManager.shared.enable = true
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// UIApplicationService.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
final class UIApplicationService: NSObject, ApplicationService {
|
||||
|
||||
private let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
|
||||
private let animationDuration: TimeInterval
|
||||
|
||||
init(animation duration: TimeInterval) {
|
||||
self.animationDuration = duration
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
self.configureUI()
|
||||
|
||||
self.window?.tintColor = Asset.deepWater.color
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
|
||||
self.blurView.frame = self.window?.bounds ?? .zero
|
||||
self.blurView.alpha = 0
|
||||
self.window?.addSubview(self.blurView)
|
||||
|
||||
UIView.animate(withDuration: self.animationDuration) { self.blurView.alpha = 1 }
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
UIView.animate(withDuration: self.animationDuration) {
|
||||
self.blurView.alpha = 0
|
||||
} completion: { _ in
|
||||
self.blurView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func configureUI() {
|
||||
|
||||
UIActivityIndicatorView.appearance().color = Asset.deepWater.color
|
||||
|
||||
UINavigationBar.appearance().shadowImage = UIImage()
|
||||
UINavigationBar.appearance().barTintColor = .white
|
||||
UINavigationBar.appearance().tintColor = #colorLiteral(red: 0.282, green: 0.322, blue: 0.3803921569, alpha: 1)
|
||||
UINavigationBar.appearance().isTranslucent = false
|
||||
UINavigationBar.appearance().titleTextAttributes = [
|
||||
.font: UIFont.font(style: .medium, size: 20),
|
||||
.foregroundColor: Asset.textCoal.color
|
||||
]
|
||||
|
||||
UIActivityIndicatorView.appearance().color = Asset.deepWater.color
|
||||
|
||||
UISegmentedControl.appearance().setTitleTextAttributes([
|
||||
.font: UIFont.font(style: .medium, size: 14),
|
||||
.foregroundColor: Asset.textGranite.color
|
||||
], for: .normal)
|
||||
|
||||
if #available(iOS 13, *) {
|
||||
UISegmentedControl.appearance().setTitleTextAttributes([
|
||||
.font: UIFont.font(style: .medium, size: 14),
|
||||
.foregroundColor: Asset.textSnow.color
|
||||
], for: .selected)
|
||||
UISegmentedControl.appearance().selectedSegmentTintColor = Asset.deepWater.color
|
||||
}
|
||||
|
||||
UITabBar.appearance().tintColor = Asset.deepWater.color
|
||||
UITabBarItem.appearance().setTitleTextAttributes([
|
||||
.font : UIFont.font(style: .medium, size: 12)
|
||||
], for: .normal)
|
||||
|
||||
UISwitch.appearance().onTintColor = Asset.deepWater.color
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// UserNotificationApplicationService.swift
|
||||
// JMalinkaWallet
|
||||
//
|
||||
// Created by Juraldinio on 5/29/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class UserNotificationApplicationService: NSObject, ApplicationService, UNUserNotificationCenterDelegate {
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { _, _ in }
|
||||
|
||||
application.registerForRemoteNotifications()
|
||||
}
|
||||
|
||||
// MARK: - UNUserNotificationCenterDelegate
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// WalletApplicationDelegate.swift
|
||||
// List
|
||||
//
|
||||
// Created by Igor Danich on 25.06.2020.
|
||||
// Copyright © 2020 Igor Danich. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import CoreData
|
||||
|
||||
@UIApplicationMain
|
||||
class WalletApplicationDelegate: PluggableApplicationDelegate {
|
||||
|
||||
override var services: [ApplicationService] {
|
||||
[
|
||||
UIApplicationService(animation: Animation.slow),
|
||||
IQKeyboardAppicationService(),
|
||||
FirebaseApplicationService(),
|
||||
UserNotificationApplicationService(),
|
||||
CommonApplicationService(),
|
||||
BranchApplicationService()
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -77,8 +77,8 @@ extension UIViewController {
|
||||
keyboard?.removeValue(forKey: action)
|
||||
}
|
||||
|
||||
var appDelegate: AppDelegate {
|
||||
var appDelegate: WalletApplicationDelegate {
|
||||
// swiftlint:disable force_cast
|
||||
return UIApplication.shared.delegate as! AppDelegate
|
||||
return UIApplication.shared.delegate as! WalletApplicationDelegate
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user