Skip to content

Commit

Permalink
Merge commit '7573edfa93c9708607f74d48b6a15ea3ec55a63e' into ja-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tequdev committed Oct 13, 2023
2 parents 811b1d8 + 7573edf commit 93f481d
Show file tree
Hide file tree
Showing 164 changed files with 1,841 additions and 1,420 deletions.
26 changes: 14 additions & 12 deletions .cosmos/cosmos.imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ import { RendererConfig, UserModuleWrappers } from 'react-cosmos-core';

import './prepare';

import * as fixture0 from './fixtures/SegmentButton.fixture';
import * as fixture1 from './fixtures/RecipientElement.fixture';
import * as fixture2 from './fixtures/InfoMessage.fixture';
import * as fixture3 from './fixtures/Badge.fixture';
import * as fixture4 from './fixtures/Avatar.fixture';
import * as fixture5 from './fixtures/AmountText.fixture';
import * as fixture0 from './fixtures/XAppShortList.fixture';
import * as fixture1 from './fixtures/SegmentButton.fixture';
import * as fixture2 from './fixtures/RecipientElement.fixture';
import * as fixture3 from './fixtures/InfoMessage.fixture';
import * as fixture4 from './fixtures/Badge.fixture';
import * as fixture5 from './fixtures/Avatar.fixture';
import * as fixture6 from './fixtures/AmountText.fixture';

export const rendererConfig: RendererConfig = {
"playgroundUrl": "http://localhost:5001",
"rendererUrl": null
};

const fixtures = {
'fixtures/SegmentButton.fixture.tsx': { module: fixture0 },
'fixtures/RecipientElement.fixture.tsx': { module: fixture1 },
'fixtures/InfoMessage.fixture.tsx': { module: fixture2 },
'fixtures/Badge.fixture.tsx': { module: fixture3 },
'fixtures/Avatar.fixture.tsx': { module: fixture4 },
'fixtures/AmountText.fixture.tsx': { module: fixture5 }
'fixtures/XAppShortList.fixture.tsx': { module: fixture0 },
'fixtures/SegmentButton.fixture.tsx': { module: fixture1 },
'fixtures/RecipientElement.fixture.tsx': { module: fixture2 },
'fixtures/InfoMessage.fixture.tsx': { module: fixture3 },
'fixtures/Badge.fixture.tsx': { module: fixture4 },
'fixtures/Avatar.fixture.tsx': { module: fixture5 },
'fixtures/AmountText.fixture.tsx': { module: fixture6 }
};

const decorators = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/* eslint-disable spellcheck/spell-checker */
import React from 'react';
import { storiesOf } from '@storybook/react-native';

import { withContainer } from '../../../../storybook/decoration';

import { XAppShortList } from '../XAppShortList';
import { XAppShortList } from '@components/Modules/XAppShortList';

const apps = [
{
Expand Down Expand Up @@ -33,6 +29,4 @@ const apps = [
},
];

storiesOf('XAppList', module)
.addDecorator(withContainer)
.add('default', () => <XAppShortList apps={apps} />);
export default <XAppShortList apps={apps} />;
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ subprojects { subproject ->
versionMajor = npmVersion[0]
versionMinor = npmVersion[1]
versionPatch = npmVersion[2]
buildNumber = 4
buildNumber = 5
}
}

Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ PODS:
- React-CoreModules
- React-RCTImage
- React-RCTText
- RealmJS (11.10.2):
- RealmJS (12.2.0):
- React
- RNFBAnalytics (18.5.0):
- Firebase/AnalyticsWithoutAdIdSupport (= 10.15.0)
Expand Down Expand Up @@ -819,7 +819,7 @@ SPEC CHECKSUMS:
React-utils: 40cdd9acee23230df5b78bf78a64ce8a2084c2d0
ReactCommon: 4ec7cc40d091eed0a510755619940b6a03cb507b
ReactNativeNavigation: 2651d0bc1479e9df0789b077ae93320dc2c9b73b
RealmJS: 73a36da3cbbe85e1bdcbf55683172b51f35070d3
RealmJS: a480cb21d4b0ba82c843c77c3a211770411eec75
RNFBAnalytics: 403369236afba1d1083e236c17028d8a62f31527
RNFBApp: 082df9f8ffba99f23f7aee3ecb64df703e7e1adb
RNFBCrashlytics: 9d5b36a7e280178c5d61695936cb812005bf17ad
Expand Down
14 changes: 8 additions & 6 deletions ios/Xaman.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@
"${PODS_ROOT}/Firebase/CoreOnly/Sources",
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/Headers/Private/React-Core\"",
"$CONFIGURATION_TEMP_DIR/Xaman.build/DerivedSources",
$CONFIGURATION_TEMP_DIR/Xaman.build/DerivedSources,
);
INFOPLIST_FILE = XamanTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand Down Expand Up @@ -1078,7 +1078,7 @@
"${PODS_ROOT}/Firebase/CoreOnly/Sources",
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/Headers/Private/React-Core\"",
"$CONFIGURATION_TEMP_DIR/Xaman.build/DerivedSources",
$CONFIGURATION_TEMP_DIR/Xaman.build/DerivedSources,
);
INFOPLIST_FILE = XamanTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
Expand Down Expand Up @@ -1106,7 +1106,7 @@
CODE_SIGN_ENTITLEMENTS = Xaman/Xaman.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = LK5BBJNJZ6;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
Expand Down Expand Up @@ -1142,7 +1142,7 @@
CODE_SIGN_ENTITLEMENTS = Xaman/Xaman.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 5;
DEVELOPMENT_TEAM = LK5BBJNJZ6;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = Xaman/Info.plist;
Expand Down Expand Up @@ -1233,7 +1233,8 @@
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1305,7 +1306,8 @@
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
Expand Down
4 changes: 3 additions & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// hide console.log console.error in jest tests
/* Hide console.log console.error in jest tests */
jest.spyOn(global.console, 'log').mockImplementation(() => jest.fn());
jest.spyOn(global.console, 'error').mockImplementation(() => jest.fn());
jest.spyOn(global.console, 'debug').mockImplementation(() => jest.fn());

/* Mock RNN event listeners */
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter.js');
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');

/* Realm */
process.env.REALM_DISABLE_ANALYTICS = true;
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"react-native-camera": "4.2.1",
"react-native-interactable": "2.0.1",
"react-native-navigation": "7.37.0",
"realm": "11.10.2",
"ripple-address-codec": "4.3.0",
"realm": "12.2.0",
"ripple-binary-codec": "npm:[email protected]",
"tangem-sdk-react-native": "2.3.1",
"uuid": "9.0.1",
Expand All @@ -51,14 +50,13 @@
"@types/i18n-js": "3.8.5",
"@types/jest": "29.5.5",
"@types/lodash": "4.14.199",
"@types/react": "18.2.22",
"@types/react": "18.2.23",
"@types/react-native": "0.72.2",
"@types/react-test-renderer": "18.0.2",
"@types/react-test-renderer": "18.0.3",
"@types/uuid": "9.0.4",
"@typescript-eslint/eslint-plugin": "6.7.2",
"@typescript-eslint/parser": "6.7.2",
"babel-jest": "29.7.0",
"babel-loader": "9.1.3",
"babel-plugin-rewrite-require": "1.14.5",
"babel-plugin-transform-remove-console": "6.9.4",
"coveralls": "3.1.1",
Expand Down
6 changes: 3 additions & 3 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Application {

constructor() {
this.storage = new DataStorage();
this.logger = services.LoggerService.createLogger('Application');
this.logger = services.LoggerService.createLogger('App');
this.initialized = false;
}

Expand Down Expand Up @@ -237,11 +237,11 @@ class Application {

// if there is a language set in the settings load the setting base on the settings
if (core?.language) {
this.logger.debug(`Locale set to: ${core.language.toUpperCase()}`);
this.logger.debug(`Settings [Locale]/[Currency]: ${core.language.toUpperCase()}/${core.currency}`);
Localize.setLocale(core.language, core.useSystemSeparators ? localeSettings : undefined);
} else {
// app is not initialized yet, set to default device locale
this.logger.debug('Locale is not initialized, setting base on device languageCode');
this.logger.debug('Locale is not initialized, setting base on device settings');
const locale = Localize.setLocale(localeSettings.languageCode, localeSettings);
CoreRepository.saveSettings({ language: locale });
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/libs/ledger/pathFinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class LedgerPathFinding extends EventEmitter {

// request is canceled
if (id !== this.requestId) {
reject(new Error('CANCELED'));
reject(new Error('Request has been canceled and invalidated'));
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/common/libs/payload/digest/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { mapKeys } from 'lodash';
import * as codec from 'ripple-binary-codec';
import * as AccountLib from 'xrpl-accountlib';

import { GetDeviceUniqueId } from '@common/helpers/device';
import { SHA1 } from '@common/libs/crypto';
Expand Down Expand Up @@ -44,7 +44,7 @@ class DigestCodecWithSHA1 extends Digest {

// calculate checksum
// @ts-ignore
const checksum = codec[hashEncodingMethod](normalizedRequestJson);
const checksum = AccountLib.binary[hashEncodingMethod](normalizedRequestJson);

// calculate digest SHA1{checksum}+{deviceId}
const deviceId = GetDeviceUniqueId();
Expand Down
52 changes: 26 additions & 26 deletions src/components/General/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { Component } from 'react';
import React, { Component, PropsWithChildren } from 'react';
import { isEqual } from 'lodash';

import { View, Text, TextStyle, ViewStyle, ImageStyle } from 'react-native';
Expand All @@ -13,7 +13,7 @@ import { LoadingIndicator } from '@components/General/LoadingIndicator';
import styles from './styles';

/* Types ==================================================================== */
interface Props {
interface Props extends PropsWithChildren {
style?: ViewStyle | ViewStyle[];
textStyle?: TextStyle | TextStyle[];
disabledStyle?: TextStyle | TextStyle[];
Expand All @@ -40,7 +40,6 @@ interface Props {
icon?: Extract<keyof typeof Images, string>;
iconPosition?: 'right' | 'left';
iconSize?: number;
extraComponent?: React.ReactNode;
hitSlop?: any;
}

Expand All @@ -55,8 +54,14 @@ export default class Button extends Component<Props> {
numberOfLines: 2,
};

renderChildren() {
shouldComponentUpdate(nextProps: Props) {
return !isEqual(nextProps, this.props);
}

renderInnerContent() {
const {
children,
isLoading,
label,
icon,
iconPosition,
Expand All @@ -74,9 +79,25 @@ export default class Button extends Component<Props> {
iconStyle,
iconSize,
isDisabled,
extraComponent,
loadingIndicatorStyle,
} = this.props;

// loading indicator
if (isLoading) {
return (
<LoadingIndicator
size="small"
style={styles.spinner}
color={loadingIndicatorStyle || light ? 'default' : 'light'}
/>
);
}

// if children provided
if (children) {
return children;
}

return (
<View style={styles.buttonWrapper}>
{icon && iconPosition === 'left' && (
Expand Down Expand Up @@ -124,31 +145,10 @@ export default class Button extends Component<Props> {
]}
/>
)}
{extraComponent && extraComponent}
</View>
);
}

shouldComponentUpdate(nextProps: Props) {
return !isEqual(nextProps, this.props);
}

renderInnerContent() {
const { isLoading, light, loadingIndicatorStyle } = this.props;

if (isLoading) {
return (
<LoadingIndicator
size="small"
style={styles.spinner}
color={loadingIndicatorStyle || light ? 'default' : 'light'}
/>
);
}

return this.renderChildren();
}

onPress = () => {
const { onPress, isLoading } = this.props;

Expand Down
6 changes: 5 additions & 1 deletion src/components/General/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ interface ChildrenProps {
iconStyle?: ImageStyle;
render?: any;
onPress?: () => void;
extraComponent?: React.ReactNode;
}

interface Props {
placement: placementType;
leftComponent?: ChildrenProps;
centerComponent?: ChildrenProps;
subComponent?: ChildrenProps;
rightComponent?: ChildrenProps;
backgroundColor?: string;
containerStyle?: ViewStyle;
Expand Down Expand Up @@ -88,7 +90,7 @@ const Children = ({
onPress={onPress}
>
{children.text && children.icon && (
<View style={[AppStyles.row]}>
<View style={AppStyles.row}>
{(placement === 'left' || placement === 'center') && (
<Icon style={styles.iconStyle} size={children.iconSize || 30} name={children.icon} />
)}
Expand All @@ -115,6 +117,8 @@ const Children = ({
style={[styles.iconStyle, children.iconStyle]}
/>
)}

{children.extraComponent && children.extraComponent}
</TouchableDebounce>
);
};
Expand Down
Loading

0 comments on commit 93f481d

Please sign in to comment.