This repository was archived by the owner on Aug 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Delete User's Profile #98
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d1e5971
Create API module
hamorillo ff250a7
Add API module with delete profile method
hamorillo 52bc9cb
Profile deletion confirmation dialog
hamorillo 76714db
Remove extra trailing empty space
etoledom 2280a58
Adding generic error alert to delete account flow
etoledom d6106f7
Update snapshot
etoledom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| /build |
This file contains hidden or 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,28 @@ | ||
| plugins { | ||
| id("java-library") | ||
| alias(libs.plugins.kotlin.jvm) | ||
| alias(libs.plugins.ksp) | ||
| } | ||
| java { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
|
|
||
| dependencies { | ||
| implementation(project(":foundations")) | ||
|
|
||
| implementation(project.dependencies.platform(libs.koin.bom)) | ||
| implementation(libs.koin.core) | ||
| implementation(libs.kotlinx.coroutines) | ||
| implementation(libs.retrofit) | ||
| implementation(libs.retrofit.serialization) | ||
| ksp(libs.moshi.kotlin.codegen) | ||
|
|
||
| // Test dependencies | ||
| testImplementation(libs.junit) | ||
| } | ||
| } | ||
| kotlin { | ||
| compilerOptions { | ||
| jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 | ||
| } | ||
| } |
Empty file.
This file contains hidden or 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,21 @@ | ||
| # Add project specific ProGuard rules here. | ||
| # You can control the set of applied configuration files using the | ||
| # proguardFiles setting in build.gradle. | ||
| # | ||
| # For more details, see | ||
| # http://developer.android.com/guide/developing/tools/proguard.html | ||
|
|
||
| # If your project uses WebView with JS, uncomment the following | ||
| # and specify the fully qualified class name to the JavaScript interface | ||
| # class: | ||
| #-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| # public *; | ||
| #} | ||
|
|
||
| # Uncomment this to preserve the line number information for | ||
| # debugging stack traces. | ||
| #-keepattributes SourceFile,LineNumberTable | ||
|
|
||
| # If you keep the line number information, uncomment this to | ||
| # hide the original source file name. | ||
| #-renamesourcefileattribute SourceFile |
This file contains hidden or 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,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| </manifest> |
This file contains hidden or 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,27 @@ | ||
| package com.gravatar.app.di | ||
|
|
||
| import com.gravatar.app.restapi.GravatarApi | ||
| import com.gravatar.app.services.GravatarService | ||
| import com.gravatar.app.services.GravatarServiceImpl | ||
| import com.squareup.moshi.Moshi | ||
| import org.koin.dsl.module | ||
| import retrofit2.Retrofit | ||
| import retrofit2.converter.moshi.MoshiConverterFactory | ||
|
|
||
| val apiModule = module { | ||
| single<Retrofit> { | ||
| Retrofit.Builder() | ||
| .baseUrl("https://api.gravatar.com/v3/") | ||
| .addConverterFactory( | ||
| MoshiConverterFactory.create() | ||
| ) | ||
| .build() | ||
| } | ||
| single<GravatarApi> { get<Retrofit>().create(GravatarApi::class.java) } | ||
| single<GravatarService> { | ||
| GravatarServiceImpl( | ||
| gravatarApi = get(), | ||
| dispatchers = get() | ||
| ) | ||
| } | ||
| } | ||
9 changes: 9 additions & 0 deletions
9
api/src/main/kotlin/com/gravatar/app/model/DeleteAccountStatus.kt
This file contains hidden or 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,9 @@ | ||
| package com.gravatar.app.model | ||
|
|
||
| import com.squareup.moshi.Json | ||
| import com.squareup.moshi.JsonClass | ||
|
|
||
| @JsonClass(generateAdapter = true) | ||
| data class DeleteAccountStatus( | ||
| @Json(name = "status") val status: String = "disabled", | ||
| ) |
24 changes: 24 additions & 0 deletions
24
api/src/main/kotlin/com/gravatar/app/restapi/GravatarApi.kt
This file contains hidden or 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,24 @@ | ||
| package com.gravatar.app.restapi | ||
|
|
||
| import com.gravatar.app.model.DeleteAccountStatus | ||
| import retrofit2.Response | ||
| import retrofit2.http.Body | ||
| import retrofit2.http.Header | ||
| import retrofit2.http.POST | ||
|
|
||
| /** | ||
| * Interface defining the Gravatar API endpoints. | ||
| */ | ||
| internal interface GravatarApi { | ||
| /** | ||
| * Disables the user's Gravatar account. | ||
| * Makes a POST request to https://api.gravatar.com/v3/me/status | ||
| * | ||
| * @return [Result] indicating success or failure of the operation | ||
| */ | ||
| @POST("me/status") | ||
| suspend fun disableAccount( | ||
| @Header("Authorization") authorization: String, | ||
| @Body body: DeleteAccountStatus = DeleteAccountStatus() | ||
| ): Response<Unit> | ||
| } |
29 changes: 29 additions & 0 deletions
29
api/src/main/kotlin/com/gravatar/app/services/GravatarService.kt
This file contains hidden or 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,29 @@ | ||||||||||||||
| package com.gravatar.app.services | ||||||||||||||
|
|
||||||||||||||
| import com.gravatar.app.foundations.DispatcherProvider | ||||||||||||||
| import com.gravatar.app.restapi.GravatarApi | ||||||||||||||
| import kotlinx.coroutines.withContext | ||||||||||||||
|
|
||||||||||||||
| internal class GravatarServiceImpl( | ||||||||||||||
| private val gravatarApi: GravatarApi, | ||||||||||||||
| private val dispatchers: DispatcherProvider | ||||||||||||||
| ) : GravatarService { | ||||||||||||||
|
|
||||||||||||||
| override suspend fun deleteProfile(authorization: String): Result<Unit> = withContext(dispatchers.io) { | ||||||||||||||
| return@withContext try { | ||||||||||||||
| val response = gravatarApi.disableAccount("Bearer $authorization") | ||||||||||||||
|
|
||||||||||||||
| if (response.isSuccessful) { | ||||||||||||||
| Result.success(Unit) | ||||||||||||||
| } else { | ||||||||||||||
| Result.failure(Exception("Failed to disable account.")) | ||||||||||||||
|
||||||||||||||
| Result.failure(Exception("Failed to disable account.")) | |
| Result.failure( | |
| Exception( | |
| "Failed to disable account: HTTP ${response.code()} - ${response.message()}${response.errorBody()?.let { " - ${it.string()}" } ?: ""}" | |
| ) | |
| ) |
This file contains hidden or 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
Binary file modified
BIN
+16.4 KB
(130%)
....home.components.topbar.components.AboutAppDialogTest.aboutAppDialogVisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+68.2 KB
...s.topbar.components.AboutAppDialogTest.deleteConfirmationBottomSheetVisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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
7 changes: 7 additions & 0 deletions
7
...ar/app/homeUi/presentation/home/components/topbar/components/about/AboutAppDialogEvent.kt
This file contains hidden or 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 com.gravatar.app.homeUi.presentation.home.components.topbar.components.about | ||
|
|
||
| sealed class AboutAppDialogEvent { | ||
| data object OnShowDeleteConfirmation : AboutAppDialogEvent() | ||
| data object OnHideDeleteConfirmation : AboutAppDialogEvent() | ||
| data object OnConfirmDeleteAccount : AboutAppDialogEvent() | ||
| } |
7 changes: 7 additions & 0 deletions
7
...ar/app/homeUi/presentation/home/components/topbar/components/about/AboutAppDialogState.kt
This file contains hidden or 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 com.gravatar.app.homeUi.presentation.home.components.topbar.components.about | ||
|
|
||
| internal data class AboutAppDialogState( | ||
| val isDeleteConfirmationVisible: Boolean = false, | ||
| val isLoading: Boolean = false, | ||
| val showDeleteAccountErrorAlert: Boolean = false, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Retrofit instance is created without proper HTTP client configuration. Consider using the existing OkHttpClient from the userComponent module to maintain consistent networking configuration including interceptors and timeouts.