Skip to content

Commit

Permalink
Merge pull request #70 from ZeusLN/master
Browse files Browse the repository at this point in the history
v0.0.8
  • Loading branch information
ZeusLN authored Apr 1, 2019
2 parents 92a64e9 + 6dc63fb commit 6a22ef2
Show file tree
Hide file tree
Showing 37 changed files with 772 additions and 280 deletions.
3 changes: 1 addition & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default class App extends React.PureComponent {

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff'
flex: 1
}
});
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Zeus is built on TypeScript and React-Native. It runs on both iOS and Android.

*Disclaimer*: Zeus and Lightning in general are software projects in their early development stages. Please be wary when using Lightning and do not fund your node with more money than you are willing to lose.

### App Store links
* [Google Play](https://play.google.com/store/apps/details?id=com.zeusln.zeus)
* [Apple TestFlight](https://testflight.apple.com/join/gpVFzEHN)

### Get in touch with us
* Come chat with us on
[Telegram](https://t.me/zeusLN)
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ android {
applicationId "com.zeusln.zeus"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 7
versionName "0.0.7"
versionCode 8
versionName "0.0.8"
}
signingConfigs {
release {
Expand Down
18 changes: 15 additions & 3 deletions components/CopyButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ interface CopyButtonState {
}

export default class CopyButton extends React.Component<CopyButtonProps, CopyButtonState> {
isComponentMounted: boolean = false;

state = {
copied: false
}

componentDidMount() {
this.isComponentMounted = true;
}

componentWillUnmount() {
this.isComponentMounted = false;
}

copyToClipboard = () => {
const { copyValue } = this.props;
this.setState({
Expand All @@ -25,9 +35,11 @@ export default class CopyButton extends React.Component<CopyButtonProps, CopyBut
Clipboard.setString(copyValue);

setTimeout(() => {
this.setState({
copied: false
});
if (this.isComponentMounted) {
this.setState({
copied: false
});
}
}, 5000);
}

Expand Down
29 changes: 21 additions & 8 deletions components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { Header } from 'react-native-elements';
import { CameraKitCameraScreen } from 'react-native-camera-kit';
import { CameraKitCamera, CameraKitCameraScreen } from 'react-native-camera-kit';
import Permissions from 'react-native-permissions';

interface QRProps {
Expand All @@ -21,9 +21,19 @@ export default class QRCodeScanner extends React.Component<QRProps, QRState> {
}

async componentDidMount() {
await Permissions.request('camera').then((response: any) => {
this.setState({ hasCameraPermission: response === 'authorized' });
});
if (Platform.OS === 'ios') {
const isCameraAuthorized = await CameraKitCamera.checkDeviceCameraAuthorizationStatus();

if (isCameraAuthorized) {
this.setState({ hasCameraPermission: true });
}
} else {
// CameraKitCamera permissions don't work on Android at the moment
// use react-native-permissions
await Permissions.request('camera').then((response: any) => {
this.setState({ hasCameraPermission: response === 'authorized' });
});
}
}

render() {
Expand All @@ -39,7 +49,7 @@ export default class QRCodeScanner extends React.Component<QRProps, QRState> {
}

return (
<View>
<React.Fragment>
<Header
leftComponent={<BackButton />}
centerComponent={{ text: title, style: { color: '#fff' } }}
Expand All @@ -55,9 +65,12 @@ export default class QRCodeScanner extends React.Component<QRProps, QRState> {
onReadCode={(event: any) => handleQRScanned(event.nativeEvent.codeStringValue)}
hideControls={false}
showFrame={true}
heightForScannerFrame={300}
heightForScannerFrame={250}
style={{
flex: 1
}}
/>
</View>
</React.Fragment>
);
}
}
Expand Down
Binary file added images/lightning-green-pending-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/lightning-green-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/lightning-red-pending-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/lightning-red-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/onchain-green-pending-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/onchain-green-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/onchain-red-pending-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/onchain-red-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions ios/zeus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -1596,14 +1596,14 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-permissions/ios/**",
"$(SRCROOT)/../node_modules/react-native-camera/ios/**",
"$(SRCROOT)/../node_modules/react-native-keychain/RNKeychainManager",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
);
INFOPLIST_FILE = zeus/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1637,6 +1637,7 @@
INFOPLIST_FILE = zeus/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion ios/zeus/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.7</string>
<string>0.0.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zeus",
"version": "0.0.7",
"version": "0.0.8",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
Expand Down
9 changes: 2 additions & 7 deletions stores/SettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ import * as Keychain from 'react-native-keychain';
import { action, observable } from 'mobx';
import axios from 'axios';

interface Credentials {
service: string;
username: string;
password: string;
};

interface Settings {
host?: string;
port?: string;
macaroonHex?: string;
onChainAndress?: string;
theme?: string;
}

export default class SettingsStore {
Expand Down Expand Up @@ -57,7 +52,7 @@ export default class SettingsStore {

try {
// Retrieve the credentials
const credentials: Credentials | any = await Keychain.getGenericPassword();
const credentials: any = await Keychain.getGenericPassword();
this.loading = false;
if (credentials) {
this.settings = JSON.parse(credentials.password);
Expand Down
7 changes: 7 additions & 0 deletions utils/AddressUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ describe('AddressUtils', () => {
expect(AddressUtils.isValidLightningPaymentRequest('lnbc5fasdfa')).toBeTruthy();
expect(AddressUtils.isValidLightningPaymentRequest('lnbc1pwxmpg5pp5pfc6hq9cn2059n8q6n0qhlxlyk6y38f7yxsg0cdq0s3s8xryaj6qdph235hqurfdcsyuet9wfsk5j6pyq58g6tswp5kutndv55jsaf5x5mrs2gcqzysxqyz5vq54gltey50ra8utdya5xj5yr9d30s4p627ftz4fjp78ky2slka2gskvp096jjefq3d5ujhnqwrrh70espxyh09kdmq8q64n3jaj8ldegq5m4ddp')).toBeTruthy();
});
it('validates capitalized Lightning payment requests properly', () => {
expect(AddressUtils.isValidLightningPaymentRequest('B')).toBeFalsy();
expect(AddressUtils.isValidLightningPaymentRequest('LNBCRT421FS1MMV3982SKMS')).toBeTruthy();
expect(AddressUtils.isValidLightningPaymentRequest('LNTB4FE03RFSD41FEFW')).toBeTruthy();
expect(AddressUtils.isValidLightningPaymentRequest('LNBC5FASDFA')).toBeTruthy();
expect(AddressUtils.isValidLightningPaymentRequest('LNBC1PWXMPG5PP5PFC6HQ9CN2059N8Q6N0QHLXLYK6Y38F7YXSG0CDQ0S3S8XRYAJ6QDPH235HQURFDCSYUET9WFSK5J6PYQ58G6TSWP5KUTNDV55JSAF5X5MRS2GCQZYSXQYZ5VQ54GLTEY50RA8UTDYA5XJ5YR9D30S4P627FTZ4FJP78KY2SLKA2GSKVP096JJEFQ3D5UJHNQWRRH70ESPXYH09KDMQ8Q64N3JAJ8LDEGQ5M4DDP')).toBeTruthy();
});
});
});
3 changes: 2 additions & 1 deletion utils/AddressUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const btcNonBech = /^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$/;
const btcBech = /^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/;
const lnInvoice = /^(lnbcrt|lntb|lnbc)([0-9]{1,}[a-z0-9]+){1}$/;

const lnInvoice = /^(lnbcrt|lntb|lnbc|LNBCRT|LNTB|LNBC)([0-9]{1,}[a-zA-Z0-9]+){1}$/;

/* testnet */
const btcNonBechTestnet = /^[2][a-km-zA-HJ-NP-Z1-9]{25,34}$/;
Expand Down
Loading

0 comments on commit 6a22ef2

Please sign in to comment.