Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Jun 18, 2024
2 parents 1611248 + 302376e commit d0c560e
Show file tree
Hide file tree
Showing 35 changed files with 409 additions and 624 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.6
3.1.6
9 changes: 4 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
source 'https://rubygems.org'
source "https://rubygems.org"

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '>= 2.6.10'

gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
ruby "3.1.6"
gem "cocoapods", ">= 1.13", "< 1.15"
gem "activesupport", ">= 6.1.7.3", "< 7.1.0"
gem "fastlane"
60 changes: 28 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ GEM
base64
nkf
rexml
activesupport (6.1.7.7)
activesupport (7.0.8.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
Expand All @@ -19,17 +18,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.911.0)
aws-sdk-core (3.191.6)
aws-partitions (1.944.0)
aws-sdk-core (3.197.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.78.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (1.84.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.146.1)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-s3 (1.152.3)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -78,18 +77,17 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.3)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
domain_name (0.6.20240107)
dotenv (2.8.1)
emoji_regex (3.2.3)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.109.0)
excon (0.110.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -160,7 +158,7 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
ffi (1.16.3)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
Expand All @@ -178,19 +176,19 @@ GEM
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.29.0)
google-apis-storage_v1 (0.31.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.6.1)
google-cloud-core (1.7.0)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
google-cloud-errors (1.4.0)
google-cloud-storage (1.47.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.29.0)
google-apis-storage_v1 (~> 0.31.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
Expand All @@ -201,27 +199,27 @@ GEM
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.5)
http-cookie (1.0.6)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
jwt (2.8.1)
base64
mini_magick (4.12.0)
mini_magick (4.13.1)
mini_mime (1.1.5)
minitest (5.22.3)
minitest (5.23.1)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.0)
multipart-post (2.4.1)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
nkf (0.2.0)
optparse (0.4.0)
optparse (0.5.0)
os (1.1.4)
plist (3.7.1)
public_suffix (4.0.7)
Expand All @@ -231,20 +229,22 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rexml (3.2.9)
strscan
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.5)
signet (0.18.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.10)
CFPropertyList
naturally
strscan (3.1.0)
terminal-notifier (2.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand All @@ -258,9 +258,6 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
word_wrap (1.0.0)
xcodeproj (1.24.0)
Expand All @@ -274,7 +271,6 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.6.13)

PLATFORMS
ruby
Expand All @@ -285,7 +281,7 @@ DEPENDENCIES
fastlane

RUBY VERSION
ruby 2.7.4p191
ruby 3.1.6p260

BUNDLED WITH
2.4.22
2.5.13
18 changes: 18 additions & 0 deletions class/contact-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import BIP47Factory from '@spsina/bip47';
import { SilentPayment } from 'silent-payments';

import ecc from '../blue_modules/noble_ecc';
import * as bitcoin from 'bitcoinjs-lib';

export class ContactList {
isBip47PaymentCodeValid(pc: string) {
Expand All @@ -21,4 +22,21 @@ export class ContactList {
isPaymentCodeValid(pc: string): boolean {
return this.isBip47PaymentCodeValid(pc) || this.isBip352PaymentCodeValid(pc);
}

isAddressValid(address: string): boolean {
try {
bitcoin.address.toOutputScript(address); // throws, no?

if (!address.toLowerCase().startsWith('bc1')) return true;
const decoded = bitcoin.address.fromBech32(address);
if (decoded.version === 0) return true;
if (decoded.version === 1 && decoded.data.length !== 32) return false;
if (decoded.version === 1 && !ecc.isPoint(Buffer.concat([Buffer.from([2]), decoded.data]))) return false;
if (decoded.version > 1) return false;
// ^^^ some day, when versions above 1 will be actually utilized, we would need to unhardcode this
return true;
} catch (e) {
return false;
}
}
}
45 changes: 29 additions & 16 deletions components/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useMemo } from 'react';
import { ActivityIndicator, I18nManager, Pressable, PressableProps, StyleSheet, Switch, TouchableOpacity } from 'react-native';
import { ActivityIndicator, I18nManager, Pressable, PressableProps, StyleSheet, Switch, TouchableOpacity, View } from 'react-native';
import { Avatar, ListItem as RNElementsListItem, Button } from '@rneui/themed'; // Replace with actual import paths

import { useTheme } from './themes';
Expand Down Expand Up @@ -58,13 +58,6 @@ const DefaultRightContent: React.FC<{ reset: () => void; onDeletePressed?: () =>
/>
);

const styles = StyleSheet.create({
rightButton: {
minHeight: '100%',
backgroundColor: 'red',
},
});

const ListItem: React.FC<ListItemProps> = React.memo(
({
swipeable = false,
Expand Down Expand Up @@ -107,9 +100,7 @@ const ListItem: React.FC<ListItemProps> = React.memo(
fontWeight: '400',
fontSize: 14,
},
rightTitleContainer: {
flex: 1,
},

containerStyle: {
backgroundColor: colors.background,
},
Expand All @@ -121,8 +112,18 @@ const ListItem: React.FC<ListItemProps> = React.memo(

const renderContent = () => (
<>
{leftIcon && <Avatar icon={leftIcon} />}
{leftAvatar && leftAvatar}
{leftIcon && (
<>
<View style={styles.width16} />
<Avatar icon={leftIcon} />
</>
)}
{leftAvatar && (
<>
{leftAvatar}
<View style={styles.width16} />
</>
)}
<RNElementsListItem.Content>
<RNElementsListItem.Title style={stylesHook.title} numberOfLines={0} accessible={switchProps === undefined}>
{title}
Expand All @@ -137,12 +138,13 @@ const ListItem: React.FC<ListItemProps> = React.memo(
</RNElementsListItem.Subtitle>
)}
</RNElementsListItem.Content>

{rightTitle && (
<RNElementsListItem.Content right style={stylesHook.rightTitleContainer}>
<RNElementsListItem.Title style={rightTitleStyle} numberOfLines={0} right>
<View style={styles.margin8}>
<RNElementsListItem.Title style={rightTitleStyle} numberOfLines={0}>
{rightTitle}
</RNElementsListItem.Title>
</RNElementsListItem.Content>
</View>
)}
{isLoading ? (
<ActivityIndicator />
Expand Down Expand Up @@ -197,3 +199,14 @@ const ListItem: React.FC<ListItemProps> = React.memo(
);

export default ListItem;

const styles = StyleSheet.create({
rightButton: {
minHeight: '100%',
backgroundColor: 'red',
},
margin8: {
margin: 8,
},
width16: { width: 16 },
});
6 changes: 4 additions & 2 deletions components/ReplaceFeeSuggestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ const ReplaceFeeSuggestions: React.FC<ReplaceFeeSuggestionsProps> = ({ onFeeSele
setNetworkFees(fees);
onFeeSelected(fees.fastestFee);
setSelectedFeeType(NetworkTransactionFeeType.FAST);
}, [onFeeSelected]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
fetchNetworkFees();
}, [fetchNetworkFees]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handleFeeSelection = (feeType: NetworkTransactionFeeType) => {
if (feeType !== NetworkTransactionFeeType.CUSTOM) {
Expand Down
34 changes: 14 additions & 20 deletions components/TransactionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
() => ({
backgroundColor: 'transparent',
borderBottomColor: colors.lightBorder,
paddingTop: 16,
paddingBottom: 16,
paddingRight: 0,
}),
[colors.lightBorder],
);
Expand Down Expand Up @@ -342,22 +339,20 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [item.hash, subtitle, rowTitle, subtitleNumberOfLines, txMetadata]);
return (
<View style={styles.container}>
<ToolTipMenu ref={menuRef} actions={toolTipActions} onPressMenuItem={onToolTipPress} onPress={onPress}>
<ListItem
leftAvatar={avatar}
title={title}
subtitleNumberOfLines={subtitleNumberOfLines}
subtitle={subtitle}
Component={View}
subtitleProps={subtitleProps}
chevron={false}
rightTitle={rowTitle}
rightTitleStyle={rowTitleStyle}
containerStyle={containerStyle}
/>
</ToolTipMenu>
</View>
<ToolTipMenu ref={menuRef} actions={toolTipActions} onPressMenuItem={onToolTipPress} onPress={onPress}>
<ListItem
leftAvatar={avatar}
title={title}
subtitleNumberOfLines={subtitleNumberOfLines}
subtitle={subtitle}
Component={View}
subtitleProps={subtitleProps}
chevron={false}
rightTitle={rowTitle}
rightTitleStyle={rowTitleStyle}
containerStyle={containerStyle}
/>
</ToolTipMenu>
);
});

Expand Down Expand Up @@ -395,5 +390,4 @@ const actionIcons = {

const styles = StyleSheet.create({
iconWidth: { width: 25 },
container: { marginHorizontal: 4 },
});
Loading

0 comments on commit d0c560e

Please sign in to comment.