[auth] Fix deeplink issue (#4818)

## Description
Also
- Remove logo from privacy screen
- Fix bug while deleting items from trash
## Tests
This commit is contained in:
Neeraj
2025-01-22 14:45:21 +05:30
committed by GitHub
7 changed files with 21 additions and 23 deletions

View File

@@ -46,6 +46,7 @@
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data android:name="flutterEmbedding" android:value="2"/>
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
<meta-data android:name="io.sentry.dsn"
android:value="https://ed4ddd6309b847ba8849935e26e9b648@sentry.ente.io/9"/>

View File

@@ -63,6 +63,8 @@
<string>Main</string>
<key>UIStatusBarHidden</key>
<false/>
<key>FlutterDeepLinkingEnabled</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>

View File

@@ -64,22 +64,6 @@ class CodeStore {
return true;
}
Future<void> updateCodeIndex(Code code) async {
final key = code.generatedID!;
_cacheCodes.remove(key);
int deletedIndex = code.display.position;
_cacheCodes.forEach((key, c) async {
if (c.display.position > deletedIndex) {
Code updatedCode = c.copyWith(
display: c.display.copyWith(position: c.display.position - 1),
);
await addCode(updatedCode);
}
});
}
Future<List<Code>> getAllCodes({
AccountMode? accountMode,
bool sortCodes = true,
@@ -179,7 +163,6 @@ class CodeStore {
Future<void> removeCode(Code code, {AccountMode? accountMode}) async {
final mode = accountMode ?? _authenticatorService.getAccountMode();
await _authenticatorService.deleteEntry(code.generatedID!, mode);
await updateCodeIndex(code);
Bus.instance.fire(CodesUpdatedEvent());
}

View File

@@ -645,7 +645,12 @@ class _CodeWidgetState extends State<CodeWidget> {
firstButtonLabel: l10n.delete,
isCritical: true,
firstButtonOnTap: () async {
await CodeStore.instance.removeCode(widget.code);
try {
await CodeStore.instance.removeCode(widget.code);
} catch (e,s) {
logger.severe('Failed to delete code',e,s);
showGenericErrorDialog(context: context, error: e).ignore();
}
},
);
}

View File

@@ -667,16 +667,24 @@ class _HomePageState extends State<HomePage> {
}
return false;
}
int lastScanTime = DateTime.now().millisecondsSinceEpoch - 1000;
void _handleDeeplink(BuildContext context, String? link) {
if (!Configuration.instance.hasConfiguredAccount() || link == null) {
bool isAccountConfigured = Configuration.instance.hasConfiguredAccount();
bool isOfflineModeEnabled = Configuration.instance.hasOptedForOfflineMode() &&
Configuration.instance.getOfflineSecretKey() != null;
if (!(isAccountConfigured || isOfflineModeEnabled) || link == null) {
return;
}
if (DateTime.now().millisecondsSinceEpoch - lastScanTime < 1000) {
_logger.info("Ignoring potential event for same deeplink");
return;
}
lastScanTime = DateTime.now().millisecondsSinceEpoch;
if (mounted && link.toLowerCase().startsWith("otpauth://")) {
try {
final newCode = Code.fromOTPAuthUrl(link);
getNextTotp(newCode);
CodeStore.instance.addCode(newCode);
CodeStore.instance.addCode(newCode, shouldSync: false);
_focusNewCode(newCode);
} catch (e, s) {
showGenericErrorDialog(

View File

@@ -90,7 +90,6 @@ class LockScreenSettings {
: await PrivacyScreen.instance.enable(
iosOptions: const PrivacyIosOptions(
enablePrivacy: true,
privacyImageName: 'LaunchImage',
),
androidOptions: const PrivacyAndroidOptions(
enableSecure: true,

View File

@@ -1,7 +1,7 @@
name: ente_auth
description: ente two-factor authenticator
version: 4.3.0+430
version: 4.3.1+431
publish_to: none
environment: