π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
refactor: replace shareDialog with showShareSheet for improved sharing functionality
AmanRajSinghMourya47df15e8cfa2
diff --git a/mobile/apps/locker/lib/ui/pages/recovery_key_page.dart b/mobile/apps/locker/lib/ui/pages/recovery_key_page.dartdeleted file mode 100644index 1d59e84069..0000000000--- a/mobile/apps/locker/lib/ui/pages/recovery_key_page.dart+++ /dev/null@@ -1,150 +0,0 @@-import 'package:ente_ui/components/text_input_widget.dart';-import 'package:ente_ui/theme/ente_theme.dart';-import 'package:flutter/material.dart';-import "package:locker/ui/components/gradient_button.dart";--class RecoveryKeyPage extends StatefulWidget {- const RecoveryKeyPage({super.key});-- @override- State<RecoveryKeyPage> createState() => _RecoveryKeyPageState();-}--class _RecoveryKeyPageState extends State<RecoveryKeyPage> {- String? _recoveryKey;- final ValueNotifier<bool> _submitNotifier = ValueNotifier(false);-- @override- void dispose() {- _submitNotifier.dispose();- super.dispose();- }-- Future<void> _handleLogin() async {- // TODO: Implement actual recovery key validation and login logic- // For now, just simulate a delay- await Future.delayed(const Duration(seconds: 1));- }-- void _handleForgotRecoveryKey() {- // TODO: Implement forgot recovery key logic- }-- void _handleSignUp() {- // TODO: Implement sign up navigation or dialog- }-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);-- return Scaffold(- backgroundColor: colorScheme.backgroundBase,- appBar: AppBar(- backgroundColor: colorScheme.backgroundBase,- elevation: 0,- leading: IconButton(- icon: Icon(Icons.arrow_back, color: colorScheme.primary700),- onPressed: () => Navigator.of(context).pop(),- ),- title: Text(- "Locker",- style: textTheme.h3.copyWith(- color: colorScheme.primary700,- fontWeight: FontWeight.w600,- ),- ),- centerTitle: true,- ),- body: SafeArea(- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 24.0),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Expanded(- child: SingleChildScrollView(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const SizedBox(height: 48),- TextInputWidget(- label: "Recovery key",- hintText: "Enter your recovery key",- initialValue: _recoveryKey,- autoFocus: true,- textCapitalization: TextCapitalization.none,- onChange: (value) {- setState(() {- _recoveryKey = value;- });- },- submitNotifier: _submitNotifier,- onSubmit: (value) async {- _recoveryKey = value;- await _handleLogin();- },- shouldSurfaceExecutionStates: false,- ),- Align(- alignment: Alignment.centerRight,- child: TextButton(- onPressed: _handleForgotRecoveryKey,- child: Text(- "Forgot Recovery key?",- style: textTheme.bodyBold.copyWith(- color: colorScheme.primary700,- decoration: TextDecoration.underline,- decorationColor: colorScheme.primary700,- ),- ),- ),- ),- ],- ),- ),- ),- SizedBox(- width: double.infinity,- child: GradientButton(- onTap: _recoveryKey != null && _recoveryKey!.isNotEmpty- ? () async {- _submitNotifier.value = !_submitNotifier.value;- }- : null,- text: "Log In",- ),- ),- const SizedBox(height: 16),- Center(- child: TextButton(- onPressed: _handleSignUp,- child: RichText(- text: TextSpan(- style: textTheme.body.copyWith(- color: colorScheme.textBase,- ),- children: [- const TextSpan(text: "Don't have an account? "),- TextSpan(- text: "Sign up",- style: textTheme.bodyBold.copyWith(- color: colorScheme.primary700,- decoration: TextDecoration.underline,- decorationColor: colorScheme.primary700,- ),- ),- ],- ),- ),- ),- ),- const SizedBox(height: 24),- ],- ),- ),- ),- );- }-}diff --git a/mobile/packages/accounts/lib/pages/recovery_key_page.dart b/mobile/packages/accounts/lib/pages/recovery_key_page.dartindex 81b62133c9..2f69fd8665 100644--- a/mobile/packages/accounts/lib/pages/recovery_key_page.dart+++ b/mobile/packages/accounts/lib/pages/recovery_key_page.dart@@ -218,7 +218,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {childrens.add(GradientButton(onTap: () async {- await shareDialog(+ await showShareSheet(context,context.strings.recoveryKey,saveAction: () async {diff --git a/mobile/packages/utils/lib/share_utils.dart b/mobile/packages/utils/lib/share_utils.dartindex 884901c442..7d867f63f0 100644--- a/mobile/packages/utils/lib/share_utils.dart+++ b/mobile/packages/utils/lib/share_utils.dart@@ -1,9 +1,12 @@import 'dart:io';import 'package:ente_strings/extensions.dart';+import "package:ente_ui/components/base_bottom_sheet.dart";import 'package:ente_ui/components/buttons/button_widget.dart';+import "package:ente_ui/components/buttons/gradient_button.dart";import 'package:ente_ui/components/buttons/models/button_type.dart';import 'package:ente_ui/components/dialog_widget.dart';+import "package:ente_ui/theme/ente_theme.dart";import 'package:flutter/material.dart';import 'package:logging/logging.dart';import 'package:share_plus/share_plus.dart';@@ -52,6 +55,61 @@ Future<void> shareDialog();}+Future<void> showShareSheet(+ BuildContext context,+ String title, {+ required Function saveAction,+ required Function sendAction,+}) async {+ return showBaseBottomSheet(+ context,+ headerSpacing: 20,+ title: title,+ child: Builder(+ builder: (context) {+ final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);+ return Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ Platform.isLinux || Platform.isWindows+ ? context.strings.saveOnlyDescription+ : context.strings.saveOrSendDescription,+ style: textTheme.body.copyWith(+ color: colorScheme.textMuted,+ ),+ ),+ const SizedBox(height: 20),+ GradientButton(+ onTap: () async {+ await saveAction();+ },+ text: context.strings.save,+ ),+ if (!Platform.isWindows && !Platform.isLinux)+ const SizedBox(height: 20),+ if (!Platform.isWindows && !Platform.isLinux)+ GestureDetector(+ onTap: () async {+ await sendAction();+ },+ child: Text(+ context.strings.send,+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.primary700,+ decorationColor: colorScheme.primary700,+ decoration: TextDecoration.underline,+ ),+ ),+ ),+ ],+ );+ },+ ),+ );+}+Rect _sharePosOrigin(BuildContext? context, GlobalKey? key) {late final Rect rect;if (context != null) {