Skip to content

Commit d95df66

Browse files
authored
[auth] Fix deeplink issue (#4818)
## Description Also - Remove logo from privacy screen - Fix bug while deleting items from trash ## Tests
2 parents 267f54d + 58cb9f4 commit d95df66

File tree

7 files changed

+21
-23
lines changed

7 files changed

+21
-23
lines changed

auth/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<!-- Don't delete the meta-data below.
4747
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
4848
<meta-data android:name="flutterEmbedding" android:value="2"/>
49+
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
4950

5051
<meta-data android:name="io.sentry.dsn"
5152
android:value="https://[email protected]/9"/>

auth/ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
<string>Main</string>
6464
<key>UIStatusBarHidden</key>
6565
<false/>
66+
<key>FlutterDeepLinkingEnabled</key>
67+
<false/>
6668
<key>UISupportedInterfaceOrientations</key>
6769
<array>
6870
<string>UIInterfaceOrientationPortrait</string>

auth/lib/store/code_store.dart

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,6 @@ class CodeStore {
6464
return true;
6565
}
6666

67-
Future<void> updateCodeIndex(Code code) async {
68-
final key = code.generatedID!;
69-
70-
_cacheCodes.remove(key);
71-
int deletedIndex = code.display.position;
72-
73-
_cacheCodes.forEach((key, c) async {
74-
if (c.display.position > deletedIndex) {
75-
Code updatedCode = c.copyWith(
76-
display: c.display.copyWith(position: c.display.position - 1),
77-
);
78-
await addCode(updatedCode);
79-
}
80-
});
81-
}
82-
8367
Future<List<Code>> getAllCodes({
8468
AccountMode? accountMode,
8569
bool sortCodes = true,
@@ -179,7 +163,6 @@ class CodeStore {
179163
Future<void> removeCode(Code code, {AccountMode? accountMode}) async {
180164
final mode = accountMode ?? _authenticatorService.getAccountMode();
181165
await _authenticatorService.deleteEntry(code.generatedID!, mode);
182-
await updateCodeIndex(code);
183166
Bus.instance.fire(CodesUpdatedEvent());
184167
}
185168

auth/lib/ui/code_widget.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,12 @@ class _CodeWidgetState extends State<CodeWidget> {
645645
firstButtonLabel: l10n.delete,
646646
isCritical: true,
647647
firstButtonOnTap: () async {
648-
await CodeStore.instance.removeCode(widget.code);
648+
try {
649+
await CodeStore.instance.removeCode(widget.code);
650+
} catch (e,s) {
651+
logger.severe('Failed to delete code',e,s);
652+
showGenericErrorDialog(context: context, error: e).ignore();
653+
}
649654
},
650655
);
651656
}

auth/lib/ui/home_page.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,24 @@ class _HomePageState extends State<HomePage> {
667667
}
668668
return false;
669669
}
670-
670+
int lastScanTime = DateTime.now().millisecondsSinceEpoch - 1000;
671671
void _handleDeeplink(BuildContext context, String? link) {
672-
if (!Configuration.instance.hasConfiguredAccount() || link == null) {
672+
bool isAccountConfigured = Configuration.instance.hasConfiguredAccount();
673+
bool isOfflineModeEnabled = Configuration.instance.hasOptedForOfflineMode() &&
674+
Configuration.instance.getOfflineSecretKey() != null;
675+
if (!(isAccountConfigured || isOfflineModeEnabled) || link == null) {
676+
return;
677+
}
678+
if (DateTime.now().millisecondsSinceEpoch - lastScanTime < 1000) {
679+
_logger.info("Ignoring potential event for same deeplink");
673680
return;
674681
}
682+
lastScanTime = DateTime.now().millisecondsSinceEpoch;
675683
if (mounted && link.toLowerCase().startsWith("otpauth://")) {
676684
try {
677685
final newCode = Code.fromOTPAuthUrl(link);
678686
getNextTotp(newCode);
679-
CodeStore.instance.addCode(newCode);
687+
CodeStore.instance.addCode(newCode, shouldSync: false);
680688
_focusNewCode(newCode);
681689
} catch (e, s) {
682690
showGenericErrorDialog(

auth/lib/utils/lock_screen_settings.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ class LockScreenSettings {
9090
: await PrivacyScreen.instance.enable(
9191
iosOptions: const PrivacyIosOptions(
9292
enablePrivacy: true,
93-
privacyImageName: 'LaunchImage',
9493
),
9594
androidOptions: const PrivacyAndroidOptions(
9695
enableSecure: true,

auth/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
name: ente_auth
33
description: ente two-factor authenticator
4-
version: 4.3.0+430
4+
version: 4.3.1+431
55
publish_to: none
66

77
environment:

0 commit comments

Comments
 (0)