From 5c39404db5b2256f38e79b839cb90d078f9457ef Mon Sep 17 00:00:00 2001 From: alansley Date: Wed, 21 Aug 2024 12:06:54 +1000 Subject: [PATCH] Renamed MaybeScanQrCode to QRScannerScreen & removed double-import of ZXing core + removed ZXing android-integration --- app/build.gradle | 2 -- .../securesms/conversation/start/newmessage/NewMessage.kt | 4 ++-- .../securesms/onboarding/loadaccount/LoadAccount.kt | 4 ++-- .../org/thoughtcrime/securesms/preferences/QRCodeActivity.kt | 4 ++-- .../main/java/org/thoughtcrime/securesms/ui/components/QR.kt | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2b771d53a2..36cdee2a3f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -274,8 +274,6 @@ dependencies { implementation 'pl.tajchert:waitingdots:0.1.0' implementation 'com.vanniktech:android-image-cropper:4.5.0' implementation 'com.melnykov:floatingactionbutton:1.3.0' - implementation 'com.google.zxing:android-integration:3.1.0' - implementation 'com.google.zxing:core:3.2.1' implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') { exclude group: 'com.android.support', module: 'support-annotations' } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt index a2cb95a6b4..df54f9cae8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/start/newmessage/NewMessage.kt @@ -48,7 +48,7 @@ import org.thoughtcrime.securesms.ui.LoadingArcOr import org.thoughtcrime.securesms.ui.components.AppBarCloseIcon import org.thoughtcrime.securesms.ui.components.BackAppBar import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon -import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode +import org.thoughtcrime.securesms.ui.components.QRScannerScreen import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField import org.thoughtcrime.securesms.ui.components.SessionTabRow @@ -89,7 +89,7 @@ internal fun NewMessage( HorizontalPager(pagerState) { when (TITLES[it]) { R.string.enter_account_id -> EnterAccountId(state, callbacks, onHelp) - R.string.qrScan -> MaybeScanQrCode(qrErrors, onScan = callbacks::onScanQrCode) + R.string.qrScan -> QRScannerScreen(qrErrors, onScan = callbacks::onScanQrCode) } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt index cc1033ee96..56d1c54ea4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/loadaccount/LoadAccount.kt @@ -26,7 +26,7 @@ import network.loki.messenger.R import org.thoughtcrime.securesms.onboarding.ui.ContinuePrimaryOutlineButton import org.thoughtcrime.securesms.ui.theme.LocalDimensions import org.thoughtcrime.securesms.ui.theme.PreviewTheme -import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode +import org.thoughtcrime.securesms.ui.components.QRScannerScreen import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField import org.thoughtcrime.securesms.ui.components.SessionTabRow import org.thoughtcrime.securesms.ui.theme.LocalType @@ -52,7 +52,7 @@ internal fun LoadAccountScreen( ) { page -> when (TITLES[page]) { R.string.sessionRecoveryPassword -> RecoveryPassword(state, onChange, onContinue) - R.string.qrScan -> MaybeScanQrCode(qrErrors, onScan = onScan) + R.string.qrScan -> QRScannerScreen(qrErrors, onScan = onScan) } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt index 84f316db7a..52cb345fab 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/QRCodeActivity.kt @@ -27,7 +27,7 @@ import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2 import org.thoughtcrime.securesms.database.threadDatabase import org.thoughtcrime.securesms.ui.theme.LocalDimensions import org.thoughtcrime.securesms.ui.theme.LocalColors -import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode +import org.thoughtcrime.securesms.ui.components.QRScannerScreen import org.thoughtcrime.securesms.ui.components.QrImage import org.thoughtcrime.securesms.ui.components.SessionTabRow import org.thoughtcrime.securesms.ui.contentDescription @@ -83,7 +83,7 @@ private fun Tabs(accountId: String, errors: Flow, onScan: (String) -> Un ) { page -> when (TITLES[page]) { R.string.view -> QrPage(accountId) - R.string.scan -> MaybeScanQrCode(errors, onScan = onScan) + R.string.scan -> QRScannerScreen(errors, onScan = onScan) } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt index d0fd4ac3e9..9661b3bc06 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/QR.kt @@ -67,7 +67,7 @@ private const val TAG = "NewMessageFragment" @OptIn(ExperimentalPermissionsApi::class) @Composable -fun MaybeScanQrCode( +fun QRScannerScreen( errors: Flow, onClickSettings: () -> Unit = LocalContext.current.run { { Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {