Linux phones have no banking apps, and a command line is no answer on a phone. The app does everything the nostro command does and, like it, only talks to nostrod: it holds no key and no token. - Nostro.Ui, a toolkit whose screens are functions that fill a frame, ported from imsd-messages ca5cd72d; Nostro.App, the app's state, forms and screens; Nostro.Ui.Shell, which puts them on a Wayland window with Crafter.Graphics; nostro-app; and Nostro.DebugCommands for the --debug-api build. - Client: every method also in an asynchronous form for an sd-event loop, with DaemonMissing and OutcomeUnknown. - nostrod's Flatpak is net.catcrafts.Nostrod now and the app takes net.catcrafts.Nostro; install.sh moves the state. The app's Flatpak, both Flatpaks cross-built for aarch64, and the licence texts they carry. - nostro-fake-system, a made-up bus and bank with a real nostrod on them, to look at the app against. The README's screenshots are taken on it. - The nostro command: an API key's environment is the key's own to say, so --sandbox is for bunq-oauth alone, and a virtual card is listed as VIRTUAL. The published contract changes in three places, before any release (design rule 10): - Transactions' query takes `stored`: answered from what nostrod has stored, without asking the bank. The app searches with it; before, every search was a call to bunq. - AddBunq's `environment` no longer chooses over what the key says of itself: a key of the other environment is refused. - SetCardStatus refuses to freeze or unfreeze a virtual card. bunq reports one as DEACTIVATED however well it pays, and leaves it as it is when asked, without an error. The app is GPL-3.0-only, the library stays LGPL-3.0-only, and no code moved from one to the other (design rule 13). Transaction's schema is unchanged. Verified: the 17 tests pass with every line, function and region of what they link run, and the five lint runs are clean. Every screen was looked at on the made-up system, at a phone's and a desktop's sizes in the light and the dark look, on Plasma under Wayland. What is said of bunq's cards comes from its sandbox, with throwaway users, and from one real virtual card. Known to have been used against production: connecting, and reading accounts, payments and cards. Not known to have been tried: a payment from the app against bunq, OAuth against bunq, and anything on a phone. Building the app takes --graphics=, a Crafter.Graphics checkout on its branch claude/nostro-app, until that branch is merged and pinned here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
73 lines
2.7 KiB
C++
73 lines
2.7 KiB
C++
// SPDX-License-Identifier: GPL-3.0-only
|
|
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
|
|
|
export module Nostro.Ui:Layout;
|
|
|
|
import std;
|
|
import :Geometry;
|
|
|
|
// Boxes handed out one after the other: all the layout a screen of rows and forms needs. A screen says how tall each
|
|
// thing is, or asks the thing itself, and the cursor moves on.
|
|
|
|
export namespace Nostro::Ui {
|
|
// Down a column: each box is as wide as the column and starts where the one before ended, plus the gap.
|
|
struct Column {
|
|
Box area;
|
|
float gap = 0;
|
|
float cursor = 0; // the top of the next box
|
|
|
|
constexpr Column(Box area, float gap = 0) noexcept : area(area), gap(gap), cursor(area.y) {
|
|
}
|
|
|
|
// The box the next thing may use: from the cursor down to the area's end.
|
|
constexpr Box Next() const noexcept {
|
|
return {area.x, cursor, area.w, std::max(0.0f, area.Bottom() - cursor)};
|
|
}
|
|
// The next thing turned out this tall.
|
|
constexpr void Advance(float height) noexcept {
|
|
cursor += height + gap;
|
|
}
|
|
// The next box, `height` tall. It may reach past the area's end: a column that scrolls is as long as its content.
|
|
constexpr Box Take(float height) noexcept {
|
|
const Box box{area.x, cursor, area.w, height};
|
|
Advance(height);
|
|
return box;
|
|
}
|
|
// How tall everything taken so far is, without the gap after the last.
|
|
constexpr float Used() const noexcept {
|
|
return std::max(0.0f, cursor - gap - area.y);
|
|
}
|
|
};
|
|
|
|
// Along a row: boxes are taken from its left or its right end, and what is left between them is the rest.
|
|
struct Row {
|
|
Box area;
|
|
float gap = 0;
|
|
float left = 0;
|
|
float right = 0;
|
|
|
|
constexpr Row(Box area, float gap = 0) noexcept : area(area), gap(gap), left(area.x), right(area.Right()) {
|
|
}
|
|
|
|
constexpr Box TakeLeft(float width) noexcept {
|
|
const Box box{left, area.y, width, area.h};
|
|
left += width + gap;
|
|
return box;
|
|
}
|
|
constexpr Box TakeRight(float width) noexcept {
|
|
right -= width;
|
|
const Box box{right, area.y, width, area.h};
|
|
right -= gap;
|
|
return box;
|
|
}
|
|
constexpr Box Rest() const noexcept {
|
|
return {left, area.y, std::max(0.0f, right - left), area.h};
|
|
}
|
|
};
|
|
|
|
// A box at most `maxWidth` wide in the middle of an area's width: what keeps a form readable in a wide window.
|
|
constexpr Box Centered(Box area, float maxWidth) noexcept {
|
|
const float width = std::min(area.w, maxWidth);
|
|
return {area.x + (area.w - width) / 2, area.y, width, area.h};
|
|
}
|
|
}
|