Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8071c0bb authored by Mathew Smith's avatar Mathew Smith Committed by Romain Hunault
Browse files

Try auto add google accounts

parent a06f6a7f
Loading
Loading
Loading
Loading
Loading
+18 −20
Original line number Diff line number Diff line
@@ -1640,27 +1640,25 @@ open class MessageList :
                    accountWasAdded = true
                }
            }
//            for (googleAccount in googleAccounts) {
//                val emailId: String = accountManager.getUserData(
//                    googleAccount,
//                    ACCOUNT_EMAIL_ADDRESS_KEY
//                )
//                var accountIsSignedIn = false
//                for (account in accounts) {
//                    if (emailId == account.email) {
//                        if (account.name == null) { // we need to fix an old bug
//                            account.name = emailId
//                            account.save(Preferences.getPreferences(this))
//                        }
//                        accountIsSignedIn = true
//                        break
//                    }
//                }
//                if (!accountIsSignedIn) {
            for (googleAccount in googleAccounts) {
                val emailId: String = accountManager.getUserData(googleAccount, ACCOUNT_EMAIL_ADDRESS_KEY)
                var accountIsSignedIn = false
                for (account in accounts) {
                    if (emailId == account.email) {
                        if (account.name == null) { // we need to fix an old bug
                            account.name = emailId
                            Preferences.getPreferences(this).saveAccount(account)
                        }
                        accountIsSignedIn = true
                        break
                    }
                }
                if (!accountIsSignedIn) {
//                    GoogleAccountCreator.createAccount(this, emailId)
//                    accountWasAdded = true
//                }
//            }
                    EeloAccountCreator.createAccount(this, emailId, "")
                    accountWasAdded = true
                }
            }
            accountWasAdded
        } catch (e: SecurityException) {
            e.printStackTrace()