mirror of
https://github.com/wgtunnel/android.git
synced 2026-06-02 00:29:08 +02:00
@@ -136,6 +136,8 @@ android {
|
||||
licensee {
|
||||
allowedLicenses().forEach { allow(it) }
|
||||
allowedLicenseUrls().forEach { allowUrl(it) }
|
||||
// foss, but missing license
|
||||
ignoreDependencies("com.github.T8RIN.QuickieExtended")
|
||||
}
|
||||
|
||||
android.applicationVariants.all {
|
||||
|
||||
@@ -59,10 +59,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.App.Start"
|
||||
tools:targetApi="tiramisu">
|
||||
<activity
|
||||
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||
android:screenOrientation="portrait"
|
||||
tools:replace="screenOrientation" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
||||
+24
-16
@@ -12,9 +12,6 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.journeyapps.barcodescanner.ScanContract
|
||||
import com.journeyapps.barcodescanner.ScanOptions
|
||||
import com.zaneschepke.wireguardautotunnel.R
|
||||
import com.zaneschepke.wireguardautotunnel.ui.LocalNavController
|
||||
import com.zaneschepke.wireguardautotunnel.ui.LocalSharedVm
|
||||
@@ -29,7 +26,10 @@ import com.zaneschepke.wireguardautotunnel.ui.screens.tunnels.components.UrlImpo
|
||||
import com.zaneschepke.wireguardautotunnel.ui.sideeffect.LocalSideEffect
|
||||
import com.zaneschepke.wireguardautotunnel.util.FileUtils
|
||||
import com.zaneschepke.wireguardautotunnel.util.StringValue
|
||||
import io.github.g00fy2.quickie.QRResult
|
||||
import io.github.g00fy2.quickie.ScanQRCode
|
||||
import org.orbitmvi.orbit.compose.collectSideEffect
|
||||
import timber.log.Timber
|
||||
|
||||
@Composable
|
||||
fun TunnelsScreen() {
|
||||
@@ -65,16 +65,26 @@ fun TunnelsScreen() {
|
||||
onData = { data -> viewModel.importFromUri(data) },
|
||||
)
|
||||
|
||||
val scanLauncher =
|
||||
rememberLauncherForActivityResult(
|
||||
contract = ScanContract(),
|
||||
onResult = { result ->
|
||||
result
|
||||
?.contents
|
||||
?.takeIf { it.isNotEmpty() }
|
||||
?.let { contents -> viewModel.importFromQr(contents) }
|
||||
},
|
||||
)
|
||||
val scanQrCodeLauncher =
|
||||
rememberLauncherForActivityResult(ScanQRCode()) { result ->
|
||||
when (result) {
|
||||
is QRResult.QRError -> {
|
||||
Timber.e(result.exception, "QR Code")
|
||||
}
|
||||
QRResult.QRMissingPermission -> {
|
||||
viewModel.showSnackMessage(
|
||||
StringValue.StringResource(R.string.camera_permission_required)
|
||||
)
|
||||
}
|
||||
is QRResult.QRSuccess -> {
|
||||
result.content.rawValue?.let { viewModel.importFromQr(it) }
|
||||
?: viewModel.showSnackMessage(
|
||||
StringValue.StringResource(R.string.config_error)
|
||||
)
|
||||
}
|
||||
QRResult.QRUserCanceled -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
val requestPermissionLauncher =
|
||||
rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted
|
||||
@@ -85,9 +95,7 @@ fun TunnelsScreen() {
|
||||
)
|
||||
return@rememberLauncherForActivityResult
|
||||
}
|
||||
scanLauncher.launch(
|
||||
ScanOptions().setDesiredBarcodeFormats(ScanOptions.QR_CODE).setBeepEnabled(false)
|
||||
)
|
||||
scanQrCodeLauncher.launch(null)
|
||||
}
|
||||
|
||||
if (showDeleteModal) {
|
||||
|
||||
@@ -20,7 +20,7 @@ fun allowedLicenses(): List<String> {
|
||||
}
|
||||
|
||||
fun allowedLicenseUrls(): List<String> {
|
||||
return listOf("https://github.com/journeyapps/zxing-android-embedded/blob/master/COPYING",
|
||||
return listOf("https://jsoup.org/license", "http://opensource.org/licenses/bsd-license.php", "https://github.com/journeyapps/zxing-android-embedded/blob/master/COPYING",
|
||||
"https://github.com/RikkaApps/Shizuku-API/blob/master/LICENSE", "https://github.com/rafi0101/Android-Room-Database-Backup/blob/master/LICENSE",
|
||||
"https://opensource.org/license/mit")
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ androidx-junit = "1.3.0"
|
||||
icmp4a = "1.0.0"
|
||||
ipaddress = "5.5.1"
|
||||
leakcanaryAndroid = "3.0-alpha-8"
|
||||
orbitCompose = "10.0.0"
|
||||
orbitCompose = "11.0.0"
|
||||
roomdatabasebackup = "1.1.0"
|
||||
shizuku = "13.1.5"
|
||||
appcompat = "1.7.1"
|
||||
@@ -37,7 +37,7 @@ composeBom = "2025.11.00"
|
||||
compose = "1.9.4"
|
||||
icons = "1.7.8"
|
||||
workRuntimeKtxVersion = "2.11.0"
|
||||
zxingAndroidEmbedded = "4.3.0"
|
||||
quickieFoss = "1.15.7"
|
||||
coreSplashscreen = "1.2.0"
|
||||
gradlePlugins-grgit = "5.3.3"
|
||||
reorderable = "3.0.0"
|
||||
@@ -94,7 +94,7 @@ wireguard-tunnel = ["tunnel", "amneziawg-android"]
|
||||
shizuku = ["shizuku-api", "shizuku-provider"]
|
||||
|
||||
# UI utilities
|
||||
ui-utilities = ["pin-lock-compose", "qrose", "reorderable", "zxing-android-embedded", "androidx-core-splashscreen"]
|
||||
ui-utilities = ["pin-lock-compose", "qrose", "reorderable", "quickie-foss", "androidx-core-splashscreen"]
|
||||
|
||||
# Misc utilities
|
||||
misc-utilities = ["semver4j", "icmp4a", "slf4j-android", "timber"]
|
||||
@@ -184,7 +184,7 @@ qrose = { module = "io.github.alexzhirkevich:qrose", version.ref = "qrose" }
|
||||
semver4j = { module = "com.vdurmont:semver4j", version.ref = "semver4j" }
|
||||
slf4j-android = { module = "org.slf4j:slf4j-android", version.ref = "slf4jAndroid" }
|
||||
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
|
||||
zxing-android-embedded = { module = "com.journeyapps:zxing-android-embedded", version.ref = "zxingAndroidEmbedded" }
|
||||
quickie-foss = { module = "com.github.T8RIN.QuickieExtended:quickie-foss", version.ref = "quickieFoss" }
|
||||
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
|
||||
reorderable = { module = "sh.calvin.reorderable:reorderable", version.ref = "reorderable" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user