From a8b8207154ec8c329b039c17927f79d17e117114 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Thu, 14 Oct 2021 10:30:20 +1100 Subject: [PATCH] clean --- Session/Meta/AppDelegate.m | 12 -------- Session/Meta/AppDelegate.swift | 53 --------------------------------- Session/Meta/Session-Info.plist | 12 +++----- 3 files changed, 4 insertions(+), 73 deletions(-) diff --git a/Session/Meta/AppDelegate.m b/Session/Meta/AppDelegate.m index a96e311cd..4f2854842 100644 --- a/Session/Meta/AppDelegate.m +++ b/Session/Meta/AppDelegate.m @@ -224,11 +224,7 @@ static NSTimeInterval launchStartedAt; OWSLogInfo(@"application: didFinishLaunchingWithOptions completed."); [self setUpCallHandling]; - if (@available(iOS 13.0, *)) { - [self registerBackgroundTasks]; - } - return YES; } @@ -256,10 +252,6 @@ static NSTimeInterval launchStartedAt; [AppReadiness runNowOrWhenAppDidBecomeReady:^{ [self handleActivation]; }]; - - if (@available(iOS 13, *)) { - [self cancelAllPendingBackgroundTasks]; - } // Clear all notifications whenever we become active. // When opening the app from a notification, @@ -287,10 +279,6 @@ static NSTimeInterval launchStartedAt; [sharedUserDefaults synchronize]; [DDLog flushLog]; - - if (@available(iOS 13, *)) { - [self scheduleAppRefresh]; - } } #pragma mark - Orientation diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index 9b2e274f0..ef474dd76 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -2,9 +2,6 @@ import PromiseKit import WebRTC import SessionUIKit import UIKit -import BackgroundTasks -import SessionUtilitiesKit -import SessionMessagingKit extension AppDelegate { @@ -103,54 +100,4 @@ extension AppDelegate { } } } - - // MARK: Background tasks - @available(iOS 13.0, *) - @objc func registerBackgroundTasks() { - BGTaskScheduler.shared.register(forTaskWithIdentifier: "com.loki-project.loki-messenger.refresh", using: nil) { task in - self.handleAppRefresh(task: task as! BGAppRefreshTask) - } - - BGTaskScheduler.shared.register(forTaskWithIdentifier: "com.loki-project.loki-messenger.vibrate", using: nil) { task in - Vibration.shared.startVibration() - DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 60, execute: { - Vibration.shared.stopVibrationIfPossible() - task.setTaskCompleted(success: true) - }) - } - } - - @available(iOS 13.0, *) - @objc func cancelAllPendingBackgroundTasks() { - BGTaskScheduler.shared.cancelAllTaskRequests() - } - - @available(iOS 13.0, *) - @objc func scheduleAppRefresh() { - let request = BGAppRefreshTaskRequest(identifier: "com.loki-project.loki-messenger.refresh") - // Fetch no earlier than 15 minutes from now. - request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) - - do { - try BGTaskScheduler.shared.submit(request) - } catch { - print("Could not schedule app refresh: \(error)") - } - } - - @available(iOS 13.0, *) - private func handleAppRefresh(task: BGAppRefreshTask) { - // Schedule a new refresh task. - scheduleAppRefresh() - AppReadiness.runNowOrWhenAppDidBecomeReady{ - BackgroundPoller.poll(completionHandler: { result in - if result == .failed { - task.setTaskCompleted(success: false) - } else { - task.setTaskCompleted(success: true) - } - }) - } - } - } diff --git a/Session/Meta/Session-Info.plist b/Session/Meta/Session-Info.plist index 3771b748c..b28a0d205 100644 --- a/Session/Meta/Session-Info.plist +++ b/Session/Meta/Session-Info.plist @@ -2,11 +2,6 @@ - BGTaskSchedulerPermittedIdentifiers - - com.loki-project.loki-messenger.vibrate - com.loki-project.loki-messenger.refresh - BuildDetails CarthageVersion @@ -96,6 +91,8 @@ Signal uses your contacts to find users you know. We do not store your contacts on the server. NSFaceIDUsageDescription Session's Screen Lock feature uses Face ID. + NSHumanReadableCopyright + com.loki-project.loki-messenger NSMicrophoneUsageDescription Session needs access to your microphone to record media. NSPhotoLibraryAddUsageDescription @@ -123,9 +120,10 @@ UIBackgroundModes + audio fetch - processing remote-notification + voip UILaunchStoryboardName Launch Screen @@ -141,7 +139,5 @@ UIViewControllerBasedStatusBarAppearance - NSHumanReadableCopyright - com.loki-project.loki-messenger