Skip to content

Commit

Permalink
Merge pull request #73 from Tiqr/feature/edured-78_delete_login_details
Browse files Browse the repository at this point in the history
Feature/edured 78 delete login details
  • Loading branch information
IuliaSTANA authored Apr 14, 2023
2 parents 7b6556c + 3b142e3 commit 2a7b538
Show file tree
Hide file tree
Showing 21 changed files with 529 additions and 220 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Build nl.eduid Release APK
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'gradle'

Expand Down
27 changes: 15 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ plugins {
id("com.google.dagger.hilt.android")
}

if (JavaVersion.current() < JavaVersion.VERSION_11) {
throw GradleException("Please use JDK ${JavaVersion.VERSION_11} or above")
if (JavaVersion.current() < JavaVersion.VERSION_17) {
throw GradleException("Please use JDK ${JavaVersion.VERSION_17} or above")
}

fun String.runCommand(workingDir: File = file("./")): String {
Expand Down Expand Up @@ -85,6 +85,8 @@ android {
}

getByName("debug") {
isMinifyEnabled = true
isShrinkResources = true
applicationIdSuffix = ".testing"
versionNameSuffix = " DEBUG"
buildConfigField("String", "ENV_HOST", "\"https://login.test2.eduid.nl\"")
Expand All @@ -98,11 +100,12 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()

kotlin {
jvmToolchain(17)
}

kapt {
Expand All @@ -117,7 +120,7 @@ android {
abortOnError = false
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.0"
kotlinCompilerExtensionVersion = "1.4.5"
}
packagingOptions {
resources {
Expand All @@ -129,11 +132,6 @@ android {

dependencies {

repositories {
google()
mavenCentral()
}
implementation(platform("androidx.compose:compose-bom:2022.12.00"))
implementation(project(":data"))
implementation(project(":core"))

Expand All @@ -148,6 +146,9 @@ dependencies {
implementation(libs.androidx.camera.lifecycle)
implementation(libs.androidx.camera.view)
implementation(libs.androidx.biometric)
val composeBom = platform(libs.androidx.compose.bom)
implementation(composeBom)

implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.ui:ui-tooling-preview")
Expand All @@ -162,6 +163,8 @@ dependencies {
implementation(libs.androidx.core)
implementation(libs.androidx.concurrent)
implementation(libs.androidx.datastore)
implementation(libs.androidx.lifecycle.runtimeCompose)
implementation(libs.androidx.lifecycle.viewModelCompose)
implementation(libs.androidx.lifecycle.common)
implementation(libs.androidx.lifecycle.livedata)
implementation(libs.androidx.localBroadcastManager)
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/kotlin/nl/eduid/di/api/EduIdApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ interface EduIdApi {
@GET("/mobile/tiqr/sp/start-enrollment")
suspend fun startEnrollment(): Response<EnrollResponse>

@GET("/mobile/api/sp/tokens")
suspend fun getTokens(): Response<List<TokenResponse>>

@GET("/mobile/api/sp/institution/names")
suspend fun getInstitutionName(@Query("schac_home") schac_home: String): Response<InstitutionNameResponse>

Expand All @@ -38,4 +41,7 @@ interface EduIdApi {

@PUT("/mobile/api/sp/institution")
suspend fun removeConnection(@Body account: LinkedAccount): Response<UserDetails>

@PUT("/mobile/api/sp/service")
suspend fun removeService(@Body serviceId: DeleteServiceRequest): Response<UserDetails>
}
48 changes: 41 additions & 7 deletions app/src/main/kotlin/nl/eduid/di/model/EduIdModels.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ const val EMAIL_DOMAIN_FORBIDDEN = 412
data class EnrollResponse(
val url: String,
val enrollmentKey: String,
@Json(name = "qrcode")
val qrCode: String,
@Json(name = "qrcode") val qrCode: String,
) : Parcelable

@Parcelize
Expand All @@ -66,7 +65,7 @@ data class UserDetails(
val eduIdPerServiceProvider: Map<String, EduIdPerServiceProvider>,

val loginOptions: List<String>,
val registration: Registration?
val registration: Registration?,
) : Parcelable {

fun isRecoveryRequired(): Boolean = registration?.status != "FINALIZED"
Expand All @@ -80,7 +79,7 @@ data class EduIdPerServiceProvider(
val serviceName: String,
val serviceNameNl: String,
val serviceLogoUrl: String,
val createdAt: Long
val createdAt: Long,
) : Parcelable

@Parcelize
Expand All @@ -94,7 +93,7 @@ data class LinkedAccount(
val familyName: String,
val eduPersonAffiliations: List<String>,
val createdAt: Long,
val expiresAt: Long
val expiresAt: Long,
) : Parcelable

@Parcelize
Expand All @@ -113,10 +112,45 @@ data class InstitutionNameResponse(
val displayNameEn: String,
val displayNameNl: String,

) : Parcelable
) : Parcelable

@Parcelize
@JsonClass(generateAdapter = true)
data class EmailChangeRequest(
val email: String,
) : Parcelable
) : Parcelable

@Parcelize
@JsonClass(generateAdapter = true)
data class DeleteServiceRequest(
val serviceProviderEntityId: String,
val tokens: List<Token>,
) : Parcelable

@Parcelize
@JsonClass(generateAdapter = true)
data class Token(
val id: String,
val type: String,
) : Parcelable

@Parcelize
@JsonClass(generateAdapter = true)
data class TokenResponse(
val id: String,
val clientName: String,
val clientId: String,
val type: String,
val scopes: List<Scope>?,
) : Parcelable

@Parcelize
@JsonClass(generateAdapter = true)
data class Scope(val name: String, val descriptions: Description?) : Parcelable {
fun hasValidDescription(): Boolean =
descriptions != null && (descriptions.en != null || descriptions.nl != null)
}

@Parcelize
@JsonClass(generateAdapter = true)
data class Description(val en: String?, val nl: String?) : Parcelable
63 changes: 33 additions & 30 deletions app/src/main/kotlin/nl/eduid/graphs/MainGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,44 @@ fun MainGraph(
},
) { navController.popBackStack() }
}
//region Delete Account
composable(
route = ManageAccountRoute.routeWithArgs, arguments = ManageAccountRoute.arguments
) { entry ->
val viewModel = hiltViewModel<ManageAccountViewModel>(entry)
ManageAccountScreen(
viewModel = viewModel,
goBack = { navController.popBackStack() },
onDeleteAccountPressed = { navController.navigate(Graph.DELETE_ACCOUNT_FIRST_CONFIRM) },
dateString = ManageAccountRoute.decodeDateFromEntry(entry),
)
}

composable(Graph.DELETE_ACCOUNT_FIRST_CONFIRM) {
DeleteAccountFirstConfirmScreen(
goBack = { navController.popBackStack() },
onDeleteAccountPressed = { navController.navigate(Graph.DELETE_ACCOUNT_SECOND_CONFIRM) },
)
}

composable(Graph.DELETE_ACCOUNT_SECOND_CONFIRM) {
val viewModel = hiltViewModel<DeleteAccountSecondConfirmViewModel>(it)
DeleteAccountSecondConfirmScreen(
viewModel = viewModel,
goBack = { navController.popBackStack() },
)
}//endregion
//endregion
//region Data and activity
composable(Graph.DATA_AND_ACTIVITY) {
val viewModel = hiltViewModel<DataAndActivityViewModel>(it)
DataAndActivityScreen(
viewModel = viewModel,
goBack = { navController.popBackStack() },
onDeleteLoginClicked = {},
)
) { navController.popBackStack() }
}

//endregion
//region Security
composable(Graph.SECURITY) {
val viewModel = hiltViewModel<SecurityViewModel>(it)
SecurityScreen(
Expand Down Expand Up @@ -421,33 +450,7 @@ fun MainGraph(
onSaveNewEmailRequested = { email -> navController.goToEmailSent(email) },
)
}

composable(
route = ManageAccountRoute.routeWithArgs, arguments = ManageAccountRoute.arguments
) { entry ->
val viewModel = hiltViewModel<ManageAccountViewModel>(entry)
ManageAccountScreen(
viewModel = viewModel,
goBack = { navController.popBackStack() },
onDeleteAccountPressed = { navController.navigate(Graph.DELETE_ACCOUNT_FIRST_CONFIRM) },
dateString = ManageAccountRoute.decodeDateFromEntry(entry),
)
}

composable(Graph.DELETE_ACCOUNT_FIRST_CONFIRM) {
DeleteAccountFirstConfirmScreen(
goBack = { navController.popBackStack() },
onDeleteAccountPressed = { navController.navigate(Graph.DELETE_ACCOUNT_SECOND_CONFIRM) },
)
}

composable(Graph.DELETE_ACCOUNT_SECOND_CONFIRM) {
val viewModel = hiltViewModel<DeleteAccountSecondConfirmViewModel>(it)
DeleteAccountSecondConfirmScreen(
viewModel = viewModel,
goBack = { navController.popBackStack() },
)
}
//endregion
}

private fun NavController.goToEmailSent(email: String) = navigate(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package nl.eduid.screens.dataactivity

data class DataAndActivityData(
val providerList: List<Provider>? = null,
) {
companion object {
data class Provider(
val providerName: String,
val createdStamp: Long,
val firstLoginStamp: Long,
val uniqueId: String,
val providerLogoUrl: String,
)
}
}
data class ServiceProvider(
val providerName: String,
val createdStamp: Long,
val firstLoginStamp: Long,
val uniqueId: String,
val serviceProviderEntityId: String,
val providerLogoUrl: String,
)
Loading

0 comments on commit 2a7b538

Please sign in to comment.