Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display inbox of newly created account after account setup #7491

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
package com.fsck.k9.feature

import android.content.Context
import android.content.Intent
import app.k9mail.feature.launcher.FeatureLauncherExternalContract
import com.fsck.k9.activity.MessageList

class AccountSetupFinishedLauncher(
private val context: Context,
) : FeatureLauncherExternalContract.AccountSetupFinishedLauncher {
override fun launch(accountUuid: String) {
val intent = Intent(context, MessageList::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
putExtra(MessageList.EXTRA_ACCOUNT, accountUuid)
}

context.startActivity(intent)
MessageList.launch(context, accountUuid)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.os.Bundle;
import android.os.Parcelable;

import com.fsck.k9.Account;
import com.fsck.k9.BaseAccount;
import com.fsck.k9.ui.R;
import com.fsck.k9.search.SearchAccount;
Expand All @@ -28,7 +27,7 @@ protected void onAccountSelected(BaseAccount account) {
SearchAccount searchAccount = (SearchAccount) account;
shortcutIntent = MessageList.shortcutIntent(this, searchAccount.getId());
} else {
shortcutIntent = MessageList.shortcutIntentForAccount(this, (Account) account);
shortcutIntent = MessageList.shortcutIntentForAccount(this, account.getUuid());
}

Intent intent = new Intent();
Expand Down
12 changes: 10 additions & 2 deletions app/ui/legacy/src/main/java/com/fsck/k9/activity/MessageList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1483,10 +1483,10 @@ open class MessageList :
}

@JvmStatic
fun shortcutIntentForAccount(context: Context?, account: Account): Intent {
fun shortcutIntentForAccount(context: Context, accountUuid: String): Intent {
return Intent(context, MessageList::class.java).apply {
action = ACTION_SHORTCUT
putExtra(EXTRA_ACCOUNT, account.uuid)
putExtra(EXTRA_ACCOUNT, accountUuid)

addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
Expand Down Expand Up @@ -1552,6 +1552,14 @@ open class MessageList :

actionDisplaySearch(context, search, noThreading = false, newTask = false)
}

/**
* Display the default folder of a given account.
*/
fun launch(context: Context, accountUuid: String) {
val intent = shortcutIntentForAccount(context, accountUuid)
context.startActivity(intent)
}
}
}

Expand Down