mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
ADD: Add Wallet menu item
This commit is contained in:
parent
d88cc931b6
commit
85c57de1c5
9
App.js
9
App.js
@ -84,6 +84,14 @@ const App = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addWalletMenuAction = () => {
|
||||||
|
NavigationService.dispatch(
|
||||||
|
CommonActions.navigate({
|
||||||
|
name: 'AddWalletRoot',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const onUserActivityOpen = data => {
|
const onUserActivityOpen = data => {
|
||||||
switch (data.activityType) {
|
switch (data.activityType) {
|
||||||
case HandoffComponent.activityTypes.ReceiveOnchain:
|
case HandoffComponent.activityTypes.ReceiveOnchain:
|
||||||
@ -127,6 +135,7 @@ const App = () => {
|
|||||||
*/
|
*/
|
||||||
eventEmitter?.addListener('onNotificationReceived', onNotificationReceived);
|
eventEmitter?.addListener('onNotificationReceived', onNotificationReceived);
|
||||||
eventEmitter?.addListener('openSettings', openSettings);
|
eventEmitter?.addListener('openSettings', openSettings);
|
||||||
|
eventEmitter?.addListener('addWalletMenuAction', addWalletMenuAction);
|
||||||
eventEmitter?.addListener('onUserActivityOpen', onUserActivityOpen);
|
eventEmitter?.addListener('onUserActivityOpen', onUserActivityOpen);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
|
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openSettings {
|
- (void)openSettings:(UIKeyCommand *)keyCommand {
|
||||||
[EventEmitter.sharedInstance openSettings];
|
[EventEmitter.sharedInstance openSettings];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,13 +126,33 @@
|
|||||||
[builder removeMenuForIdentifier:UIMenuServices];
|
[builder removeMenuForIdentifier:UIMenuServices];
|
||||||
[builder removeMenuForIdentifier:UIMenuFormat];
|
[builder removeMenuForIdentifier:UIMenuFormat];
|
||||||
[builder removeMenuForIdentifier:UIMenuToolbar];
|
[builder removeMenuForIdentifier:UIMenuToolbar];
|
||||||
[builder removeMenuForIdentifier:UIMenuFile];
|
|
||||||
|
|
||||||
UIKeyCommand *settingsCommand = [UIKeyCommand keyCommandWithInput:@"," modifierFlags:UIKeyModifierCommand action:@selector(openSettings)];
|
|
||||||
[settingsCommand setTitle:@"Settings..."];
|
|
||||||
UIMenu *settings = [UIMenu menuWithTitle:@"Settings..." image:nil identifier:@"openSettings" options:UIMenuOptionsDisplayInline children:@[settingsCommand]];
|
|
||||||
|
|
||||||
[builder insertSiblingMenu:settings afterMenuForIdentifier:UIMenuAbout];
|
// Add Wallet action with Command + A shortcut
|
||||||
|
UIKeyCommand *addWalletCommand = [UIKeyCommand keyCommandWithInput:@"A" modifierFlags:UIKeyModifierCommand action:@selector(addWalletAction:)];
|
||||||
|
[addWalletCommand setTitle:@"Add Wallet"];
|
||||||
|
UIMenu *addWalletMenu = [UIMenu menuWithTitle:@"" image:nil identifier:nil options:UIMenuOptionsDisplayInline children:@[addWalletCommand]];
|
||||||
|
|
||||||
|
|
||||||
|
// Modify the existing File menu
|
||||||
|
UIMenu *fileMenu = [builder menuForIdentifier:UIMenuFile];
|
||||||
|
if (fileMenu) {
|
||||||
|
// Replace the children of the File menu with the Add Wallet menu
|
||||||
|
UIMenu *newFileMenu = [UIMenu menuWithTitle:fileMenu.title image:nil identifier:fileMenu.identifier options:fileMenu.options children:@[addWalletMenu]];
|
||||||
|
[builder replaceMenuForIdentifier:UIMenuFile withMenu:newFileMenu];
|
||||||
|
}
|
||||||
|
// Existing settings menu
|
||||||
|
UIKeyCommand *settingsCommand = [UIKeyCommand keyCommandWithInput:@"," modifierFlags:UIKeyModifierCommand action:@selector(openSettings)];
|
||||||
|
[settingsCommand setTitle:@"Settings..."];
|
||||||
|
UIMenu *settings = [UIMenu menuWithTitle:@"Settings..." image:nil identifier:nil options:UIMenuOptionsDisplayInline children:@[settingsCommand]];
|
||||||
|
[builder insertSiblingMenu:settings afterMenuForIdentifier:UIMenuAbout];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action for Add Wallet
|
||||||
|
- (void)addWalletAction:(UIKeyCommand *)keyCommand {
|
||||||
|
// Implement the functionality for adding a wallet
|
||||||
|
[EventEmitter.sharedInstance addWalletMenuAction];
|
||||||
|
|
||||||
|
NSLog(@"Add Wallet action performed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
+ (EventEmitter *)sharedInstance;
|
+ (EventEmitter *)sharedInstance;
|
||||||
- (void)sendNotification:(NSDictionary *)userInfo;
|
- (void)sendNotification:(NSDictionary *)userInfo;
|
||||||
- (void)openSettings;
|
- (void)openSettings;
|
||||||
|
- (void)addWalletMenuAction;
|
||||||
- (void)sendUserActivity:(NSDictionary *)userInfo;
|
- (void)sendUserActivity:(NSDictionary *)userInfo;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -32,7 +32,7 @@ RCT_EXPORT_MODULE();
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray<NSString *> *)supportedEvents {
|
- (NSArray<NSString *> *)supportedEvents {
|
||||||
return @[@"onNotificationReceived",@"openSettings",@"onUserActivityOpen"];
|
return @[@"onNotificationReceived",@"openSettings",@"onUserActivityOpen",@"addWalletMenuAction"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)sendNotification:(NSDictionary *)userInfo
|
- (void)sendNotification:(NSDictionary *)userInfo
|
||||||
@ -58,5 +58,8 @@ RCT_REMAP_METHOD(getMostRecentUserActivity, resolve: (RCTPromiseResolveBlock)res
|
|||||||
[sharedInstance sendEventWithName:@"openSettings" body:nil];
|
[sharedInstance sendEventWithName:@"openSettings" body:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)addWalletMenuAction {
|
||||||
|
[sharedInstance sendEventWithName:@"addWalletMenuAction" body:nil];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user