Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update UI

AmanRajSinghMourya04f9b8844c24
diff --git a/mobile/packages/legacy/lib/pages/select_contact_page.dart b/mobile/packages/legacy/lib/pages/select_contact_page.dart
index 7cd6dbba3a..d917fcf683 100644
--- a/mobile/packages/legacy/lib/pages/select_contact_page.dart
+++ b/mobile/packages/legacy/lib/pages/select_contact_page.dart
@@ -148,7 +148,7 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
decoration: InputDecoration(
fillColor: colorScheme.fillFaint,
filled: true,
- hintText: context.strings.enterNameOrEmailToShareWith,
+ hintText: context.strings.enterEmail,
hintStyle: TextStyle(color: colorScheme.textMuted),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
@@ -190,7 +190,7 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- context.strings.addAnExistingContact,
+ context.strings.chooseFromAnExistingContact,
style: textTheme.bodyMuted,
),
const SizedBox(height: 12),
@@ -255,7 +255,7 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- context.strings.chooseRecoveryTime,
+ context.strings.chooseARecoveryTime,
style: textTheme.bodyMuted,
),
const SizedBox(height: 12),
@@ -307,7 +307,7 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
Widget _buildAddContactButton(EnteTextTheme textTheme) {
final bool canAdd = selectedEmail.isNotEmpty || _emailIsValid;
return GradientButton(
- text: context.strings.addContact,
+ text: context.strings.addTrustedContact,
onTap: canAdd ? _onAddContactTap : null,
);
}
@@ -379,15 +379,11 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
return;
}
final emailToAdd = selectedEmail.isNotEmpty ? selectedEmail : _email;
- await showDialog(
- context: context,
- builder: (BuildContext context) {
- return VerifyIdentityDialog(
- self: false,
- email: emailToAdd,
- config: widget.config,
- );
- },
+ await showVerifyIdentitySheet(
+ context,
+ self: false,
+ email: emailToAdd,
+ config: widget.config,
);
}
@@ -410,10 +406,6 @@ class _AddContactBottomSheetState extends State<AddContactBottomSheet> {
}
suggestedUsers.sort((a, b) => a.email.compareTo(b.email));
- suggestedUsers.add(
- User(email: "[email protected]"),
- );
-
return suggestedUsers;
}
}
diff --git a/mobile/packages/sharing/lib/verify_identity_dialog.dart b/mobile/packages/sharing/lib/verify_identity_dialog.dart
index ab52778de7..ea3f156adf 100644
--- a/mobile/packages/sharing/lib/verify_identity_dialog.dart
+++ b/mobile/packages/sharing/lib/verify_identity_dialog.dart
@@ -2,19 +2,38 @@ import "dart:convert";
import 'package:bip39/bip39.dart' as bip39;
import "package:crypto/crypto.dart";
-import "package:dotted_border/dotted_border.dart";
import "package:ente_accounts/services/user_service.dart";
import "package:ente_configuration/base_configuration.dart";
import "package:ente_strings/ente_strings.dart";
-import "package:ente_ui/components/buttons/button_widget.dart";
-import "package:ente_ui/components/buttons/models/button_type.dart";
+import "package:ente_ui/components/buttons/gradient_button.dart";
import "package:ente_ui/components/loading_widget.dart";
+import "package:ente_ui/theme/colors.dart";
import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_ui/theme/text_style.dart";
import "package:ente_utils/share_utils.dart";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
import "package:logging/logging.dart";
+/// Shows the verify identity bottom sheet
+Future<void> showVerifyIdentitySheet(
+ BuildContext context, {
+ required bool self,
+ String email = '',
+ required BaseConfiguration config,
+}) {
+ return showModalBottomSheet<void>(
+ context: context,
+ isScrollControlled: true,
+ backgroundColor: Colors.transparent,
+ builder: (context) => VerifyIdentityDialog(
+ self: self,
+ email: email,
+ config: config,
+ ),
+ );
+}
+
class VerifyIdentityDialog extends StatefulWidget {
// email id of the user who's verification ID is being displayed for
// verification
@@ -40,10 +59,9 @@ class VerifyIdentityDialog extends StatefulWidget {
}
class _VerifyIdentityDialogState extends State<VerifyIdentityDialog> {
- final bool doesUserExist = true;
-
@override
Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
final textStyle = getEnteTextTheme(context);
final String subTitle = widget.self
? context.strings.thisIsYourVerificationId
@@ -52,88 +70,152 @@ class _VerifyIdentityDialogState extends State<VerifyIdentityDialog> {
? context.strings.someoneSharingAlbumsWithYouShouldSeeTheSameId
: context.strings.howToViewShareeVerificationID;
- final AlertDialog alert = AlertDialog(
- title: Text(
- widget.self
- ? context.strings.verificationId
- : context.strings.verifyEmailID(widget.email),
+ return Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundElevated2,
+ borderRadius: const BorderRadius.only(
+ topLeft: Radius.circular(24),
+ topRight: Radius.circular(24),
+ ),
),
- content: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- FutureBuilder<String>(
- future: _getPublicKey(),
- builder: (context, snapshot) {
- if (snapshot.hasData) {
- final publicKey = snapshot.data!;
- if (publicKey.isEmpty) {
- return Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- context.strings.emailNoEnteAccount(widget.email),
- ),
- const SizedBox(height: 24),
- ButtonWidget(
- buttonType: ButtonType.neutral,
- icon: Icons.adaptive.share,
- labelText: context.strings.sendInvite,
- isInAlert: true,
- onTap: () async {
- // ignore: unawaited_futures
- shareText(
- context.strings.shareTextRecommendUsingEnte,
- );
- },
- ),
- ],
- );
- } else {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
+ child: SafeArea(
+ top: false,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ _buildHeader(context, colorScheme),
+ const SizedBox(height: 12),
+ FutureBuilder<String>(
+ future: _getPublicKey(),
+ builder: (context, snapshot) {
+ if (snapshot.hasData) {
+ final publicKey = snapshot.data!;
+ if (publicKey.isEmpty) {
+ return _buildNoAccountContent(
+ context,
+ colorScheme,
+ textStyle,
+ );
+ } else {
+ return _buildVerificationContent(
+ context,
+ colorScheme,
+ textStyle,
+ publicKey,
subTitle,
- style: textStyle.bodyMuted,
- ),
- const SizedBox(height: 20),
- _verificationIDWidget(context, publicKey),
- const SizedBox(height: 16),
- Text(
bottomText,
- style: textStyle.bodyMuted,
- ),
- const SizedBox(height: 24),
- ButtonWidget(
- buttonType: ButtonType.neutral,
- isInAlert: true,
- labelText: widget.self
- ? context.strings.ok
- : context.strings.done,
- ),
- ],
- );
- }
- } else if (snapshot.hasError) {
- Logger("VerificationID")
- .severe("failed to end userID", snapshot.error);
- return Text(
- context.strings.somethingWentWrong,
- style: textStyle.bodyMuted,
- );
- } else {
- return const SizedBox(
- height: 200,
- child: EnteLoadingWidget(),
- );
- }
- },
+ );
+ }
+ } else if (snapshot.hasError) {
+ Logger("VerificationID")
+ .severe("failed to end userID", snapshot.error);
+ return Text(
+ context.strings.somethingWentWrong,
+ style: textStyle.bodyMuted,
+ );
+ } else {
+ return const SizedBox(
+ height: 200,
+ child: EnteLoadingWidget(),
+ );
+ }
+ },
+ ),
+ ],
),
- ],
+ ),
),
);
- return alert;
+ }
+
+ Widget _buildHeader(
+ BuildContext context,
+ EnteColorScheme colorScheme,
+ ) {
+ return Row(
+ mainAxisAlignment: MainAxisAlignment.end,
+ children: [
+ GestureDetector(
+ onTap: () => Navigator.of(context).pop(),
+ child: Container(
+ padding: const EdgeInsets.all(8),
+ decoration: BoxDecoration(
+ color: colorScheme.fillFaint,
+ shape: BoxShape.circle,
+ ),
+ child: Icon(
+ Icons.close,
+ size: 20,
+ color: colorScheme.textBase,
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+
+ Widget _buildNoAccountContent(
+ BuildContext context,
+ EnteColorScheme colorScheme,
+ EnteTextTheme textStyle,
+ ) {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ context.strings.verify,
+ style: textStyle.largeBold,
+ ),
+ const SizedBox(height: 8),
+ Text(
+ context.strings.emailNoEnteAccount(widget.email),
+ style: textStyle.small.copyWith(color: colorScheme.textMuted),
+ textAlign: TextAlign.center,
+ ),
+ const SizedBox(height: 20),
+ GradientButton(
+ text: context.strings.sendInvite,
+ onTap: () {
+ shareText(context.strings.shareTextRecommendUsingEnte);
+ },
+ ),
+ ],
+ );
+ }
+
+ Widget _buildVerificationContent(
+ BuildContext context,
+ EnteColorScheme colorScheme,
+ EnteTextTheme textStyle,
+ String publicKey,
+ String subTitle,
+ String bottomText,
+ ) {
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ context.strings.verify,
+ style: textStyle.largeBold,
+ ),
+ const SizedBox(height: 8),
+ Text(
+ subTitle,
+ style: textStyle.small.copyWith(color: colorScheme.textMuted),
+ textAlign: TextAlign.center,
+ ),
+ const SizedBox(height: 20),
+ _verificationIDWidget(context, publicKey),
+ const SizedBox(height: 20),
+ Text(
+ bottomText,
+ style: textStyle.small.copyWith(color: colorScheme.textMuted),
+ textAlign: TextAlign.center,
+ ),
+ ],
+ );
}
Future<String> _getPublicKey() async {
@@ -153,47 +235,33 @@ class _VerifyIdentityDialogState extends State<VerifyIdentityDialog> {
final colorScheme = getEnteColorScheme(context);
final textStyle = getEnteTextTheme(context);
final String verificationID = _generateVerificationID(publicKey);
- return DottedBorder(
- options: RoundedRectDottedBorderOptions(
- color: colorScheme.strokeMuted,
- strokeWidth: 1,
- dashPattern: const [12, 6],
- radius: const Radius.circular(8),
- ),
- child: Column(
- children: [
- GestureDetector(
- onTap: () async {
- if (verificationID.isEmpty) {
- return;
- }
- await Clipboard.setData(
- ClipboardData(text: verificationID),
- );
- // ignore: unawaited_futures
- shareText(
- widget.self
- ? context.strings.shareMyVerificationID(verificationID)
- : context.strings
- .shareTextConfirmOthersVerificationID(verificationID),
- );
- },
- child: Container(
- decoration: BoxDecoration(
- borderRadius: const BorderRadius.all(
- Radius.circular(2),
- ),
- color: colorScheme.backgroundElevated2,
- ),
- padding: const EdgeInsets.all(20),
- width: double.infinity,
- child: Text(
- verificationID,
- style: textStyle.bodyBold,
- ),
- ),
- ),
- ],
+ return GestureDetector(
+ onTap: () async {
+ if (verificationID.isEmpty) {
+ return;
+ }
+ await Clipboard.setData(
+ ClipboardData(text: verificationID),
+ );
+ // ignore: unawaited_futures
+ shareText(
+ widget.self
+ ? context.strings.shareMyVerificationID(verificationID)
+ : context.strings
+ .shareTextConfirmOthersVerificationID(verificationID),
+ );
+ },
+ child: Container(
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8),
+ color: colorScheme.primary700,
+ ),
+ padding: const EdgeInsets.all(20),
+ width: double.infinity,
+ child: Text(
+ verificationID,
+ style: textStyle.bodyBold.copyWith(color: Colors.white),
+ ),
),
);
}