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

Commit baabc140 authored by Michael Enoma's avatar Michael Enoma 👽
Browse files

Add permission for account manager

parent 8d351e42
Loading
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.fsck.k9.ui">

    <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
    <uses-permission
        android:name="android.permission.AUTHENTICATE_ACCOUNTS"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />


    <queries>
        <intent>
            <!-- Used to check whether to display the "Add from Contacts" menu item in the compose screen -->
+19 −20
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import android.content.Intent
import android.content.IntentSender
import android.content.res.Configuration
import android.graphics.Color
import android.util.TypedValue
import android.os.Bundle
import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.ACCOUNT_EMAIL_ADDRESS_KEY
import com.fsck.k9.activity.setup.accountmanager.AccountManagerConstants.EELO_ACCOUNT_TYPE
@@ -1635,27 +1636,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()