Refactor to Compose based UI
This commit is contained in:
10
app/src/play/AndroidManifest.xml
Normal file
10
app/src/play/AndroidManifest.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- Remove QUERY_ALL_PACKAGES permission for Play Store build -->
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:node="remove" />
|
||||
|
||||
</manifest>
|
||||
@@ -15,10 +15,9 @@ class MLKitQRCodeAnalyzer(
|
||||
private val onSuccess: ((String) -> Unit),
|
||||
private val onFailure: ((Exception) -> Unit),
|
||||
) : ImageAnalysis.Analyzer {
|
||||
|
||||
private val barcodeScanner =
|
||||
BarcodeScanning.getClient(
|
||||
BarcodeScannerOptions.Builder().setBarcodeFormats(Barcode.FORMAT_QR_CODE).build()
|
||||
BarcodeScannerOptions.Builder().setBarcodeFormats(Barcode.FORMAT_QR_CODE).build(),
|
||||
)
|
||||
|
||||
@Volatile
|
||||
@@ -60,6 +59,5 @@ class MLKitQRCodeAnalyzer(
|
||||
|
||||
@ExperimentalGetImage
|
||||
@Suppress("UnsafeCallOnNullableType")
|
||||
private fun ImageProxy.toInputImage() =
|
||||
InputImage.fromMediaImage(image!!, imageInfo.rotationDegrees)
|
||||
}
|
||||
private fun ImageProxy.toInputImage() = InputImage.fromMediaImage(image!!, imageInfo.rotationDegrees)
|
||||
}
|
||||
|
||||
@@ -14,13 +14,16 @@ import com.google.mlkit.common.MlKitException
|
||||
import io.nekohasekai.sfa.R
|
||||
|
||||
object Vendor : VendorInterface {
|
||||
|
||||
private const val TAG = "Vendor"
|
||||
|
||||
override fun checkUpdateAvailable(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun checkUpdate(activity: Activity, byUser: Boolean) {
|
||||
override fun checkUpdate(
|
||||
activity: Activity,
|
||||
byUser: Boolean,
|
||||
) {
|
||||
val appUpdateManager = AppUpdateManagerFactory.create(activity)
|
||||
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
|
||||
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
|
||||
@@ -45,13 +48,13 @@ object Vendor : VendorInterface {
|
||||
appUpdateManager.startUpdateFlow(
|
||||
appUpdateInfo,
|
||||
activity,
|
||||
AppUpdateOptions.newBuilder(AppUpdateType.FLEXIBLE).build()
|
||||
AppUpdateOptions.newBuilder(AppUpdateType.FLEXIBLE).build(),
|
||||
)
|
||||
} else if (appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) {
|
||||
appUpdateManager.startUpdateFlow(
|
||||
appUpdateInfo,
|
||||
activity,
|
||||
AppUpdateOptions.newBuilder(AppUpdateType.IMMEDIATE).build()
|
||||
AppUpdateOptions.newBuilder(AppUpdateType.IMMEDIATE).build(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -78,7 +81,7 @@ object Vendor : VendorInterface {
|
||||
|
||||
override fun createQRCodeAnalyzer(
|
||||
onSuccess: (String) -> Unit,
|
||||
onFailure: (Exception) -> Unit
|
||||
onFailure: (Exception) -> Unit,
|
||||
): ImageAnalysis.Analyzer? {
|
||||
try {
|
||||
return MLKitQRCodeAnalyzer(onSuccess, onFailure)
|
||||
@@ -90,4 +93,8 @@ object Vendor : VendorInterface {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
override fun isPerAppProxyAvailable(): Boolean {
|
||||
// Per-app Proxy is disabled for Play Store builds due to QUERY_ALL_PACKAGES permission restriction
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user