Ver código fonte

at AppStart it will be checked if account has been setup, if not show AccountSetup wizzard

Bastian van de Wetering 6 anos atrás
pai
commit
e84ecca7b7

+ 10 - 2
deltachat-ios.xcodeproj/project.pbxproj

@@ -93,6 +93,7 @@
 		AEACE2DF1FB3246400DCDD78 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2DE1FB3246400DCDD78 /* Message.swift */; };
 		AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E21FB32B5C00DCDD78 /* Constants.swift */; };
 		AEACE2E51FB32E1900DCDD78 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E41FB32E1900DCDD78 /* Utils.swift */; };
+		AEE56D762253431E007DC082 /* AccountSetupController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE56D752253431E007DC082 /* AccountSetupController.swift */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -260,10 +261,12 @@
 		8DE110C607A0E4485C43B5FA /* Pods-deltachat-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.debug.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.debug.xcconfig"; sourceTree = "<group>"; };
 		A8615D4600859851E53CAA9C /* Pods-deltachat-ios.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-deltachat-ios.release.xcconfig"; path = "Pods/Target Support Files/Pods-deltachat-ios/Pods-deltachat-ios.release.xcconfig"; sourceTree = "<group>"; };
 		AE0D26FC1FB1FE88002FAFCE /* ChatListController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatListController.swift; sourceTree = "<group>"; };
+		AEA9CC2F22522DA20061D113 /* librpgp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = librpgp.h; sourceTree = "<group>"; };
 		AEACE2DC1FB323CA00DCDD78 /* ChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatViewController.swift; sourceTree = "<group>"; };
 		AEACE2DE1FB3246400DCDD78 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
 		AEACE2E21FB32B5C00DCDD78 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
 		AEACE2E41FB32E1900DCDD78 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
+		AEE56D752253431E007DC082 /* AccountSetupController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSetupController.swift; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -456,6 +459,7 @@
 				AEACE2E41FB32E1900DCDD78 /* Utils.swift */,
 				78E45E3B21D3D03700D4B15E /* TableViewCell.swift */,
 				78ED838221D5379000243125 /* TextFieldCell.swift */,
+				AEE56D752253431E007DC082 /* AccountSetupController.swift */,
 			);
 			path = "deltachat-ios";
 			sourceTree = "<group>";
@@ -514,6 +518,7 @@
 				7070FB4920FF345B000DC258 /* dc_dehtml.c */,
 				7070FB5920FF345E000DC258 /* dc_e2ee.c */,
 				7070FB4520FF345B000DC258 /* dc_hash.c */,
+				AEA9CC2F22522DA20061D113 /* librpgp.h */,
 				7070FB5220FF345D000DC258 /* dc_imex.c */,
 				7070FB5020FF345C000DC258 /* dc_job.c */,
 				7070FB5720FF345E000DC258 /* dc_key.c */,
@@ -801,6 +806,7 @@
 				AE0D26FD1FB1FE88002FAFCE /* ChatListController.swift in Sources */,
 				7070FB6920FF345F000DC258 /* dc_mimeparser.c in Sources */,
 				7A0052C81FBE6CB40048C3BF /* NewContactController.swift in Sources */,
+				AEE56D762253431E007DC082 /* AccountSetupController.swift in Sources */,
 				7070FB6020FF345F000DC258 /* dc_hash.c in Sources */,
 				AEACE2DD1FB323CA00DCDD78 /* ChatViewController.swift in Sources */,
 				7070FB4020FF3421000DC258 /* dc_chat.c in Sources */,
@@ -901,6 +907,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
+				"HEADER_SEARCH_PATHS[arch=*]" = /Users/nayooti/iOSDeveloper/rpgp_temp;
 				IPHONEOS_DEPLOYMENT_TARGET = 11.1;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
@@ -954,6 +961,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
+				"HEADER_SEARCH_PATHS[arch=*]" = /Users/nayooti/iOSDeveloper/rpgp_temp;
 				IPHONEOS_DEPLOYMENT_TARGET = 11.1;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
@@ -971,7 +979,7 @@
 				CODE_SIGN_ENTITLEMENTS = "deltachat-ios/deltachat-ios.entitlements";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				DEVELOPMENT_TEAM = EEQW58QXHC;
+				DEVELOPMENT_TEAM = 5287229JS5;
 				ENABLE_BITCODE = NO;
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1049,7 +1057,7 @@
 				CODE_SIGN_ENTITLEMENTS = "deltachat-ios/deltachat-ios.entitlements";
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				DEVELOPMENT_TEAM = EEQW58QXHC;
+				DEVELOPMENT_TEAM = 5287229JS5;
 				ENABLE_BITCODE = NO;
 				HEADER_SEARCH_PATHS = (
 					"$(inherited)",

+ 22 - 2
deltachat-ios/AppCoordinator.swift

@@ -14,16 +14,36 @@ protocol Coordinator {
 
 class AppCoordinator: Coordinator {
   let baseController = BaseController()
+  
+  private var appTabBarController: AppTabBarController = AppTabBarController()
 
   func setupViewControllers(window: UIWindow) {
-    window.rootViewController = AppTabBarController()
+    window.rootViewController = appTabBarController
     window.makeKeyAndVisible()
+    
+  }
+  
+  func presentAccountSetup() {
+    let accountSetupController = AccountSetupController()
+    let accountSetupNavigationController = UINavigationController(rootViewController: accountSetupController)
+    appTabBarController.present(accountSetupNavigationController, animated: false, completion: nil)
   }
 
   func setupInnerViewControllers() {
     let chatListController = ChatListController()
     let chatNavigationController = UINavigationController(rootViewController: chatListController)
-
     baseController.present(chatNavigationController, animated: false, completion: nil)
   }
+  
+  /*
+  func setupAccountSetup() {
+    let accountSetupController = AccountSetupController()
+    let accountSetupNavigationController = UINavigationController(rootViewController: accountSetupController)
+    baseController.present(accountSetupNavigationController, animated: false, completion: nil)
+  }
+  */
+    
+    
+    
+    
 }

+ 19 - 13
deltachat-ios/AppDelegate.swift

@@ -62,15 +62,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     guard let window = window else {
       fatalError("window was nil in app delegate")
     }
+    
+    // setup deltachat core context
+      //       - second param remains nil (user data for more than one mailbox)
+    mailboxPointer = dc_context_new(callback_ios, nil, "iOS")
+    guard mailboxPointer != nil else {
+      fatalError("Error: dc_context_new returned nil")
+    }
+    
+    open()
+    let isConfigured = dc_is_configured(mailboxPointer) != 0
+    
     AppDelegate.appCoordinator.setupViewControllers(window: window)
-
+    
+    
     UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalMinimum)
-
+    
     start()
-    open()
-
+    
     registerForPushNotifications()
-
+    if !isConfigured {
+      AppDelegate.appCoordinator.presentAccountSetup()
+    }
     return true
   }
 
@@ -157,14 +170,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
       return
     }
 
-    if mailboxPointer == nil {
-      //       - second param remains nil (user data for more than one mailbox)
-      mailboxPointer = dc_context_new(callback_ios, nil, "iOS")
-      guard mailboxPointer != nil else {
-        fatalError("Error: dc_context_new returned nil")
-      }
-    }
-
+    
     state = .running
 
     DispatchQueue.global(qos: .background).async {

+ 3 - 0
deltachat-ios/TopViews/SettingsController.swift

@@ -217,6 +217,9 @@ internal final class SettingsViewController: QuickTableViewController {
       ]),
     ]
   }
+    
+    
+    
 
   // MARK: - Actions
 

+ 2 - 0
deltachat-ios/Wrapper.swift

@@ -520,6 +520,8 @@ class MRConfig {
     let vStr = value ? "1" : "0"
     setOptStr(key, vStr)
   }
+    
+
 
   private class func getInt(_ key: String) -> Int {
     let vStr = getOptStr(key)