fix macos quick actions plugin issue (#2914)
David Adegoke committed
Feb 18, 2026 at 12:34 UTC
b00fb19286ab8c3bf56336d49751e5aab0f024b1
1 file changed
+47
-37
lib/main.dart
+47
-37
@@ -85,38 +85,40 @@ Future<void> runAppWithZone({Key? topLevelKey}) async {
85
86
final Completer<String?> initialShortcutCompleter = Completer<String?>();
87
88
- const QuickActions quickActions = QuickActions();
89
-
90
- quickActions.initialize((String shortcutType) {
91
- // Complete the completer only once (for cold starts)
92
- if (!initialShortcutCompleter.isCompleted) {
93
- initialShortcutCompleter.complete(shortcutType);
94
- }
88
+ // Quick Actions plugin supports only iOS/Android platforms
89
+ if (Platform.isIOS || Platform.isAndroid) {
90
+ const QuickActions quickActions = QuickActions();
91
+
92
+ quickActions.initialize((String shortcutType) {
93
+ // Complete the completer only once (for cold starts)
94
+ if (!initialShortcutCompleter.isCompleted) {
95
+ initialShortcutCompleter.complete(shortcutType);
96
+ }
97
+
98
+ // Convert the shortcut type to a URI and add it to the stream
99
+ final uri = Uri.parse('cakewallet://quickaction/$shortcutType');
100
+ quickActionsStream.sink.add(uri);
101
+ });
102
96
- // Convert the shortcut type to a URI and add it to the stream
97
- final uri = Uri.parse('cakewallet://quickaction/$shortcutType');
98
- quickActionsStream.sink.add(uri);
99
- });
100
-
101
- quickActions.setShortcutItems(<ShortcutItem>[
102
- const ShortcutItem(
103
- type: 'send',
104
- icon: 'send',
105
- localizedTitle: 'Send',
106
- localizedSubtitle: 'Send funds'),
107
- const ShortcutItem(
108
- type: 'receive',
109
- icon: 'receive',
110
- localizedTitle: 'Receive',
111
- localizedSubtitle: 'Receive funds')
112
- ]);
113
-
114
- // Fallback in case the initial shortcut is not received (normal cold start)
115
- Future<void>.delayed(const Duration(milliseconds: 500), () {
116
- if (!initialShortcutCompleter.isCompleted) {
117
- initialShortcutCompleter.complete(null);
118
- }
119
- });
103
+ quickActions.setShortcutItems(<ShortcutItem>[
104
+ const ShortcutItem(
105
+ type: 'send', icon: 'send', localizedTitle: 'Send', localizedSubtitle: 'Send funds'),
106
+ const ShortcutItem(
107
+ type: 'receive',
108
+ icon: 'receive',
109
+ localizedTitle: 'Receive',
110
+ localizedSubtitle: 'Receive funds')
111
+ ]);
112
+
113
+ // Fallback in case the initial shortcut is not received (normal cold start)
114
+ Future<void>.delayed(const Duration(milliseconds: 500), () {
115
+ if (!initialShortcutCompleter.isCompleted) {
116
+ initialShortcutCompleter.complete(null);
117
+ }
118
+ });
119
+ } else {
120
+ initialShortcutCompleter.complete(null);
121
+ }
122
123
final initialQuickAction = await initialShortcutCompleter.future;
124
FlutterError.onError = ExceptionHandler.onError;
@@ -137,10 +139,10 @@ Future<void> runAppWithZone({Key? topLevelKey}) async {
139
} catch (e) {
140
printV("Failed to initialize tor: $e");
141
}
140
-
142
+
143
try {
144
await linuxSymlinkSharedPreferences();
143
- } catch (e) {
145
+ } catch (e) {
146
printV("Failed to symlink linux preferences: $e");
147
}
148
@@ -162,7 +164,7 @@ Future<void> runAppWithZone({Key? topLevelKey}) async {
164
}
165
var zcashPassword = await secureStorageShared.read(key: "com.cakewallet.cw_zcash/zec.db");
166
if (zcashPassword == null || zcashPassword.isEmpty) {
165
- zcashPassword = generateKey().substring(0,32);
167
+ zcashPassword = generateKey().substring(0, 32);
168
secureStorageShared.write(key: "com.cakewallet.cw_zcash/zec.db", value: zcashPassword);
169
}
170
zcash?.unlockDatabase(zcashPassword);
@@ -172,11 +174,17 @@ Future<void> runAppWithZone({Key? topLevelKey}) async {
174
runApp(
175
DefaultAssetBundle(
176
bundle: TestAssetBundle(),
175
- child: App(key: topLevelKey, initialQuickAction:initialQuickAction,quickActionsStream: quickActionsStream.stream),
177
+ child: App(
178
+ key: topLevelKey,
179
+ initialQuickAction: initialQuickAction,
180
+ quickActionsStream: quickActionsStream.stream),
181
),
182
);
183
} else {
179
- runApp(App(key: topLevelKey, initialQuickAction: initialQuickAction, quickActionsStream: quickActionsStream.stream));
184
+ runApp(App(
185
+ key: topLevelKey,
186
+ initialQuickAction: initialQuickAction,
187
+ quickActionsStream: quickActionsStream.stream));
188
}
189
190
isAppRunning = true;
@@ -396,7 +404,9 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
404
final authenticationStore = getIt.get<AuthenticationStore>();
405
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
406
? Routes.welcome
399
- : settingsStore.currentBuiltinTor ? Routes.startTor : Routes.login;
407
+ : settingsStore.currentBuiltinTor
408
+ ? Routes.startTor
409
+ : Routes.login;
410
final currentTheme = appStore.themeStore.currentTheme;
411
final statusBarBrightness =
412
currentTheme.type == currentTheme.isDark ? Brightness.light : Brightness.dark;