-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ScanOID4VPQR view to navController which launches when scan to sh…
…are button is pressed
- Loading branch information
1 parent
67ca763
commit fe68da5
Showing
4 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
44 changes: 44 additions & 0 deletions
44
example/src/main/java/com/spruceid/mobilesdkexample/wallet/ScanOID4VPQR.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,44 @@ | ||
package com.spruceid.mobilesdkexample.wallet | ||
|
||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.navigation.NavController | ||
import com.spruceid.mobilesdkexample.ScanningComponent | ||
import com.spruceid.mobilesdkexample.ScanningType | ||
import com.google.accompanist.permissions.ExperimentalPermissionsApi | ||
import com.spruceid.mobile.sdk.rs.verifyJwtVp | ||
import kotlinx.coroutines.GlobalScope | ||
import kotlinx.coroutines.launch | ||
|
||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalPermissionsApi::class) | ||
@Composable | ||
fun ScanOID4VPQR( | ||
navController: NavController | ||
) { | ||
var success by remember { | ||
mutableStateOf<Boolean?>(null) | ||
} | ||
|
||
fun onRead(url: String) { | ||
GlobalScope.launch { | ||
// TODO: Add other checks as necessary for validating OID4VP url | ||
// and handle OID4VP flow | ||
|
||
// success = url.startsWith("oid4vp://") | ||
|
||
// if (success == false) { | ||
// error("Not a valid OID4VP url.") | ||
// } | ||
} | ||
} | ||
|
||
ScanningComponent( | ||
navController = navController, | ||
scanningType = ScanningType.QRCODE, | ||
onRead = ::onRead | ||
) | ||
} |
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