-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add permissions screen to onboarding flow
- Loading branch information
Showing
9 changed files
with
109 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...re/onboarding/main/src/main/kotlin/app/k9mail/feature/onboarding/main/OnboardingModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package app.k9mail.feature.onboarding.main | ||
|
||
import app.k9mail.feature.onboarding.permissions.featureOnboardingPermissionsModule | ||
import org.koin.core.module.Module | ||
import org.koin.dsl.module | ||
|
||
val featureOnboardingModule: Module = module { | ||
includes( | ||
featureOnboardingPermissionsModule, | ||
) | ||
} |
63 changes: 63 additions & 0 deletions
63
...g/main/src/main/kotlin/app/k9mail/feature/onboarding/main/navigation/OnboardingNavHost.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package app.k9mail.feature.onboarding.main.navigation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.navigation.NavController | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.rememberNavController | ||
import app.k9mail.feature.account.setup.navigation.nestedAccountSetupRoute | ||
import app.k9mail.feature.onboarding.permissions.ui.PermissionsScreen | ||
import app.k9mail.feature.onboarding.welcome.ui.OnboardingScreen | ||
|
||
private const val NESTED_NAVIGATION_ROUTE_WELCOME = "welcome" | ||
private const val NESTED_NAVIGATION_ROUTE_ACCOUNT_SETUP = "account_setup" | ||
private const val NESTED_NAVIGATION_ROUTE_PERMISSIONS = "permissions" | ||
|
||
private fun NavController.navigateToAccountSetup() { | ||
navigate(NESTED_NAVIGATION_ROUTE_ACCOUNT_SETUP) | ||
} | ||
|
||
private fun NavController.navigateToPermissions() { | ||
navigate(NESTED_NAVIGATION_ROUTE_PERMISSIONS) | ||
} | ||
|
||
@Composable | ||
fun OnboardingNavHost( | ||
onImport: () -> Unit, | ||
onBack: () -> Unit, | ||
onFinish: (String) -> Unit, | ||
) { | ||
val navController = rememberNavController() | ||
var accountUuid by rememberSaveable { mutableStateOf<String?>(null) } | ||
|
||
NavHost( | ||
navController = navController, | ||
startDestination = NESTED_NAVIGATION_ROUTE_WELCOME, | ||
) { | ||
composable(route = NESTED_NAVIGATION_ROUTE_WELCOME) { | ||
OnboardingScreen( | ||
onStartClick = { navController.navigateToAccountSetup() }, | ||
onImportClick = onImport, | ||
) | ||
} | ||
|
||
nestedAccountSetupRoute( | ||
route = NESTED_NAVIGATION_ROUTE_ACCOUNT_SETUP, | ||
onBack = onBack, | ||
onFinish = { createdAccountUuid -> | ||
accountUuid = createdAccountUuid | ||
navController.navigateToPermissions() | ||
}, | ||
) | ||
|
||
composable(route = NESTED_NAVIGATION_ROUTE_PERMISSIONS) { | ||
PermissionsScreen( | ||
onNext = { onFinish(requireNotNull(accountUuid)) }, | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters