Skip to content

Commit

Permalink
Merge branch 'ZeusLN:master' into csv-export
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajeett01 authored Jul 1, 2024
2 parents 8ebf4a4 + 77bcc7c commit 69a729b
Show file tree
Hide file tree
Showing 39 changed files with 1,487 additions and 715 deletions.
2 changes: 1 addition & 1 deletion 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-alpha10"
versionName "0.9.0-alpha11"
multiDexEnabled true
}
signingConfigs {
Expand Down
1 change: 1 addition & 0 deletions assets/images/SVG/Caret Right alt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 23 additions & 3 deletions components/Channels/ChannelItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export function ChannelItem({
pendingTimelock,
noBorder,
hideLabels,
selected
selected,
highlightLabels
}: {
title?: string;
secondTitle?: string;
Expand All @@ -41,6 +42,7 @@ export function ChannelItem({
noBorder?: boolean;
hideLabels?: boolean;
selected?: boolean;
highlightLabels?: boolean;
}) {
const { settings } = Stores.settingsStore;
const { privacy } = settings;
Expand Down Expand Up @@ -68,7 +70,13 @@ export function ChannelItem({
{title && (
<View style={{ flex: 1, paddingRight: 10 }}>
<Body
color={selected ? 'highlight' : 'text'}
color={
selected
? 'highlight'
: highlightLabels
? 'outbound'
: 'text'
}
bold={selected}
>
{PrivacyUtils.sensitiveValue(title)}
Expand All @@ -78,7 +86,13 @@ export function ChannelItem({
{secondTitle && (
<View style={{ flex: 1, alignItems: 'flex-end' }}>
<Body
color={selected ? 'highlight' : 'text'}
color={
selected
? 'highlight'
: highlightLabels
? 'inbound'
: 'text'
}
bold={selected}
>
{secondTitle}
Expand Down Expand Up @@ -128,6 +142,9 @@ export function ChannelItem({
accessibilityLabel={localeString(
'views.Channel.outboundCapacity'
)}
colorOverride={
highlightLabels ? themeColor('outbound') : undefined
}
/>
<Amount
sats={inbound}
Expand All @@ -136,6 +153,9 @@ export function ChannelItem({
accessibilityLabel={localeString(
'views.Channel.inboundCapacity'
)}
colorOverride={
highlightLabels ? themeColor('inbound') : undefined
}
/>
</Row>
)}
Expand Down
116 changes: 46 additions & 70 deletions components/LSPS1OrderResponse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { inject, observer } from 'mobx-react';
import { ScrollView, View } from 'react-native';
import moment from 'moment';
import BigNumber from 'bignumber.js';

import Screen from './Screen';
import KeyValue from './KeyValue';
Expand Down Expand Up @@ -56,6 +57,7 @@ export default class LSPS1OrderResponse extends React.Component<
'views.LSPS1.receiveLimit'
)}
noBorder
highlightLabels
/>
{orderResponse?.order_id && (
<KeyValue
Expand All @@ -71,44 +73,19 @@ export default class LSPS1OrderResponse extends React.Component<
)}
value={
<Amount
sats={
orderResponse?.client_balance_sat +
orderResponse?.lsp_balance_sat
}
sats={new BigNumber(
orderResponse?.client_balance_sat
)
.plus(
orderResponse?.lsp_balance_sat
)
.toNumber()}
sensitive
toggleable
/>
}
/>
)}
{orderResponse?.lsp_balance_sat && (
<KeyValue
keyValue={localeString(
'views.LSPS1.lspBalance'
)}
value={
<Amount
sats={orderResponse?.lsp_balance_sat}
sensitive
toggleable
/>
}
/>
)}
{orderResponse?.client_balance_sat && (
<KeyValue
keyValue={localeString(
'views.LSPS1.clientBalance'
)}
value={
<Amount
sats={orderResponse?.client_balance_sat}
sensitive
toggleable
/>
}
/>
)}
{orderResponse?.announce_channel && (
<KeyValue
keyValue={localeString(
Expand Down Expand Up @@ -465,46 +442,45 @@ export default class LSPS1OrderResponse extends React.Component<
)}
{orderResponse?.order_state === 'CREATED' && orderView && (
<>
{payment.bolt11?.invoice ||
{(payment.bolt11?.invoice ||
payment.lightning_invoice ||
(payment.bolt11_invoice && (
<>
<Button
title={
payment.onchain
? localeString(
'views.LSPS1.makePaymentLN'
)
: localeString(
'views.LSPS1.makePayment'
)
}
containerStyle={{
paddingVertical: 20
}}
onPress={() => {
InvoicesStore.getPayReq(
payment.bolt11
?.invoice ||
payment.lightning_invoice ||
payment.bolt11_invoice
)
.then(() => {
navigation.navigate(
'PaymentRequest',
{}
);
})
.catch((error: any) =>
console.error(
'Error fetching payment request:',
error
)
payment.bolt11_invoice) && (
<>
<Button
title={
payment.onchain
? localeString(
'views.LSPS1.makePaymentLN'
)
: localeString(
'views.LSPS1.makePayment'
)
}
containerStyle={{
paddingVertical: 20
}}
onPress={() => {
InvoicesStore.getPayReq(
payment.bolt11?.invoice ||
payment.lightning_invoice ||
payment.bolt11_invoice
)
.then(() => {
navigation.navigate(
'PaymentRequest',
{}
);
}}
/>
</>
))}
})
.catch((error: any) =>
console.error(
'Error fetching payment request:',
error
)
);
}}
/>
</>
)}
{payment.onchain?.address &&
payment.onchain?.fee_total_sat && (
<>
Expand Down
140 changes: 140 additions & 0 deletions components/SwipeButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import React, { useRef } from 'react';
import {
View,
Text,
StyleSheet,
Animated,
PanResponder,
PanResponderGestureState,
GestureResponderEvent,
Dimensions
} from 'react-native';

import CaretRight from '../assets/images/SVG/Caret Right alt.svg';
import { themeColor } from '../utils/ThemeUtils';

interface SwipeButtonProps {
onSwipeSuccess: () => void;
swipeButtonStyle?: object;
instructionText?: string;
instructionsStyle?: object;
containerStyle?: object;
}

const SwipeButton: React.FC<SwipeButtonProps> = ({
onSwipeSuccess,
swipeButtonStyle,
instructionText = '',
instructionsStyle,
containerStyle
}) => {
const pan = useRef(new Animated.Value(0)).current;
const screenWidth = Dimensions.get('window').width;

const containerWidth = screenWidth - 40;
const swipeButtonWidth = 50;
const maxTranslation = containerWidth - swipeButtonWidth;

const textOpacity = pan.interpolate({
inputRange: [0, maxTranslation / 2, maxTranslation],
outputRange: [1, 0, 0],
extrapolate: 'clamp'
});

const panResponder = useRef(
PanResponder.create({
onStartShouldSetPanResponder: () => true,
onPanResponderGrant: () => {
pan.setOffset(pan._value);
pan.setValue(0);
},
onPanResponderMove: (e, gesture) => {
const newValue = gesture.dx;
if (newValue >= 0 && newValue <= maxTranslation) {
pan.setValue(newValue);
}
},
onPanResponderRelease: (
e: GestureResponderEvent,
gesture: PanResponderGestureState
) => {
if (gesture.dx > maxTranslation * 0.95) {
onSwipeSuccess();
Animated.spring(pan, {
toValue: maxTranslation,
useNativeDriver: false
}).start();
} else {
Animated.spring(pan, {
toValue: 0,
useNativeDriver: false
}).start();
}
}
})
).current;

return (
<View style={[styles.container, containerStyle]}>
<Animated.View
style={[
styles.instructionsContainer,
instructionsStyle,
{ opacity: textOpacity }
]}
>
<Text style={[styles.instructions]}>{instructionText}</Text>
</Animated.View>
<Animated.View
style={[
styles.swipeButton,
swipeButtonStyle,
{ transform: [{ translateX: pan }] }
]}
{...panResponder.panHandlers}
>
<CaretRight
fill={themeColor('background')}
width={24}
height={24}
/>
</Animated.View>
</View>
);
};

const styles = StyleSheet.create({
container: {
height: 50,
backgroundColor: '#ccc',
borderRadius: 5,
marginHorizontal: 20,
justifyContent: 'center',
alignItems: 'center',
marginTop: 20
},
instructionsContainer: {
alignItems: 'center'
},
instructions: {
fontSize: 16,
fontFamily: 'PPNeueMontreal-Book',
color: 'black'
},
swipeButton: {
position: 'absolute',
left: 0,
width: 50,
height: 50,
color: 'black',
backgroundColor: 'white',
borderRadius: 5,
justifyContent: 'center',
alignItems: 'center'
},
textStyle: {
fontSize: 18
}
});

export default SwipeButton;
4 changes: 2 additions & 2 deletions ios/zeus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@
CODE_SIGN_ENTITLEMENTS = zeus/zeus.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 25;
CURRENT_PROJECT_VERSION = 26;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 9TU7M3555F;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1864,7 +1864,7 @@
CODE_SIGN_ENTITLEMENTS = zeus/zeusRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 25;
CURRENT_PROJECT_VERSION = 26;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 9TU7M3555F;
ENABLE_BITCODE = NO;
Expand Down
Loading

0 comments on commit 69a729b

Please sign in to comment.