Procházet zdrojové kódy

remove redundand word account from DcAccounts methods where possible

cyberta před 4 roky
rodič
revize
c4b133854c

+ 5 - 5
DcCore/DcCore/DC/Wrapper.swift

@@ -18,15 +18,15 @@ public class DcAccounts {
         accountsPointer = nil
     }
 
-    public func migrateAccount(dbLocation: String) -> Int {
+    public func migrate(dbLocation: String) -> Int {
         return Int(dc_accounts_migrate_account(accountsPointer, dbLocation))
     }
 
-    public func addAccount() -> Int {
+    public func add() -> Int {
         return Int(dc_accounts_add_account(accountsPointer))
     }
 
-    public func getAccount(id: Int) -> DcContext {
+    public func get(id: Int) -> DcContext {
         let contextPointer = dc_accounts_get_account(accountsPointer, UInt32(id))
         return DcContext(contextPointer: contextPointer)
     }
@@ -56,11 +56,11 @@ public class DcAccounts {
         dc_accounts_stop_io(accountsPointer)
     }
 
-    public func selectAccount(id: Int) -> Bool {
+    public func select(id: Int) -> Bool {
         return dc_accounts_select_account(accountsPointer, UInt32(id)) == 1
     }
 
-    public func removeAccount(id: Int) -> Bool {
+    public func remove(id: Int) -> Bool {
         return dc_accounts_remove_account(accountsPointer, UInt32(id)) == 1
     }
 

+ 1 - 1
DcCore/DcCore/DC/events.swift

@@ -23,7 +23,7 @@ public class DcEventHandler {
         let id = event.id
         let data1 = event.data1Int
         let data2 = event.data2Int
-        let dcContext = dcAccounts.getAccount(id: event.accountId)
+        let dcContext = dcAccounts.get(id: event.accountId)
 
         if id >= DC_EVENT_ERROR && id <= 499 {
             let s = event.data2String

+ 3 - 3
deltachat-ios/AppDelegate.swift

@@ -59,7 +59,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         dcAccounts.openDatabase()
         migrateToDcAccounts()
         if dcAccounts.getAll().isEmpty {
-            dcAccounts.addAccount()
+            dcAccounts.add()
         }
         dcAccounts.getSelected().logger = DcLogger()
         logger.info("➡️ didFinishLaunchingWithOptions")
@@ -462,7 +462,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         dcContext.openDatabase(dbFile: databaseLocation)
         if dcContext.isConfigured() {
             dcContext.closeDatabase()
-            if dcAccounts.migrateAccount(dbLocation: databaseLocation) == 0 {
+            if dcAccounts.migrate(dbLocation: databaseLocation) == 0 {
                 fatalError("Account could not be migrated")
                 // TODO: show error message in UI
             }
@@ -489,7 +489,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     }
 
     func deleteCurrentAccount() {
-        _ = dcAccounts.removeAccount(id: dcAccounts.getSelected().id)
+        _ = dcAccounts.remove(id: dcAccounts.getSelected().id)
     }
 
     func installEventHandler() {

+ 4 - 4
deltachat-ios/Controller/AccountSetupController.swift

@@ -778,12 +778,12 @@ class AccountSetupController: UITableViewController, ProgressAlertHandler {
             guard let self = self else { return }
             appDelegate.locationManager.disableLocationStreamingInAllChats()
             self.dcAccounts.stopIo()
-            self.dcAccounts.removeAccount(id: self.dcAccounts.getSelected().id)
+            self.dcAccounts.remove(id: self.dcAccounts.getSelected().id)
             if let firstAccountId = self.dcAccounts.getAll().first {
-                _ = self.dcAccounts.selectAccount(id: firstAccountId)
+                _ = self.dcAccounts.select(id: firstAccountId)
             } else {
-                let accountId = self.dcAccounts.addAccount()
-                _ = self.dcAccounts.selectAccount(id: accountId)
+                let accountId = self.dcAccounts.add()
+                _ = self.dcAccounts.select(id: accountId)
             }
             appDelegate.reloadDcContext()
             appDelegate.installEventHandler()

+ 2 - 2
deltachat-ios/Controller/WelcomeViewController.swift

@@ -119,9 +119,9 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
             addProgressAlertListener(dcAccounts: dcAccounts, progressName: dcNotificationConfigureProgress, onSuccess: handleLoginSuccess)
             showProgressAlert(title: String.localized("login_header"), dcContext: dcContext)
             dcAccounts.stopIo()
-            let accountId = dcAccounts.addAccount()
+            let accountId = dcAccounts.add()
             if accountId != 0 {
-                self.dcContext = dcAccounts.getAccount(id: accountId)
+                self.dcContext = dcAccounts.get(id: accountId)
             }
             dcContext.configure()
         } else {