Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Merge remote-tracking branch 'origin/main' into beta

Prateek Sunal5634b50528d9
diff --cc auth/ios/Podfile.lock
index c70156377c,9e781fd489..038487635a
--- a/auth/ios/Podfile.lock
+++ b/auth/ios/Podfile.lock
@@@ -232,46 -202,42 +227,45 @@@ EXTERNAL SOURCES
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
- connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
- device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
+ app_links: 5ef33d0d295a89d9d16bb81b0e3b0d5f70d6c875
+ connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
+ device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
- file_picker: ce3938a0df3cc1ef404671531facef740d03f920
+ file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de
file_saver: 503e386464dbe118f630e17b4c2e1190fa0cf808
fk_user_agent: 1f47ec39291e8372b1d692b50084b0d54103c545
- Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
+ Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_email_sender: 02d7443217d8c41483223627972bfdc09f74276b
- flutter_inappwebview: acd4fc0f012cefd09015000c241137d82f01ba62
- flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
+ flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0
+ flutter_local_authentication: 1172a4dd88f6306dadce067454e2c4caf07977bb
+ flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
- flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
- FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
- local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
+ local_auth_ios: 1ba1475238daa33a6ffa2a29242558437be435ac
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
- open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
- package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
- path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
+ package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
+ path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
privacy_screen: 1a131c052ceb3c3659934b003b0d397c2381a24e
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
- Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
- SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9
- Sentry: e3203780941722a1fcfee99e351de14244c7f806
- sentry_flutter: 8f0ffd53088e6a4d50c095852c5cad9e4405025c
- SentryPrivate: 5e3683390f66611fc7c6215e27645873adb55d13
+ ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
+ SDWebImage: fc8f2d48bbfd72ef39d70e981bd24a3f3be53fec
+ Sentry: 1ebcaef678a27c8ac515f974cb5425dd1bbdec2f
+ sentry_flutter: ecdfbedee55337205561cfa782ee02d31ec83e1f
+ SentryPrivate: 765c9b4ebe9ac1a5fcdc067c5a1cfbf3f10e1677
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
- shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
- sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
+ shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
+ smart_auth: 4bedbc118723912d0e45a07e8ab34039c19e04f2
+ sodium_libs: 0486eb2c3172ce494406367d4b379042444b769d
+ sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
+ sqlite3: 73b7fc691fdc43277614250e04d183740cb15078
+ sqlite3_flutter_libs: af0e8fe9bce48abddd1ffdbbf839db0302d72d80
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
- Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
- uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
- url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
+ Toast: ec33c32b8688982cecc6348adeae667c1b9938da
+ url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
PODFILE CHECKSUM: b4e3a7eabb03395b66e81fc061789f61526ee6bb
diff --cc auth/lib/core/network.dart
index 087d6accac,1942fcbb83..f9d3af41e5
--- a/auth/lib/core/network.dart
+++ b/auth/lib/core/network.dart
@@@ -41,22 -30,25 +36,28 @@@ class Network
},
),
);
- _dio.interceptors.add(RequestIdInterceptor());
-
++
_enteDio = Dio(
BaseOptions(
- baseUrl: endpoint,
- connectTimeout: kConnectTimeout,
+ baseUrl: apiEndpoint,
+ connectTimeout: Duration(milliseconds: kConnectTimeout),
headers: {
- HttpHeaders.userAgentHeader: FkUserAgent.userAgent,
- 'X-Client-Version': packageInfo.version,
- 'X-Client-Package': packageInfo.packageName,
+ if (PlatformUtil.isMobile())
+ HttpHeaders.userAgentHeader: FkUserAgent.userAgent
+ else
+ HttpHeaders.userAgentHeader: Platform.operatingSystem,
+ 'X-Client-Version': version,
+ 'X-Client-Package': packageName,
},
),
);
- _enteDio.interceptors.add(EnteRequestInterceptor(preferences, apiEndpoint));
+ _setupInterceptors(endpoint);
-
++
+ Bus.instance.on<EndpointUpdatedEvent>().listen((event) {
+ final endpoint = Configuration.instance.getHttpEndpoint();
+ _enteDio.options.baseUrl = endpoint;
+ _setupInterceptors(endpoint);
+ });
}
Network._privateConstructor();
diff --cc auth/lib/gateway/authenticator.dart
index c51b84db59,ee19c79b0d..3f3c7c8974
--- a/auth/lib/gateway/authenticator.dart
+++ b/auth/lib/gateway/authenticator.dart
@@@ -30,16 -23,9 +23,9 @@@ class AuthenticatorGateway
Future<AuthKey> getKey() async {
try {
- final response = await _dio.get(
- "$_basedEndpoint/key",
- options: Options(
- headers: {
- "X-Auth-Token": _config.getToken(),
- },
- ),
- );
+ final response = await _enteDio.get("/authenticator/key");
return AuthKey.fromMap(response.data);
- } on DioError catch (e) {
+ } on DioException catch (e) {
if (e.response != null && (e.response!.statusCode ?? 0) == 404) {
throw AuthenticatorKeyNotFound();
} else {
diff --cc auth/lib/l10n/arb/app_en.arb
index 7af9ce901b,f540fc7176..a2f6e77edf
--- a/auth/lib/l10n/arb/app_en.arb
+++ b/auth/lib/l10n/arb/app_en.arb
@@@ -410,8 -407,14 +411,15 @@@
"doNotSignOut": "Do not sign out",
"hearUsWhereTitle": "How did you hear about Ente? (optional)",
"hearUsExplanation": "We don't track app installs. It'd help if you told us where you found us!",
+ "recoveryKeySaved": "Recovery key saved in Downloads folder!",
"waitingForBrowserRequest": "Waiting for browser request...",
- "launchPasskeyUrlAgain": "Launch passkey URL again",
- "passkey": "Passkey"
+ "waitingForVerification": "Waiting for verification...",
+ "passkey": "Passkey",
+ "developerSettingsWarning":"Are you sure that you want to modify Developer settings?",
+ "developerSettings": "Developer settings",
+ "serverEndpoint": "Server endpoint",
+ "invalidEndpoint": "Invalid endpoint",
+ "invalidEndpointMessage": "Sorry, the endpoint you entered is invalid. Please enter a valid endpoint and try again.",
+ "endpointUpdatedMessage": "Endpoint updated successfully",
+ "customEndpoint": "Connected to {endpoint}"
}
diff --cc auth/lib/onboarding/view/onboarding_page.dart
index ab4d7b2af7,b97c3436a0..ebc70a5590
--- a/auth/lib/onboarding/view/onboarding_page.dart
+++ b/auth/lib/onboarding/view/onboarding_page.dart
@@@ -57,125 -62,142 +63,152 @@@ class _OnboardingPageState extends Stat
final l10n = context.l10n;
return Scaffold(
body: SafeArea(
- child: SingleChildScrollView(
- child: Center(
- child: ConstrainedBox(
- constraints:
- const BoxConstraints.tightFor(height: 800, width: 450),
- child: Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 40.0,
- horizontal: 40,
- ),
- child: Column(
- children: [
- Column(
- children: [
- kDebugMode
- ? GestureDetector(
- child: const Align(
- alignment: Alignment.topRight,
- child: Text("Lang"),
+ child: GestureDetector(
+ onTap: () async {
+ _developerModeTapCount++;
+ if (_developerModeTapCount >= kDeveloperModeTapCountThreshold) {
+ _developerModeTapCount = 0;
+ final result = await showChoiceDialog(
+ context,
+ title: l10n.developerSettings,
+ firstButtonLabel: l10n.yes,
+ body: l10n.developerSettingsWarning,
+ isDismissible: false,
+ );
+ if (result?.action == ButtonAction.first) {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return const DeveloperSettingsPage();
+ },
+ ),
+ );
+ setState(() {});
+ }
+ }
+ },
- child: Center(
- child: SingleChildScrollView(
- child: Padding(
- padding:
- const EdgeInsets.symmetric(vertical: 40.0, horizontal: 40),
- child: Column(
- children: [
- Column(
- children: [
- kDebugMode
- ? GestureDetector(
- child: const Align(
- alignment: Alignment.topRight,
- child: Text("Lang"),
++ child: SingleChildScrollView(
++ child: Center(
++ child: ConstrainedBox(
++ constraints:
++ const BoxConstraints.tightFor(height: 800, width: 450),
++ child: Padding(
++ padding: const EdgeInsets.symmetric(
++ vertical: 40.0,
++ horizontal: 40,
++ ),
++ child: Column(
++ children: [
++ Column(
++ children: [
++ kDebugMode
++ ? GestureDetector(
++ child: const Align(
++ alignment: Alignment.topRight,
++ child: Text("Lang"),
++ ),
++ onTap: () async {
++ final locale = await getLocale();
++ // ignore: unawaited_futures
++ routeToPage(
++ context,
++ LanguageSelectorPage(
++ appSupportedLocales,
++ (locale) async {
++ await setLocale(locale);
++ App.setLocale(context, locale);
++ },
++ locale,
++ ),
++ ).then((value) {
++ setState(() {});
++ });
++ },
++ )
++ : const SizedBox(),
++ Image.asset(
++ "assets/sheild-front-gradient.png",
++ width: 200,
++ height: 200,
++ ),
++ const SizedBox(height: 12),
++ const Text(
++ "ente",
++ style: TextStyle(
++ fontWeight: FontWeight.bold,
++ fontFamily: 'Montserrat',
++ fontSize: 42,
++ ),
++ ),
++ const SizedBox(height: 4),
++ Text(
++ "Authenticator",
++ style: Theme.of(context).textTheme.headlineMedium,
++ ),
++ const SizedBox(height: 32),
++ Text(
++ l10n.onBoardingBody,
++ textAlign: TextAlign.center,
++ style: Theme.of(context)
++ .textTheme
++ .titleLarge!
++ .copyWith(
++ color: Colors.white38,
),
-- onTap: () async {
-- final locale = await getLocale();
- // ignore: unawaited_futures
-- routeToPage(
-- context,
-- LanguageSelectorPage(
-- appSupportedLocales,
-- (locale) async {
-- await setLocale(locale);
-- App.setLocale(context, locale);
-- },
-- locale,
-- ),
-- ).then((value) {
-- setState(() {});
-- });
-- },
-- )
-- : const SizedBox(),
-- Image.asset(
-- "assets/sheild-front-gradient.png",
-- width: 200,
-- height: 200,
-- ),
-- const SizedBox(height: 12),
-- const Text(
-- "ente",
-- style: TextStyle(
-- fontWeight: FontWeight.bold,
-- fontFamily: 'Montserrat',
-- fontSize: 42,
),
++ ],
++ ),
++ const SizedBox(height: 100),
++ Container(
++ width: double.infinity,
++ padding: const EdgeInsets.symmetric(horizontal: 20),
++ child: GradientButton(
++ onTap: _navigateToSignUpPage,
++ text: l10n.newUser,
),
-- const SizedBox(height: 4),
-- Text(
-- "Authenticator",
-- style: Theme.of(context).textTheme.headlineMedium,
-- ),
-- const SizedBox(height: 32),
-- Text(
-- l10n.onBoardingBody,
-- textAlign: TextAlign.center,
-- style:
-- Theme.of(context).textTheme.titleLarge!.copyWith(
-- color: Colors.white38,
- // color: Theme.of(context)
- // .colorScheme
- // .mutedTextColor,
-- ),
-- ),
-- ],
-- ),
-- const SizedBox(height: 100),
-- Container(
-- width: double.infinity,
-- padding: const EdgeInsets.symmetric(horizontal: 20),
-- child: GradientButton(
-- onTap: _navigateToSignUpPage,
-- text: l10n.newUser,
),
-- ),
- const SizedBox(height: 24),
- const SizedBox(height: 4),
-- Container(
- height: 56,
-- width: double.infinity,
- padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
-- child: Hero(
-- tag: "log_in",
-- child: ElevatedButton(
-- style: Theme.of(context)
-- .colorScheme
-- .optionalActionButtonStyle,
-- onPressed: _navigateToSignInPage,
-- child: Text(
-- l10n.existingUser,
-- style: const TextStyle(
-- color: Colors.black, // same for both themes
++ const SizedBox(height: 24),
++ Container(
++ height: 56,
++ width: double.infinity,
++ padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
++ child: Hero(
++ tag: "log_in",
++ child: ElevatedButton(
++ style: Theme.of(context)
++ .colorScheme
++ .optionalActionButtonStyle,
++ onPressed: _navigateToSignInPage,
++ child: Text(
++ l10n.existingUser,
++ style: const TextStyle(
++ color: Colors.black, // same for both themes
++ ),
),
),
),
),
-- ),
-- const SizedBox(height: 4),
-- Container(
-- width: double.infinity,
-- padding: const EdgeInsets.only(top: 20, bottom: 20),
-- child: GestureDetector(
-- onTap: _optForOfflineMode,
-- child: Center(
-- child: Text(
-- l10n.useOffline,
-- style: body.copyWith(
-- color:
-- Theme.of(context).colorScheme.mutedTextColor,
++ const SizedBox(height: 4),
++ Container(
++ width: double.infinity,
++ padding: const EdgeInsets.only(top: 20, bottom: 20),
++ child: GestureDetector(
++ onTap: _optForOfflineMode,
++ child: Center(
++ child: Text(
++ l10n.useOffline,
++ style: body.copyWith(
++ color: Theme.of(context)
++ .colorScheme
++ .mutedTextColor,
++ ),
),
),
),
),
-- ),
- const DeveloperSettingsWidget(),
-- ],
++ const DeveloperSettingsWidget(),
++ ],
++ ),
),
),
),
diff --cc auth/lib/services/user_service.dart
index 4c0cf1ebdf,b870aa6472..9294680598
--- a/auth/lib/services/user_service.dart
+++ b/auth/lib/services/user_service.dart
@@@ -404,9 -410,10 +410,10 @@@ class UserService
context.l10n.oops,
context.l10n.verificationFailedPleaseTryAgain,
);
- } on DioError catch (e) {
+ } on DioException catch (e) {
await dialog.hide();
if (e.response != null && e.response!.statusCode == 403) {
+ // ignore: unawaited_futures
showErrorDialog(
context,
context.l10n.oops,
@@@ -754,9 -772,10 +772,10 @@@
await dialog.show();
try {
final response = await _dio.get(
- _config.getHttpEndpoint() + "/users/two-factor/recover",
+ "${_config.getHttpEndpoint()}/users/two-factor/recover",
queryParameters: {
"sessionID": sessionID,
+ "twoFactorType": twoFactorTypeToString(type),
},
);
if (response.statusCode == 200) {
@@@ -773,7 -794,8 +794,8 @@@
(route) => route.isFirst,
);
}
- } on DioError catch (e) {
+ } on DioException catch (e) {
+ await dialog.hide();
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
showToast(context, context.l10n.sessionExpired);
@@@ -862,7 -891,8 +891,8 @@@
(route) => route.isFirst,
);
}
- } on DioError catch (e) {
+ } on DioException catch (e) {
+ await dialog.hide();
_logger.severe(e);
if (e.response != null && e.response!.statusCode == 404) {
showToast(context, "Session expired");
diff --cc auth/lib/ui/account/request_pwd_verification_page.dart
index 0e557bb80e,d852859fa7..5901d3bd45
--- a/auth/lib/ui/account/request_pwd_verification_page.dart
+++ b/auth/lib/ui/account/request_pwd_verification_page.dart
@@@ -90,14 -88,14 +90,14 @@@ class _RequestPasswordVerificationPageS
attributes.opsLimit,
);
CryptoUtil.decryptSync(
- Sodium.base642bin(attributes.encryptedKey),
+ CryptoUtil.base642bin(attributes.encryptedKey),
keyEncryptionKey,
- Sodium.base642bin(attributes.keyDecryptionNonce),
+ CryptoUtil.base642bin(attributes.keyDecryptionNonce),
);
- dialog.show();
+ await dialog.show();
// pop
await widget.onPasswordVerified(keyEncryptionKey);
- dialog.hide();
+ await dialog.hide();
Navigator.of(context).pop(true);
} catch (e, s) {
_logger.severe("Error while verifying password", e, s);
diff --cc auth/lib/ui/passkey_page.dart
index 5b4cbf18d1,3c60af36e6..8c2e54e980
--- a/auth/lib/ui/passkey_page.dart
+++ b/auth/lib/ui/passkey_page.dart
@@@ -1,12 -1,15 +1,15 @@@
import 'dart:convert';
+import 'package:app_links/app_links.dart';
import 'package:ente_auth/core/configuration.dart';
- import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
+ import 'package:ente_auth/models/account/two_factor.dart';
import 'package:ente_auth/services/user_service.dart';
+ import 'package:ente_auth/ui/components/buttons/button_widget.dart';
+ import 'package:ente_auth/ui/components/models/button_type.dart';
+ import 'package:ente_auth/utils/dialog_util.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
-import 'package:uni_links/uni_links.dart';
import 'package:url_launcher/url_launcher_string.dart';
class PasskeyPage extends StatefulWidget {
diff --cc auth/lib/ui/settings/account_section_widget.dart
index f29e1f296e,60e426b090..d51b2dd873
--- a/auth/lib/ui/settings/account_section_widget.dart
+++ b/auth/lib/ui/settings/account_section_widget.dart
@@@ -48,8 -47,8 +48,9 @@@ class AccountSectionWidget extends Stat
context,
l10n.authToChangeYourEmail,
);
+ await PlatformUtil.refocusWindows();
if (hasAuthenticated) {
+ // ignore: unawaited_futures
showDialog(
context: context,
builder: (BuildContext context) {
@@@ -106,8 -106,9 +108,9 @@@
String recoveryKey;
try {
recoveryKey =
- Sodium.bin2hex(Configuration.instance.getRecoveryKey());
+ CryptoUtil.bin2hex(Configuration.instance.getRecoveryKey());
} catch (e) {
+ // ignore: unawaited_futures
showGenericErrorDialog(context: context);
return;
}
diff --cc auth/lib/ui/settings/app_update_dialog.dart
index c396184eaa,12049017c2..176abc4b19
--- a/auth/lib/ui/settings/app_update_dialog.dart
+++ b/auth/lib/ui/settings/app_update_dialog.dart
@@@ -1,15 -1,7 +1,8 @@@
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:ente_auth/utils/platform_util.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 {
diff --cc auth/lib/ui/settings/security_section_widget.dart
index a100792bb0,f4cc3324f3..4e50d38fbd
--- a/auth/lib/ui/settings/security_section_widget.dart
+++ b/auth/lib/ui/settings/security_section_widget.dart
@@@ -16,15 -16,15 +16,16 @@@ import 'package:ente_auth/ui/components
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/components/toggle_switch_widget.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
-import 'package:ente_auth/utils/crypto_util.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/navigation_util.dart';
+import 'package:ente_auth/utils/platform_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
+import 'package:ente_crypto_dart/ente_crypto_dart.dart';
import 'package:flutter/material.dart';
+ import 'package:logging/logging.dart';
class SecuritySectionWidget extends StatefulWidget {
- const SecuritySectionWidget({Key? key}) : super(key: key);
+ const SecuritySectionWidget({super.key});
@override
State<SecuritySectionWidget> createState() => _SecuritySectionWidgetState();
@@@ -117,8 -117,8 +119,9 @@@ class _SecuritySectionWidgetState exten
context,
context.l10n.authToViewYourActiveSessions,
);
+ await PlatformUtil.refocusWindows();
if (hasAuthenticated) {
+ // ignore: unawaited_futures
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
diff --cc auth/lib/ui/settings/support_section_widget.dart
index 77497be2a4,418c1d4302..1343d23476
--- a/auth/lib/ui/settings/support_section_widget.dart
+++ b/auth/lib/ui/settings/support_section_widget.dart
@@@ -61,8 -62,9 +62,9 @@@ class _SupportSectionWidgetState extend
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
+ // ignore: unawaited_futures
launchUrlString(
- githubDiscussionsUrl,
+ githubIssuesUrl,
mode: LaunchMode.externalApplication,
);
},
diff --cc auth/lib/ui/two_factor_recovery_page.dart
index 12ace414fe,4eae7ff2dc..5743f0246f
--- a/auth/lib/ui/two_factor_recovery_page.dart
+++ b/auth/lib/ui/two_factor_recovery_page.dart
@@@ -1,4 -1,7 +1,5 @@@
-import 'dart:ui';
-
import 'package:ente_auth/l10n/l10n.dart';
+ import 'package:ente_auth/models/account/two_factor.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:flutter/material.dart';
diff --cc auth/lib/utils/email_util.dart
index dce1c7aef5,d276962b1e..7679dbf91e
--- a/auth/lib/utils/email_util.dart
+++ b/auth/lib/utils/email_util.dart
@@@ -42,70 -40,69 +42,107 @@@ Future<void> sendLogs
String? body,
}) async {
final l10n = context.l10n;
- final List<Widget> actions = [
- TextButton(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Icon(
- Icons.feed_outlined,
- color: Theme.of(context).iconTheme.color?.withOpacity(0.85),
- ),
- const Padding(padding: EdgeInsets.all(4)),
- Text(
- l10n.viewLogsAction,
- style: TextStyle(
- color: Theme.of(context)
- .colorScheme
- .defaultTextColor
- .withOpacity(0.85),
+ showDialogWidget(
+ context: context,
+ title: title,
+ icon: Icons.bug_report_outlined,
+ body: l10n.sendLogsDescription,
+ buttons: [
+ ButtonWidget(
+ isInAlert: true,
+ buttonType: ButtonType.neutral,
+ labelText: l10n.reportABug,
+ buttonAction: ButtonAction.first,
+ shouldSurfaceExecutionStates: false,
+ onTap: () async {
+ await _sendLogs(context, toEmail, subject, body);
+ if (postShare != null) {
+ postShare();
+ }
+ },
+ ),
+ //isInAlert is false here as we don't want to the dialog to dismiss
+ //on pressing this button
+ ButtonWidget(
+ buttonType: ButtonType.secondary,
+ labelText: l10n.viewLogsAction,
+ buttonAction: ButtonAction.second,
+ onTap: () async {
+ showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return LogFileViewer(SuperLogging.logFile!);
+ },
+ barrierColor: Colors.black87,
+ barrierDismissible: false,
+ );
+ },
+ ),
+ ButtonWidget(
+ isInAlert: true,
+ buttonType: ButtonType.secondary,
+ labelText: l10n.exportLogs,
+ buttonAction: ButtonAction.third,
+ onTap: () async {
+ Future.delayed(
+ const Duration(milliseconds: 200),
+ () => shareDialog(
+ context,
+ title,
+ saveAction: () async {
+ final zipFilePath = await getZippedLogsFile(context);
+ await exportLogs(context, zipFilePath);
+ },
+ sendAction: () async {
+ final zipFilePath = await getZippedLogsFile(context);
+ await exportLogs(context, zipFilePath, true);
+ },
),
- ),
- ],
+ );
+ },
),
- ButtonWidget(
- isInAlert: true,
- buttonType: ButtonType.secondary,
- labelText: l10n.cancel,
- buttonAction: ButtonAction.cancel,
+ onPressed: () async {
+ // ignore: unawaited_futures
+ showDialog(
+ context: context,
+ builder: (BuildContext context) {
+ return LogFileViewer(SuperLogging.logFile!);
+ },
+ barrierColor: Colors.black87,
+ barrierDismissible: false,
+ );
+ },
+ ),
+ TextButton(
+ child: Text(
+ title,
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.alternativeColor,
+ ),
+ ),
+ onPressed: () async {
+ Navigator.of(context, rootNavigator: true).pop('dialog');
+ await _sendLogs(context, toEmail, subject, body);
+ if (postShare != null) {
+ postShare();
+ }
+ },
+ ),
+ ];
+ final List<Widget> content = [];
+ content.addAll(
+ [
+ Text(
+ l10n.sendLogsDescription,
+ style: const TextStyle(
+ height: 1.5,
+ fontSize: 16,
+ ),
+ ),
+ const Padding(padding: EdgeInsets.all(12)),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: actions,
),
],
);
diff --cc auth/lib/utils/toast_util.dart
index 319c0eb911,c275160ebd..942274bc85
--- a/auth/lib/utils/toast_util.dart
+++ b/auth/lib/utils/toast_util.dart
@@@ -1,52 -1,25 +1,52 @@@
import 'package:ente_auth/ente_theme_data.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
- Future showToast(
+ void showToast(
BuildContext context,
String message, {
toastLength = Toast.LENGTH_LONG,
iOSDismissOnTap = true,
}) async {
- await Fluttertoast.cancel();
- await Fluttertoast.showToast(
- msg: message,
- toastLength: toastLength,
- gravity: ToastGravity.BOTTOM,
- timeInSecForIosWeb: 1,
- backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
- textColor: Theme.of(context).colorScheme.toastTextColor,
- fontSize: 16.0,
- );
+ try {
+ await Fluttertoast.cancel();
- return Fluttertoast.showToast(
++ await Fluttertoast.showToast(
+ msg: message,
+ toastLength: toastLength,
+ gravity: ToastGravity.BOTTOM,
+ timeInSecForIosWeb: 1,
+ backgroundColor: Theme.of(context).colorScheme.toastBackgroundColor,
+ textColor: Theme.of(context).colorScheme.toastTextColor,
+ fontSize: 16.0,
+ );
+ } on MissingPluginException catch (_) {
+ Widget toast = Container(
+ padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(25.0),
+ color: Theme.of(context).colorScheme.toastBackgroundColor,
+ ),
+ child: Text(
+ message,
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.toastTextColor,
+ fontSize: 16.0,
+ ),
+ ),
+ );
+
+ final fToast = FToast();
+ fToast.init(context);
+
+ fToast.showToast(
+ child: toast,
+ gravity: ToastGravity.BOTTOM,
+ toastDuration: const Duration(seconds: 2),
+ );
+ }
}
- Future<void> showShortToast(context, String message) {
- return showToast(context, message, toastLength: Toast.LENGTH_SHORT);
+ void showShortToast(context, String message) {
+ showToast(context, message, toastLength: Toast.LENGTH_SHORT);
}
diff --cc auth/pubspec.lock
index 79a86072b0,4514e503ca..059e4eb38b
--- a/auth/pubspec.lock
+++ b/auth/pubspec.lock
@@@ -213,10 -197,19 +213,10 @@@ packages
dependency: "direct main"
description:
name: collection
- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
+ sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
url: "https://pub.dev"
source: hosted
- version: "1.17.2"
- computer:
- dependency: "direct main"
- description:
- path: "."
- ref: HEAD
- resolved-ref: "82e365fed8a1a76f6eea0220de98389eed7b0445"
- url: "https://github.com/ente-io/computer.git"
- source: git
- version: "3.2.1"
+ version: "1.18.0"
confetti:
dependency: "direct main"
description:
@@@ -1018,13 -920,13 +1018,13 @@@
source: hosted
version: "0.2.0"
path:
- dependency: transitive
+ dependency: "direct main"
description:
name: path
- sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
+ sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
- version: "1.9.0"
+ version: "1.8.3"
path_drawing:
dependency: transitive
description:
@@@ -1483,10 -1368,18 +1483,10 @@@
dependency: transitive
description:
name: test_api
- sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
+ sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
url: "https://pub.dev"
source: hosted
- version: "0.6.0"
- test_core:
- dependency: transitive
- description:
- name: test_core
- sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e"
- url: "https://pub.dev"
- source: hosted
- version: "0.5.3"
+ version: "0.6.1"
timezone:
dependency: transitive
description: