-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# *account onboarding* ## ⚙️ Release Notes **Onboarding**: - Consent - Invitation - Onboarding - SequentialOnborading **Account:** - Login - Register - Credential Manager ## 📚 Documentation tbd ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md). --------- Signed-off-by: Basler182 <[email protected]> Co-authored-by: Paul Schmiedmayer <[email protected]> Co-authored-by: eldcn <[email protected]>
- Loading branch information
1 parent
c03f2c8
commit d9bb114
Showing
118 changed files
with
5,166 additions
and
135 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
app/src/main/kotlin/edu/stanford/spezi/app/MainActivityViewModel.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,38 @@ | ||
package edu.stanford.spezi.app | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import edu.stanford.spezi.app.navigation.AppNavigationEvent | ||
import edu.stanford.spezi.core.logging.speziLogger | ||
import edu.stanford.spezi.core.navigation.NavigationEvent | ||
import edu.stanford.spezi.core.navigation.Navigator | ||
import edu.stanford.spezi.module.account.AccountEvents | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class MainActivityViewModel @Inject constructor( | ||
private val accountEvents: AccountEvents, | ||
private val navigator: Navigator, | ||
) : ViewModel() { | ||
private val logger by speziLogger() | ||
|
||
init { | ||
viewModelScope.launch { | ||
accountEvents.events.collect { event -> | ||
when (event) { | ||
is AccountEvents.Event.SignUpSuccess, AccountEvents.Event.SignInSuccess -> { | ||
navigator.navigateTo(AppNavigationEvent.BluetoothScreen) | ||
} | ||
else -> { | ||
logger.i { "Ignoring registration event: $event" } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun getNavigationEvents(): Flow<NavigationEvent> = navigator.events | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/kotlin/edu/stanford/spezi/app/navigation/AppNavigationEvent.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,7 @@ | ||
package edu.stanford.spezi.app.navigation | ||
|
||
import edu.stanford.spezi.core.navigation.NavigationEvent | ||
|
||
sealed interface AppNavigationEvent : NavigationEvent { | ||
data object BluetoothScreen : AppNavigationEvent | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/kotlin/edu/stanford/spezi/app/navigation/NavTypeUtils.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,22 @@ | ||
package edu.stanford.spezi.app.navigation | ||
|
||
import android.os.Bundle | ||
import androidx.navigation.NavType | ||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
|
||
internal inline fun <reified T : Any> serializableType( | ||
isNullableAllowed: Boolean = false, | ||
json: Json = Json, | ||
) = object : NavType<T>(isNullableAllowed = isNullableAllowed) { | ||
override fun get(bundle: Bundle, key: String) = | ||
bundle.getString(key)?.let<String, T>(json::decodeFromString) | ||
|
||
override fun parseValue(value: String): T = json.decodeFromString(value) | ||
|
||
override fun serializeAsValue(value: T): String = json.encodeToString(value) | ||
|
||
override fun put(bundle: Bundle, key: String, value: T) { | ||
bundle.putString(key, json.encodeToString(value)) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/kotlin/edu/stanford/spezi/app/navigation/Routes.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,33 @@ | ||
package edu.stanford.spezi.app.navigation | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
sealed class Routes { | ||
|
||
@Serializable | ||
data class RegisterScreen( | ||
val registerParams: @Serializable RegisterParams, | ||
) : Routes() | ||
|
||
@Serializable | ||
data class LoginScreen(val isAlreadyRegistered: @Serializable Boolean = true) : Routes() | ||
|
||
@Serializable | ||
data object SequentialOnboardingScreen : Routes() | ||
|
||
@Serializable | ||
data object InvitationCodeScreen : Routes() | ||
|
||
@Serializable | ||
data object OnboardingScreen : Routes() | ||
|
||
@Serializable | ||
data object ConsentScreen : Routes() | ||
|
||
@Serializable | ||
data object BluetoothScreen : Routes() | ||
} | ||
|
||
@Serializable | ||
data class RegisterParams(val isGoogleSignUp: Boolean, val email: String, val password: String) |
Oops, something went wrong.