mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-13 19:16:52 +01:00
Merge pull request #7622 from BlueWallet/swift
REF: ObjC emitters to Swift
This commit is contained in:
commit
52b3cb9b34
16 changed files with 260 additions and 324 deletions
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { requireNativeComponent, View, StyleSheet, NativeSyntheticEvent } from 'react-native';
|
||||
|
||||
interface SegmentedControlProps {
|
||||
|
@ -21,9 +21,18 @@ interface NativeSegmentedControlProps {
|
|||
const NativeSegmentedControl = requireNativeComponent<NativeSegmentedControlProps>('CustomSegmentedControl');
|
||||
|
||||
const SegmentedControl: React.FC<SegmentedControlProps> = ({ values, selectedIndex, onChange }) => {
|
||||
const handleChange = (event: NativeSyntheticEvent<SegmentedControlEvent>) => {
|
||||
onChange(event.nativeEvent.selectedIndex);
|
||||
};
|
||||
const handleChange = useMemo(
|
||||
() => (event: NativeSyntheticEvent<SegmentedControlEvent>) => {
|
||||
if (event?.nativeEvent?.selectedIndex !== undefined) {
|
||||
onChange(event.nativeEvent.selectedIndex);
|
||||
}
|
||||
},
|
||||
[onChange],
|
||||
);
|
||||
|
||||
if (!Array.isArray(values) || values.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
32F0A29A2311DBB20095C559 /* ComplicationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32F0A2992311DBB20095C559 /* ComplicationController.swift */; };
|
||||
6D2A6464258BA92D0092292B /* Stickers.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6D2A6463258BA92D0092292B /* Stickers.xcassets */; };
|
||||
6D2A6468258BA92D0092292B /* Stickers.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 6D2A6461258BA92C0092292B /* Stickers.appex */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
6D32C5C62596CE3A008C077C /* EventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D32C5C52596CE3A008C077C /* EventEmitter.m */; };
|
||||
6D4AF15925D21172009DD853 /* MarketAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D9A2E6A254BAB1B007B5B82 /* MarketAPI.swift */; };
|
||||
6D4AF16D25D21192009DD853 /* Placeholders.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DEB4BFA254FBA0E00E9F9AA /* Placeholders.swift */; };
|
||||
6D4AF17825D211A3009DD853 /* FiatUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D2AA8072568B8F40090B089 /* FiatUnit.swift */; };
|
||||
|
@ -113,12 +112,11 @@
|
|||
B440340F2BCC40A400162242 /* fiatUnits.json in Resources */ = {isa = PBXBuildFile; fileRef = B440340E2BCC40A400162242 /* fiatUnits.json */; };
|
||||
B44034102BCC40A400162242 /* fiatUnits.json in Resources */ = {isa = PBXBuildFile; fileRef = B440340E2BCC40A400162242 /* fiatUnits.json */; };
|
||||
B44034112BCC40A400162242 /* fiatUnits.json in Resources */ = {isa = PBXBuildFile; fileRef = B440340E2BCC40A400162242 /* fiatUnits.json */; };
|
||||
B44305BC2D6A04B2004675CC /* CustomSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = B44305BB2D6A04B2004675CC /* CustomSegmentedControl.m */; };
|
||||
B450109C2C0FCD8A00619044 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B450109B2C0FCD8A00619044 /* Utilities.swift */; };
|
||||
B450109D2C0FCD9F00619044 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B450109B2C0FCD8A00619044 /* Utilities.swift */; };
|
||||
B450109F2C0FCDA500619044 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B450109B2C0FCD8A00619044 /* Utilities.swift */; };
|
||||
B45010A62C1507DE00619044 /* CustomSegmentedControlManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B45010A52C1507DE00619044 /* CustomSegmentedControlManager.m */; };
|
||||
B4549F362B82B10D002E3153 /* ci_post_clone.sh in Resources */ = {isa = PBXBuildFile; fileRef = B4549F352B82B10D002E3153 /* ci_post_clone.sh */; };
|
||||
B45942C42CDECF2400B3DC2E /* MenuElementsEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = B4C075292CDDB3C500322A84 /* MenuElementsEmitter.m */; };
|
||||
B461B852299599F800E431AA /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = B461B851299599F800E431AA /* AppDelegate.mm */; };
|
||||
B4742E972CCDBE8300380EEE /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = B4742E962CCDBE8300380EEE /* Localizable.xcstrings */; };
|
||||
B4742E982CCDBE8300380EEE /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = B4742E962CCDBE8300380EEE /* Localizable.xcstrings */; };
|
||||
|
@ -156,13 +154,16 @@
|
|||
B4AB225E2B02AD12001F4328 /* XMLParserDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4AB225C2B02AD12001F4328 /* XMLParserDelegate.swift */; };
|
||||
B4B1A4622BFA73110072E3BB /* WidgetHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */; };
|
||||
B4B1A4642BFA73110072E3BB /* WidgetHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */; };
|
||||
B4B3EC222D69FF6C00327F3D /* CustomSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B3EC202D69FF6C00327F3D /* CustomSegmentedControl.swift */; };
|
||||
B4B3EC252D69FF8700327F3D /* EventEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B3EC232D69FF8700327F3D /* EventEmitter.swift */; };
|
||||
B4B3EC262D69FF8700327F3D /* MenuElementsEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B3EC242D69FF8700327F3D /* MenuElementsEmitter.swift */; };
|
||||
B4D0B2622C1DEA11006B6B1B /* ReceivePageInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2612C1DEA11006B6B1B /* ReceivePageInterfaceController.swift */; };
|
||||
B4D0B2642C1DEA99006B6B1B /* ReceiveType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2632C1DEA99006B6B1B /* ReceiveType.swift */; };
|
||||
B4D0B2662C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2652C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift */; };
|
||||
B4D0B2682C1DED67006B6B1B /* ReceiveMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4D0B2672C1DED67006B6B1B /* ReceiveMethod.swift */; };
|
||||
B4EE583C226703320003363C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B40D4E35225841ED00428FCC /* Assets.xcassets */; };
|
||||
B4EFF73B2C3F6C5E0095D655 /* MockData.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4EFF73A2C3F6C5E0095D655 /* MockData.swift */; };
|
||||
C978A716948AB7DEC5B6F677 /* (null) in Frameworks */ = {isa = PBXBuildFile; };
|
||||
C978A716948AB7DEC5B6F677 /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -294,8 +295,6 @@
|
|||
6D2A6463258BA92D0092292B /* Stickers.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Stickers.xcassets; sourceTree = "<group>"; };
|
||||
6D2A6465258BA92D0092292B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
6D2AA8072568B8F40090B089 /* FiatUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FiatUnit.swift; sourceTree = "<group>"; };
|
||||
6D32C5C42596CE2F008C077C /* EventEmitter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EventEmitter.h; sourceTree = "<group>"; };
|
||||
6D32C5C52596CE3A008C077C /* EventEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EventEmitter.m; sourceTree = "<group>"; };
|
||||
6D333B3A252FE1A3004D72DF /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
||||
6D333B3C252FE1A3004D72DF /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
||||
6D4AF18225D215D0009DD853 /* BlueWalletWatch-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BlueWalletWatch-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
|
@ -372,9 +371,8 @@
|
|||
B44033F82BCC379200162242 /* WidgetDataStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetDataStore.swift; sourceTree = "<group>"; };
|
||||
B44033FF2BCC37F800162242 /* Bundle+decode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+decode.swift"; sourceTree = "<group>"; };
|
||||
B440340E2BCC40A400162242 /* fiatUnits.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = fiatUnits.json; path = ../../../models/fiatUnits.json; sourceTree = "<group>"; };
|
||||
B44305BB2D6A04B2004675CC /* CustomSegmentedControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomSegmentedControl.m; sourceTree = "<group>"; };
|
||||
B450109B2C0FCD8A00619044 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
|
||||
B45010A52C1507DE00619044 /* CustomSegmentedControlManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomSegmentedControlManager.m; sourceTree = "<group>"; };
|
||||
B45010A92C15080500619044 /* CustomSegmentedControlManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomSegmentedControlManager.h; sourceTree = "<group>"; };
|
||||
B4549F352B82B10D002E3153 /* ci_post_clone.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ci_post_clone.sh; sourceTree = "<group>"; };
|
||||
B461B850299599F800E431AA /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = BlueWallet/AppDelegate.h; sourceTree = "<group>"; };
|
||||
B461B851299599F800E431AA /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = BlueWallet/AppDelegate.mm; sourceTree = "<group>"; };
|
||||
|
@ -396,8 +394,9 @@
|
|||
B4AB225C2B02AD12001F4328 /* XMLParserDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLParserDelegate.swift; sourceTree = "<group>"; };
|
||||
B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetHelper.swift; sourceTree = "<group>"; };
|
||||
B4B31A352C77BBA000663334 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Interface.strings; sourceTree = "<group>"; };
|
||||
B4C075282CDDB3BE00322A84 /* MenuElementsEmitter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MenuElementsEmitter.h; sourceTree = "<group>"; };
|
||||
B4C075292CDDB3C500322A84 /* MenuElementsEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MenuElementsEmitter.m; sourceTree = "<group>"; };
|
||||
B4B3EC202D69FF6C00327F3D /* CustomSegmentedControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSegmentedControl.swift; sourceTree = "<group>"; };
|
||||
B4B3EC232D69FF8700327F3D /* EventEmitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventEmitter.swift; sourceTree = "<group>"; };
|
||||
B4B3EC242D69FF8700327F3D /* MenuElementsEmitter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuElementsEmitter.swift; sourceTree = "<group>"; };
|
||||
B4D0B2612C1DEA11006B6B1B /* ReceivePageInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceivePageInterfaceController.swift; sourceTree = "<group>"; };
|
||||
B4D0B2632C1DEA99006B6B1B /* ReceiveType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveType.swift; sourceTree = "<group>"; };
|
||||
B4D0B2652C1DEB7F006B6B1B /* ReceiveInterfaceMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiveInterfaceMode.swift; sourceTree = "<group>"; };
|
||||
|
@ -427,7 +426,7 @@
|
|||
files = (
|
||||
782F075B5DD048449E2DECE9 /* libz.tbd in Frameworks */,
|
||||
764B49B1420D4AEB8109BF62 /* libsqlite3.0.tbd in Frameworks */,
|
||||
C978A716948AB7DEC5B6F677 /* (null) in Frameworks */,
|
||||
C978A716948AB7DEC5B6F677 /* BuildFile in Frameworks */,
|
||||
17CDA0718F42DB2CE856C872 /* libPods-BlueWallet.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -489,7 +488,6 @@
|
|||
13B07FAE1A68108700A75B9A /* BlueWallet */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B4C0752B2CDDB3CC00322A84 /* MenuElementsEmitter */,
|
||||
B461B850299599F800E431AA /* AppDelegate.h */,
|
||||
B461B851299599F800E431AA /* AppDelegate.mm */,
|
||||
32C7944323B8879D00BE2AFA /* BlueWalletRelease.entitlements */,
|
||||
|
@ -501,8 +499,6 @@
|
|||
32B5A3292334450100F8D608 /* Bridge.swift */,
|
||||
32B5A3282334450100F8D608 /* BlueWallet-Bridging-Header.h */,
|
||||
6DF25A9E249DB97E001D06F5 /* LaunchScreen.storyboard */,
|
||||
6D32C5C42596CE2F008C077C /* EventEmitter.h */,
|
||||
6D32C5C52596CE3A008C077C /* EventEmitter.m */,
|
||||
84E05A832721191B001A0D3A /* Settings.bundle */,
|
||||
B4742E962CCDBE8300380EEE /* Localizable.xcstrings */,
|
||||
);
|
||||
|
@ -786,6 +782,15 @@
|
|||
path = Shared;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B44305BD2D6A04B9004675CC /* SegmentedControl */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B44305BB2D6A04B2004675CC /* CustomSegmentedControl.m */,
|
||||
B4B3EC202D69FF6C00327F3D /* CustomSegmentedControl.swift */,
|
||||
);
|
||||
path = SegmentedControl;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B450109A2C0FCD7E00619044 /* Utilities */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -798,21 +803,14 @@
|
|||
B45010A12C1504E900619044 /* Components */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B44305BD2D6A04B9004675CC /* SegmentedControl */,
|
||||
B4B3EC232D69FF8700327F3D /* EventEmitter.swift */,
|
||||
B4B3EC242D69FF8700327F3D /* MenuElementsEmitter.swift */,
|
||||
B4B1A4612BFA73110072E3BB /* WidgetHelper.swift */,
|
||||
B45010A82C1507F000619044 /* SegmentedControl */,
|
||||
);
|
||||
path = Components;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B45010A82C1507F000619044 /* SegmentedControl */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B45010A52C1507DE00619044 /* CustomSegmentedControlManager.m */,
|
||||
B45010A92C15080500619044 /* CustomSegmentedControlManager.h */,
|
||||
);
|
||||
path = SegmentedControl;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B4549F2E2B80FEA1002E3153 /* ci_scripts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -829,15 +827,6 @@
|
|||
path = BlueWalletUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B4C0752B2CDDB3CC00322A84 /* MenuElementsEmitter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B4C075292CDDB3C500322A84 /* MenuElementsEmitter.m */,
|
||||
B4C075282CDDB3BE00322A84 /* MenuElementsEmitter.h */,
|
||||
);
|
||||
path = MenuElementsEmitter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FAA856B639C61E61D2CF90A8 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1239,28 +1228,29 @@
|
|||
B44033EE2BCC374500162242 /* Numeric+abbreviated.swift in Sources */,
|
||||
B48630E82CCEE92400A8425C /* PriceWidget.swift in Sources */,
|
||||
B44033DD2BCC36C300162242 /* LatestTransaction.swift in Sources */,
|
||||
6D32C5C62596CE3A008C077C /* EventEmitter.m in Sources */,
|
||||
B49A28C12CD199FC006B08E4 /* SwiftTCPClient.swift in Sources */,
|
||||
B44033FE2BCC37D700162242 /* MarketAPI.swift in Sources */,
|
||||
B450109C2C0FCD8A00619044 /* Utilities.swift in Sources */,
|
||||
B48630E52CCEE8B800A8425C /* PriceView.swift in Sources */,
|
||||
B48630E72CCEE91900A8425C /* PriceWidgetProvider.swift in Sources */,
|
||||
B4B3EC252D69FF8700327F3D /* EventEmitter.swift in Sources */,
|
||||
B4B3EC262D69FF8700327F3D /* MenuElementsEmitter.swift in Sources */,
|
||||
B49A28C02CD199C7006B08E4 /* MarketAPI+Electrum.swift in Sources */,
|
||||
B48630ED2CCEEEB000A8425C /* WalletAppShortcuts.swift in Sources */,
|
||||
B45010A62C1507DE00619044 /* CustomSegmentedControlManager.m in Sources */,
|
||||
B44033CE2BCC352900162242 /* UserDefaultsGroup.swift in Sources */,
|
||||
13B07FC11A68108700A75B9A /* main.m in Sources */,
|
||||
B45942C42CDECF2400B3DC2E /* MenuElementsEmitter.m in Sources */,
|
||||
B461B852299599F800E431AA /* AppDelegate.mm in Sources */,
|
||||
B44033F42BCC377F00162242 /* WidgetData.swift in Sources */,
|
||||
B49A28C52CD1A894006B08E4 /* MarketData.swift in Sources */,
|
||||
B49A28BF2CD18A9A006B08E4 /* FiatUnitEnum.swift in Sources */,
|
||||
B44305BC2D6A04B2004675CC /* CustomSegmentedControl.m in Sources */,
|
||||
B44033C42BCC332400162242 /* Balance.swift in Sources */,
|
||||
B48630EE2CCEEEE900A8425C /* PriceIntent.swift in Sources */,
|
||||
B44034072BCC38A000162242 /* FiatUnit.swift in Sources */,
|
||||
B44034002BCC37F800162242 /* Bundle+decode.swift in Sources */,
|
||||
B44033E22BCC36CB00162242 /* Placeholders.swift in Sources */,
|
||||
B4793DBB2CEDACBD00C92C2E /* Chain.swift in Sources */,
|
||||
B4B3EC222D69FF6C00327F3D /* CustomSegmentedControl.swift in Sources */,
|
||||
B4B1A4622BFA73110072E3BB /* WidgetHelper.swift in Sources */,
|
||||
B48630E12CCEE7C800A8425C /* PriceWidgetEntryView.swift in Sources */,
|
||||
B44033DA2BCC369A00162242 /* Colors.swift in Sources */,
|
||||
|
|
|
@ -6,12 +6,9 @@
|
|||
#import "RNQuickActionManager.h"
|
||||
#import <UserNotifications/UserNotifications.h>
|
||||
#import <RNCPushNotificationIOS.h>
|
||||
#import "EventEmitter.h"
|
||||
#import "MenuElementsEmitter.h"
|
||||
#import <React/RCTRootView.h>
|
||||
#import <Bugsnag/Bugsnag.h>
|
||||
#import "BlueWallet-Swift.h"
|
||||
#import "CustomSegmentedControlManager.h"
|
||||
|
||||
@interface AppDelegate() <UNUserNotificationCenterDelegate>
|
||||
|
||||
|
@ -24,7 +21,6 @@
|
|||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
[MenuElementsEmitter sharedInstance];
|
||||
[CustomSegmentedControlManager registerIfNecessary];
|
||||
[self clearFilesIfNeeded];
|
||||
self.userDefaultsGroup = [[NSUserDefaults alloc] initWithSuiteName:@"group.io.bluewallet.bluewallet"];
|
||||
|
||||
|
@ -171,8 +167,8 @@
|
|||
[userActivity.activityType isEqualToString:@"io.bluewallet.bluewallet.xpub"] ||
|
||||
[userActivity.activityType isEqualToString:@"io.bluewallet.bluewallet.blockexplorer"]) {
|
||||
|
||||
if ([EventEmitter.sharedInstance respondsToSelector:@selector(sendUserActivity:)]) {
|
||||
[EventEmitter.sharedInstance sendUserActivity:userActivityData];
|
||||
if ([EventEmitter.shared respondsToSelector:@selector(sendUserActivity:)]) {
|
||||
[EventEmitter.shared sendUserActivity:userActivityData];
|
||||
} else {
|
||||
NSLog(@"[Handoff] EventEmitter does not implement sendUserActivity:");
|
||||
}
|
||||
|
@ -210,7 +206,7 @@
|
|||
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
|
||||
{
|
||||
NSDictionary *userInfo = notification.request.content.userInfo;
|
||||
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);
|
||||
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionList | UNNotificationPresentationOptionBanner | UNNotificationPresentationOptionBadge);
|
||||
}
|
||||
|
||||
- (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder {
|
||||
|
@ -259,24 +255,21 @@
|
|||
}
|
||||
|
||||
- (void)openSettings:(UIKeyCommand *)keyCommand {
|
||||
[MenuElementsEmitter.sharedInstance openSettings];
|
||||
[MenuElementsEmitter.shared openSettings];
|
||||
}
|
||||
|
||||
- (void)addWalletAction:(UIKeyCommand *)keyCommand {
|
||||
// Implement the functionality for adding a wallet
|
||||
[MenuElementsEmitter.sharedInstance addWalletMenuAction];
|
||||
[MenuElementsEmitter.shared addWalletMenuAction];
|
||||
NSLog(@"Add Wallet action performed");
|
||||
}
|
||||
|
||||
- (void)importWalletAction:(UIKeyCommand *)keyCommand {
|
||||
// Implement the functionality for adding a wallet
|
||||
[MenuElementsEmitter.sharedInstance importWalletMenuAction];
|
||||
[MenuElementsEmitter.shared importWalletMenuAction];
|
||||
NSLog(@"Import Wallet action performed");
|
||||
}
|
||||
|
||||
- (void)reloadTransactionsAction:(UIKeyCommand *)keyCommand {
|
||||
// Implement the functionality for adding a wallet
|
||||
[MenuElementsEmitter.sharedInstance reloadTransactionsMenuAction];
|
||||
[MenuElementsEmitter.shared reloadTransactionsMenuAction];
|
||||
NSLog(@"Reload Transactions action performed");
|
||||
}
|
||||
|
||||
|
|
32
ios/Components/EventEmitter.swift
Normal file
32
ios/Components/EventEmitter.swift
Normal file
|
@ -0,0 +1,32 @@
|
|||
import Foundation
|
||||
import React
|
||||
|
||||
@objc(EventEmitter)
|
||||
class EventEmitter: RCTEventEmitter {
|
||||
static let sharedInstance = EventEmitter()
|
||||
|
||||
override class func requiresMainQueueSetup() -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@objc static func shared() -> EventEmitter {
|
||||
return sharedInstance
|
||||
}
|
||||
|
||||
override func supportedEvents() -> [String]! {
|
||||
return ["onUserActivityOpen"]
|
||||
}
|
||||
|
||||
@objc func sendUserActivity(_ userInfo: [String: Any]) {
|
||||
sendEvent(withName: "onUserActivityOpen", body: userInfo)
|
||||
}
|
||||
|
||||
@objc func getMostRecentUserActivity(_ resolve: @escaping RCTPromiseResolveBlock,
|
||||
rejecter reject: RCTPromiseRejectBlock) {
|
||||
if let defaults = UserDefaults(suiteName: "group.io.bluewallet.bluewallet") {
|
||||
resolve(defaults.value(forKey: "onUserActivityOpen"))
|
||||
} else {
|
||||
resolve(nil)
|
||||
}
|
||||
}
|
||||
}
|
35
ios/Components/MenuElementsEmitter.swift
Normal file
35
ios/Components/MenuElementsEmitter.swift
Normal file
|
@ -0,0 +1,35 @@
|
|||
import Foundation
|
||||
import React
|
||||
|
||||
@objc(MenuElementsEmitter)
|
||||
class MenuElementsEmitter: RCTEventEmitter {
|
||||
static let sharedInstance = MenuElementsEmitter()
|
||||
|
||||
override class func requiresMainQueueSetup() -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override func supportedEvents() -> [String]! {
|
||||
return ["openSettings", "addWalletMenuAction", "importWalletMenuAction", "reloadTransactionsMenuAction"]
|
||||
}
|
||||
|
||||
@objc static func shared() -> MenuElementsEmitter {
|
||||
return sharedInstance
|
||||
}
|
||||
|
||||
@objc func openSettings() {
|
||||
sendEvent(withName: "openSettings", body: nil)
|
||||
}
|
||||
|
||||
@objc func addWalletMenuAction() {
|
||||
sendEvent(withName: "addWalletMenuAction", body: nil)
|
||||
}
|
||||
|
||||
@objc func importWalletMenuAction() {
|
||||
sendEvent(withName: "importWalletMenuAction", body: nil)
|
||||
}
|
||||
|
||||
@objc func reloadTransactionsMenuAction() {
|
||||
sendEvent(withName: "reloadTransactionsMenuAction", body: nil)
|
||||
}
|
||||
}
|
9
ios/Components/SegmentedControl/CustomSegmentedControl.m
Normal file
9
ios/Components/SegmentedControl/CustomSegmentedControl.m
Normal file
|
@ -0,0 +1,9 @@
|
|||
#import <React/RCTViewManager.h>
|
||||
|
||||
@interface RCT_EXTERN_MODULE(CustomSegmentedControlManager, RCTViewManager)
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(values, NSArray)
|
||||
RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSNumber)
|
||||
RCT_EXPORT_VIEW_PROPERTY(onChangeEvent, RCTDirectEventBlock)
|
||||
|
||||
@end
|
70
ios/Components/SegmentedControl/CustomSegmentedControl.swift
Normal file
70
ios/Components/SegmentedControl/CustomSegmentedControl.swift
Normal file
|
@ -0,0 +1,70 @@
|
|||
import UIKit
|
||||
import React
|
||||
|
||||
class CustomSegmentedControl: UISegmentedControl {
|
||||
@objc var onChangeEvent: RCTDirectEventBlock?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
addTarget(self, action: #selector(onChange(_:)), for: .valueChanged)
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
addTarget(self, action: #selector(onChange(_:)), for: .valueChanged)
|
||||
}
|
||||
|
||||
@objc func setValues(_ values: [String]) {
|
||||
removeAllSegments()
|
||||
for (index, title) in values.enumerated() {
|
||||
insertSegment(withTitle: title, at: index, animated: false)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func setSelectedIndex(_ selectedIndex: NSNumber) {
|
||||
self.selectedSegmentIndex = selectedIndex.intValue
|
||||
}
|
||||
|
||||
@objc func onChange(_ sender: UISegmentedControl) {
|
||||
onChangeEvent?(["selectedIndex": sender.selectedSegmentIndex])
|
||||
}
|
||||
}
|
||||
|
||||
@objc(CustomSegmentedControlManager)
|
||||
class CustomSegmentedControlManager: RCTViewManager {
|
||||
static var isRegistered = false
|
||||
|
||||
override func view() -> UIView! {
|
||||
// Ensure native module is registered before returning the view.
|
||||
CustomSegmentedControlManager.registerIfNecessary()
|
||||
return CustomSegmentedControl(frame: .zero)
|
||||
}
|
||||
|
||||
@objc static func registerIfNecessary() {
|
||||
if !isRegistered {
|
||||
isRegistered = true
|
||||
}
|
||||
}
|
||||
|
||||
// Changed from static to instance method.
|
||||
override func constantsToExport() -> [AnyHashable: Any]! {
|
||||
return [
|
||||
"bubblingEventTypes": [
|
||||
"onChangeEvent": [
|
||||
"phasedRegistrationNames": [
|
||||
"bubbled": "onChangeEvent",
|
||||
"captured": "onChangeEventCapture"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
override class func moduleName() -> String! {
|
||||
return "CustomSegmentedControl"
|
||||
}
|
||||
|
||||
override class func requiresMainQueueSetup() -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
//
|
||||
// SegmentedControlManager.h
|
||||
// BlueWallet
|
||||
//
|
||||
// Created by Marcos Rodriguez on 6/8/24.
|
||||
// Copyright © 2024 BlueWallet. All rights reserved.
|
||||
//
|
||||
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
@interface CustomSegmentedControlManager : RCTViewManager
|
||||
|
||||
+ (void)registerIfNecessary;
|
||||
|
||||
@end
|
|
@ -1,70 +0,0 @@
|
|||
#import "CustomSegmentedControlManager.h"
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTEventDispatcher.h>
|
||||
#import <React/UIView+React.h>
|
||||
|
||||
@interface CustomSegmentedControl : UISegmentedControl
|
||||
@property (nonatomic, copy) RCTDirectEventBlock onChangeEvent;
|
||||
- (void)setValues:(NSArray<NSString *> *)values;
|
||||
- (void)setSelectedIndex:(NSNumber *)selectedIndex;
|
||||
@end
|
||||
|
||||
@implementation CustomSegmentedControl
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self addTarget:self action:@selector(onChange:) forControlEvents:UIControlEventValueChanged];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setValues:(NSArray<NSString *> *)values {
|
||||
@try {
|
||||
[self removeAllSegments];
|
||||
for (NSUInteger i = 0; i < values.count; i++) {
|
||||
[self insertSegmentWithTitle:values[i] atIndex:i animated:NO];
|
||||
}
|
||||
} @catch (NSException *exception) {
|
||||
NSLog(@"Error setting property 'values': %@", exception.reason);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSelectedIndex:(NSNumber *)selectedIndex {
|
||||
@try {
|
||||
self.selectedSegmentIndex = selectedIndex.integerValue;
|
||||
} @catch (NSException *exception) {
|
||||
NSLog(@"Error setting property 'selectedIndex': %@", exception.reason);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onChange:(UISegmentedControl *)sender {
|
||||
if (self.onChangeEvent) {
|
||||
self.onChangeEvent(@{@"selectedIndex": @(self.selectedSegmentIndex)});
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CustomSegmentedControlManager
|
||||
|
||||
static BOOL isRegistered = NO;
|
||||
|
||||
RCT_EXPORT_MODULE(CustomSegmentedControl)
|
||||
|
||||
- (UIView *)view {
|
||||
return [CustomSegmentedControl new];
|
||||
}
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(values, NSArray)
|
||||
RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSNumber)
|
||||
RCT_EXPORT_VIEW_PROPERTY(onChangeEvent, RCTDirectEventBlock)
|
||||
|
||||
+ (void)registerIfNecessary {
|
||||
if (!isRegistered) {
|
||||
isRegistered = YES;
|
||||
// Registration logic if necessary
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,17 +0,0 @@
|
|||
//
|
||||
// EventEmitter.h
|
||||
// BlueWallet
|
||||
//
|
||||
// Created by Marcos Rodriguez on 12/25/20.
|
||||
// Copyright © 2020 BlueWallet. All rights reserved.
|
||||
//
|
||||
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <React/RCTEventEmitter.h>
|
||||
|
||||
@interface EventEmitter : RCTEventEmitter <RCTBridgeModule>
|
||||
|
||||
+ (EventEmitter *)sharedInstance;
|
||||
- (void)sendUserActivity:(NSDictionary *)userInfo;
|
||||
|
||||
@end
|
|
@ -1,62 +0,0 @@
|
|||
//
|
||||
// EventEmitter.m
|
||||
// BlueWallet
|
||||
//
|
||||
// Created by Marcos Rodriguez on 12/25/20.
|
||||
// Copyright © 2020 BlueWallet. All rights reserved.
|
||||
//
|
||||
|
||||
#import "EventEmitter.h"
|
||||
|
||||
static EventEmitter *sharedInstance;
|
||||
|
||||
@implementation EventEmitter
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
+ (BOOL)requiresMainQueueSetup {
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (instancetype)sharedInstance {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[self alloc] init];
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (void)removeListeners:(double)count {
|
||||
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents {
|
||||
return @[@"onUserActivityOpen"];
|
||||
}
|
||||
|
||||
- (void)sendUserActivity:(NSDictionary *)userInfo
|
||||
{
|
||||
if (![userInfo isKindOfClass:[NSDictionary class]]) {
|
||||
NSLog(@"[EventEmitter] Invalid user activity data: %@", userInfo);
|
||||
return;
|
||||
}
|
||||
@try {
|
||||
[self sendEventWithName:@"onUserActivityOpen" body:userInfo];
|
||||
} @catch (NSException *exception) {
|
||||
NSLog(@"[EventEmitter] Exception while sending event: %@", exception);
|
||||
}
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(getMostRecentUserActivity:(RCTPromiseResolveBlock)resolve
|
||||
rejecter:(RCTPromiseRejectBlock)reject)
|
||||
{
|
||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.io.bluewallet.bluewallet"];
|
||||
resolve([defaults valueForKey:@"onUserActivityOpen"]);
|
||||
}
|
||||
|
||||
@end
|
33
ios/EventEmitter.swift
Normal file
33
ios/EventEmitter.swift
Normal file
|
@ -0,0 +1,33 @@
|
|||
import Foundation
|
||||
import React
|
||||
|
||||
@objc(EventEmitter)
|
||||
class EventEmitter: RCTEventEmitter {
|
||||
static let sharedInstance = EventEmitter()
|
||||
|
||||
override class func requiresMainQueueSetup() -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@objc static func shared() -> EventEmitter {
|
||||
return sharedInstance
|
||||
}
|
||||
|
||||
override func supportedEvents() -> [String]! {
|
||||
return ["onUserActivityOpen"]
|
||||
}
|
||||
|
||||
@objc func sendUserActivity(_ userInfo: [String: Any]) {
|
||||
// Removed unnecessary type check; directly sending the event with userInfo.
|
||||
sendEvent(withName: "onUserActivityOpen", body: userInfo)
|
||||
}
|
||||
|
||||
@objc func getMostRecentUserActivity(_ resolve: @escaping RCTPromiseResolveBlock,
|
||||
rejecter reject: RCTPromiseRejectBlock) {
|
||||
if let defaults = UserDefaults(suiteName: "group.io.bluewallet.bluewallet") {
|
||||
resolve(defaults.value(forKey: "onUserActivityOpen"))
|
||||
} else {
|
||||
resolve(nil)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
//
|
||||
// MenuElementsEmitter.h
|
||||
// BlueWallet
|
||||
//
|
||||
|
||||
#import <React/RCTEventEmitter.h>
|
||||
|
||||
@interface MenuElementsEmitter : RCTEventEmitter
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (void)openSettings;
|
||||
- (void)addWalletMenuAction;
|
||||
- (void)importWalletMenuAction;
|
||||
- (void)reloadTransactionsMenuAction;
|
||||
|
||||
@end
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// MenuElementsEmitter.h
|
||||
// BlueWallet
|
||||
//
|
||||
// Created by Marcos Rodriguez on 11/7/24.
|
||||
// Copyright © 2024 BlueWallet. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// MenuElementsEmitter.h
|
||||
// BlueWallet
|
||||
//
|
||||
|
||||
#import <React/RCTEventEmitter.h>
|
||||
|
||||
@interface MenuElementsEmitter : RCTEventEmitter
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (void)openSettings;
|
||||
- (void)addWalletMenuAction;
|
||||
- (void)importWalletMenuAction;
|
||||
- (void)reloadTransactionsMenuAction;
|
||||
- (NSArray<NSString *> *)supportedEvents;
|
||||
|
||||
@end
|
|
@ -1,62 +0,0 @@
|
|||
//
|
||||
// MenuElementsEmitter.m
|
||||
// BlueWallet
|
||||
//
|
||||
// Created by Marcos Rodriguez on 11/7/24.
|
||||
// Copyright © 2024 BlueWallet. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MenuElementsEmitter.h"
|
||||
|
||||
static MenuElementsEmitter *sharedInstance;
|
||||
|
||||
@implementation MenuElementsEmitter
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
+ (BOOL)requiresMainQueueSetup {
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (instancetype)sharedInstance {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[self alloc] init];
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
sharedInstance = self;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents {
|
||||
return @[
|
||||
@"openSettings",
|
||||
@"addWalletMenuAction",
|
||||
@"importWalletMenuAction",
|
||||
@"reloadTransactionsMenuAction"
|
||||
];
|
||||
}
|
||||
|
||||
- (void)openSettings {
|
||||
[self sendEventWithName:@"openSettings" body:nil];
|
||||
}
|
||||
|
||||
- (void)addWalletMenuAction {
|
||||
[self sendEventWithName:@"addWalletMenuAction" body:nil];
|
||||
}
|
||||
|
||||
- (void)importWalletMenuAction {
|
||||
[self sendEventWithName:@"importWalletMenuAction" body:nil];
|
||||
}
|
||||
|
||||
- (void)reloadTransactionsMenuAction {
|
||||
[self sendEventWithName:@"reloadTransactionsMenuAction" body:nil];
|
||||
}
|
||||
|
||||
@end
|
35
ios/MenuElementsEmitter/MenuElementsEmitter.swift
Normal file
35
ios/MenuElementsEmitter/MenuElementsEmitter.swift
Normal file
|
@ -0,0 +1,35 @@
|
|||
import Foundation
|
||||
import React
|
||||
|
||||
@objc(MenuElementsEmitter)
|
||||
class MenuElementsEmitter: RCTEventEmitter {
|
||||
static let sharedInstance = MenuElementsEmitter()
|
||||
|
||||
override class func requiresMainQueueSetup() -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override func supportedEvents() -> [String]! {
|
||||
return ["openSettings", "addWalletMenuAction", "importWalletMenuAction", "reloadTransactionsMenuAction"]
|
||||
}
|
||||
|
||||
@objc static func shared() -> MenuElementsEmitter {
|
||||
return sharedInstance
|
||||
}
|
||||
|
||||
@objc func openSettings() {
|
||||
sendEvent(withName: "openSettings", body: nil)
|
||||
}
|
||||
|
||||
@objc func addWalletMenuAction() {
|
||||
sendEvent(withName: "addWalletMenuAction", body: nil)
|
||||
}
|
||||
|
||||
@objc func importWalletMenuAction() {
|
||||
sendEvent(withName: "importWalletMenuAction", body: nil)
|
||||
}
|
||||
|
||||
@objc func reloadTransactionsMenuAction() {
|
||||
sendEvent(withName: "reloadTransactionsMenuAction", body: nil)
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue