-
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 9d20aea
Showing
21 changed files
with
693 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 | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
/* | ||
* 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" | ||
|
||
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") } | ||
} |
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.