Skip to content

Commit

Permalink
Merge master to shubham/wiring-up-endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamkmr04 committed May 17, 2024
1 parent 8c4d6d2 commit 3260fdd
Show file tree
Hide file tree
Showing 196 changed files with 2,600 additions and 1,726 deletions.
709 changes: 699 additions & 10 deletions App.tsx

Large diffs are not rendered by default.

495 changes: 0 additions & 495 deletions Navigation.ts

This file was deleted.

13 changes: 8 additions & 5 deletions NavigationService.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { NavigationActions } from 'react-navigation';
import {
CommonActions,
NavigationContainerRef
} from '@react-navigation/native';

let _navigator;
let _navigator: NavigationContainerRef<{}>;

function setTopLevelNavigator(navigatorRef) {
function setTopLevelNavigator(navigatorRef: NavigationContainerRef<{}>) {
_navigator = navigatorRef;
}

function navigate(routeName: string, params?: any) {
_navigator.dispatch(
NavigationActions.navigate({
routeName,
CommonActions.navigate({
name: routeName,
params
})
);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Reproducible builds are available for Android only right now. You'll need Docker
2. Change to the zeus directory: `cd zeus`
3. Execute the build script: `./build.sh`
4. If everything goes well, the script will print a list of all the generated APK files and SHA256 hashes for each one of them: armv7, armv8, x86, x86_64, universal. The equivalent to the one provided in the web page is the one ending in 'universal'. You can compare SHA256 hashes with the ones provided on the [GitHub releases page](https://github.com/ZeusLN/zeus/releases)
5. Download the oficial APK from [GitHub releases page](https://github.com/ZeusLN/zeus/releases) or from the [ZEUS homepage](https://zeusln.com/): `wget https://zeusln.com/zeus-v0.8.0-universal.apk`
5. Download the official APK from [GitHub releases page](https://github.com/ZeusLN/zeus/releases) or from the [ZEUS homepage](https://zeusln.com/): `wget https://zeusln.com/zeus-v0.8.0-universal.apk`
6. Compare both APKs with a suitable utility like `diffoscope`, `apksigcopier` or by running `diff --brief --recursive ./unpacked_oficial_apk ./unpacked_built_apk`. You should only get differences for the certificates used to sign the official APK

If you want to install the APK built this way onto your own smartphone, you'll need to sign it yourself (see next section). Note that the first time you install a build made using this procedure, you'll need to uninstall your current version of ZEUS and then install the one built here because certificates will not match. You'll lose your connection details and you'll need to reconfigure ZEUS again to connect to your nodes.
Expand Down
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 84
versionName "0.9.0-alpha3"
versionName "0.9.0-alpha4"
multiDexEnabled true
missingDimensionStrategy 'react-native-camera', 'general'
}
Expand Down Expand Up @@ -191,8 +191,8 @@ dependencies {
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01'
implementation files("../../node_modules/react-native-tor/android/libs/sifir_android.aar")
// gif
implementation 'com.facebook.fresco:fresco:2.6.0'
implementation 'com.facebook.fresco:animated-gif:2.6.0'
implementation 'com.facebook.fresco:fresco:3.1.3'
implementation 'com.facebook.fresco:animated-gif:3.1.3'

// Pegasus
// implementation(name:"Lndmobile", ext:"aar")
Expand Down
21 changes: 20 additions & 1 deletion android/app/src/main/java/com/zeus/LndMobile.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,17 @@ public void stopLnd(Promise promise) {
}

@ReactMethod
public void gossipSync(String networkType, Promise promise) {
public void gossipSync(String serviceUrl, String networkType, Promise promise) {
int req = new Random().nextInt();
requests.put(req, promise);

Message message = Message.obtain(null, LndMobileService.MSG_GOSSIP_SYNC, req, 0);
message.replyTo = messenger;
Bundle bundle = new Bundle();
bundle.putString(
"serviceUrl",
serviceUrl
);
bundle.putString(
"networkType",
networkType
Expand All @@ -406,6 +410,21 @@ public void gossipSync(String networkType, Promise promise) {
}
}

@ReactMethod
public void cancelGossipSync(Promise promise) {
int req = new Random().nextInt();
requests.put(req, promise);

Message message = Message.obtain(null, LndMobileService.MSG_CANCEL_GOSSIP_SYNC, req, 0);
message.replyTo = messenger;

try {
lndMobileServiceMessenger.send(message);
} catch (RemoteException e) {
promise.reject(TAG, "Could not Send MSG_CANCEL_GOSSIP_SYNC to LndMobileService", e);
}
}

@ReactMethod
public void sendCommand(String method, String payloadStr, final Promise promise) {
int req = new Random().nextInt();
Expand Down
19 changes: 17 additions & 2 deletions android/app/src/main/java/com/zeus/LndMobileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public class LndMobileService extends Service {
static final int MSG_GRPC_STREAM_WRITE_RESULT = 22;
static final int MSG_GOSSIP_SYNC = 23;
static final int MSG_GOSSIP_SYNC_RESULT = 24;
static final int MSG_CANCEL_GOSSIP_SYNC = 25;
static final int MSG_CANCEL_GOSSIP_SYNC_RESULT = 26;

private Map<String, Method> syncMethods = new HashMap<>();
private Map<String, Method> streamMethods = new HashMap<>();
Expand Down Expand Up @@ -236,8 +238,13 @@ public void handleMessage(Message msg) {
break;

case MSG_GOSSIP_SYNC:
final String serviceUrl = bundle.getString("serviceUrl", "");
final String networkType = bundle.getString("networkType", "");
gossipSync(msg.replyTo, networkType, request);
gossipSync(msg.replyTo, serviceUrl, networkType, request);
break;

case MSG_CANCEL_GOSSIP_SYNC:
cancelGossipSync(msg.replyTo, request);
break;

case MSG_PING:
Expand Down Expand Up @@ -367,10 +374,11 @@ public void onResponse(byte[] bytes) {
}
}

void gossipSync(Messenger recipient, String networkType, int request) {
void gossipSync(Messenger recipient, String serviceUrl, String networkType, int request) {
Runnable gossipSync = new Runnable() {
public void run() {
Lndmobile.gossipSync(
serviceUrl,
getApplicationContext().getCacheDir().getAbsolutePath(),
getApplicationContext().getFilesDir().getAbsolutePath(),
networkType,
Expand Down Expand Up @@ -631,4 +639,11 @@ public void onResponse(byte[] bytes) {
}
);
}

private void cancelGossipSync(Messenger recipient, int request) {
if (notificationManager != null) {
notificationManager.cancelAll();
}
Lndmobile.cancelGossipSync();
}
}
4 changes: 0 additions & 4 deletions android/link-assets-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@
"path": "assets/images/SVG/Edit.svg",
"sha1": "1f6acf36aa5a17040c73377b528ed5b953a48850"
},
{
"path": "assets/images/SVG/Error.svg",
"sha1": "1bf7ab74cc3be1adca93c821e0c577374a2238de"
},
{
"path": "assets/images/SVG/ErrorIcon.svg",
"sha1": "05da1a652815c751b35361d0433742894988be0a"
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n
include ':lndmobile'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
include ':react-native-haptic-feedback'
project(':react-native-haptic-feedback').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-haptic-feedback/android')
5 changes: 0 additions & 5 deletions assets/images/SVG/Error.svg

This file was deleted.

2 changes: 1 addition & 1 deletion assets/images/SVG/ErrorIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion backends/EmbeddedLND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export default class EmbeddedLND extends LND {
expiry: data.expiry,
is_amp: data.is_amp,
is_private: data.private,
preimage: data.preimage
preimage: data.preimage,
route_hints: data.route_hints
});
getPayments = async () => await listPayments();
getNewAddress = async (data: any) =>
Expand Down
3 changes: 2 additions & 1 deletion backends/LND.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ export default class LND {
private: data.private,
r_preimage: data.preimage
? Base64Utils.hexToBase64(data.preimage)
: undefined
: undefined,
route_hints: data.route_hints
});
getPayments = () => this.getRequest('/v1/payments?include_incomplete=true');
getNewAddress = (data: any) => this.getRequest('/v1/newaddress', data);
Expand Down
3 changes: 2 additions & 1 deletion backends/LightningNodeConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ export default class LightningNodeConnect {
private: data.private,
r_preimage: data.preimage
? Base64Utils.hexToBase64(data.preimage)
: undefined
: undefined,
route_hints: data.route_hints
})
.then((data: lnrpc.AddInvoiceResponse) => snakeize(data));
getPayments = async () =>
Expand Down
8 changes: 5 additions & 3 deletions components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function Button(props: ButtonProps) {
? themeColor('highlight')
: secondary
? themeColor('secondary')
: warning
? themeColor('delete')
: themeColor('text'),
...buttonStyle
}}
Expand All @@ -101,9 +103,9 @@ function Button(props: ButtonProps) {
color: iconOnly
? textColor
: quaternary
? warning
? themeColor('warning')
: textColor
? textColor
: warning
? themeColor('text')
: secondary
? themeColor('highlight')
: themeColor('background'),
Expand Down
Loading

0 comments on commit 3260fdd

Please sign in to comment.