π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Clean up
Neeraj Guptaafebe1ade12c
diff --git a/mobile/apps/auth/lib/ui/home_page.dart b/mobile/apps/auth/lib/ui/home_page.dartindex 33fdf5c4e5..e407301693 100644--- a/mobile/apps/auth/lib/ui/home_page.dart+++ b/mobile/apps/auth/lib/ui/home_page.dart@@ -35,7 +35,6 @@ import 'package:ente_auth/ui/settings_page.dart';import 'package:ente_auth/ui/sort_option_menu.dart';import 'package:ente_auth/utils/dialog_util.dart';import 'package:ente_auth/utils/platform_util.dart';-import 'package:ente_auth/utils/toast_util.dart';import 'package:ente_auth/utils/totp_util.dart';import 'package:ente_events/event_bus.dart';import 'package:ente_lock_screen/lock_screen_settings.dart';@@ -48,10 +47,8 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_speed_dial/flutter_speed_dial.dart';import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';-import 'package:image/image.dart' as img;import 'package:logging/logging.dart';import 'package:move_to_background/move_to_background.dart';-import 'package:zxing2/qrcode.dart';class HomePage extends BaseHomePage {const HomePage({super.key});@@ -294,69 +291,6 @@ class _HomePageState extends State<HomePage> {}}- Future<void> _importFromGallery() async {- final l10n = AppLocalizations.of(context);-- if (_isImportingFromGallery) {- return;- }-- setState(() {- _isImportingFromGallery = true;- });-- try {- final FilePickerResult? result = await FilePicker.platform.pickFiles(- type: FileType.image,- );-- if (result == null || result.files.single.path == null) {- return;- }-- final String imagePath = result.files.single.path!;- final rawImage = await File(imagePath).readAsBytes();- final image = img.decodeImage(rawImage);-- if (image == null) {- await showErrorDialog(context, l10n.error, l10n.errorCouldNotReadImage);- return;- }-- final source = RGBLuminanceSource(- image.width,- image.height,- image.getBytes(order: img.ChannelOrder.rgba).buffer.asInt32List(),- );- final bitmap = BinaryBitmap(HybridBinarizer(source));- final reader = QRCodeReader();- final Result decodeResult = reader.decode(bitmap);- final String code = decodeResult.text;- try {- final newCode = Code.fromOTPAuthUrl(code);- await CodeStore.instance.addCode(newCode, shouldSync: false);- } catch (e) {- await showErrorDialog(- context,- l10n.errorInvalidQRCode,- l10n.errorInvalidQRCodeBody,- );- }- } on ReaderException {- showToast(context, l10n.errorNoQRCode);- } catch (e) {- await showErrorDialog(- context,- l10n.errorGenericTitle,- l10n.errorGenericBody,- );- } finally {- setState(() {- _isImportingFromGallery = false;- });- }- }-Future<void> _importFromGalleryNative() async {final l10n = AppLocalizations.of(context);@@ -364,9 +298,7 @@ class _HomePageState extends State<HomePage> {return;}- setState(() {- _isImportingFromGallery = true;- });+ _isImportingFromGallery = true;try {final FilePickerResult? result = await FilePicker.platform.pickFiles(@@ -412,9 +344,7 @@ class _HomePageState extends State<HomePage> {l10n.errorGenericBody,);} finally {- setState(() {- _isImportingFromGallery = false;- });+ _isImportingFromGallery = false;}}@@ -881,14 +811,6 @@ class _HomePageState extends State<HomePage> {backgroundColor: Theme.of(context).colorScheme.fabBackgroundColor,foregroundColor: Theme.of(context).colorScheme.fabForegroundColor,labelWidget: SpeedDialLabelWidget(context.l10n.importFromGallery),- onTap: _importFromGallery,- ),- if (PlatformUtil.isMobile())- SpeedDialChild(- child: const Icon(Icons.photo_library),- backgroundColor: Theme.of(context).colorScheme.fabBackgroundColor,- foregroundColor: Theme.of(context).colorScheme.fabForegroundColor,- labelWidget: const SpeedDialLabelWidget("Scan image (Native)"),onTap: _importFromGalleryNative,),],diff --git a/mobile/apps/auth/plugins/qr/example/ios/Runner/AppDelegate.swift b/mobile/apps/auth/plugins/qr/example/ios/Runner/AppDelegate.swiftdeleted file mode 100644index 964982012b..0000000000--- a/mobile/apps/auth/plugins/qr/example/ios/Runner/AppDelegate.swift+++ /dev/null@@ -1,15 +0,0 @@-import Flutter-import UIKit--import ente_qr--@UIApplicationMain-@objc class AppDelegate: FlutterAppDelegate {- override func application(- _ application: UIApplication,- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?- ) -> Bool {- GeneratedPluginRegistrant.register(with: self)- return super.application(application, didFinishLaunchingWithOptions: launchOptions)- }-}diff --git a/mobile/apps/auth/plugins/qr/example/lib/main.dart b/mobile/apps/auth/plugins/qr/example/lib/main.dartdeleted file mode 100644index cb25f66dc8..0000000000--- a/mobile/apps/auth/plugins/qr/example/lib/main.dart+++ /dev/null@@ -1,124 +0,0 @@-import 'dart:async';--import 'package:ente_qr/ente_qr.dart';-import 'package:file_picker/file_picker.dart';-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';--void main() {- runApp(const MyApp());-}--class MyApp extends StatefulWidget {- const MyApp({super.key});-- @override- State<MyApp> createState() => _MyAppState();-}--class _MyAppState extends State<MyApp> {- String _platformVersion = 'Unknown';- String _qrResult = 'No QR code scanned yet';- final _enteQrPlugin = EnteQr();-- @override- void initState() {- super.initState();- initPlatformState();- }-- // Platform messages are asynchronous, so we initialize in an async method.- Future<void> initPlatformState() async {- String platformVersion;- // Platform messages may fail, so we use a try/catch PlatformException.- // We also handle the message potentially returning null.- try {- platformVersion = await _enteQrPlugin.getPlatformVersion() ??- 'Unknown platform version';- } on PlatformException {- platformVersion = 'Failed to get platform version.';- }-- // If the widget was removed from the tree while the asynchronous platform- // message was in flight, we want to discard the reply rather than calling- // setState to update our non-existent appearance.- if (!mounted) return;-- setState(() {- _platformVersion = platformVersion;- });- }-- Future<void> _pickImageAndScanQr() async {- try {- final FilePickerResult? result = await FilePicker.platform.pickFiles(- type: FileType.image,- allowMultiple: false,- );-- if (result != null && result.files.single.path != null) {- final String imagePath = result.files.single.path!;-- setState(() {- _qrResult = 'Scanning QR code...';- });-- final QrScanResult qrResult =- await _enteQrPlugin.scanQrFromImage(imagePath);-- setState(() {- if (qrResult.success) {- _qrResult = 'QR Code found: ${qrResult.content}';- } else {- _qrResult = 'Error: ${qrResult.error}';- }- });- } else {- setState(() {- _qrResult = 'No image selected';- });- }- } catch (e) {- setState(() {- _qrResult = 'Error picking file: $e';- });- }- }-- @override- Widget build(BuildContext context) {- return MaterialApp(- home: Scaffold(- appBar: AppBar(- title: const Text('Ente QR Plugin Example'),- ),- body: Padding(- padding: const EdgeInsets.all(16.0),- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Text('Running on: $_platformVersion\n'),- const SizedBox(height: 20),- ElevatedButton(- onPressed: _pickImageAndScanQr,- child: const Text('Pick Image and Scan QR Code'),- ),- const SizedBox(height: 20),- Container(- padding: const EdgeInsets.all(16),- decoration: BoxDecoration(- border: Border.all(color: Colors.grey),- borderRadius: BorderRadius.circular(8),- ),- child: Text(- _qrResult,- style: const TextStyle(fontSize: 16),- ),- ),- ],- ),- ),- ),- );- }-}diff --git a/mobile/apps/auth/plugins/qr/example/pubspec.yaml b/mobile/apps/auth/plugins/qr/example/pubspec.yamldeleted file mode 100644index 8eee59207d..0000000000--- a/mobile/apps/auth/plugins/qr/example/pubspec.yaml+++ /dev/null@@ -1,45 +0,0 @@-name: ente_qr_example-description: "Demonstrates how to use the ente_qr plugin."-publish_to: 'none' # Remove this line if you wish to publish to pub.dev--environment:- sdk: '>=3.4.3 <4.0.0'--dependencies:- flutter:- sdk: flutter-- ente_qr:- # When depending on this package from a real application you should use:- # ente_qr: ^x.y.z- # See https://dart.dev/tools/pub/dependencies#version-constraints- # The example app is bundled with the plugin so we use a path dependency on- # the parent directory to use the current plugin's version.- path: ../-- # The following adds the Cupertino Icons font to your application.- # Use with the CupertinoIcons class for iOS style icons.- cupertino_icons: ^1.0.6- file_picker: ^5.5.0--dev_dependencies:- flutter_test:- sdk: flutter-- # The "flutter_lints" package below contains a set of recommended lints to- # encourage good coding practices. The lint set provided by the package is- # activated in the `analysis_options.yaml` file located at the root of your- # package. See that file for information about deactivating specific lint- # rules and activating additional ones.- flutter_lints: ^3.0.0--# For information on the generic Dart part of this file, see the-# following page: https://dart.dev/tools/pub/pubspec--# The following section is specific to Flutter packages.-flutter:-- # The following line ensures that the Material Icons font is- # included with your application, so that you can use the icons in- # the material Icons class.- uses-material-design: truediff --git a/mobile/apps/auth/pubspec.lock b/mobile/apps/auth/pubspec.lockindex 5b4e282cc3..1005b6f6ed 100644--- a/mobile/apps/auth/pubspec.lock+++ b/mobile/apps/auth/pubspec.lock@@ -201,14 +201,6 @@ packages:url: "https://pub.dev"source: hostedversion: "1.4.0"- charcode:- dependency: transitive- description:- name: charcode- sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a- url: "https://pub.dev"- source: hosted- version: "1.4.0"checked_yaml:dependency: transitivedescription:@@ -2036,14 +2028,6 @@ packages:url: "https://pub.dev"source: hostedversion: "3.1.3"- zxing2:- dependency: "direct main"- description:- name: zxing2- sha256: "2677c49a3b9ca9457cb1d294fd4bd5041cac6aab8cdb07b216ba4e98945c684f"- url: "https://pub.dev"- source: hosted- version: "0.2.4"sdks:dart: ">=3.7.2 <4.0.0"flutter: ">=3.29.0"diff --git a/mobile/apps/auth/pubspec.yaml b/mobile/apps/auth/pubspec.yamlindex ea48aa9e46..3014a7f68b 100644--- a/mobile/apps/auth/pubspec.yaml+++ b/mobile/apps/auth/pubspec.yaml@@ -133,7 +133,6 @@ dependencies:win32: ^5.1.1window_manager: ^0.5.0xdg_directories: ^1.0.4- zxing2: ^0.2.4dev_dependencies:build_runner: ^2.1.11