-
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.
DO NOT MERGE: androidApp: Initial support for tickets
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
- Loading branch information
1 parent
00d094a
commit 6001ad5
Showing
22 changed files
with
767 additions
and
35 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
17 changes: 17 additions & 0 deletions
17
androidApp/src/main/java/app/opass/ccip/android/ui/extensions/NavHostController.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,17 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 OPass | ||
* SPDX-License-Identifier: GPL-3.0-only | ||
*/ | ||
|
||
package app.opass.ccip.android.ui.extensions | ||
|
||
import androidx.navigation.NavGraph.Companion.findStartDestination | ||
import androidx.navigation.NavHostController | ||
import app.opass.ccip.android.ui.navigation.Screen | ||
|
||
fun NavHostController.popBackToEventScreen(eventId: String) { | ||
navigate(Screen.Event(eventId)) { | ||
popUpTo(graph.findStartDestination().id) { inclusive = true } | ||
launchSingleTop = true | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
androidApp/src/main/java/app/opass/ccip/android/ui/extensions/SharedPreferences.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,39 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 OPass | ||
* SPDX-License-Identifier: GPL-3.0-only | ||
*/ | ||
|
||
package app.opass.ccip.android.ui.extensions | ||
|
||
import android.content.SharedPreferences | ||
import androidx.core.content.edit | ||
|
||
private const val CURRENT_EVENT_ID = "CURRENT_EVENT_ID" | ||
private const val TOKEN = "TOKEN" | ||
private const val AUTO_BRIGHTEN = "AUTO_BRIGHTEN" | ||
|
||
val SharedPreferences.autoBrighten: Boolean | ||
get() = this.getBoolean(AUTO_BRIGHTEN, true) | ||
|
||
val SharedPreferences.currentEventId: String? | ||
get() = this.getString(CURRENT_EVENT_ID, null) | ||
|
||
fun SharedPreferences.saveCurrentEventId(eventId: String) { | ||
return this.edit { putString(CURRENT_EVENT_ID, eventId) } | ||
} | ||
|
||
fun SharedPreferences.getToken(eventId: String): String? { | ||
return this.getString("${eventId}_$TOKEN", null) | ||
} | ||
|
||
fun SharedPreferences.saveToken(eventId: String, token: String) { | ||
return this.edit { putString("${eventId}_$TOKEN", token) } | ||
} | ||
|
||
fun SharedPreferences.removeToken(eventId: String) { | ||
return this.edit { remove("${eventId}_$TOKEN") } | ||
} | ||
|
||
fun SharedPreferences.autoBrighten(enabled: Boolean) { | ||
return this.edit { putBoolean(AUTO_BRIGHTEN, enabled) } | ||
} |
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
Oops, something went wrong.