Skip to content

Commit e7219dc

Browse files
committed
Merge upstream/master; fix Language spec and backdoor opacity
- Resolve modify/delete conflict: keep shroud.spec.js deleted (superseded by new specs) - Drop Language step from 06-settings.spec.js (screen removed upstream) - Fix SkipVerifyBackdoor opacity 0 → 0.01 so iOS XCUITest hittability check passes
2 parents 5a76566 + 3fbcfff commit e7219dc

87 files changed

Lines changed: 894 additions & 20459 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ npm start
8686

8787
Open ios/Shroud.xcworkspace. Once the project loads, select the scheme/target Shroud. Click Run.
8888

89+
* To generate the debug APK:
90+
91+
```bash
92+
bash scripts/build-debug-apk.sh
93+
```
94+
8995
## TESTS
9096

9197
```bash

ShroudComponents.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { forwardRef } from 'react';
33
import { Dimensions, Platform, Pressable, StyleSheet, TextInput, View } from 'react-native';
44
import { Icon, Text } from '@rneui/themed';
55
import { useTheme } from './components/themes';
6-
import { useLocale } from '@react-navigation/native';
76

87
const { height, width } = Dimensions.get('window');
98
const aspectRatio = height / width;
@@ -39,11 +38,9 @@ export const ShroudCard = props => {
3938

4039
export const ShroudText = ({ bold = false, ...props }) => {
4140
const { colors } = useTheme();
42-
const { direction } = useLocale();
4341
const style = StyleSheet.compose(
4442
{
4543
color: colors.foregroundColor,
46-
writingDirection: direction,
4744
fontWeight: bold ? 'bold' : 'normal',
4845
},
4946
props.style,
@@ -58,7 +55,6 @@ export const ShroudTextCentered = props => {
5855

5956
export const ShroudFormLabel = props => {
6057
const { colors } = useTheme();
61-
const { direction } = useLocale();
6258

6359
return (
6460
<Text
@@ -67,7 +63,6 @@ export const ShroudFormLabel = props => {
6763
color: colors.foregroundColor,
6864
fontWeight: '400',
6965
marginHorizontal: 20,
70-
writingDirection: direction,
7166
}}
7267
/>
7368
);

__mocks__/react-native-localize.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const getLocales = () => [
2-
// you can choose / add the locales you want
32
{ countryCode: 'US', languageTag: 'en-US', languageCode: 'en', isRTL: false },
4-
{ countryCode: 'FR', languageTag: 'fr-FR', languageCode: 'fr', isRTL: false },
53
];
6-
const getCurrencies = () => ['USD', 'EUR']; // can be empty array
4+
const getCurrencies = () => ['USD'];
75

86
export { getLocales, getCurrencies };

android/app/src/main/java/org/bitshala/shroud/MainApplication.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ class MainApplication : Application(), ReactApplication {
6969
registerReceiver(themeChangeReceiver, IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED))
7070

7171
val sharedI18nUtilInstance = I18nUtil.getInstance()
72-
sharedI18nUtilInstance.allowRTL(applicationContext, true)
72+
sharedI18nUtilInstance.allowRTL(applicationContext, false)
73+
sharedI18nUtilInstance.forceRTL(applicationContext, false)
7374
SoLoader.init(this, OpenSourceMergedSoMapping)
7475
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
7576
// If you opted-in for the New Architecture, we load the native entry point for this app.

class/wallets/hd-bip352-wallet.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,33 @@ export class HDSilentPaymentsWallet extends HDTaprootWallet {
425425
}
426426
}
427427

428+
async scanByTxid(txid: string): Promise<{ found: boolean; utxosFound: number; blockHeight: number; tipHeight: number }> {
429+
const indexer = getDefaultIndexer();
430+
const [response, tipResponse] = await Promise.all([indexer.getTransactionByTxid(txid), indexer.getLatestBlockHeight()]);
431+
const tx = response.transaction;
432+
433+
const result = await this.processTransactions([tx]);
434+
435+
let newlyAdded = false;
436+
for (const utxo of result.utxos) {
437+
if (this.addUTXO(utxo)) {
438+
newlyAdded = true;
439+
}
440+
}
441+
442+
if (newlyAdded) {
443+
this.onBalanceChangeCallback?.();
444+
this.onPersistCallback?.();
445+
}
446+
447+
return {
448+
found: result.utxos.length > 0,
449+
utxosFound: result.utxos.length,
450+
blockHeight: tx.blockHeight,
451+
tipHeight: tipResponse.height,
452+
};
453+
}
454+
428455
async fetchUtxo(): Promise<void> {
429456
const spUtxos = this.getSilentPaymentUTXOs();
430457

components/Context/SettingsProvider.tsx

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import AsyncStorage from '@react-native-async-storage/async-storage';
21
import { BLOCK_EXPLORERS, getBlockExplorerUrl, saveBlockExplorer, BlockExplorer, normalizeUrl } from '../../models/blockExplorer';
32
import * as Electrum from '../../modules/Electrum';
43
import React, { createContext, useCallback, useEffect, useMemo, useState } from 'react';
@@ -7,7 +6,7 @@ import { isReadClipboardAllowed, setReadClipboardAllowed } from '../../modules/c
76
import { getPreferredCurrency, GROUP_IO_SHROUD, initCurrencyDaemon, setPreferredCurrency } from '../../modules/currency';
87
import { clearUseURv1, isURv1Enabled, setUseURv1 } from '../../modules/ur';
98
import { ShroudApp } from '../../class';
10-
import { saveLanguage, STORAGE_KEY } from '../../loc';
9+
1110
import { FiatUnit, TFiatUnit } from '../../models/fiatUnit';
1211
import {
1312
getEnabled as getIsDeviceQuickActionsEnabled,
@@ -75,8 +74,6 @@ export const getTotalBalancePreferredUnit = async (): Promise<BitcoinUnit> => {
7574
interface SettingsContextType {
7675
preferredFiatCurrency: TFiatUnit;
7776
setPreferredFiatCurrencyStorage: (currency: TFiatUnit) => Promise<void>;
78-
language: string;
79-
setLanguageStorage: (language: string) => Promise<void>;
8077
isPrivacyBlurEnabled: boolean;
8178
setIsPrivacyBlurEnabled: (value: boolean) => void;
8279
isDoNotTrackEnabled: boolean;
@@ -100,8 +97,6 @@ interface SettingsContextType {
10097
const defaultSettingsContext: SettingsContextType = {
10198
preferredFiatCurrency: FiatUnit.USD,
10299
setPreferredFiatCurrencyStorage: async () => {},
103-
language: 'en',
104-
setLanguageStorage: async () => {},
105100
isPrivacyBlurEnabled: true,
106101
setIsPrivacyBlurEnabled: () => {},
107102
isDoNotTrackEnabled: false,
@@ -126,7 +121,6 @@ export const SettingsContext = createContext<SettingsContextType>(defaultSetting
126121

127122
export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.memo(({ children }: { children: React.ReactNode }) => {
128123
const [preferredFiatCurrency, setPreferredFiatCurrencyState] = useState<TFiatUnit>(FiatUnit.USD);
129-
const [language, setLanguage] = useState<string>('en');
130124
const [isPrivacyBlurEnabled, setIsPrivacyBlurEnabled] = useState<boolean>(true);
131125
const [isDoNotTrackEnabled, setIsDoNotTrackEnabled] = useState<boolean>(false);
132126
const [isLegacyURv1Enabled, setIsLegacyURv1Enabled] = useState<boolean>(false);
@@ -151,9 +145,6 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.m
151145
Electrum.isDisabled().then(disabled => {
152146
setIsElectrumDisabled(disabled);
153147
}),
154-
AsyncStorage.getItem(STORAGE_KEY).then(lang => {
155-
setLanguage(lang ?? 'en');
156-
}),
157148
isURv1Enabled().then(urv1Enabled => {
158149
setIsLegacyURv1Enabled(urv1Enabled);
159150
}),
@@ -217,15 +208,6 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.m
217208
}
218209
}, []);
219210

220-
const setLanguageStorage = useCallback(async (newLanguage: string): Promise<void> => {
221-
try {
222-
await saveLanguage(newLanguage);
223-
setLanguage(newLanguage);
224-
} catch (e) {
225-
console.error('Error setting language:', e);
226-
}
227-
}, []);
228-
229211
const setDoNotTrackStorage = useCallback(async (value: boolean): Promise<void> => {
230212
try {
231213
await DefaultPreference.setName(GROUP_IO_SHROUD);
@@ -305,8 +287,6 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.m
305287
() => ({
306288
preferredFiatCurrency,
307289
setPreferredFiatCurrencyStorage,
308-
language,
309-
setLanguageStorage,
310290
isPrivacyBlurEnabled,
311291
setIsPrivacyBlurEnabled,
312292
isDoNotTrackEnabled,
@@ -329,8 +309,6 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = React.m
329309
[
330310
preferredFiatCurrency,
331311
setPreferredFiatCurrencyStorage,
332-
language,
333-
setLanguageStorage,
334312
isPrivacyBlurEnabled,
335313
setIsPrivacyBlurEnabled,
336314
isDoNotTrackEnabled,

components/ListItem.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React, { useMemo } from 'react';
22
import { ActivityIndicator, Pressable, PressableProps, StyleSheet, Switch, TouchableOpacity, View } from 'react-native';
33
import { Avatar, ListItem as RNElementsListItem, Button } from '@rneui/themed'; // Replace with actual import paths
4-
import { useLocale } from '@react-navigation/native';
5-
64
import { useTheme } from './themes';
75

86
// Update the type for the props
@@ -87,17 +85,14 @@ const ListItem: React.FC<ListItemProps> = React.memo(
8785
swipeableRightContent,
8886
}: ListItemProps) => {
8987
const { colors } = useTheme();
90-
const { direction } = useLocale();
9188
const stylesHook = StyleSheet.create({
9289
title: {
9390
color: disabled ? colors.buttonDisabledTextColor : colors.foregroundColor,
9491
fontSize: 16,
9592
fontWeight: '500',
96-
writingDirection: direction,
9793
},
9894
subtitle: {
9995
flexWrap: 'wrap',
100-
writingDirection: direction,
10196
color: colors.alternativeTextColor,
10297
fontWeight: '400',
10398
paddingVertical: switchProps ? 8 : 0,
@@ -154,7 +149,7 @@ const ListItem: React.FC<ListItemProps> = React.memo(
154149
<ActivityIndicator />
155150
) : (
156151
<>
157-
{chevron && <RNElementsListItem.Chevron iconStyle={{ transform: [{ scaleX: direction === 'rtl' ? -1 : 1 }] }} />}
152+
{chevron && <RNElementsListItem.Chevron />}
158153
{rightIcon && <Avatar icon={rightIcon} />}
159154
{switchProps && (
160155
<Switch {...memoizedSwitchProps} accessibilityLabel={title} style={styles.margin16} accessible accessibilityRole="switch" />

components/TooltipMenu.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useCallback, useMemo } from 'react';
22
import { Platform, TouchableOpacity } from 'react-native';
33
import { MenuView, MenuAction, NativeActionEvent } from '@react-native-menu/menu';
44
import { ToolTipMenuProps, Action } from './types';
5-
import { useSettings } from '../hooks/context/useSettings';
65

76
const ToolTipMenu = (props: ToolTipMenuProps) => {
87
const {
@@ -17,8 +16,6 @@ const ToolTipMenu = (props: ToolTipMenuProps) => {
1716
...restProps
1817
} = props;
1918

20-
const { language } = useSettings();
21-
2219
// Map Menu Items for RN Menu (supports subactions and displayInline)
2320
const mapMenuItemForMenuView = useCallback((action: Action): MenuAction | null => {
2421
if (!action.id) return null;
@@ -117,7 +114,7 @@ const ToolTipMenu = (props: ToolTipMenuProps) => {
117114
accessibilityLabel={props.accessibilityLabel}
118115
accessibilityHint={props.accessibilityHint}
119116
accessibilityRole={props.accessibilityRole}
120-
accessibilityLanguage={language}
117+
accessibilityLanguage="en"
121118
>
122119
{isMenuPrimaryAction || isButton ? (
123120
<TouchableOpacity style={buttonStyle} disabled={disabled} onPress={onPress} {...restProps}>

components/TransactionListItem.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = memo(
6363
const { navigate } = useExtendedNavigation<NavigationProps>();
6464
const menuRef = useRef<ToolTipMenuProps>();
6565
const { txMetadata } = useStorage();
66-
const { language, selectedBlockExplorer } = useSettings();
66+
const { selectedBlockExplorer } = useSettings();
6767
const insets = useSafeAreaInsets();
6868
const containerStyle = useMemo(
6969
() => ({
@@ -88,8 +88,7 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = memo(
8888
} else {
8989
return transactionTimeToReadable(item.timestamp);
9090
}
91-
// eslint-disable-next-line react-hooks/exhaustive-deps
92-
}, [relevantAddress, item.confirmations, item.timestamp, language]);
91+
}, [relevantAddress, item.confirmations, item.timestamp]);
9392

9493
const timeText = useMemo(() => {
9594
if (item.confirmations === 0) {
@@ -111,8 +110,7 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = memo(
111110
return transactionTimeToReadable(item.timestamp);
112111
}
113112
}
114-
// eslint-disable-next-line react-hooks/exhaustive-deps
115-
}, [item.confirmations, item.timestamp, language]);
113+
}, [item.confirmations, item.timestamp]);
116114

117115
const txMemo = txMetadata[item.hash]?.memo ?? '';
118116
const subtitle = useMemo(() => {

0 commit comments

Comments
 (0)