mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
ADD: Menu for mac
This commit is contained in:
parent
42cba3e368
commit
8f081cbbbb
10
App.js
10
App.js
@ -84,6 +84,14 @@ const App = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const openSettings = () => {
|
||||
NavigationService.dispatch(
|
||||
CommonActions.navigate({
|
||||
name: 'Settings',
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (walletsInitialized) {
|
||||
addListeners();
|
||||
@ -96,6 +104,7 @@ const App = () => {
|
||||
Linking.removeEventListener('url', handleOpenURL);
|
||||
AppState.removeEventListener('change', handleAppStateChange);
|
||||
eventEmitter.removeAllListeners('onNotificationReceived');
|
||||
eventEmitter.removeAllListeners('openSettings');
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
@ -118,6 +127,7 @@ const App = () => {
|
||||
QuickActions.popInitialAction().then(popInitialAction);
|
||||
handleAppStateChange(undefined);
|
||||
eventEmitter.addListener('onNotificationReceived', fetchWalletTransactionsInReceivedNotification);
|
||||
eventEmitter.addListener('openSettings', openSettings);
|
||||
};
|
||||
|
||||
const popInitialAction = async data => {
|
||||
|
@ -13,8 +13,8 @@
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
#import <RNCPushNotificationIOS.h>
|
||||
#import "EventEmitter.h"
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
#ifdef FB_SONARKIT_ENABLED
|
||||
#if DEBUG
|
||||
#import <FlipperKit/FlipperClient.h>
|
||||
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
||||
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
|
||||
@ -38,8 +38,10 @@ static void InitializeFlipper(UIApplication *application) {
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
#if !TARGET_OS_MACCATALYST
|
||||
#ifdef FB_SONARKIT_ENABLED
|
||||
InitializeFlipper(application);
|
||||
#endif
|
||||
#endif
|
||||
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
||||
@ -135,4 +137,35 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response
|
||||
[RNCPushNotificationIOS didReceiveLocalNotification:notification];
|
||||
}
|
||||
|
||||
- (void)openPreferences {
|
||||
[EventEmitter.sharedInstance openSettings];
|
||||
}
|
||||
|
||||
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder {
|
||||
[super buildMenuWithBuilder:builder];
|
||||
[builder removeMenuForIdentifier:UIMenuServices];
|
||||
[builder removeMenuForIdentifier:UIMenuFormat];
|
||||
[builder removeMenuForIdentifier:UIMenuToolbar];
|
||||
[builder removeMenuForIdentifier:UIMenuFile];
|
||||
|
||||
UIKeyCommand *preferencesCommand = [UIKeyCommand keyCommandWithInput:@"," modifierFlags:UIKeyModifierCommand action:@selector(openPreferences)];
|
||||
[preferencesCommand setTitle:@"Preferences..."];
|
||||
UIMenu *preferences = [UIMenu menuWithTitle:@"Preferences..." image:nil identifier:@"openPreferences" options:UIMenuOptionsDisplayInline children:@[preferencesCommand]];
|
||||
|
||||
[builder insertSiblingMenu:preferences afterMenuForIdentifier:UIMenuAbout];
|
||||
}
|
||||
|
||||
|
||||
-(void)showHelp:(id)sender {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://help.bluewallet.io"] options:@{} completionHandler:nil];
|
||||
}
|
||||
|
||||
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
|
||||
if (action == @selector(showHelp:)) {
|
||||
return true;
|
||||
} else {
|
||||
return [super canPerformAction:action withSender:sender];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -13,5 +13,6 @@
|
||||
|
||||
+ (EventEmitter *)sharedInstance;
|
||||
- (void)sendNotification:(NSDictionary *)userInfo;
|
||||
- (void)openSettings;
|
||||
|
||||
@end
|
||||
|
@ -29,7 +29,7 @@ RCT_EXPORT_MODULE();
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents {
|
||||
return @[@"onNotificationReceived"];
|
||||
return @[@"onNotificationReceived",@"openSettings"];
|
||||
}
|
||||
|
||||
- (void)sendNotification:(NSDictionary *)userInfo
|
||||
@ -37,4 +37,11 @@ RCT_EXPORT_MODULE();
|
||||
[sharedInstance sendEventWithName:@"onNotificationReceived" body:userInfo];
|
||||
}
|
||||
|
||||
|
||||
- (void)openSettings
|
||||
{
|
||||
[sharedInstance sendEventWithName:@"openSettings" body:nil];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
Image,
|
||||
Dimensions,
|
||||
useWindowDimensions,
|
||||
SafeAreaView,
|
||||
} from 'react-native';
|
||||
import { BlueHeaderDefaultMain, BlueTransactionListItem } from '../../BlueComponents';
|
||||
import WalletsCarousel from '../../components/WalletsCarousel';
|
||||
@ -27,6 +28,7 @@ import { getSystemName, isTablet } from 'react-native-device-info';
|
||||
import { useFocusEffect, useNavigation, useRoute, useTheme } from '@react-navigation/native';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import isCatalyst from 'react-native-is-catalyst';
|
||||
|
||||
const A = require('../../blue_modules/analytics');
|
||||
const fs = require('../../blue_modules/fs');
|
||||
const WalletsListSections = { CAROUSEL: 'CAROUSEL', LOCALTRADER: 'LOCALTRADER', TRANSACTIONS: 'TRANSACTIONS' };
|
||||
@ -113,6 +115,7 @@ const WalletsList = () => {
|
||||
useEffect(() => {
|
||||
setOptions({
|
||||
title: '',
|
||||
headerShown: !isCatalyst,
|
||||
headerStyle: {
|
||||
backgroundColor: colors.customHeader,
|
||||
borderBottomWidth: 0,
|
||||
@ -433,7 +436,7 @@ const WalletsList = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<View style={styles.root} onLayout={onLayout}>
|
||||
<SafeAreaView style={styles.root} onLayout={onLayout}>
|
||||
<StatusBar barStyle="default" />
|
||||
<View style={[styles.walletsListWrapper, stylesHook.walletsListWrapper]}>
|
||||
<SectionList
|
||||
@ -453,7 +456,7 @@ const WalletsList = () => {
|
||||
/>
|
||||
{renderScanButton()}
|
||||
</View>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
--- AppDelegate.m 2020-11-14 23:55:37.000000000 -0500
|
||||
+++ AppDelegate.m 2020-11-14 23:39:56.000000000 -0500
|
||||
@@ -13,7 +13,7 @@
|
||||
#import "RNQuickActionManager.h"
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
#import <RNCPushNotificationIOS.h>
|
||||
-#ifdef FB_SONARKIT_ENABLED
|
||||
+#if !TARGET_OS_MACCATALYST
|
||||
#if DEBUG
|
||||
#import <FlipperKit/FlipperClient.h>
|
||||
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
||||
@@ -38,10 +38,11 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
-#ifdef FB_SONARKIT_ENABLED
|
||||
+#if DEBUG
|
||||
+ #if !TARGET_OS_MACCATALYST
|
||||
InitializeFlipper(application);
|
||||
#endif
|
||||
-
|
||||
+#endif
|
||||
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
||||
moduleName:@"BlueWallet"
|
||||
-
|
@ -1,5 +1,3 @@
|
||||
echo "Applying patch for AppDelegate.m"
|
||||
patch ios/BlueWallet/AppDelegate.m ./scripts/maccatalystpatches/appdelegate.patch --no-backup-if-mismatch
|
||||
echo "Applying patch for package.json"
|
||||
patch package.json ./scripts/maccatalystpatches/packagejson.patch --no-backup-if-mismatch
|
||||
echo "Removing node_modules"
|
||||
|
Loading…
Reference in New Issue
Block a user