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 Mar 10, 2024
2 parents 7ae104e + 23c58b9 commit ce0752e
Show file tree
Hide file tree
Showing 74 changed files with 1,693 additions and 715 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ 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'
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
gem "fastlane"
25 changes: 15 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.7.6)
activesupport (6.1.7.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -17,8 +19,8 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.883.0)
aws-sdk-core (3.191.0)
aws-partitions (1.895.0)
aws-sdk-core (3.191.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
Expand All @@ -33,6 +35,7 @@ GEM
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.14.3)
addressable (~> 2.8)
Expand Down Expand Up @@ -205,17 +208,19 @@ GEM
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.1)
jwt (2.7.1)
jwt (2.8.1)
base64
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.21.2)
minitest (5.22.2)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.3.0)
multipart-post (2.4.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
nkf (0.2.0)
optparse (0.4.0)
os (1.1.4)
plist (3.7.1)
Expand Down Expand Up @@ -258,7 +263,7 @@ GEM
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
word_wrap (1.0.0)
xcodeproj (1.23.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -269,14 +274,14 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.6.12)
zeitwerk (2.6.13)

PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.3, < 7.1.0)
cocoapods (>= 1.13)
cocoapods (>= 1.13, < 1.15)
fastlane

RUBY VERSION
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "6.5.6"
versionName "6.5.9"
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
Expand Down
2 changes: 1 addition & 1 deletion components/BottomModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const BottomModal: React.FC<BottomModalProps> = ({
{props.children}
{doneButton && (
<View style={[styles.hasDoneButton, stylesHook.hasDoneButton]}>
<Button title={loc.send.input_done} onPress={onClose} />
<Button title={loc.send.input_done} onPress={onClose} testID="ModalDoneButton" />
<BlueSpacing10 />
</View>
)}
Expand Down
43 changes: 34 additions & 9 deletions components/DynamicQRCode.js → components/DynamicQRCode.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint react/prop-types: "off", react-native/no-inline-styles: "off" */
import React, { Component } from 'react';
import { Text } from 'react-native-elements';
import { Dimensions, LayoutAnimation, StyleSheet, TouchableOpacity, View } from 'react-native';
Expand All @@ -10,9 +9,24 @@ import loc from '../loc';

const { height, width } = Dimensions.get('window');

export class DynamicQRCode extends Component {
constructor() {
super();
interface DynamicQRCodeProps {
value: string;
capacity?: number;
hideControls?: boolean;
}

interface DynamicQRCodeState {
index: number;
total: number;
qrCodeHeight: number;
intervalHandler: ReturnType<typeof setInterval> | number | null;
displayQRCode: boolean;
hideControls?: boolean;
}

export class DynamicQRCode extends Component<DynamicQRCodeProps, DynamicQRCodeState> {
constructor(props: DynamicQRCodeProps) {
super(props);
const qrCodeHeight = height > width ? width - 40 : width / 3;
const qrCodeMaxHeight = 370;
this.state = {
Expand All @@ -24,7 +38,7 @@ export class DynamicQRCode extends Component {
};
}

fragments = [];
fragments: string[] = [];

componentDidMount() {
const { value, capacity = 200, hideControls = true } = this.props;
Expand Down Expand Up @@ -67,7 +81,7 @@ export class DynamicQRCode extends Component {
};

stopAutoMove = () => {
clearInterval(this.state.intervalHandler);
clearInterval(this.state.intervalHandler as number);
this.setState(() => ({
intervalHandler: null,
}));
Expand Down Expand Up @@ -138,21 +152,21 @@ export class DynamicQRCode extends Component {
<View style={animatedQRCodeStyle.controller}>
<TouchableOpacity
accessibilityRole="button"
style={[animatedQRCodeStyle.button, { width: '25%', alignItems: 'flex-start' }]}
style={[animatedQRCodeStyle.button, animatedQRCodeStyle.buttonPrev]}
onPress={this.moveToPreviousFragment}
>
<Text style={animatedQRCodeStyle.text}>{loc.send.dynamic_prev}</Text>
</TouchableOpacity>
<TouchableOpacity
accessibilityRole="button"
style={[animatedQRCodeStyle.button, { width: '50%' }]}
style={[animatedQRCodeStyle.button, animatedQRCodeStyle.buttonStopStart]}
onPress={this.state.intervalHandler ? this.stopAutoMove : this.startAutoMove}
>
<Text style={animatedQRCodeStyle.text}>{this.state.intervalHandler ? loc.send.dynamic_stop : loc.send.dynamic_start}</Text>
</TouchableOpacity>
<TouchableOpacity
accessibilityRole="button"
style={[animatedQRCodeStyle.button, { width: '25%', alignItems: 'flex-end' }]}
style={[animatedQRCodeStyle.button, animatedQRCodeStyle.buttonNext]}
onPress={this.moveToNextFragment}
>
<Text style={animatedQRCodeStyle.text}>{loc.send.dynamic_next}</Text>
Expand Down Expand Up @@ -189,6 +203,17 @@ const animatedQRCodeStyle = StyleSheet.create({
height: 45,
justifyContent: 'center',
},
buttonPrev: {
width: '25%',
alignItems: 'flex-start',
},
buttonStopStart: {
width: '50%',
},
buttonNext: {
width: '25%',
alignItems: 'flex-end',
},
text: {
fontSize: 14,
color: BlueCurrentTheme.colors.foregroundColor,
Expand Down
38 changes: 35 additions & 3 deletions components/MultipleStepsListItem.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import React, { useRef } from 'react';

import { View, StyleSheet, Text, TouchableOpacity, ActivityIndicator } from 'react-native';
import { View, StyleSheet, Text, TouchableOpacity, ActivityIndicator, findNodeHandle } from 'react-native';
import PropTypes from 'prop-types';
import { Icon } from 'react-native-elements';
import { useTheme } from './themes';
import ActionSheetOptions from '../screen/ActionSheet.common';
import ActionSheet from '../screen/ActionSheet';
export const MultipleStepsListItemDashType = Object.freeze({ none: 0, top: 1, bottom: 2, topAndBottom: 3 });
export const MultipleStepsListItemButtohType = Object.freeze({ partial: 0, full: 1 });

Expand All @@ -15,6 +17,8 @@ const MultipleStepsListItem = props => {
circledText = '',
leftText = '',
checked = false,
useActionSheet = false,
actionSheetOptions = null, // Default to null or appropriate default
} = props;
const stylesHook = StyleSheet.create({
provideKeyButton: {
Expand All @@ -36,6 +40,29 @@ const MultipleStepsListItem = props => {
color: colors.alternativeTextColor,
},
});
const selfRef = useRef(null); // Create a ref for the component itself

const handleOnPressForActionSheet = () => {
if (useActionSheet && actionSheetOptions) {
// Clone options to modify them
let modifiedOptions = { ...actionSheetOptions };

// Use 'selfRef' if the component uses its own ref, or 'ref' if it's using forwarded ref
const anchor = findNodeHandle(selfRef.current);

if (anchor) {
// Attach the anchor only if it exists
modifiedOptions = { ...modifiedOptions, anchor };
}

ActionSheet.showActionSheetWithOptions(modifiedOptions, buttonIndex => {
// Call the original onPress function, if provided, and not cancelled
if (buttonIndex !== -1 && props.button.onPress) {
props.button.onPress(buttonIndex);
}
});
}
};

const renderDashes = () => {
switch (dashes) {
Expand Down Expand Up @@ -106,10 +133,12 @@ const MultipleStepsListItem = props => {
{props.button.buttonType === undefined ||
(props.button.buttonType === MultipleStepsListItemButtohType.full && (
<TouchableOpacity
ref={useActionSheet ? selfRef : null}
testID={props.button.testID}
accessibilityRole="button"
disabled={props.button.disabled}
style={[styles.provideKeyButton, stylesHook.provideKeyButton, buttonOpacity]}
onPress={props.button.onPress}
onPress={useActionSheet ? handleOnPressForActionSheet : props.button.onPress}
>
<Text style={[styles.provideKeyButtonText, stylesHook.provideKeyButtonText]}>{props.button.text}</Text>
</TouchableOpacity>
Expand All @@ -120,6 +149,7 @@ const MultipleStepsListItem = props => {
{props.button.leftText}
</Text>
<TouchableOpacity
testID={props.button.testID}
accessibilityRole="button"
disabled={props.button.disabled}
style={[styles.rowPartialRightButton, stylesHook.provideKeyButton, rightButtonOpacity]}
Expand Down Expand Up @@ -155,6 +185,8 @@ MultipleStepsListItem.propTypes = {
checked: PropTypes.bool,
leftText: PropTypes.string,
showActivityIndicator: PropTypes.bool,
useActionSheet: PropTypes.bool,
actionSheetOptions: PropTypes.shape(ActionSheetOptions),
dashes: PropTypes.number,
button: PropTypes.shape({
text: PropTypes.string,
Expand Down
40 changes: 0 additions & 40 deletions components/SquareButton.js

This file was deleted.

41 changes: 41 additions & 0 deletions components/SquareButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { forwardRef } from 'react';
import { TouchableOpacity, View, Text, StyleProp, ViewStyle, StyleSheet } from 'react-native';
import { useTheme } from './themes';

interface SquareButtonProps {
title: string;
onPress: () => void;
style: StyleProp<ViewStyle>;
testID?: string;
}

export const SquareButton = forwardRef<TouchableOpacity, SquareButtonProps>((props, ref) => {
const { title, onPress, style, testID } = props;
const { colors } = useTheme();

const hookStyles = StyleSheet.create({
text: {
color: colors.buttonTextColor,
},
});

return (
<TouchableOpacity ref={ref} style={style} onPress={onPress} testID={testID} accessibilityRole="button">
<View style={styles.contentContainer}>
<Text style={[styles.text, hookStyles.text]}>{title}</Text>
</View>
</TouchableOpacity>
);
});

const styles = StyleSheet.create({
contentContainer: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
text: {
marginHorizontal: 8,
fontSize: 16,
},
});
Loading

0 comments on commit ce0752e

Please sign in to comment.