diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-02 20:55:07 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-02 20:55:07 +0100 |
| commit | 3e1f3a6f5ef5fba661f702e7457ee9c833c516f3 (patch) | |
| tree | 7ea8e32559fd8c0bac0a2eca71f5d0aa1ab109a6 /app/src/main/java | |
| parent | 2b9a095cbf4720f056532bded1be9f2584f8447a (diff) | |
| download | HardenedPass-3e1f3a6f5ef5fba661f702e7457ee9c833c516f3.tar.gz HardenedPass-3e1f3a6f5ef5fba661f702e7457ee9c833c516f3.zip | |
fix(app): make LegacyScreen a top-level composable
Slack's ComposeUnstableReceiver lint rejects an instance composable on
the activity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'app/src/main/java')
| -rw-r--r-- | app/src/main/java/app/passwordstore/ui/main/MainActivity.kt | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt b/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt index 018deae3..48546e00 100644 --- a/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt @@ -5,6 +5,7 @@ package app.passwordstore.ui.main +import android.app.Activity import android.content.Intent import android.os.Bundle import androidx.activity.compose.setContent @@ -46,32 +47,34 @@ class MainActivity : FragmentActivity() { NavHost(rememberNavController(), startDestination = start) { composable<ListRoute> { LegacyScreen( - Intent(this@MainActivity, PasswordStore::class.java).setAction(Intent.ACTION_VIEW) + this@MainActivity, + Intent(this@MainActivity, PasswordStore::class.java).setAction(Intent.ACTION_VIEW), ) } composable<EntryRoute> { entry -> val route = entry.toRoute<EntryRoute>() LegacyScreen( + this@MainActivity, Intent(this@MainActivity, DecryptActivity::class.java) .putExtra(BasePGPActivity.EXTRA_FILE_PATH, route.filePath) .putExtra( BasePGPActivity.EXTRA_REPO_PATH, PasswordRepository.getRepositoryDirectory().absolutePath, - ) + ), ) } } } } } +} - // ponytail: trampoline to a screen not yet ported; each port replaces one call with the - // real composable, and the last port deletes this function. - @Composable - private fun LegacyScreen(intent: Intent) { - LaunchedEffect(Unit) { - startActivity(intent) - finish() - } +// ponytail: trampoline to a screen not yet ported; each port replaces one call with the +// real composable, and the last port deletes this function. +@Composable +private fun LegacyScreen(activity: Activity, intent: Intent) { + LaunchedEffect(Unit) { + activity.startActivity(intent) + activity.finish() } } |
