From 46522c329c3e0838ed4e88f6b930161c59bc36a8 Mon Sep 17 00:00:00 2001 From: vishnukvmd Date: Wed, 13 Mar 2024 11:12:06 +0530 Subject: [PATCH] Remove unused code for app-updates --- auth/ios/Podfile.lock | 6 - auth/lib/ui/settings/app_update_dialog.dart | 120 -------------------- auth/pubspec.lock | 8 -- auth/pubspec.yaml | 2 - 4 files changed, 136 deletions(-) diff --git a/auth/ios/Podfile.lock b/auth/ios/Podfile.lock index dc7d8d043..9e781fd48 100644 --- a/auth/ios/Podfile.lock +++ b/auth/ios/Podfile.lock @@ -71,8 +71,6 @@ PODS: - move_to_background (0.0.1): - Flutter - MTBBarcodeScanner (5.0.11) - - open_filex (0.0.2): - - Flutter - OrderedSet (5.0.0) - package_info_plus (0.4.5): - Flutter @@ -126,7 +124,6 @@ DEPENDENCIES: - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`) - move_to_background (from `.symlinks/plugins/move_to_background/ios`) - - open_filex (from `.symlinks/plugins/open_filex/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - privacy_screen (from `.symlinks/plugins/privacy_screen/ios`) @@ -183,8 +180,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/local_auth_ios/ios" move_to_background: :path: ".symlinks/plugins/move_to_background/ios" - open_filex: - :path: ".symlinks/plugins/open_filex/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: @@ -226,7 +221,6 @@ SPEC CHECKSUMS: local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605 move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7 path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 diff --git a/auth/lib/ui/settings/app_update_dialog.dart b/auth/lib/ui/settings/app_update_dialog.dart index 5d05dddc5..12049017c 100644 --- a/auth/lib/ui/settings/app_update_dialog.dart +++ b/auth/lib/ui/settings/app_update_dialog.dart @@ -1,14 +1,7 @@ -import 'dart:io'; - -import 'package:ente_auth/core/configuration.dart'; -import 'package:ente_auth/core/network.dart'; -import 'package:ente_auth/ente_theme_data.dart'; import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/services/update_service.dart'; import 'package:ente_auth/theme/ente_theme.dart'; import 'package:flutter/material.dart'; -import 'package:logging/logging.dart'; -import 'package:open_filex/open_filex.dart'; import 'package:url_launcher/url_launcher_string.dart'; class AppUpdateDialog extends StatefulWidget { @@ -114,116 +107,3 @@ class _AppUpdateDialogState extends State { ); } } - -class ApkDownloaderDialog extends StatefulWidget { - final LatestVersionInfo? versionInfo; - - const ApkDownloaderDialog(this.versionInfo, {Key? key}) : super(key: key); - - @override - State createState() => _ApkDownloaderDialogState(); -} - -class _ApkDownloaderDialogState extends State { - String? _saveUrl; - double? _downloadProgress; - - @override - void initState() { - super.initState(); - _saveUrl = Configuration.instance.getTempDirectory() + - "ente-" + - widget.versionInfo!.name! + - ".apk"; - _downloadApk(); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async => false, - child: AlertDialog( - title: const Text( - "Downloading...", - style: TextStyle( - fontSize: 16, - ), - textAlign: TextAlign.center, - ), - content: LinearProgressIndicator( - value: _downloadProgress, - valueColor: AlwaysStoppedAnimation( - Theme.of(context).colorScheme.alternativeColor, - ), - ), - ), - ); - } - - Future _downloadApk() async { - try { - if (!File(_saveUrl!).existsSync()) { - await Network.instance.getDio().download( - widget.versionInfo!.url!, - _saveUrl, - onReceiveProgress: (count, _) { - setState(() { - _downloadProgress = count / widget.versionInfo!.size!; - }); - }, - ); - } - Navigator.of(context, rootNavigator: true).pop('dialog'); - // ignore: unawaited_futures - OpenFilex.open(_saveUrl); - } catch (e) { - Logger("ApkDownloader").severe(e); - final AlertDialog alert = AlertDialog( - title: const Text("Sorry"), - content: const Text("The download could not be completed"), - actions: [ - TextButton( - child: const Text( - "Ignore", - style: TextStyle( - color: Colors.white, - ), - ), - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - Navigator.of(context, rootNavigator: true).pop('dialog'); - }, - ), - TextButton( - child: Text( - "Retry", - style: TextStyle( - color: Theme.of(context).colorScheme.alternativeColor, - ), - ), - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - Navigator.of(context, rootNavigator: true).pop('dialog'); - showDialog( - context: context, - builder: (BuildContext context) { - return ApkDownloaderDialog(widget.versionInfo); - }, - barrierDismissible: false, - ); - }, - ), - ], - ); - // ignore: unawaited_futures - showDialog( - context: context, - builder: (BuildContext context) { - return alert; - }, - barrierColor: Colors.black87, - ); - return; - } - } -} diff --git a/auth/pubspec.lock b/auth/pubspec.lock index 7f0c7cf0b..4514e503c 100644 --- a/auth/pubspec.lock +++ b/auth/pubspec.lock @@ -879,14 +879,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" - open_filex: - dependency: "direct main" - description: - name: open_filex - sha256: "854aefd72dfd74219dc8c8d1767c34ec1eae64b8399a5be317bddb1ec2108915" - url: "https://pub.dev" - source: hosted - version: "4.3.2" otp: dependency: "direct main" description: diff --git a/auth/pubspec.yaml b/auth/pubspec.yaml index 042e78512..5e7808407 100644 --- a/auth/pubspec.yaml +++ b/auth/pubspec.yaml @@ -54,13 +54,11 @@ dependencies: intl: ^0.18.0 json_annotation: ^4.5.0 local_auth: ^2.1.7 - local_auth_android: ^1.0.31 local_auth_ios: ^1.1.3 logging: ^1.0.1 modal_bottom_sheet: ^3.0.0-pre move_to_background: ^1.0.2 - open_filex: ^4.3.2 otp: ^3.1.1 package_info_plus: ^4.1.0 password_strength: ^0.2.0