Skip to content

Commit

Permalink
Minor bug fixes (#127)
Browse files Browse the repository at this point in the history
* add disclaimer screen

* update dashboard and bottom nav

* fmtJson, sort json tl

* lint, fmtJson

* handle not allowed QR code scan on iOS. Fixes #7

* use device theme on initial start. Fixes #105

* update disclaimer screen

* update action btns component

* add TODOs

* remove commented code

* fix plural tl

* fix coin selection padding issue

* update contact list circle component styling

* update contact entry styling

* update circle container styling

* update keyboard avoiding view

* add safeAreaView for iOS bottom container

* iOS useSafeAreaInsets

* iOS useSafeAreaInsets

* not able to fix test

* fix scan QR code on iOS. Fixes #7

* update global color obj

* handle missing promise rejections in app..tsx

* add more safeAreaView for iOS

* update

* add safeAreaView insets on proofs list

* fix flashlist scroll

* more safeAreaView

* add selectAmountScreen

* add selectMint screen

* add Processing screen

* add processingError screen

* update var name _mintUrl to _testmintUrl

* update

* update invoice nav params

* update invoice nav params

* add select target screen for melting

* start updating the ux in melting process

* improve code and UX for melting to lnurl

* lint

* add lnurl/invoice input screen

* auto-focus input field

* open LN wallet

* add toaster to input field screen

* update

* update melt input field screen

* Rename selectTarget.tsx to SelectTarget.tsx

* update melting screen using input field

* check if invoice expired

* update

* handle user pastes invoice using the keyboard

* update loading container

* clean up dashboard screen

* update dashboard

* avoid duplicated store calls in mint selection

* add noMints, allMintsEmpty for melting screen

* start ux update of ecash sending

* update send ecash ux

* update QR scan process, fix few ios layouts

* add outgoing payment overview

* change intermint swap to multimint-swap

* multimint-swap coinSelection, clean up

* update styling and minor fixes

* add missing memo screen

* add custom txtInput component

* add custom txtInput component

* create main screen container component, cleanup

* update coin selection components

* Move ErrorScreen into folder Screens

* fix ref forwarding and import cycle

* update mint list screen

* update mint management screen

* fix contact unhandled promise rejection

* update disclaimer screen

* update dashboard

* update history entry styling

* claim unspent token from history entry

* add some button icons and txt hints

* fix tl amount claimed from history details

* update light theme colors

* update success screen

* fix ios layout issue in payment screens

* fix ios layout issue in payment screens

* addfrontend 4 advanced settings (request timeout)

* start update of nav component

* update navigation component

* add nav to container component

* update container component

* set axios default timeout

* update processing error screen layout

* update light theme and icons

* lint, sort tl, update formatMintUrl

* sort tl

* update bottom nav txt on active screen

* update QR scanner screen

* update formatMintUrl

* update auth screen

* handle getCurrentKeysetIds bad response

* remove plus icon from add button

* remove icon from send/receive options

* update dashboard design

* update pin screen

* add global object with STORE_KEYS references

* clean up and add initial explainer screen

* update disclaimer tl

* update dashboard components

* lint, use promiseAll on app init

* add nostr-tools and nostr util

* add nostr profile with npub

* nostr profile

* start relay setup

* test

* Send Ecash over NOSTR (#121)

* add dummy relay class

* dummy contactlist inView handler

* test

* get metadata from contacts in viewport

* get and save user relays

* generate sk

* fix contacts state, show relay count

* show user about section

* update nostr profiles

* update list styling

* err: cannot read property 'importkey' of undefined

* add comments

* test encrypt dm

* test

* test

* test

* send token

* add method dropAllData

* update sender msg

* update sender msg

* send ecash via nostr from dashboard

* add user profile component

* also accept hex input as npub

* add missing translations

* close prompt onPress

* fix missing vars by reclaiming from history

* add back btn in contact list screen while payment

* update ecash payment proces based on user contacts

* remove old contact context

* 0.0.1-beta

* fix nostr contact sync

* update userProfile box and fix modal opening

* send ecash from contact profile screen

* update contact screen

* make profile links pressable

* update contact list for payments

* dont truncate lnurl if it is a payment recipient

* fix spelling and translations

* fix dashboard balance linebreaking

* update toaster component

* update dashboard receiving options

* update options component

* update viewabilityConfig

* add nostr gif in processing nostr tx screen

* add privacy settings, hide balance option

* add nostr context, claim nostr dm screen layout

* top up a mint after adding it

* decrypt and check dm for incoming cashu token

* claim ecash nostr, clean up the usePrompt usage

* add binary search

* add small doc for combined bnary search method

* rename to binaryInsert

* update docs for binarySearchAndInsert method

* clean up theme context

* clean up nostr context

* clean up context usage

* clean up privacy context

* refactored all context providers

* update prompt context, add proper timer handling

* fix mint info

* show topup modal after adding new mint

* update disclaimer version

* disable nav btns if screen is focused

* clean up app component

* fix back from mints screen after minting token

* update nostr messages screen name

* update proofs screen layout

* fix screen name on sending ecash

* update nostr contact row onpress

* use only latest profile data

* more screen folder out of components folder

* format int in payment overview screen

* show sender metadata in nostr msg screen

* add mints option to settings

* disable send button while no balance or no mints

* add missing translations, remove todos done

* fix auth

* fix pin auth flow

* show nostr payment method if user has npub

* update splash screen

* update readme image

* update readme

* update readme

* update readme

* update readme

* update nostr nav params interface

* update contact screen

* add nostr todo

* expo update deps

* update payment overview btn text

* update spelling in prompt var.

* update checking fees for multimint swap

* update invoice screen for special case

* add a clipboard helper

* add a clipboard helper

* add a simple clipboard copy state hook

* add a Copy component

* update

* comment out unused nostr global consts

* improve maintainability of translation namespaces

* make theme and colors type-safe

* update

* update TODOs

* fix fee estimation for multimint swap

* wrap est. fee in try catch

* update ZapIcon styling, update mint funds overview

* fix missing DE TL

* improve UX in nostr dms

* add missing translation

* make claim prompt more readable

* add "troubleshooting" to readme

* update readme

* hide splash screen once theme is loaded

* close top-up modal

* update melting over nostr by checking pubKey

* update remaining mints for multimint swap

* fix endless loading symbol on empty clipboard

* update invoice screen UX

* update label of nav button in invoice screen

* add TxtButton component

* use TxtButton component

* flashlist entry row styling attempt
  • Loading branch information
KKA11010 authored Aug 17, 2023
1 parent c11757d commit cfc20e0
Show file tree
Hide file tree
Showing 22 changed files with 210 additions and 170 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ The NUT documents (**N**otation, **U**sage and **T**erminology) each specify par
6. A browser tab will be opened. Press the "Expo Go" button in the bottom of the page.
7. eNuts will be bundled up and will run on your device.

**Troubleshooting**

- If you see this build error: `[GraphQL] Entity not authorized` in you terminal, you can simply remove the following line from the `config/app.config.ts` file:

```javascript
// Unauthorized error related to the project ID used in the expo organization for eNuts
// If you are not a member of the organization, you will encounter the build error.
{
...
extra: {
// Delete the following line to fix the issue:
eas: { projectId: 'edb75ccd-71ac-4934-9147-baf1c7f2b068' },
...
}
...
}
```

## 👏 Contribute

The main purpose of this repository is to continue evolving and pushing the adoption of Ecash for Bitcoin using the Cashu protocol. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read more on [how to contribute](https://github.com/cashubtc/eNuts/blob/main/CONTRIBUTING.md).
Expand Down
39 changes: 37 additions & 2 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useThemeContext } from '@src/context/Theme'
import { highlight as hi } from '@styles'
import { SafeAreaView, StyleSheet, Text, TouchableHighlight, TouchableOpacity } from 'react-native'
import { globals, highlight as hi } from '@styles'
import { SafeAreaView, type StyleProp, StyleSheet, Text, type TextStyle, TouchableHighlight, TouchableOpacity } from 'react-native'

import Loading from './Loading'
import Txt from './Txt'

interface IButtonProps {
txt: string
Expand Down Expand Up @@ -84,6 +85,32 @@ export function IconBtn({ icon, size, outlined, disabled, onPress, testId }: IIc
)
}

interface ITxtBtnProps {
txt: string
onPress: () => void
icon?: React.ReactNode
disabled?: boolean
style?: StyleProp<TextStyle>[]
txtColor?: string
}

export function TxtButton({ txt, onPress, icon, disabled, style, txtColor }: ITxtBtnProps) {
const { color, highlight } = useThemeContext()
return (
<TouchableOpacity
style={[styles.copyTxt, ...(style || [])]}
onPress={onPress}
disabled={disabled}
>
<Txt
txt={txt}
styles={[globals(color).pressTxt, { color: txtColor || hi[highlight], marginRight: icon ? 10 : 0 }]}
/>
{icon ? icon : null}
</TouchableOpacity>
)
}

const styles = StyleSheet.create({
safeArea: {
width: '100%'
Expand All @@ -106,5 +133,13 @@ const styles = StyleSheet.create({
borderWidth: 1,
alignItems: 'center',
justifyContent: 'center',
},
// txt button
copyTxt: {
paddingTop: 30,
paddingBottom: 10,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
}
})
15 changes: 7 additions & 8 deletions src/components/Empty.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { RootStackParamList } from '@model/nav'
import type { NativeStackNavigationProp } from '@react-navigation/native-stack'
import { useThemeContext } from '@src/context/Theme'
import { globals, highlight as hi } from '@styles'
import { useTranslation } from 'react-i18next'
import { Image, StyleSheet, TouchableOpacity } from 'react-native'
import { Image, StyleSheet } from 'react-native'

import { TxtButton } from './Button'
import Txt from './Txt'

interface IEmptyProps {
Expand All @@ -15,7 +15,7 @@ interface IEmptyProps {

export default function Empty({ txt, hasOk, nav }: IEmptyProps) {
const { t } = useTranslation()
const { color, highlight } = useThemeContext()
const { color } = useThemeContext()
return (
<>
<Image
Expand All @@ -28,12 +28,11 @@ export default function Empty({ txt, hasOk, nav }: IEmptyProps) {
styles={[styles.emptyTxt, { color: color.TEXT_SECONDARY, marginBottom: hasOk ? 10 : 0 }]}
/>
{hasOk &&
<TouchableOpacity
<TxtButton
txt={t('backToDashboard')}
onPress={() => nav?.navigate('dashboard')}
style={{ paddingVertical: 10 }}
>
<Txt txt={t('backToDashboard')} styles={[globals(color).pressTxt, { color: hi[highlight], padding: 10 }]} />
</TouchableOpacity>
style={[{ paddingVertical: 10 }]}
/>
}
</>
)
Expand Down
23 changes: 8 additions & 15 deletions src/components/InitialModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useThemeContext } from '@src/context/Theme'
import { NS } from '@src/i18n'
import { globals } from '@styles'
import { useTranslation } from 'react-i18next'
import { StyleSheet,Text, TouchableOpacity } from 'react-native'
import { Text } from 'react-native'

import Button from './Button'
import Button, { TxtButton } from './Button'

interface IInitialModalProps {
visible: boolean
Expand All @@ -25,18 +25,11 @@ export default function InitialModal({ visible, onConfirm, onCancel }: IInitialM
{t('startHint')}
</Text>
<Button txt={t('addMint')} onPress={onConfirm} />
<TouchableOpacity onPress={onCancel}>
<Text style={[globals(color, highlight).pressTxt, styles.cancel]}>
{t('willDoLater')}
</Text>
</TouchableOpacity>
<TxtButton
txt={t('willDoLater')}
onPress={onCancel}
style={[{ paddingTop: 25, paddingBottom: 10, }]}
/>
</MyModal>
)
}

const styles = StyleSheet.create({
cancel: {
marginTop: 25,
marginBottom: 10,
},
})
}
22 changes: 8 additions & 14 deletions src/components/LeaveAppModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { NS } from '@src/i18n'
import { globals } from '@styles'
import { isErr, openUrl } from '@util'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, TouchableOpacity } from 'react-native'
import { Text } from 'react-native'

import Button from './Button'
import Button, { TxtButton } from './Button'
import MyModal from './modal'

interface ILeaveAppModalProps {
Expand All @@ -15,7 +15,7 @@ interface ILeaveAppModalProps {
closeModal: () => void
}

export default function LeaveAppModal({ url, visible, closeModal }: ILeaveAppModalProps ) {
export default function LeaveAppModal({ url, visible, closeModal }: ILeaveAppModalProps) {
const { t } = useTranslation([NS.common])
const { color, highlight } = useThemeContext()
const { openPromptAutoClose } = usePromptContext()
Expand All @@ -33,18 +33,12 @@ export default function LeaveAppModal({ url, visible, closeModal }: ILeaveAppMod
&quot;{url}&quot;
</Text>
<Button txt={t('continue')} onPress={() => void handleContinue()} />
<TouchableOpacity onPress={closeModal}>
<Text style={[globals(color, highlight).pressTxt, styles.cancel]}>
{t('cancel')}
</Text>
</TouchableOpacity>
<TxtButton
txt={t('cancel')}
onPress={closeModal}
style={[{ paddingTop: 25, paddingBottom: 20 }]}
/>
</MyModal>
</>
)
}

const styles = StyleSheet.create({
cancel: {
marginTop: 25,
},
})
17 changes: 9 additions & 8 deletions src/components/modal/OptsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { TxtButton } from '@comps/Button'
import { CopyIcon, NostrIcon, ReceiveIcon, SendIcon, ZapIcon } from '@comps/Icons'
import Option from '@comps/Option'
import Txt from '@comps/Txt'
import { useNostrContext } from '@src/context/Nostr'
import { useThemeContext } from '@src/context/Theme'
import { NS } from '@src/i18n'
import { globals, mainColors } from '@styles'
import { mainColors } from '@styles'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import { StyleSheet, View } from 'react-native'

import MyModal from '.'

Expand Down Expand Up @@ -34,7 +35,7 @@ export default function OptsModal({
isSend,
}: IOptsModal) {
const { t } = useTranslation([NS.common])
const { color, highlight } = useThemeContext()
const { color } = useThemeContext()
const { nutPub } = useNostrContext()
return (
<MyModal type='bottom' animation='slide' visible={visible} close={onPressCancel}>
Expand Down Expand Up @@ -67,11 +68,11 @@ export default function OptsModal({
hint={isSend ? t('payInvoiceDashboard') : t('createInvoiceDashboard')}
onPress={onPressSecondBtn}
/>
<TouchableOpacity style={styles.no} onPress={onPressCancel}>
<Text style={globals(color, highlight).pressTxt}>
{t('cancel')}
</Text>
</TouchableOpacity>
<TxtButton
txt={t('cancel')}
onPress={onPressCancel}
style={[{ paddingBottom: 15 }]}
/>
</View>
</MyModal>
)
Expand Down
24 changes: 8 additions & 16 deletions src/components/modal/Question.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Button from '@comps/Button'
import Button, { TxtButton } from '@comps/Button'
import { useThemeContext } from '@src/context/Theme'
import { NS } from '@src/i18n'
import { globals } from '@styles'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, TouchableOpacity } from 'react-native'
import { Text } from 'react-native'

import MyModal from '.'

Expand All @@ -19,7 +19,7 @@ interface IQuestionModalProps {

export function QuestionModal({ header, txt, visible, confirmTxt, confirmFn, cancelTxt, cancelFn }: IQuestionModalProps) {
const { t } = useTranslation([NS.common])
const { color, highlight } = useThemeContext()
const { color } = useThemeContext()
return (
<MyModal type='question' animation='fade' visible={visible} close={cancelFn} >
<Text style={[globals(color).modalHeader, !txt?.length ? { marginBottom: 0 } : {}]}>
Expand All @@ -29,19 +29,11 @@ export function QuestionModal({ header, txt, visible, confirmTxt, confirmFn, can
{txt}
</Text>
<Button txt={confirmTxt || t('yes')} onPress={confirmFn} />
<TouchableOpacity style={styles.cancelWrap} onPress={cancelFn}>
<Text style={globals(color, highlight).pressTxt}>
{cancelTxt || t('no')}
</Text>
</TouchableOpacity>
<TxtButton
txt={cancelTxt || t('no')}
onPress={cancelFn}
style={[{ paddingBottom: 0 }]}
/>
</MyModal>
)
}

const styles = StyleSheet.create({
cancelWrap: {
width: '25%',
alignItems: 'center',
paddingTop: 35,
},
})
11 changes: 8 additions & 3 deletions src/components/nav/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ interface TTopNavProps {
withBackBtn?: boolean
cancel?: boolean
handlePress?: () => void
txt?: string
}

export default function TopNav({ screenName, withBackBtn, cancel, handlePress }: TTopNavProps) {
export default function TopNav({ screenName, withBackBtn, cancel, handlePress, txt }: TTopNavProps) {
const { t } = useTranslation([NS.common])
const { color, highlight } = useThemeContext()
return (
Expand All @@ -25,9 +26,13 @@ export default function TopNav({ screenName, withBackBtn, cancel, handlePress }:
<View />
}
<TouchableOpacity style={styles.topIconR} onPress={handlePress}>
{(withBackBtn || cancel) ?
{(withBackBtn || cancel || txt?.length) ?
<Text style={globals(color, highlight).pressTxt}>
{t(withBackBtn ? 'back' : 'cancel')}
{txt ?
txt
:
t(withBackBtn ? 'back' : 'cancel')
}
</Text>
:
<ScanQRIcon color={color.TEXT} />
Expand Down
3 changes: 1 addition & 2 deletions src/context/FocusClaim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ const useFocusClaim = () => {
let isSpent = false
const fn = async () => {
const clipboard = await getStrFromClipboard()
if (!clipboard) { return }
if (!isCashuToken(clipboard)) { return false }
if (!clipboard?.length || !isCashuToken(clipboard)) { return false }
const info = getTokenInfo(clipboard)
if (!info) { return false }
// check if mint is a trusted one
Expand Down
3 changes: 0 additions & 3 deletions src/context/Nostr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { IProfileContent, TContact } from '@model/nostr'
import { store } from '@store'
import { STORE_KEYS } from '@store/consts'
import { getRedeemdedSigs } from '@store/nostrDms'
import * as SplashScreen from 'expo-splash-screen'
import { createContext, useContext, useEffect, useState } from 'react'

const useNostr = () => {
Expand All @@ -28,8 +27,6 @@ const useNostr = () => {
setClaimedEvtIds(redeemed)
} catch (e) {
l(e)
} finally {
await SplashScreen.hideAsync()
}
})()
}, [])
Expand Down
3 changes: 3 additions & 0 deletions src/context/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getPreferences, setPreferences } from '@db'
import { l } from '@log'
import type { IPreferences } from '@model'
import { dark, HighlightKey, light , lightTheme } from '@styles'
import * as SplashScreen from 'expo-splash-screen'
import { createContext, useContext, useEffect, useState } from 'react'
import { Appearance } from 'react-native'

Expand Down Expand Up @@ -52,6 +53,8 @@ const useTheme = () => {
theme: 'Default',
hasPref: true
})
} finally {
await SplashScreen.hideAsync()
}
})()
}, [])
Expand Down
Loading

0 comments on commit cfc20e0

Please sign in to comment.