소스 검색

made appdelegate methods private whenever possible

Bastian van de Wetering 6 년 전
부모
커밋
b6d85c2a8a
1개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 11 11
      deltachat-ios/AppDelegate.swift

+ 11 - 11
deltachat-ios/AppDelegate.swift

@@ -26,9 +26,9 @@ enum ApplicationState {
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
   static let appCoordinator = AppCoordinator()
-  static var progress: Float = 0
+	static var progress: Float = 0	// TODO: delete
   static var lastErrorDuringConfig: String?
-  var backgroundTask: UIBackgroundTaskIdentifier = .invalid
+  private var backgroundTask: UIBackgroundTaskIdentifier = .invalid
 
   var reachability = Reachability()!
   var window: UIWindow?
@@ -107,7 +107,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     maybeStop()
   }
 
-  func maybeStop() {
+  private func maybeStop() {
     DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
       let app = UIApplication.shared
       logger.info("state: \(app.applicationState) time remaining \(app.backgroundTimeRemaining)")
@@ -138,7 +138,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     return documentsPath + "/messenger.db"
   }
 
-  func open() {
+	func open() {
     logger.info("open: \(dbfile())")
 
     if mailboxPointer == nil {
@@ -232,7 +232,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     DBDebugToolkit.add(info)
   }
 
-  @objc func reachabilityChanged(note: Notification) {
+  @objc private func reachabilityChanged(note: Notification) {
     let reachability = note.object as! Reachability
 
     switch reachability.connection {
@@ -259,7 +259,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
   // MARK: - BackgroundTask
 
-  func registerBackgroundTask() {
+  private func registerBackgroundTask() {
     logger.info("background task registered")
     backgroundTask = UIApplication.shared.beginBackgroundTask { [weak self] in
       self?.endBackgroundTask()
@@ -267,7 +267,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     assert(backgroundTask != .invalid)
   }
 
-  func endBackgroundTask() {
+  private func endBackgroundTask() {
     logger.info("background task ended")
     UIApplication.shared.endBackgroundTask(backgroundTask)
     backgroundTask = .invalid
@@ -275,7 +275,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
   // MARK: - PushNotifications
 
-  func registerForPushNotifications() {
+  private func registerForPushNotifications() {
     UNUserNotificationCenter.current().delegate = self
 
     UNUserNotificationCenter.current()
@@ -287,18 +287,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
       }
   }
 
-  func getNotificationSettings() {
+  private func getNotificationSettings() {
     UNUserNotificationCenter.current().getNotificationSettings { settings in
       logger.info("Notification settings: \(settings)")
     }
   }
 
-  func userNotificationCenter(_: UNUserNotificationCenter, willPresent _: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
+  private func userNotificationCenter(_: UNUserNotificationCenter, willPresent _: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
     logger.info("forground notification")
     completionHandler([.alert, .sound])
   }
 
-  func userNotificationCenter(_: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
+  private func userNotificationCenter(_: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
     if response.notification.request.identifier == Constants.notificationIdentifier {
       logger.info("handling notifications")
       let userInfo = response.notification.request.content.userInfo