Skip to content

Commit

Permalink
Display inbox of newly created account after account setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cketti committed Jan 10, 2024
1 parent b9a7d17 commit b34cf91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
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

0 comments on commit b34cf91

Please sign in to comment.