Nav3 migration add subscription activity#642
Conversation
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
|
This PR/issue depends on: |
# Conflicts: # app/src/main/AndroidManifest.xml # app/src/main/java/at/bitfire/icsdroid/MainActivity.kt # app/src/main/java/at/bitfire/icsdroid/ui/nav/Destination.kt # app/src/main/java/at/bitfire/icsdroid/ui/nav/MainApp.kt # app/src/main/java/at/bitfire/icsdroid/ui/screen/SubscriptionsScreen.kt # app/src/main/java/at/bitfire/icsdroid/ui/views/AddSubscriptionActivity.kt
There was a problem hiding this comment.
Pull Request Overview
Migrates the AddSubscriptionActivity to use Nav3 by removing the standalone Activity and integrating its functionality into the Compose navigation system.
- Replaced standalone Activity with Compose screen navigation
- Moved intent handling and file picker logic from Activity to Composable functions
- Updated navigation flow to use Nav3 backstack management
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| AddSubscriptionActivity.kt | Removed entire Activity class, eliminating 133 lines of Activity-based navigation |
| SubscriptionsScreen.kt | Modified to accept onAddRequested callback instead of launching Activity directly |
| AddSubscriptionScreen.kt | Added new wrapper Composable with intent handling and file picker logic |
| MainApp.kt | Integrated AddSubscription destination with intent parsing and navigation setup |
| Destination.kt | Added AddSubscription destination with title and color parameters |
| AccountAuthenticatorService.kt | Updated to launch MainActivity instead of the removed AddSubscriptionActivity |
| AndroidManifest.xml | Merged intent filters into MainActivity and removed AddSubscriptionActivity declaration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
There was a problem hiding this comment.
I don't remember exactly what I did, but when I played around a bit with going forward and backward around the AddSubscriptionScreen, then closing the app and opening via calendar permission request notification and I got this crash:
Details
11:42:21.981 E FATAL EXCEPTION: main
Process: at.bitfire.icsdroid, PID: 14145
java.lang.IllegalArgumentException: NavDisplay backstack cannot be empty
at androidx.navigation3.ui.NavDisplayKt.NavDisplay(NavDisplay.kt:170)
at androidx.navigation3.ui.NavDisplayKt.NavDisplay$lambda$11(Unknown Source:36)
at androidx.navigation3.ui.NavDisplayKt.$r8$lambda$SLsTTf3eDnrSQmCrJvKtHwJ4fig(Unknown Source:0)
at androidx.navigation3.ui.NavDisplayKt$$ExternalSyntheticLambda3.invoke(D8$$SyntheticClass:0)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:196)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2893)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:3229)
at androidx.compose.runtime.ComposerImpl.doCompose-aFTiNEg(Composer.kt:3853)
at androidx.compose.runtime.ComposerImpl.recompose-aFTiNEg$runtime(Composer.kt:3777)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:1049)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1336)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:155)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.invokeSuspend$lambda$22(Recomposer.kt:625)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2.$r8$lambda$OqADLCDYmRw1RgNUvn1CR0kX32M(Unknown Source:0)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:39)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:108)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964)
at android.view.Choreographer.doCallbacks(Choreographer.java:790)
at android.view.Choreographer.doFrame(Choreographer.java:721)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:951)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@3f2828a, androidx.compose.ui.platform.MotionDurationScaleImpl@2c3d0fb, StandaloneCoroutine{Cancelling}@42ea518, AndroidUiDispatcher@6b9cb71]
|
Mmmmh... In theory it's possible according to the default onBack: (Int) -> Unit = {
if (backStack is MutableList<T>) {
repeat(it) { backStack.removeAt(backStack.lastIndex) }
}
},Technically, if for some reason it's called when the backstack has length 1, it gets cleared. Maybe we can extend with our own implementation avoiding this scenario |
sunkup
left a comment
There was a problem hiding this comment.
Seems to work now. There was still some strangeness with going back to the same screen twice, but I can't reproduce it anymore, so I will open an issue when it happens again and I know why ...
Purpose
Migrate
AddSubscriptionActivityto Nav3.Depends on #640Short description
Checklist