Skip to content

Commit

Permalink
Merge pull request #1873 from kaloudis/revamp-onboarding
Browse files Browse the repository at this point in the history
Revamp onboarding
  • Loading branch information
kaloudis authored Nov 27, 2023
2 parents ad85cf3 + 5e3d50b commit 7a610b4
Show file tree
Hide file tree
Showing 16 changed files with 217 additions and 160 deletions.
Binary file modified assets/images/intro/1.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 modified assets/images/intro/2.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 modified assets/images/intro/3.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 modified assets/images/intro/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"general.lightningInvoice": "Lightning invoice",
"general.or": "or",
"general.reset": "Reset",
"general.other": "Other",
"views.Settings.Support.title": "Support ZEUS",
"views.Settings.Support.titleAlt": "Merch and Support",
"views.Settings.SocialMedia.title": "Social media",
Expand Down Expand Up @@ -288,7 +289,7 @@
"views.Wallet.Wallet.startingNode": "Zeus is starting your node.",
"views.Wallet.Wallet.expressGraphSync": "Zeus is running express graph sync. Hang tight.",
"views.Wallet.restart": "Restart",
"views.Wallet.KeypadPane.lspExplainerFirstChannel": "Your first lightning receive must be 50,000 sats or more. A setup fee will be deducted from this amount.",
"views.Wallet.KeypadPane.lspExplainerFirstChannel": "It is recommended that your first lightning receive be 100,000 sats or more; the larger the better. A setup fee will be deducted from this amount.",
"views.Wallet.KeypadPane.lspExplainer": "You will be charged a setup fee if paid over lightning.",
"views.Wallet.KeypadPane.lspExplainerBelowMin": "Your next lightning receive must be 50,000 sats or more. A setup fee will be deducted from this amount.",
"view.Wallet.PosPane.orderNumber": "Order number",
Expand Down Expand Up @@ -441,6 +442,8 @@
"views.NodeQRScanner.error": "Scanned QR code was not a valid Lightning Node",
"views.Intro.whatIsZeus": "What is Zeus?",
"views.Intro.quickStart": "Quick start",
"views.Intro.lightningOnboarding": "Learn about lightning onboarding",
"views.Intro.lightningLiquidity": "Learn about lightning liquidity",
"views.Intro.advancedSetUp": "Advanced set-up",
"views.Intro.creatingWallet": "Zeus is creating your wallet.",
"views.Intro.carousel1.title": "Payments you can trust",
Expand Down Expand Up @@ -836,7 +839,7 @@
"stores.InvoicesStore.errorCreatingInvoice": "Error creating invoice",
"stores.InvoicesStore.errorGeneratingAddress": "Error generating new address",
"stores.InvoicesStore.zeroAmountLndhub": "LNDHub instance might not support zero-amount invoices",
"stores.InvoicesStore.lspNewChannelNeeded": "A new channel is needed to be able to receive this amount. You can try requesting a smaller amount or paying the invoice below to get a new channel.",
"stores.InvoicesStore.lspNewChannelNeeded": "A new channel is needed to be able to receive the amount requested. A setup fee has been added to the invoice.",
"stores.SettingsStore.btcPayImplementationSupport": "Sorry, we currently only support BTCPay instances using lnd or c-lightning",
"stores.SettingsStore.btcPayFetchConfigError": "Error fetching BTCPay configuration",
"stores.SettingsStore.olympianFetchError": "Error fetching Olympians",
Expand Down Expand Up @@ -894,8 +897,9 @@
"views.Settings.LightningAddress.generatingPreimages": "Generating preimages",
"views.Settings.LightningAddress.ChangeAddress": "Change address",
"views.Settings.LightningAddress.nostrKeys.changeWarning": "Warning: changing your Nostr keys will delete your pending payments. Please redeem your pending payments before submitting new keys.",
"views.Settings.LightningAddress.receiveExplainer1": "In order to redeem payments from ZEUS PAY, you need a channel with inbound capacity, ideally from our LSP, OLYMPUS by ZEUS.",
"views.Settings.LightningAddress.receiveExplainer2": "You can send yourself a payment of 50,000 sats or greater to get a channel from us.",
"views.Settings.LightningAddress.explainer1": "To get started with a lightning address you must first have a lightning channel and inbound liquidity.",
"views.Settings.LightningAddress.explainer2": "The easiest way to do so is to purchase a 0-conf channel from our LSP, OLYMPUS by ZEUS. Just generate an invoice and pay yourself from another lightning wallet.",
"views.Settings.LightningAddress.get0ConfChan": "Get 0-conf channel",
"views.Settings.LightningAddressSettings.title": "Lightning address settings",
"views.Settings.LightningAddressSettings.automaticallyAccept": "Automatically accept payments on startup",
"views.Settings.LightningAddressSettings.automaticallyAcceptAttestationLevel": "Attestation level for automatic acceptance",
Expand Down
1 change: 1 addition & 0 deletions stores/InvoicesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default class InvoicesStore {
unified?: boolean,
customPreimage?: string
) => {
this.lspStore?.resetFee();
this.payment_request = null;
this.payment_request_amt = null;
if (!unified) this.creatingInvoice = true;
Expand Down
7 changes: 6 additions & 1 deletion stores/LSPStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class LSPStore {
@action
public reset = () => {
this.info = {};
this.zeroConfFee = undefined;
this.resetFee();
this.error = false;
this.error_msg = '';
this.showLspSettings = false;
Expand All @@ -41,6 +41,11 @@ export default class LSPStore {
// this.channelAcceptor = undefined;
};

@action
public resetFee = () => {
this.zeroConfFee = undefined;
};

getLSPHost = () =>
this.settingsStore.embeddedLndNetwork === 'Mainnet'
? this.settingsStore.settings.lspMainnet
Expand Down
26 changes: 5 additions & 21 deletions stores/LightningAddressStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,6 @@ export default class LightningAddressStore {
BackendUtils.signMessage(verification)
.then((data: any) => {
const signature = data.zbase || data.signature;
const request_channels =
this.settingsStore.implementation ===
'embedded-lnd';
ReactNativeBlobUtil.fetch(
'POST',
`${LNURL_HOST}/lnurl/create`,
Expand All @@ -308,7 +305,7 @@ export default class LightningAddressStore {
nostr_pk,
relays,
relays_sig,
request_channels
request_channels: false // deprecated
})
)
.then(async (response: any) => {
Expand Down Expand Up @@ -336,7 +333,7 @@ export default class LightningAddressStore {
automaticallyAccept:
true,
automaticallyRequestOlympusChannels:
request_channels,
false, // deprecated
allowComments: true,
nostrPrivateKey,
nostrRelays: relays,
Expand Down Expand Up @@ -932,18 +929,10 @@ export default class LightningAddressStore {
}
};

const automaticallyRequestOlympusChannels =
this.settingsStore?.settings?.lightningAddress
?.automaticallyRequestOlympusChannels;

BackendUtils.createInvoice({
// 24 hrs
expiry: '86400',
value:
BackendUtils.supportsLSPs() &&
automaticallyRequestOlympusChannels
? undefined
: value,
value,
memo: comment ? `ZEUS PAY: ${comment}` : 'ZEUS PAY',
preimage,
private:
Expand Down Expand Up @@ -1113,16 +1102,11 @@ export default class LightningAddressStore {

@action
public prepareToAutomaticallyAccept = async () => {
const automaticallyRequestOlympusChannels =
this.settingsStore?.settings?.lightningAddress
?.automaticallyRequestOlympusChannels;

this.prepareToAutomaticallyAcceptStart = true;

while (!this.readyToAutomaticallyAccept) {
const isReady = await this.nodeInfoStore.isLightningReadyToReceive(
automaticallyRequestOlympusChannels
);
const isReady =
await this.nodeInfoStore.isLightningReadyToReceive();
if (isReady) {
this.readyToAutomaticallyAccept = true;
this.redeemAllOpenPayments();
Expand Down
12 changes: 4 additions & 8 deletions stores/NodeInfoStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,16 @@ export default class NodeInfoStore {
};

@action
public isLightningReadyToReceive = async (
autoRequestChansEnabled?: boolean
) => {
public isLightningReadyToReceive = async () => {
await this.channelsStore.getChannels();
await this.getNodeInfo();
const syncedToChain = this.nodeInfo?.synced_to_chain;

return (
syncedToChain &&
((autoRequestChansEnabled &&
this.channelsStore.channels.length === 0) ||
this.channelsStore.channels.some(
(channel: Channel) => channel.active
))
this.channelsStore.channels.some(
(channel: Channel) => channel.active
)
);
};
}
6 changes: 3 additions & 3 deletions stores/SettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface LightningAddressSettings {
enabled: boolean;
automaticallyAccept: boolean;
automaticallyAcceptAttestationLevel: number;
automaticallyRequestOlympusChannels: boolean;
automaticallyRequestOlympusChannels: boolean; // deprecated
routeHints: boolean;
allowComments: boolean;
nostrPrivateKey: string;
Expand Down Expand Up @@ -778,7 +778,7 @@ export default class SettingsStore {
enabled: false,
automaticallyAccept: true,
automaticallyAcceptAttestationLevel: 2,
automaticallyRequestOlympusChannels: true,
automaticallyRequestOlympusChannels: false, // deprecated
routeHints: false,
allowComments: true,
nostrPrivateKey: '',
Expand Down Expand Up @@ -998,7 +998,7 @@ export default class SettingsStore {
enabled: false,
automaticallyAccept: true,
automaticallyAcceptAttestationLevel: 2,
automaticallyRequestOlympusChannels: true,
automaticallyRequestOlympusChannels: false, // deprecated
routeHints: false,
allowComments: true,
nostrPrivateKey: '',
Expand Down
42 changes: 40 additions & 2 deletions views/Intro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ErrorMessage } from '../components/SuccessErrorMessage';
import { createLndWallet } from '../utils/LndMobileUtils';
import { localeString } from '../utils/LocaleUtils';
import { themeColor } from '../utils/ThemeUtils';
import UrlUtils from '../utils/UrlUtils';

const One = require('../assets/images/intro/1.png');
const Two = require('../assets/images/intro/2.png');
Expand Down Expand Up @@ -79,8 +80,7 @@ const Intro: React.FC<IntroProps> = (props) => {
source={item.illustration}
style={{
width: screenWidth,
minHeight: '60%',
maxHeight: '80%'
height: '60%'
}}
/>
<View
Expand Down Expand Up @@ -115,6 +115,44 @@ const Intro: React.FC<IntroProps> = (props) => {
>
{item.text}
</Text>
{item.text === localeString('views.Intro.carousel3.text') && (
<>
<View
style={{
padding: 10
}}
>
<Button
title={localeString(
'views.Intro.lightningOnboarding'
)}
onPress={() =>
UrlUtils.goToUrl(
'https://docs.zeusln.app/for-users/embedded-node/lightning-onboarding/'
)
}
secondary
/>
</View>
<View
style={{
padding: 10
}}
>
<Button
title={localeString(
'views.Intro.lightningLiquidity'
)}
onPress={() =>
UrlUtils.goToUrl(
'https://bitcoin.design/guide/how-it-works/liquidity/'
)
}
secondary
/>
</View>
</>
)}
{item.text === localeString('views.Intro.carousel4.text') && (
<>
{error && (
Expand Down
Loading

0 comments on commit 7a610b4

Please sign in to comment.