Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master into staging ln #3102

Merged
merged 27 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f8bccf4
frontend: add eslint rule restrict-template-expressions
thisconnect Oct 31, 2023
c6ee6e0
frontend: fix restrict-template-expressions
thisconnect Dec 2, 2024
f5930ed
frontend: allow numbers in template literals
thisconnect Dec 2, 2024
58c9fc7
frontend: remove unused swiss-made css
thisconnect Dec 2, 2024
27fdb73
frontend/widget: fix loosing iframe ref on screen rotation
Beerosagos Dec 3, 2024
a774621
ci: add artifact url to windows outputs
sutterseba Dec 3, 2024
c033211
Merge branch 'ci-fix-windows-artifact-url'
sutterseba Dec 3, 2024
9704476
Merge branch 'iframe-ref'
Beerosagos Dec 3, 2024
1b67bce
Merge branch 'frontend-eslint-templateliterals'
thisconnect Dec 3, 2024
045aa86
frontend/notes: filter text files on notes import
Beerosagos Nov 28, 2024
4d293ce
Merge branch 'filepicker-txt'
Beerosagos Dec 4, 2024
41064f9
frontend: type coinUnit in IAccount
NicolaLS Oct 3, 2024
7aef20d
frontend: utilize send-wrapper for some logic
NicolaLS Oct 3, 2024
ec61327
Merge branch 'frontend-send-refactor'
thisconnect Dec 4, 2024
7f42c0a
frontend: fix bb01 device-info type
thisconnect Dec 4, 2024
ff01a50
frontend: remove unused state in send component
NicolaLS Oct 4, 2024
73bfcd9
frontend: improve send error handling
NicolaLS Oct 4, 2024
c5bf45c
frontend: improve note onChange handler
NicolaLS Oct 7, 2024
2fabfa4
frontend: hide estimated symbol for send-to-self transactions
thisconnect Dec 5, 2024
ca5fc80
frontend: keep fees dropdown always enabled
thisconnect Dec 4, 2024
8a6c65d
Merge branch 'frontend-enable-feetargets-dropdown'
thisconnect Dec 5, 2024
74338a9
Merge branch 'frontend-deviceinfo-null'
thisconnect Dec 5, 2024
9a74ab4
Merge branch 'frontend-fix-sendself-esitmated'
thisconnect Dec 5, 2024
85201c3
frontend: fix chart edgecase to properly update the total amount
thisconnect Dec 6, 2024
0c3f44f
Merge branch 'frontend-cleanup-send'
thisconnect Dec 9, 2024
e1d6d34
Merge branch 'frontend-fix-chart-edgecase'
thisconnect Dec 9, 2024
2403bb5
Merge branch 'master' into master-into-staging-ln
Beerosagos Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ jobs:
(cd $GOPATH/$GO_SRC_DIR; make ios)
windows:
runs-on: windows-2019
outputs:
artifact-url: ${{ steps.upload.outputs.artifact-url }}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -221,10 +223,12 @@ jobs:
cd frontends/qt
makensis setup.nsi
- name: Upload Installer
id: upload
uses: actions/upload-artifact@v4
with:
path: frontends/qt/BitBox-installer.exe
name: BitBoxApp-Windows-${{ github.sha }}.exe
name: BitBoxApp-windows-${{ github.sha }}.exe
if-no-files-found: error

report-artifacts:
needs: [android, qt-linux, macos, windows]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
- Fix long transaction notes to show fully on multiple lines when necessary
- Improve send-to-self transactions in account overview
- Use native scrollbars on macOS, iOS and Android
- Fix address signing fail on screen rotation for Pocket and Bitsurance
- Restrict selection to text files when importing notes

# 4.46.3
- Fix camera access on linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,17 @@ public void onActivityResult(Uri uri) {
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {
MainActivity.this.filePathCallback = filePathCallback;
mGetContent.launch("*/*");
String[] mimeTypes = fileChooserParams.getAcceptTypes();
String fileType = "*/*";
if (mimeTypes.length == 1) {
// import notes form uses .txt file type, but is not supported here.
if (".txt".equals(mimeTypes[0])) {
fileType = "text/plain";
} else if (MimeTypeMap.getSingleton().hasMimeType(mimeTypes[0])) {
fileType = mimeTypes[0];
}
}
mGetContent.launch(fileType);
return true;
}
});
Expand Down
12 changes: 11 additions & 1 deletion frontends/web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@
"overrides": [
{
"files": ["**/*.ts?(x)"],
"rules": { }
"rules": {
"@typescript-eslint/restrict-template-expressions": ["error", {
"allowNumber": true,
"allowAny": false,
"allowBoolean": false,
"allowNullish": false
}]
},
"parserOptions": {
"project": ["./tsconfig.json"]
}
},
{
"files": ["**/*.test.ts?(x)"],
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface IAccount {
active: boolean;
watch: boolean;
coinCode: CoinCode;
coinUnit: string;
coinUnit: CoinUnit;
coinName: string;
code: AccountCode;
name: string;
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/api/bitbox01.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export type DeviceInfo = {

export const getDeviceInfo = (
deviceID: string,
): Promise<DeviceInfo> => {
): Promise<DeviceInfo | null> => {
return apiGet(`devices/${deviceID}/info`);
};
2 changes: 1 addition & 1 deletion frontends/web/src/api/subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const subscribeEndpoint = <T>(
.catch(console.error);
break;
default:
throw new Error(`Event: ${event} not supported`);
throw new Error(`Event: ${JSON.stringify(event)} not supported`);
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/components/forms/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Select = ({
<select id={id} {...props}>
{options.map(({ value, text, disabled = false }) => (
<option
key={`${value}`}
key={String(value)}
value={value}
disabled={disabled}
>
Expand Down
8 changes: 0 additions & 8 deletions frontends/web/src/components/icon/logo.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,8 @@
width: 100% !important;
}

.swissOpenSource.large {
max-width: 280px !important;
}

@media (max-width: 768px) {
.swissOpenSource {
max-width: 180px !important;
}

.swissOpenSource.large {
max-width: 210px !important;
}
}
41 changes: 20 additions & 21 deletions frontends/web/src/components/icon/logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,22 @@ import PAXG_GREY from './assets/paxg-white.svg';
import ShiftLogo from './assets/shift-cryptosecurity-logo.svg';
import style from './logo.module.css';

interface GenericProps {
[property: string]: any;
}

export const BitBox = (props: GenericProps) => <img {...props} draggable={false} src={BitBoxLogo} alt="BitBox" className={style.logo} />;
export const BitBox02 = (props: GenericProps) => <img {...props} draggable={false} src={BitBox02Logo} alt="BitBox02" className={style.logo} />;
export const BitBox02Inverted = (props: GenericProps) => <img {...props} draggable={false} src={BitBox02InvertedLogo} alt="BitBox02" className={style.logo} />;
export const AppLogo = (props: GenericProps) => <img {...props} draggable={false} src={AppLogoImg} alt="BitBox" className={style.logo} />;
export const AppLogoInverted = (props: GenericProps) => <img {...props} draggable={false} src={AppLogoInvertedImg} alt="BitBox" className={style.logo} />;
export const BitBoxSwiss = (props: GenericProps) => <img {...props} draggable={false} src={BitBoxSwissLogo} alt="BitBox" className={style.logo} />;
export const BitBoxSwissInverted = (props: GenericProps) => <img {...props} draggable={false} src={BitBoxSwissInvertedLogo} alt="BitBox" className={style.logo} />;
export const Shift = (props: GenericProps) => <img {...props} draggable={false} src={ShiftLogo} alt="Shift Crypto" className={style.logo} />;
export const SwissMadeOpenSource = ({ large: boolean, className, ...props }: GenericProps) => <img {...props} draggable={false} src={SwissOpenSourceLight} alt="Swiss Made Open Source" className={`${style.swissOpenSource} ${props.large ? style.large : ''} ${className ? className : ''}`} />;
export const SwissMadeOpenSourceDark = ({ large: boolean, className, ...props }: GenericProps) => <img {...props} draggable={false} src={SwissOpenSourceDark} alt="Swiss Made Open Source" className={`${style.swissOpenSource} ${props.large ? style.large : ''} ${className ? className : ''}`} />;
type ImgProps = JSX.IntrinsicElements['img'];

export const BitBox = (props: ImgProps) => <img {...props} draggable={false} src={BitBoxLogo} alt="BitBox" className={style.logo} />;
export const BitBox02 = (props: ImgProps) => <img {...props} draggable={false} src={BitBox02Logo} alt="BitBox02" className={style.logo} />;
export const BitBox02Inverted = (props: ImgProps) => <img {...props} draggable={false} src={BitBox02InvertedLogo} alt="BitBox02" className={style.logo} />;
export const AppLogo = (props: ImgProps) => <img {...props} draggable={false} src={AppLogoImg} alt="BitBox" className={style.logo} />;
export const AppLogoInverted = (props: ImgProps) => <img {...props} draggable={false} src={AppLogoInvertedImg} alt="BitBox" className={style.logo} />;
export const BitBoxSwiss = (props: ImgProps) => <img {...props} draggable={false} src={BitBoxSwissLogo} alt="BitBox" className={style.logo} />;
export const BitBoxSwissInverted = (props: ImgProps) => <img {...props} draggable={false} src={BitBoxSwissInvertedLogo} alt="BitBox" className={style.logo} />;
export const Shift = (props: ImgProps) => <img {...props} draggable={false} src={ShiftLogo} alt="Shift Crypto" className={style.logo} />;
export const SwissMadeOpenSource = ({ className, ...props }: ImgProps) => <img {...props} draggable={false} src={SwissOpenSourceLight} alt="Swiss Made Open Source" className={`${style.swissOpenSource} ${className ? className : ''}`} />;
export const SwissMadeOpenSourceDark = ({ className, ...props }: ImgProps) => <img {...props} draggable={false} src={SwissOpenSourceDark} alt="Swiss Made Open Source" className={`${style.swissOpenSource} ${className ? className : ''}`} />;

type LogoMap = {
[key in CoinCode]: string[];
[key in CoinCode]: string[];
}

const logoMap: LogoMap = {
Expand All @@ -100,20 +99,20 @@ const logoMap: LogoMap = {
'eth-erc20-paxg': [PAXG, PAXG_GREY],
};

interface Props {
active?: boolean;
alt?: string;
className?: string;
coinCode: CoinCode;
stacked?: boolean;
type LogoProps = {
active?: boolean;
alt?: string;
className?: string;
coinCode: CoinCode;
stacked?: boolean;
}

export const Logo = ({
coinCode,
active,
stacked,
...rest
}: Props) => {
}: LogoProps) => {
if (!logoMap[coinCode]) {
console.error('logo undefined for ', coinCode);
return null;
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/components/transactions/transaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const Amounts = ({
<Arrow type="send_to_self" />
</span>
)}
{conversionPrefix && (
{(conversionPrefix && !sendToSelf) && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<span className={styles.txPrefix}>
{conversionPrefix}
{' '}
Expand Down
12 changes: 6 additions & 6 deletions frontends/web/src/contexts/WCWeb3WalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import { useLoad } from '@/hooks/api';
import { getConfig, setConfig } from '@/utils/config';

type TProps = {
children: ReactNode;
}
children: ReactNode;
}

export const WCWeb3WalletProvider = ({ children }: TProps) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -83,13 +83,13 @@ export const WCWeb3WalletProvider = ({ children }: TProps) => {
}
await web3wallet?.core.pairing.pair({ uri });
setConfig({ frontend: { hasUsedWalletConnect: true } });
} catch (e: any) {
console.error(`Wallet connect attempt to pair error ${e}`);
if (e.message.includes('Pairing already exists')) {
} catch (error: any) {
console.error('Wallet connect attempt to pair error', error);
if (error?.message?.includes('Pairing already exists')) {
throw new Error(t('walletConnect.useNewUri'));
}
//unexpected error, display native error message
throw new Error(e.message);
throw new Error(error.message);
}
};

Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/hooks/sdcard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useSDCard = (
switch (devices[deviceID]) {
case 'bitbox':
return getBitBox01DeviceInfo(deviceID)
.then(({ sdcard }) => sdcard);
.then(deviceInfo => deviceInfo ? deviceInfo.sdcard : Promise.reject(`Could get device info for ${deviceID}`));
case 'bitbox02':
return checkSDCard(deviceID);
default:
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/i18n/i18n.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('i18n', () => {
{ nativeLocale: 'fr', newLang: 'en', userLang: 'en' },
];
table.forEach((test) => {
it(`sets userLanguage to ${test.userLang} if native-locale is ${test.nativeLocale}`, async () => {
it(`sets userLanguage to ${test.userLang || 'null'} if native-locale is ${test.nativeLocale}`, async () => {
(apiGet as Mock).mockImplementation(endpoint => {
switch (endpoint) {
case 'config': { return Promise.resolve({}); }
Expand Down
6 changes: 4 additions & 2 deletions frontends/web/src/routes/account/info/buyReceiveCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,16 @@ export const BuyReceiveCTA = ({
const isMobile = useMediaQuery('(max-width: 768px)');

const onExchangeCTA = () => navigate(code ? `/exchange/info/${code}` : '/exchange/info');
const onWalletConnect = () => navigate(`/account/${code}/wallet-connect/dashboard`);
const onWalletConnect = () => code && navigate(`/account/${code}/wallet-connect/dashboard`);
const onReceiveCTA = () => {
if (balanceList) {
if (balanceList.length > 1) {
navigate('/accounts/select-receive');
return;
}
navigate(`/account/${code}/receive`);
if (code) {
navigate(`/account/${code}/receive`);
}
}
};

Expand Down
17 changes: 11 additions & 6 deletions frontends/web/src/routes/account/info/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { Status } from '@/components/status/status';
import style from './info.module.css';

type TProps = {
accounts: IAccount[];
code: AccountCode;
accounts: IAccount[];
code: AccountCode;
};

export const Info = ({
Expand Down Expand Up @@ -57,6 +57,8 @@ export const Info = ({
setViewXPub((viewXPub + 1) % numberOfXPubs);
};

const xpubType = xpubTypes[(viewXPub + 1) % numberOfXPubs];

return (
<div className="contentWithGuide">
<div className="container">
Expand All @@ -75,10 +77,13 @@ export const Info = ({
current: `${viewXPub + 1}`,
numberOfXPubs: numberOfXPubs.toString(),
scriptType: config.bitcoinSimple.scriptType.toUpperCase(),
})}<br />
<button className={style.nextButton} onClick={showNextXPub}>
{t(`accountInfo.xpubTypeChangeBtn.${xpubTypes[(viewXPub + 1) % numberOfXPubs]}`)}
</button>
})}
<br />
{xpubType && (
<button className={style.nextButton} onClick={showNextXPub}>
{t(`accountInfo.xpubTypeChangeBtn.${xpubType}`)}
</button>
)}
</p>
) : null}
{ (config.bitcoinSimple?.scriptType === 'p2tr') ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,23 @@ import { TConfirmSendProps } from '@/routes/account/send/components/confirm/type
import { ConfirmingWaitDialog } from '@/routes/account/send/components/confirm/dialogs/confirm-wait-dialog';
import style from './confirm.module.css';

type TConfirmSend = { bb01Paired: boolean | undefined } & TConfirmSendProps;

type TFiatValueProps = {
baseCurrencyUnit: ConversionUnit;
amount: string
}

export const ConfirmSend = (props: TConfirmSendProps) => {
switch (props.device) {
case 'bitbox':
return (
<ConfirmingWaitDialog
{...props}
/>
);
case 'bitbox02':
return (
<BB02ConfirmSend
{...props}
/>
);
default:
return null;
}
export const ConfirmSend = (props: TConfirmSend) => {
return (props.bb01Paired !== undefined ? (
<ConfirmingWaitDialog
{...props}
/>
) : (
<BB02ConfirmSend
{...props}
/>
));
};

export const BB02ConfirmSend = ({
Expand All @@ -57,7 +52,7 @@ export const BB02ConfirmSend = ({
selectedUTXOs,
coinCode,
transactionDetails
}: Omit<TConfirmSendProps, 'device'>) => {
}: TConfirmSendProps) => {

const { t } = useTranslation();
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ConfirmingWaitDialog = ({
selectedUTXOs,
coinCode,
transactionDetails
}: Omit<TConfirmSendProps, 'device'>) => {
}: TConfirmSendProps) => {
const { t } = useTranslation();
const [signProgress, setSignProgress] = useState<TSignProgress>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { ConversionUnit, CoinCode, FeeTargetCode, Fiat, IAmount } from '@/api/account';
import { TProductName } from '@/api/devices';

export type TransactionDetails = {
proposedAmount?: IAmount;
Expand All @@ -28,7 +27,6 @@ export type TransactionDetails = {
}

export type TConfirmSendProps = {
device: TProductName;
baseCurrencyUnit: ConversionUnit;
note: string;
hasSelectedUTXOs: boolean;
Expand Down
Loading
Loading