Update copies and hook for import & faq on Empty home page (#179)

This commit is contained in:
Neeraj Gupta 2023-08-08 10:26:40 +05:30 committed by GitHub
commit dc5cb41f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 46 additions and 46 deletions

View file

@ -77,7 +77,7 @@
"passwordForDecryptingExport": "Password to decrypt export", "passwordForDecryptingExport": "Password to decrypt export",
"passwordEmptyError": "Password can not be empty", "passwordEmptyError": "Password can not be empty",
"importFromApp": "Import codes from {appName}", "importFromApp": "Import codes from {appName}",
"importGoogleAuthGuide": "Export your accounts from Google Authenticator to a QR code using the \"Transfer Accounts\" option. Then using another device, scan the QR code.", "importGoogleAuthGuide": "Export your accounts from Google Authenticator to a QR code using the \"Transfer Accounts\" option. Then using another device, scan the QR code.\n\nTip: You can use your laptop's webcam to take a picture of the QR code.",
"importSelectJsonFile": "Select JSON file", "importSelectJsonFile": "Select JSON file",
"importEnteEncGuide": "Select the encrypted JSON file exported from ente", "importEnteEncGuide": "Select the encrypted JSON file exported from ente",
"importRaivoGuide": "Use the \"Export OTPs to Zip archive\" option in Raivo's Settings.\n\nExtract the zip file and import the JSON file.", "importRaivoGuide": "Use the \"Export OTPs to Zip archive\" option in Raivo's Settings.\n\nExtract the zip file and import the JSON file.",

View file

@ -7,6 +7,7 @@ import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart'; import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart';
import 'package:ente_auth/store/code_store.dart'; import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/code_timer_progress.dart'; import 'package:ente_auth/ui/code_timer_progress.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/toast_util.dart'; import 'package:ente_auth/utils/toast_util.dart';
import 'package:ente_auth/utils/totp_util.dart'; import 'package:ente_auth/utils/totp_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -261,50 +262,17 @@ class _CodeWidgetState extends State<CodeWidget> {
} }
} }
void _onDeletePressed(_) { void _onDeletePressed(_) async {
final l10n = context.l10n; final l10n = context.l10n;
final AlertDialog alert = AlertDialog( await showChoiceActionSheet(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), context,
title: Text( title: l10n.deleteCodeTitle,
l10n.deleteCodeTitle, body: l10n.deleteCodeMessage,
style: Theme.of(context).textTheme.headline6, firstButtonLabel: l10n.delete,
), isCritical: true,
content: Text( firstButtonOnTap: () async {
l10n.deleteCodeMessage, await CodeStore.instance.removeCode(widget.code);
),
actions: [
TextButton(
child: Text(
l10n.delete,
style: const TextStyle(
color: Colors.red,
),
),
onPressed: () {
CodeStore.instance.removeCode(widget.code);
Navigator.of(context, rootNavigator: true).pop('dialog');
}, },
),
TextButton(
child: Text(
l10n.cancel,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
barrierColor: Colors.black12,
); );
} }

View file

@ -1,4 +1,8 @@
import 'package:ente_auth/l10n/l10n.dart'; import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/settings/data/import_page.dart';
import 'package:ente_auth/ui/settings/faq.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class HomeEmptyStateWidget extends StatelessWidget { class HomeEmptyStateWidget extends StatelessWidget {
@ -50,6 +54,33 @@ class HomeEmptyStateWidget extends StatelessWidget {
child: Text(l10n.importEnterSetupKey), child: Text(l10n.importEnterSetupKey),
), ),
), ),
const SizedBox(height: 54),
InkWell(
onTap: () {
routeToPage(context, ImportCodePage());
},
child: Text(
l10n.importCodes,
textAlign: TextAlign.center,
style: getEnteTextTheme(context).bodyFaint.copyWith(decoration: TextDecoration.underline),
),),
const SizedBox(height: 18),
InkWell(
onTap: () {
showModalBottomSheet<void>(
backgroundColor: Theme.of(context).colorScheme.background,
barrierColor: Colors.black87,
context: context,
builder: (context) {
return const FAQQuestionsWidget();
},
);
},
child: Text(
l10n.faq,
textAlign: TextAlign.center,
style: getEnteTextTheme(context).bodyFaint.copyWith(decoration: TextDecoration.underline),
),),
], ],
), ),
], ],

View file

@ -40,7 +40,6 @@ class DataSectionWidget extends StatelessWidget {
trailingIconIsMuted: true, trailingIconIsMuted: true,
onTap: () async { onTap: () async {
routeToPage(context, ImportCodePage()); routeToPage(context, ImportCodePage());
// _showImportInstructionDialog(context);
}, },
), ),
sectionOptionSpacing, sectionOptionSpacing,

View file

@ -59,7 +59,9 @@ class ImportCodePage extends StatelessWidget {
iconButtonType: IconButtonType.secondary, iconButtonType: IconButtonType.secondary,
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
if(Navigator.canPop(context)) {
Navigator.pop(context); Navigator.pop(context);
}
}, },
), ),
], ],

View file

@ -1,6 +1,6 @@
name: ente_auth name: ente_auth
description: ente two-factor authenticator description: ente two-factor authenticator
version: 1.0.50+50 version: 1.0.51+51
publish_to: none publish_to: none
environment: environment: