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

Commit 5846389b authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

mail: Load murena accounts

parent c26e42a1
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -685,6 +685,30 @@
        <outgoing uri="smtp+tls+://mail.fairnatics.net:25" username="$email" />
    </provider>

    <!-- eFoundation -->
    <provider id="e.foundation" label="e.email" domain="e.email">
        <incoming uri="imap+ssl+://mail.ecloud.global" username="$email" />
        <outgoing uri="smtp+tls+://mail.ecloud.global" username="$email" />
    </provider>

    <!-- murena.io -->
    <provider id="murena.io" label="murena.io" domain="murena.io">
        <incoming uri="imap+ssl+://mail.ecloud.global" username="$email" />
        <outgoing uri="smtp+tls+://mail.ecloud.global" username="$email" />
    </provider>

    <!-- murena.com -->
    <provider id="murena.com" label="murena.com" domain="murena.com">
        <incoming uri="imap+ssl+://mail.murena.com" username="$email" />
        <outgoing uri="smtp+tls+://mail.murena.com" username="$email" />
    </provider>

    <!-- eeo.one -->
    <provider id="eeo.one" label="eeo.one" domain="eeo.one">
        <incoming uri="imap+ssl+://mail.eeo.one" username="$email" />
        <outgoing uri="smtp+tls+://mail.eeo.one" username="$email" />
    </provider>

    <!-- AOL variants -->
    <provider domain="aol.com">
        <incoming uri="imap+ssl+://imap.aol.com" username="$email" />
+18 −0
Original line number Diff line number Diff line
@@ -29,6 +29,11 @@
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

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

    <application
        android:allowTaskReparenting="false"
        android:resizeableActivity="true"
@@ -36,6 +41,19 @@
        tools:ignore="UnusedAttribute"
        >

        <receiver android:name="com.fsck.k9.AccountReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
            </intent-filter>
        </receiver>

        <provider
            android:name="com.fsck.k9.AppContentProvider"
            android:authorities="foundation.e.mail.provider.AppContentProvider"
            android:enabled="true"
            android:exported="true" />

        <!-- TODO: Remove once minSdkVersion has been changed to 24+ -->
        <meta-data
            android:name="com.lge.support.SPLIT_WINDOW"
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ dependencies {
    api(projects.legacy.ui.account)
    api(projects.legacy.ui.folder)
    api(projects.core.ui.legacy.designsystem)
    implementation(projects.feature.account.accountmanager)

    implementation(projects.legacy.core)
    implementation(projects.mail.common)
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 MURENA SAS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 */
package com.fsck.k9

import android.accounts.AccountManager
import android.accounts.AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.fsck.k9.activity.accountmanager.AccountManagerConstants
import com.fsck.k9.activity.accountmanager.EeloAccountCreator

class AccountReceiver : BroadcastReceiver() {

    override fun onReceive(context: Context, intent: Intent?) {
        val action = intent?.action ?: return
        val accountCreator = EeloAccountCreator(context)

        when (action) {
            AccountManagerConstants.ACCOUNT_CREATION_ACTION, LOGIN_ACCOUNTS_CHANGED_ACTION -> {
                accountCreator.loadAccountsFromAccountManager()
            }
            AccountManagerConstants.ACCOUNT_REMOVAL_ACTION -> {
                intent.extras?.let { extras ->
                    val accountType = extras.getString(AccountManager.KEY_ACCOUNT_TYPE) ?: return
                    val accountName = extras.getString(AccountManager.KEY_ACCOUNT_NAME) ?: return
                    accountCreator.removeAccount(accountType, accountName)
                }
            }
        }
    }
}
+38 −0
Original line number Diff line number Diff line
package com.fsck.k9

import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.net.Uri

class AppContentProvider : ContentProvider() {
    override fun getType(uri: Uri): String? {
        return null
    }

    override fun update(
        uri: Uri, contentValues: ContentValues?, s: String?,
        strings: Array<String>?,
    ): Int {
        return 0
    }

    override fun insert(uri: Uri, contentValues: ContentValues?): Uri? {
        return null
    }

    override fun onCreate(): Boolean {
        return false
    }

    override fun query(
        uri: Uri, strings: Array<String>?, s: String?,
        strings1: Array<String>?, s1: String?,
    ): Cursor? {
        return null
    }

    override fun delete(uri: Uri, s: String?, strings: Array<String>?): Int {
        return 0
    }
}
Loading