Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f28c49a
frontend: prepare for responsive font-size
thisconnect May 9, 2024
f09906d
frontend: implement responsive font-size using 62.5% trick
Tomasvrba Oct 15, 2025
3d71e1f
frontend: set default font-size
thisconnect Oct 16, 2025
7fd1826
frontend/android: capture textzoom and set custom base font size
thisconnect May 5, 2024
db7334d
frontend: rename css variable small to smaller
thisconnect Nov 10, 2025
616c32b
frontend: redefine size-small css variable
thisconnect Nov 10, 2025
b9ea4ee
frontend: limit font-size maximum value
thisconnect Oct 23, 2025
b9916a3
frontend: limit bottom-menu size expansion in reponsive mode
thisconnect Oct 17, 2025
218e53b
frontend: limit toggle layout in scaled up version
thisconnect Oct 17, 2025
7dc40ba
frontend: improve responsive styling of buttons
thisconnect Oct 17, 2025
4559d2f
frontend: improve form elements in responsive mode
thisconnect Oct 17, 2025
a402498
frontend: fix settings-item height in scaled up mode
thisconnect Oct 17, 2025
a20b997
frontend: improve account-summary in scaled up mode
thisconnect Oct 17, 2025
227d71b
frontend: make guide component responsive
thisconnect Oct 22, 2025
5933f37
frontend: make marketplace related components responsive
thisconnect Nov 10, 2025
c60dd8a
frontend: make dialog related components responsive
thisconnect Nov 10, 2025
2485fb1
frontend: make settings related components responsive
thisconnect Nov 10, 2025
b16097b
frontend: improve sidebar in responsive mode
thisconnect Nov 10, 2025
a99a5eb
frontend: improve all-accounts overlay in responsive mode
thisconnect Nov 11, 2025
e1f9c4f
frontend: make account-overview responsive
thisconnect Nov 11, 2025
84f2301
frontend: make recieve view responsive
thisconnect Nov 11, 2025
8a2f67d
frontend: improve send view in responsive mode
thisconnect Nov 12, 2025
274ae03
frontend: account-overview refactoring
thisconnect Nov 18, 2025
6a387dc
frontend: cleanup and remove unused icons and css
thisconnect Nov 12, 2025
5cf0ce9
frontend: optimize setup workflow in responsive mode
thisconnect Nov 13, 2025
ec4dd34
frontend: improve waitign view in responsive mode
thisconnect Nov 13, 2025
aa0f154
frontend: improve bitsurance in responsive mode
thisconnect Nov 13, 2025
a195d8b
frontend: make copy component responsive and simplify styles
thisconnect Nov 17, 2025
c4cbb12
frontend: make transaction-detail dialog reponsive
thisconnect Nov 17, 2025
d5ef18f
frontend: refactor balance and amount-with-unit components
thisconnect Nov 18, 2025
45ff425
frontend: fix broken balance tests (white spaces)
thisconnect Nov 20, 2025
06d2c23
frontend: update changelog with responsive font size on android
thisconnect Nov 21, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Sort backups from newest to oldest in manage backups
- Android: fix display of external links from Bitrefill
- fix language sometimes not persistent across app restarts
- Android: make the UI work with responsive font sizes and adhere to OS font size settings

## v4.49.0
- Bundle BitBox02 Nova firmware version v9.24.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,46 @@ public class WebViewClient extends android.webkit.WebViewClient {
private final String baseUrl;
private final AssetManager assets;
private final Application appContext;
private final int initialZoom;

public WebViewClient(String baseUrl, AssetManager assets, Application appContext) {
public WebViewClient(String baseUrl, AssetManager assets, Application appContext, int initialZoom) {
this.assets = assets;
this.appContext = appContext;
this.baseUrl = baseUrl;
this.initialZoom = initialZoom;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);

// Calculate the base font size for html as a percentage.
// This percentage dynamically adjusts to ensure 1rem = 10px, scaled according to the current zoom level.
double baseFontSizePercentage = 62.5 * ((double) initialZoom / 100.0);

// The default body font size in rem, which is independent of the zoom level.
// This size does not scale dynamically with zoom adjustments and is fixed at 1.6rem.
double defaultFontSizeREM = 1.6;

// Reset the WebView's text zoom to 100% to ensure that the scaling is controlled via CSS
// and not by the WebView's default scaling behavior.
view.getSettings().setTextZoom(100);

String cssSetupInjected =
"(function() {" +
" function applyCss() {" +
" document.documentElement.style.fontSize='" + baseFontSizePercentage + "%';" +
" document.body.style.fontSize='" + defaultFontSizeREM + "rem';" +
" }" +
" if (document.readyState === 'complete' || document.readyState === 'interactive') {" +
" applyCss();" +
" } else {" +
" document.addEventListener('DOMContentLoaded', applyCss);" +
" }" +
"})();";

// Execute the CSS setup in the WebView.
view.evaluateJavascript(cssSetupInjected, null);

// override the default readText method, that doesn't work
// because of read permission denied.
view.evaluateJavascript(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public void initialize(WebView webView) {
settings.setDomStorageEnabled(true);
settings.setMediaPlaybackRequiresUserGesture(false);
// webView.setWebContentsDebuggingEnabled(true); // enable remote debugging in chrome://inspect/#devices
webView.setWebViewClient(new WebViewClient(BASE_URL, activity.getAssets(), activity.getApplication()));
// Retrieve the current text zoom setting to adjust the base font size in the WebView.
int initialZoom = webView.getSettings().getTextZoom();
webView.setWebViewClient(new WebViewClient(BASE_URL, activity.getAssets(), activity.getApplication(), initialZoom));
webView.setWebChromeClient(webChromeClient);
webView.addJavascriptInterface(new JavascriptBridge(activity), "android");
webView.loadUrl(BASE_URL + "index.html");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
.container {
--size-default: 14px;
align-items: center;
background-color: var(--background-secondary);
border: none;
color: var(--color-default);
display: flex;
font-size: var(--size-default);
justify-content: space-between;
line-height: 1.571428;
padding: 16px;
text-align: left;
width: 100%;
Expand Down
15 changes: 7 additions & 8 deletions frontends/web/src/components/amount/amount-with-unit.module.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
.rates {
cursor: default;
line-height: 1;
margin: 0;
max-width: 100%;
white-space: nowrap;
}

.unit {
font-weight: 400;
flex-grow: 0;
flex-shrink: 0;
color: var(--color-secondary);
font-variant: normal;
position: relative;
cursor: default;
}

.availableFiatAmount {
color: var(--color-default);
padding-right: var(--space-quarter) !important;
align-items: baseline;
display: inline-flex;
flex-grow: 0;
justify-content: flex-start;
gap: 0.4ch;
text-align: right;
}

Expand All @@ -43,9 +47,4 @@
.fiatRow {
bottom: 0;
}

.availableFiatAmount,
.availableFiatUnit {
line-height: 24px;
}
}
38 changes: 14 additions & 24 deletions frontends/web/src/components/amount/amount-with-unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import style from './amount-with-unit.module.css';

type TAmountWithUnitProps = {
amount: TAmountWithConversions | undefined;
tableRow?: boolean;
enableRotateUnit?: boolean;
sign?: string;
alwaysShowAmounts?: boolean;
Expand All @@ -34,12 +33,11 @@ type TAmountWithUnitProps = {

export const AmountWithUnit = ({
amount,
tableRow,
enableRotateUnit: rotateUnit,
sign,
convertToFiat,
alwaysShowAmounts = false,
unitClassName = ''
unitClassName = '',
}: TAmountWithUnitProps) => {
const { rotateDefaultCurrency, defaultCurrency, rotateBtcUnit } = useContext(RatesContext);

Expand All @@ -64,35 +62,27 @@ export const AmountWithUnit = ({
}

const enableClick = rotateUnit && (convertToFiat || isBitcoinCoin(amount.unit));
const formattedAmount = !!displayedAmount ?
(
<Amount
alwaysShowAmounts={alwaysShowAmounts}
amount={displayedAmount}
unit={displayedUnit}
onMobileClick={enableClick ? onClick : undefined}
/>
) : '---';

const amountUnit = <AmountUnit unit={displayedUnit} rotateUnit={enableClick ? onClick : undefined} className={unitClassName}/>;

if (tableRow) {
return (
<tr className={style.fiatRow}>
<td className={style.availableFiatAmount}>{formattedAmount}</td>
<td>{amountUnit}</td>
</tr>
);
}
return (
<span className={`
${style.rates || ''}
${style.availableFiatAmount || ''}
${!displayedAmount && style.notAvailable || ''}
`.trim()}>
{!!displayedAmount ? sign : ''}
{formattedAmount}
{!!displayedAmount ? (
<Amount
alwaysShowAmounts={alwaysShowAmounts}
amount={displayedAmount}
unit={displayedUnit}
onMobileClick={enableClick ? onClick : undefined}
/>
) : '---'}
{' '}
{amountUnit}
<AmountUnit
unit={displayedUnit}
rotateUnit={enableClick ? onClick : undefined}
className={unitClassName}/>
</span>
);
};
Expand Down
6 changes: 6 additions & 0 deletions frontends/web/src/components/amount/amount.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
.amount {
align-items: baseline;
display: inline-flex;
display: flow-root; /* flow-root seems to work better on all-account. keeping inline-flex as fallback */
flex-shrink: 1;
flex-basis: auto;
flex-grow: 0;
font-variant: tabular-nums;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
Expand Down
10 changes: 5 additions & 5 deletions frontends/web/src/components/amount/conversion-amount.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
.txPrefix,
.txUnit {
color: var(--color-secondary);
font-size: 14px;
line-height: 1.285714;
font-size: var(--size-small);
white-space: nowrap;
}

.txConversionAmount .txUnit {
font-size: 12px;
font-size: var(--size-smaller);
flex-shrink: 0;
max-width: 100%;
}

.txSmallInlineIcon img {
max-height: 15px;
max-width: 15px;
max-height: 1.5rem;
max-width: 1.5rem;
vertical-align: text-bottom;
}
.txConversionAmount .txSmallInlineIcon {
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/components/aopp/aopp.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
}
@media (min-width: 1200px) {
.message {
--size-default: 18px;
--size-default: 1.8rem;
}
}
6 changes: 3 additions & 3 deletions frontends/web/src/components/badge/badge.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
border-radius: var(--space-half);
border: 1px solid;
display: inline-block;
font-size: var(--size-small);
font-size: var(--size-smaller);
flex-shrink: 0;
line-height: 1;
padding: var(--space-eight) 10px;
Expand All @@ -19,7 +19,7 @@
}

.badgeIcon {
max-width: 10px;
max-width: 1rem;
}

.withChildren .badgeIcon {
Expand All @@ -28,7 +28,7 @@

@media (max-width: 382px) {
.badge {
font-size: 10px;
font-size: var(--size-xsmall);
}
}

Expand Down
52 changes: 27 additions & 25 deletions frontends/web/src/components/balance/balance.module.css
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
.balanceTable {
align-items: flex-end;
border-collapse: collapse;
border-spacing: 0;
display: flex;
flex-direction: row;
position: relative;
.balanceContainer {
color: var(--color-default);
max-width: 100%;
}

.balanceTable tr {
display: inline-block;
vertical-align: bottom;
padding-right: var(--space-half);
.availableBalanceTitle {
color: var(--color-secondary);
line-height: 1.5;
margin-bottom: 10px;
}

.balanceTable td {
.balance {
align-items: baseline;
display: flex;
flex-direction: row;
flex-wrap: wrap;
font-size: var(--size-large);
font-weight: 400;
line-height: 1.2;
padding: 0;
vertical-align: baseline;
gap: var(--space-eight) var(--space-half);
min-height: 37px;
position: relative;
}

.balanceTable td:last-child {
font-size: var(--size-default);
.unit {
font-size: var(--size-header);
}

.pendingBalance {
color: var(--color-secondary);
font-size: var(--size-small);
font-size: var(--size-smaller);
line-height: 1;
margin: 0;
padding-top: var(--space-half);
}

@media (max-width: 768px) {
.incomingBalance {
display: inline-flex;
flex-wrap: wrap;
gap: .4ch;
}

.balanceTable {
display: inline-block;
margin: 0 auto;
}
@media (max-width: 768px) {

.balanceTable td {
.balance {
font-size: var(--size-header);
line-height: 1.5;
min-height: auto;
}

.pendingBalance {
padding-top: var(--space-quarter);
}

}
10 changes: 6 additions & 4 deletions frontends/web/src/components/balance/balance.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ describe('components/balance/balance', () => {
}
};
const { getByTestId } = render(<Balance balance={MOCK_BALANCE} />);
expect(getByTestId('availableBalance').textContent).toBe('0.005BTC512USD');
expect(getByTestId('incomingBalance').textContent).toBe('+0.003 BTC / 512 USD');
expect(getByTestId('availableBalance').textContent).toBe('0.005 BTC 512 USD');
expect(getByTestId('incomingBalance').textContent).toContain('+0.003 BTC');
expect(getByTestId('incomingBalance').textContent).toContain('512 USD');
});
});

Expand Down Expand Up @@ -176,8 +177,9 @@ describe('components/balance/balance', () => {
}
};
const { getByTestId } = render(<Balance balance={MOCK_BALANCE} />);
expect(getByTestId('availableBalance').textContent).toBe('0.005BTC512USD');
expect(getByTestId('incomingBalance').textContent).toBe('+0.003 BTC / 1,511.99 USD');
expect(getByTestId('availableBalance').textContent).toBe('0.005 BTC 512 USD');
expect(getByTestId('incomingBalance').textContent).toContain('+0.003 BTC');
expect(getByTestId('incomingBalance').textContent).toContain('1,511.99 USD');
});
afterEach(() => {
vi.restoreAllMocks();
Expand Down
Loading