diff --git a/assets/scanner-icons/cross.svg b/assets/scanner-icons/cross.svg
new file mode 100644
index 000000000..69bda0e94
--- /dev/null
+++ b/assets/scanner-icons/cross.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/scanner-icons/flash_off.svg b/assets/scanner-icons/flash_off.svg
new file mode 100644
index 000000000..fb6ad1673
--- /dev/null
+++ b/assets/scanner-icons/flash_off.svg
@@ -0,0 +1,20 @@
+
diff --git a/assets/scanner-icons/flash_on.svg b/assets/scanner-icons/flash_on.svg
new file mode 100644
index 000000000..59ed77744
--- /dev/null
+++ b/assets/scanner-icons/flash_on.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/scanner-icons/gallery.svg b/assets/scanner-icons/gallery.svg
new file mode 100644
index 000000000..ad92ee488
--- /dev/null
+++ b/assets/scanner-icons/gallery.svg
@@ -0,0 +1,18 @@
+
diff --git a/lib/ui/settings/data/import/analyze_qr_code.dart b/lib/ui/settings/data/import/analyze_qr_code.dart
index cdc9f4e23..126be527b 100644
--- a/lib/ui/settings/data/import/analyze_qr_code.dart
+++ b/lib/ui/settings/data/import/analyze_qr_code.dart
@@ -141,11 +141,11 @@ class _QrScannerState extends State {
switch (state) {
case TorchState.on:
return SvgPicture.asset(
- 'assets/simple-icons/flash_on.svg',
+ 'assets/scanner-icons/flash_on.svg',
);
case TorchState.off:
return SvgPicture.asset(
- 'assets/simple-icons/flash_off.svg',
+ 'assets/scanner-icons/flash_off.svg',
);
}
},
@@ -157,13 +157,13 @@ class _QrScannerState extends State {
// Gallery button
IconButton(
icon: SvgPicture.asset(
- 'assets/simple-icons/gallery.svg',
+ 'assets/scanner-icons/gallery.svg',
),
iconSize: 60,
onPressed: () async {
final result = await showDialogWidget(
context: context,
- title: 'Google Authenticator (saved image)',
+ title: l10n.importFromApp("Google Authenticator (saved image)"),
body:
'Please turn off all photo cloud sync from all apps, including iCloud, Google Photo, OneDrive, etc. \nAlso if you have a second smartphone, it is safer to import by scanning QR code.',
buttons: [
@@ -277,7 +277,7 @@ class _QrScannerState extends State {
Navigator.pop(context);
},
child: SvgPicture.asset(
- 'assets/simple-icons/cross.svg',
+ 'assets/scanner-icons/cross.svg',
colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcATop),
height: 30,
diff --git a/lib/ui/settings/data/import/google_auth_image_import.dart b/lib/ui/settings/data/import/google_auth_image_import.dart
deleted file mode 100644
index c843e2d52..000000000
--- a/lib/ui/settings/data/import/google_auth_image_import.dart
+++ /dev/null
@@ -1,67 +0,0 @@
-import 'dart:async';
-import 'dart:io';
-
-import 'package:ente_auth/l10n/l10n.dart';
-import 'package:ente_auth/ui/components/buttons/button_widget.dart';
-import 'package:ente_auth/ui/components/dialog_widget.dart';
-import 'package:ente_auth/ui/components/models/button_type.dart';
-import 'package:ente_auth/utils/toast_util.dart';
-import 'package:flutter/material.dart';
-import 'package:mobile_scanner/mobile_scanner.dart';
-import 'package:wechat_assets_picker/wechat_assets_picker.dart';
-
-const kGoogleAuthExportPrefix = 'otpauth-migration://offline?data=';
-
-Future showGoogleAuthImageInstruction(BuildContext context) async {
- MobileScannerController scannerController = MobileScannerController(
- detectionSpeed: DetectionSpeed.normal,
- );
- final l10n = context.l10n;
- final result = await showDialogWidget(
- context: context,
- title: 'Google Authenticator (saved image)',
- body:
- 'Please turn off all photo cloud sync from all apps, including iCloud, Google Photo, OneDrive, etc. \nAlso if you have a second smartphone, it is safer to import by scanning QR code.',
- buttons: [
- const ButtonWidget(
- buttonType: ButtonType.primary,
- labelText: 'Import from image',
- isInAlert: true,
- buttonSize: ButtonSize.large,
- buttonAction: ButtonAction.first,
- ),
- ButtonWidget(
- buttonType: ButtonType.secondary,
- labelText: context.l10n.cancel,
- buttonSize: ButtonSize.large,
- isInAlert: true,
- buttonAction: ButtonAction.second,
- ),
- ],
- );
- if (result?.action != null && result!.action != ButtonAction.cancel) {
- if (result.action == ButtonAction.first) {
- List? assets = await AssetPicker.pickAssets(
- context,
- pickerConfig: const AssetPickerConfig(
- maxAssets: 1,
- ),
- );
-
- if (assets != null && assets.isNotEmpty) {
- AssetEntity asset = assets.first;
- File? file = await asset.file;
- String path = file!.path;
-
- if (await scannerController.analyzeImage(path)) {
- final barcode = await scannerController.barcodes.first;
- showToast(context, "$barcode");
- } else {
- showToast(context, "Failed to scan image");
- }
- } else {
- showToast(context, "Image not selected");
- }
- }
- }
-}
diff --git a/lib/ui/settings/data/import/qr_scanner_overlay.dart b/lib/ui/settings/data/import/qr_scanner_overlay.dart
index fb05256a2..8dd134155 100644
--- a/lib/ui/settings/data/import/qr_scanner_overlay.dart
+++ b/lib/ui/settings/data/import/qr_scanner_overlay.dart
@@ -1,5 +1,3 @@
-
-
import 'package:flutter/material.dart';
class QRScannerOverlay extends StatelessWidget {
@@ -13,41 +11,45 @@ class QRScannerOverlay extends StatelessWidget {
MediaQuery.of(context).size.height < 400)
? 200.0
: 330.0;
- return Stack(children: [
- ColorFiltered(
- colorFilter:
- ColorFilter.mode(Colors.black.withOpacity(0.9), BlendMode.srcOut),
- child: Stack(
- children: [
- Container(
- decoration: const BoxDecoration(
- color: Colors.red, backgroundBlendMode: BlendMode.dstOut,),
- ),
- Align(
- alignment: Alignment.center,
- child: Container(
- height: scanArea,
- width: scanArea,
- decoration: BoxDecoration(
+ return Stack(
+ children: [
+ ColorFiltered(
+ colorFilter:
+ ColorFilter.mode(Colors.black.withOpacity(0.9), BlendMode.srcOut),
+ child: Stack(
+ children: [
+ Container(
+ decoration: const BoxDecoration(
color: Colors.red,
- borderRadius: BorderRadius.circular(20),
+ backgroundBlendMode: BlendMode.dstOut,
),
),
- ),
- ],
- ),
- ),
- Align(
- alignment: Alignment.center,
- child: CustomPaint(
- foregroundPainter: BorderPainter(),
- child: SizedBox(
- width: scanArea + 25,
- height: scanArea + 25,
+ Align(
+ alignment: Alignment.center,
+ child: Container(
+ height: scanArea,
+ width: scanArea,
+ decoration: BoxDecoration(
+ color: Colors.red,
+ borderRadius: BorderRadius.circular(20),
+ ),
+ ),
+ ),
+ ],
),
),
- ),
- ],);
+ Align(
+ alignment: Alignment.center,
+ child: CustomPaint(
+ foregroundPainter: BorderPainter(),
+ child: SizedBox(
+ width: scanArea + 25,
+ height: scanArea + 25,
+ ),
+ ),
+ ),
+ ],
+ );
}
}
@@ -122,15 +124,20 @@ class OverlayWithHolePainter extends CustomPainter {
void paint(Canvas canvas, Size size) {
final paint = Paint()..color = Colors.black54;
canvas.drawPath(
- Path.combine(
- PathOperation.difference,
- Path()..addRect(Rect.fromLTWH(0, 0, size.width, size.height)),
- Path()
- ..addOval(Rect.fromCircle(
- center: Offset(size.width - 44, size.height - 44), radius: 40,),)
- ..close(),
- ),
- paint,);
+ Path.combine(
+ PathOperation.difference,
+ Path()..addRect(Rect.fromLTWH(0, 0, size.width, size.height)),
+ Path()
+ ..addOval(
+ Rect.fromCircle(
+ center: Offset(size.width - 44, size.height - 44),
+ radius: 40,
+ ),
+ )
+ ..close(),
+ ),
+ paint,
+ );
}
@override