-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: android qr scan crash * fix: nav bar padding * fix: navigate back bug
- Loading branch information
1 parent
00adb72
commit 49a0a9c
Showing
16 changed files
with
126 additions
and
67 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
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
36 changes: 36 additions & 0 deletions
36
nym-vpn-android/app/src/main/java/net/nymtech/nymvpn/ui/screens/scanner/ScannerScreen.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,36 @@ | ||
package net.nymtech.nymvpn.ui.screens.scanner | ||
|
||
import android.app.Activity | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.DisposableEffect | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.viewinterop.AndroidView | ||
import com.google.accompanist.permissions.ExperimentalPermissionsApi | ||
import com.journeyapps.barcodescanner.CompoundBarcodeView | ||
import net.nymtech.nymvpn.ui.AppViewModel | ||
|
||
@OptIn(ExperimentalPermissionsApi::class) | ||
@Composable | ||
fun ScannerScreen(appViewModel: AppViewModel) { | ||
val context = LocalContext.current | ||
|
||
val barcodeView = remember { | ||
CompoundBarcodeView(context).apply { | ||
this.initializeFromIntent((context as Activity).intent) | ||
this.setStatusText("") | ||
this.decodeSingle { result -> | ||
result.text?.let { barCodeOrQr -> | ||
appViewModel.onCredentialImport(barCodeOrQr) | ||
} | ||
} | ||
} | ||
} | ||
AndroidView(factory = { barcodeView }) | ||
DisposableEffect(Unit) { | ||
barcodeView.resume() | ||
onDispose { | ||
barcodeView.pause() | ||
} | ||
} | ||
} |
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.