Skip to content

Commit

Permalink
GrindrPlus: Incognito WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
R0rt1z2 committed Nov 19, 2024
1 parent aa5fa8a commit 46dfb92
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/src/main/java/com/grindrplus/core/http/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@ class Client(interceptor: Interceptor) {
}
}
}

fun updateSettings(settings: String) {
GrindrPlus.executeAsync {
val response = sendRequest(
"https://grindr.mobi/v3/me/settings",
"PATCH",
mapOf("Content-Type" to "application/json"),
settings.toRequestBody()
)

if (response.isSuccessful) {
showToast(Toast.LENGTH_LONG, "Settings updated successfully")
} else {
showToast(
Toast.LENGTH_LONG,
"Failed to update settings: ${response.body?.string()}"
)
}
}
}

fun enableIncognito() {
updateSettings("""{"settings":{"incognito":true}}""")
}
}

fun RequestBody.Companion.createEmpty(): RequestBody {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ class SettingsFragment : Fragment() {
container?.addView(otherSettingsTitle)
container?.addView(createDynamicSettingView(context, "Online indicator duration (mins)", "Control when your green dot disappears after inactivity", "online_indicator"))
container?.addView(createDynamicSettingView(context, "Favorites grid size", "Customize grid size of the layout for the favorites tab", "favorites_grid_columns"))

container?.addView(createToggleableSettingView(context, "Force Incognito Mode", "Always appear as offline to other users", "force_incognito"))
}

private fun showResetConfirmationDialog() {
Expand Down

0 comments on commit 46dfb92

Please sign in to comment.