mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-23 15:20:55 +01:00
Merge pull request #702 from BlueWallet/watchfix
FIX: Lightning wallet was not shown on Watch app
This commit is contained in:
commit
e1ea86d132
7 changed files with 28 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
|||
import * as watch from 'react-native-watch-connectivity';
|
||||
import * as Watch from 'react-native-watch-connectivity';
|
||||
import { InteractionManager, Platform } from 'react-native';
|
||||
const loc = require('./loc');
|
||||
export default class WatchConnectivity {
|
||||
|
@ -13,13 +13,13 @@ export default class WatchConnectivity {
|
|||
|
||||
getIsWatchAppInstalled() {
|
||||
if (Platform.OS !== 'ios') return;
|
||||
watch.getIsWatchAppInstalled((err, isAppInstalled) => {
|
||||
Watch.getIsWatchAppInstalled((err, isAppInstalled) => {
|
||||
if (!err) {
|
||||
this.isAppInstalled = isAppInstalled;
|
||||
this.sendWalletsToWatch();
|
||||
}
|
||||
});
|
||||
watch.subscribeToMessages(async (err, message, reply) => {
|
||||
Watch.subscribeToMessages(async (err, message, reply) => {
|
||||
if (!err) {
|
||||
if (message.request === 'createInvoice') {
|
||||
const createInvoiceRequest = await this.handleLightningInvoiceCreateRequest(
|
||||
|
@ -57,7 +57,8 @@ export default class WatchConnectivity {
|
|||
let receiveAddress = '';
|
||||
if (wallet.allowReceive()) {
|
||||
if (wallet.getAddressAsync) {
|
||||
receiveAddress = await wallet.getAddressAsync();
|
||||
await wallet.getAddressAsync();
|
||||
receiveAddress = wallet.getAddress();
|
||||
} else {
|
||||
receiveAddress = wallet.getAddress();
|
||||
}
|
||||
|
@ -130,7 +131,7 @@ export default class WatchConnectivity {
|
|||
});
|
||||
}
|
||||
|
||||
watch.updateApplicationContext({ wallets });
|
||||
Watch.updateApplicationContext({ wallets });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,13 +6,9 @@
|
|||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
@import WatchConnectivity;
|
||||
@class WatchBridge;
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate, WCSessionDelegate>
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIWindow *window;
|
||||
@property(nonatomic, strong) WatchBridge *watchBridge;
|
||||
@property(nonatomic, strong) WCSession *session;
|
||||
|
||||
@end
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#else
|
||||
#import "RNSentry.h" // This is used for versions of react < 0.40
|
||||
#endif
|
||||
#import "WatchBridge.h"
|
||||
#import <AppCenterReactNativeShared/AppCenterReactNativeShared.h>
|
||||
#import <AppCenterReactNative.h>
|
||||
#import <AppCenterReactNativeAnalytics.h>
|
||||
|
@ -44,10 +43,6 @@
|
|||
rootViewController.view = rootView;
|
||||
self.window.rootViewController = rootViewController;
|
||||
[self.window makeKeyAndVisible];
|
||||
self.watchBridge = [WatchBridge shared];
|
||||
self.session = self.watchBridge.session;
|
||||
[self.session activateSession];
|
||||
self.session.delegate = self;
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -59,18 +54,4 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (void)sessionDidDeactivate:(WCSession *)session {
|
||||
[session activateSession];
|
||||
}
|
||||
|
||||
- (void)session:(nonnull WCSession *)session activationDidCompleteWithState:(WCSessionActivationState)activationState error:(nullable NSError *)error {
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void)sessionDidBecomeInactive:(nonnull WCSession *)session {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -104,6 +104,8 @@ PODS:
|
|||
- React
|
||||
- react-native-slider (2.0.0-rc.1):
|
||||
- React
|
||||
- react-native-watch-connectivity (0.3.2):
|
||||
- React
|
||||
- react-native-webview (6.9.0):
|
||||
- React
|
||||
- React-RCTActionSheet (0.60.5):
|
||||
|
@ -153,8 +155,6 @@ PODS:
|
|||
- React
|
||||
- RNVectorIcons (6.6.0):
|
||||
- React
|
||||
- RNWatch (0.2.1):
|
||||
- React
|
||||
- Sentry (4.1.3):
|
||||
- Sentry/Core (= 4.1.3)
|
||||
- Sentry/Core (4.1.3)
|
||||
|
@ -193,6 +193,7 @@ DEPENDENCIES:
|
|||
- react-native-image-picker (from `../node_modules/react-native-image-picker`)
|
||||
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
|
||||
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
|
||||
- react-native-watch-connectivity (from `../node_modules/react-native-watch-connectivity`)
|
||||
- react-native-webview (from `../node_modules/react-native-webview`)
|
||||
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
|
||||
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
|
||||
|
@ -216,7 +217,6 @@ DEPENDENCIES:
|
|||
- RNShare (from `../node_modules/react-native-share`)
|
||||
- RNSVG (from `../node_modules/react-native-svg`)
|
||||
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
|
||||
- RNWatch (from `../node_modules/react-native-watch-connectivity`)
|
||||
- SentryReactNative (from `../node_modules/react-native-sentry`)
|
||||
- TcpSockets (from `../node_modules/react-native-tcp`)
|
||||
- ToolTipMenu (from `../node_modules/react-native-tooltip`)
|
||||
|
@ -279,6 +279,8 @@ EXTERNAL SOURCES:
|
|||
:path: "../node_modules/react-native-randombytes"
|
||||
react-native-slider:
|
||||
:path: "../node_modules/@react-native-community/slider"
|
||||
react-native-watch-connectivity:
|
||||
:path: "../node_modules/react-native-watch-connectivity"
|
||||
react-native-webview:
|
||||
:path: "../node_modules/react-native-webview"
|
||||
React-RCTActionSheet:
|
||||
|
@ -325,8 +327,6 @@ EXTERNAL SOURCES:
|
|||
:path: "../node_modules/react-native-svg"
|
||||
RNVectorIcons:
|
||||
:path: "../node_modules/react-native-vector-icons"
|
||||
RNWatch:
|
||||
:path: "../node_modules/react-native-watch-connectivity"
|
||||
SentryReactNative:
|
||||
:path: "../node_modules/react-native-sentry"
|
||||
TcpSockets:
|
||||
|
@ -365,6 +365,7 @@ SPEC CHECKSUMS:
|
|||
react-native-image-picker: 3637d63fef7e32a230141ab4660d3ceb773c824f
|
||||
react-native-randombytes: 991545e6eaaf700b4ee384c291ef3d572e0b2ca8
|
||||
react-native-slider: 6d83f7b8076a84e965a43fbdcfcf9dac19cea42e
|
||||
react-native-watch-connectivity: 5333c7054ff667130fd93f504a3d6bb35e87cabd
|
||||
react-native-webview: f72ac4078e115dfa741cc588acb1cca25566457d
|
||||
React-RCTActionSheet: b0f1ea83f4bf75fb966eae9bfc47b78c8d3efd90
|
||||
React-RCTAnimation: 359ba1b5690b1e87cc173558a78e82d35919333e
|
||||
|
@ -388,7 +389,6 @@ SPEC CHECKSUMS:
|
|||
RNShare: 8b171d4b43c1d886917fdd303bf7a4b87167b05c
|
||||
RNSVG: 0eb087cfb5d7937be93c45b163b26352a647e681
|
||||
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
|
||||
RNWatch: c2d3bff3adf9ce06e10eb8c2d75c9043f5df0e35
|
||||
Sentry: 4e8a17b61ddd116f89536cc81d567fdee1ebca96
|
||||
SentryReactNative: 07237139c00366ea2e75ae3e5c566e7a71c27a90
|
||||
swift_qrcodejs: 4d024fc98b0778b804ec6a5c810880fd092aec9d
|
||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -11474,9 +11474,9 @@
|
|||
}
|
||||
},
|
||||
"react-native-watch-connectivity": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/react-native-watch-connectivity/-/react-native-watch-connectivity-0.2.1.tgz",
|
||||
"integrity": "sha512-PVuLRHE3kXVvY92lIo7pko/GYDIgI3STtzzUhNMrR/2DEGuoNDw18SvkTkkw+Npz1VazK34I41qMDZV7jQvP1g=="
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/react-native-watch-connectivity/-/react-native-watch-connectivity-0.3.2.tgz",
|
||||
"integrity": "sha512-NA8XHZ31i7wE1MvuOiZqk93EOl/YgvXW0g0TU7/O701QPMkUhzRWlLJxOa9opcgYLLZ6VlvvhdxJ7ZMntreJKQ=="
|
||||
},
|
||||
"react-native-webview": {
|
||||
"version": "6.9.0",
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
"preset": "react-native",
|
||||
"transform": {
|
||||
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
|
||||
}
|
||||
},
|
||||
"setupFiles": [
|
||||
"./tests/setup.js"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/preset-env": "7.5.0",
|
||||
|
@ -114,7 +117,7 @@
|
|||
"react-native-tcp": "git+https://github.com/aprock/react-native-tcp.git",
|
||||
"react-native-tooltip": "git+https://github.com/marcosrdz/react-native-tooltip.git",
|
||||
"react-native-vector-icons": "6.6.0",
|
||||
"react-native-watch-connectivity": "0.2.1",
|
||||
"react-native-watch-connectivity": "0.3.2",
|
||||
"react-native-webview": "6.9.0",
|
||||
"react-navigation": "3.11.0",
|
||||
"react-test-render": "1.1.2",
|
||||
|
|
7
tests/setup.js
Normal file
7
tests/setup.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
jest.mock('react-native-watch-connectivity', () => {
|
||||
return {
|
||||
getIsWatchAppInstalled: jest.fn(),
|
||||
subscribeToMessages: jest.fn(),
|
||||
updateApplicationContext: jest.fn(),
|
||||
}
|
||||
})
|
Loading…
Add table
Reference in a new issue