101 Commits

Author SHA1 Message Date
23cc189e53 Fix date extraction
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-07-20 19:17:47 +02:00
3098d12e8a Support short dates
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-07-20 18:32:02 +02:00
0943104cc8 Can show expense in full screen
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-20 18:23:37 +02:00
3beaba806a Can clear cost value quickly 2025-07-20 18:18:20 +02:00
1788e7f184 Can disable dates extraction 2025-07-20 18:14:03 +02:00
71d32d72ef Can extract date of expenses
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-20 18:07:22 +02:00
28f61a3099 Improve regular expression
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-20 17:44:46 +02:00
f61e3541fb Perform first OCR extraction 2025-07-20 17:25:52 +02:00
fb7891d913 Merge pull request 'Update Rust crate serde_json to 1.0.141' (#63) from renovate/serde_json-1.x into main
Some checks failed
continuous-integration/drone/push Build is failing
2025-07-20 00:15:22 +00:00
d9ede224cf Update Rust crate serde_json to 1.0.141
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-20 00:15:16 +00:00
fc9334b20b Merge pull request 'Update dependency dart to ^3.8.2' (#62) from renovate/dart-3.x into main
Some checks failed
continuous-integration/drone/push Build is failing
2025-07-19 00:18:13 +00:00
c4cbd7ec8b Update dependency dart to ^3.8.2
Some checks failed
renovate/artifacts Artifact file update failure
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-19 00:17:10 +00:00
a4ef3e74dc Optimize APK size
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-07-18 18:37:58 +02:00
dbb988f2b5 Add mobile application (#47)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Reviewed-on: #47
2025-07-18 16:06:21 +00:00
b2aff4902d Fix Flutter code quality issues
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-18 18:01:25 +02:00
6f578b39f9 Updated project dependencies
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-18 17:57:57 +02:00
de519ecb6c Fix generated APK name
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2025-07-18 11:25:19 +02:00
3049e545e9 Fix keystore script file
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-07-18 10:08:51 +02:00
1f1c01a287 Sign APK builds from CI
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-07-18 09:04:01 +02:00
92885b8af6 Merge pull request 'Update dependency globals to ^16.3.0' (#61) from renovate/globals-16.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-18 00:51:18 +00:00
44320db760 Update dependency globals to ^16.3.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-18 00:16:24 +00:00
1f2a28aa65 Fix signing configuration
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-17 22:58:59 +02:00
f9566315eb Create a publish flavor dedicated for public releases
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-17 22:50:12 +02:00
63bed07015 Change debug configuration
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-17 20:36:44 +02:00
4b84d926d4 Disallow app backup
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-17 20:32:13 +02:00
8191a28986 Fix Drone configuration
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-17 20:27:24 +02:00
8c30b50d0c Update
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build was killed
2025-07-17 20:25:31 +02:00
389b2c96ba Remove temporary comments in Drone configuration
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-07-17 19:51:01 +02:00
5a08b0c971 Test full APK build before release
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is passing
2025-07-17 19:31:39 +02:00
b3fd066633 Fix clone
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build is passing
2025-07-17 19:26:18 +02:00
5c987473a5 Unshallow Git clone
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-07-17 19:25:27 +02:00
c3d2612f9a Second test
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build was killed
2025-07-17 19:21:49 +02:00
130cc1ef0d Temp test
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build was killed
2025-07-17 19:20:44 +02:00
aebefd114a Reorganize mobile app building 2025-07-17 19:19:20 +02:00
34d3e08149 Improve pipeline
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-17 19:08:21 +02:00
ccd3540804 Remove mobile app dependencies
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build was killed
2025-07-17 18:53:12 +02:00
b9b871224b Add flutter build to CI
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build was killed
2025-07-17 18:52:16 +02:00
17a22d7a4c Add an option to start on scans screen instead of capture screen
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-17 18:04:03 +02:00
8db2cf3ece Show a message when expenses list is empty
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-17 17:51:13 +02:00
e45648e038 Fix: reset editor screen between captures 2025-07-17 17:49:01 +02:00
55144da943 Can upload expenses to server 2025-07-17 17:44:36 +02:00
5065f780f2 Merge pull request 'Update dependency @mui/x-date-pickers to ^8.8.0' (#60) from renovate/mui-x-date-pickers-8.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-17 00:46:19 +00:00
28d8b96ebe Update dependency @mui/x-date-pickers to ^8.8.0
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2025-07-17 00:16:12 +00:00
baf62aa2a5 Fix misleading comment
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-16 11:30:25 +00:00
8a9a8d6b14 Merge remote-tracking branch 'origin/main' into mobile-app
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-16 11:06:52 +02:00
c19d46a50f Merge pull request 'Update dependency @mui/x-data-grid to ^8.8.0' (#59) from renovate/mui-x-data-grid-8.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-16 00:39:44 +00:00
f001c618cd Update dependency @mui/x-data-grid to ^8.8.0
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2025-07-16 00:15:46 +00:00
f9d46e46a5 Fix ESLint issue
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-15 21:34:19 +02:00
96f1bf589c Can clear search filter in account page
Some checks failed
continuous-integration/drone/push Build is failing
2025-07-15 21:33:19 +02:00
8ec6e48938 Start to build synchronization logic
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-15 21:14:09 +02:00
235fda5c72 Can delete expense 2025-07-15 20:11:43 +02:00
2568ea14b4 Can update scanned expenses entries 2025-07-15 20:00:55 +02:00
467393dad0 Merge pull request 'Update dependency @mui/x-charts to ^8.8.0' (#58) from renovate/mui-x-charts-8.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-15 00:36:12 +00:00
f619f26e93 Update dependency @mui/x-charts to ^8.8.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-15 00:15:36 +00:00
cecb7a0cd1 Remove temporary fix on label style
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-14 16:50:53 +02:00
50812af2fc Display the list of expenses 2025-07-14 16:49:32 +02:00
547e9b7aad Can save expenses to local list
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-14 16:24:59 +02:00
dd035f8a15 Fix PDF rendering on my smartphone
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-14 16:03:45 +02:00
768706e2d4 Add expense editor
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-14 10:06:07 +02:00
70023242e9 Start to build expense editor screen 2025-07-14 09:42:42 +02:00
951338b6e4 Display generated PDF on expense screen 2025-07-14 09:15:18 +02:00
6531d73c93 Ready to implement expense editor screen
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-14 08:18:59 +02:00
51ba649b6e Can save the list of expenses 2025-07-14 08:00:35 +02:00
cc4ce19af2 Merge pull request 'Update dependency @eslint/js to ^9.31.0' (#57) from renovate/eslint-js-9.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-14 00:38:25 +00:00
192dc5827b Update dependency @eslint/js to ^9.31.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-14 00:15:23 +00:00
37674a6229 Merge pull request 'Update dependency eslint-plugin-react-x to ^1.52.3' (#56) from renovate/eslint-plugin-react-x-1.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-13 00:40:31 +00:00
ef86667029 Update dependency eslint-plugin-react-x to ^1.52.3
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-13 00:15:07 +00:00
07f63a96fa Merge pull request 'Update Rust crate diesel to 2.2.12' (#55) from renovate/diesel-2.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-12 00:47:30 +00:00
fa88a3c9ed Update Rust crate diesel to 2.2.12
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2025-07-12 00:15:34 +00:00
85c6a0b955 Merge pull request 'Update dependency @mui/x-date-pickers to ^8.7.0' (#54) from renovate/mui-x-date-pickers-8.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-11 00:41:02 +00:00
21ee97b8a4 Update dependency @mui/x-date-pickers to ^8.7.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-11 00:15:43 +00:00
119f026a21 Merge pull request 'Update Rust crate clap to 4.5.41' (#53) from renovate/clap-4.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-10 00:56:57 +00:00
d72acfac9b Update Rust crate clap to 4.5.41
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2025-07-10 00:16:25 +00:00
77c8866bb8 Merge pull request 'Update dependency @mui/x-data-grid to ^8.7.0' (#52) from renovate/mui-x-data-grid-8.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-09 00:44:36 +00:00
133f235639 Update dependency @mui/x-data-grid to ^8.7.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-09 00:15:58 +00:00
a4b630c66e Add document scanner
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-08 23:19:28 +02:00
52bbcf708f User can sign out of his account
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-08 19:54:16 +02:00
5b16ca6162 Load profile information on startup
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-08 19:34:40 +02:00
7ef0499abf Merge pull request 'Update dependency @mui/x-charts to ^8.7.0' (#51) from renovate/mui-x-charts-8.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-08 00:45:34 +00:00
1383da4483 Update dependency @mui/x-charts to ^8.7.0
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-08 00:16:00 +00:00
74bb31ecc1 Load server configuration
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-07 21:36:35 +02:00
0a87ac572b Add QrCode authentication 2025-07-07 19:44:44 +02:00
4f1a9d0865 Merge pull request 'Update dependency @eslint/js to ^9.30.1' (#50) from renovate/eslint-js-9.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-07 00:40:39 +00:00
31803feaa9 Update dependency @eslint/js to ^9.30.1
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-07 00:15:37 +00:00
aad32f9c25 Merge pull request 'Update dependency react-router-dom to ^7.6.3' (#49) from renovate/react-router-dom-7.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-06 00:42:40 +00:00
1ea2bd6acf Update dependency react-router-dom to ^7.6.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-06 00:15:52 +00:00
a085116018 Merge pull request 'Update dependency react-router to ^7.6.3' (#48) from renovate/react-router-7.x into main
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-05 00:50:00 +00:00
952a66042c Update dependency react-router to ^7.6.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-05 00:09:30 +00:00
6cf6ab5a37 Update dependency @emotion/styled to ^11.14.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2025-07-04 00:09:24 +00:00
28d47917cf Refactor repo to fix package name
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-03 23:09:36 +02:00
694884f8c4 Refacto source code following package name change
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-03 23:04:47 +02:00
c878c7f327 Set application icons
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-03 23:00:24 +02:00
8d3b17dcd1 Merge remote-tracking branch 'origin/main' into mobile-app
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-07-03 22:32:55 +02:00
1781318fdf Fix bad backend URL on generated Qr Code for tokens authentication
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-07-03 22:00:20 +02:00
2560962684 Fix cargo clippy issues
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-03 08:38:56 +02:00
7387e285a0 Fix missing redirect after login
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-02 22:48:53 +02:00
ff97fb69f7 Performed first authentication
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-02 22:14:52 +02:00
c8fa4552bb Add manual auth screen
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2025-07-02 19:50:25 +02:00
ce1c175c62 Adapt base login page
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-01 22:45:20 +02:00
9b14a28d86 Add settings screen
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-07-01 22:22:16 +02:00
29fec99b8f Add base skeleton 2025-07-01 20:40:00 +02:00
109 changed files with 3327 additions and 401 deletions

View File

@@ -4,9 +4,17 @@ type: docker
name: default
steps:
# Needs a full git clone
- name: fetch
image: alpine/git
commands:
- git fetch --tags
# Frontend
- name: web_build
image: node:23
depends_on:
- fetch
volumes:
- name: web_app
path: /tmp/web_build
@@ -20,6 +28,8 @@ steps:
# Backend
- name: backend_fetch_deps
image: rust
depends_on:
- fetch
volumes:
- name: rust_registry
path: /usr/local/cargo/registry
@@ -54,6 +64,9 @@ steps:
- name: backend_build
image: rust
when:
event:
- tag
volumes:
- name: rust_registry
path: /usr/local/cargo/registry
@@ -72,12 +85,58 @@ steps:
- ls -lah target/release/moneymgr_backend target/release/examples/api_curl
- cp target/release/moneymgr_backend target/release/examples/api_curl /tmp/release
# Mobile app code quality
- name: mobile_app_code_quality
image: ghcr.io/cirruslabs/flutter:latest
depends_on:
- fetch
commands:
- echo "Build version:" $(git describe --tags --abbrev=0)
- echo "Build number:" $(git rev-list --count $(git describe --tags --abbrev=0))
- cd moneymgr_mobile
- flutter --disable-analytics
- flutter pub get --enforce-lockfile
- dart run build_runner build
- flutter analyze
# Mobile app build
- name: mobile_app_build
image: ghcr.io/cirruslabs/flutter:latest
depends_on:
- backend_build # prevent synchronous backend & frontend build
- mobile_app_code_quality
when:
event:
- tag
environment:
JKS_KEYSTORE:
from_secret: JKS_KEYSTORE
JKS_KEYSTORE_PASSWORD:
from_secret: JKS_KEYSTORE_PASSWORD
volumes:
- name: release
path: /tmp/release
commands:
- cd moneymgr_mobile
- flutter --disable-analytics
- bash android/ci_write_keystore.sh
- flutter pub get --enforce-lockfile
- dart run build_runner build
- flutter build apk
--release
--flavor publish
--build-name $(git describe --tags --abbrev=0)
--split-per-abi
--target-platform android-arm64
--build-number $(git rev-list --count $(git describe --tags --abbrev=0))
- cp build/app/outputs/flutter-apk/app-arm64-v8a-publish-release.apk /tmp/release/moneymgr_mobile_arm64-v8a.apk
# Release
- name: gitea_release
image: plugins/gitea-release
depends_on:
- backend_build
- mobile_app_build
when:
event:
- tag

View File

@@ -77,3 +77,4 @@ services:
- S3_SECRET_KEY=$MINIO_ROOT_PASSWORD
- REDIS_HOSTNAME=redis
- REDIS_PASSWORD=${REDIS_PASS:-secretredis}
- UNSECURE_AUTO_LOGIN_EMAIL=$UNSECURE_AUTO_LOGIN_EMAIL

View File

@@ -724,9 +724,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.40"
version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f"
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
dependencies = [
"clap_builder",
"clap_derive",
@@ -734,9 +734,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.40"
version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e"
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
dependencies = [
"anstream",
"anstyle",
@@ -746,9 +746,9 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.40"
version = "4.5.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce"
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
dependencies = [
"heck",
"proc-macro2",
@@ -1100,9 +1100,9 @@ dependencies = [
[[package]]
name = "diesel"
version = "2.2.11"
version = "2.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a917a9209950404d5be011c81d081a2692a822f73c3d6af586f0cab5ff50f614"
checksum = "229850a212cd9b84d4f0290ad9d294afc0ae70fccaa8949dbe8b43ffafa1e20c"
dependencies = [
"bitflags",
"byteorder",
@@ -3232,9 +3232,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.140"
version = "1.0.141"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
dependencies = [
"itoa",
"memchr",

View File

@@ -6,9 +6,9 @@ edition = "2024"
[dependencies]
env_logger = "0.11.8"
log = "0.4.27"
diesel = { version = "2.2.11", features = ["postgres", "r2d2"] }
diesel = { version = "2.2.12", features = ["postgres", "r2d2"] }
diesel_migrations = "2.2.0"
clap = { version = "4.5.40", features = ["env", "derive"] }
clap = { version = "4.5.41", features = ["env", "derive"] }
actix-web = "4.11.0"
actix-cors = "0.7.1"
actix-multipart = "0.7.2"
@@ -22,7 +22,7 @@ rust-s3 = "0.36.0-beta.2"
thiserror = "2.0.12"
tokio = "1.45.1"
futures-util = "0.3.31"
serde_json = "1.0.140"
serde_json = "1.0.141"
light-openid = "1.0.4"
rand = "0.9.1"
ipnet = { version = "2.11.0", features = ["serde"] }

View File

@@ -30,7 +30,7 @@ pub async fn create_bucket_if_required() -> anyhow::Result<()> {
log::warn!("The bucket does not seem to exists, trying to create it!")
}
Err(e) => {
log::error!("Got unexpected error when querying bucket info: {}", e);
log::error!("Got unexpected error when querying bucket info: {e}");
return Err(BucketServiceError::FailedFetchBucketInfo.into());
}
}

View File

@@ -50,7 +50,7 @@ impl FromRequest for AccountInPath {
Self::load_account_from_path(&auth, account_id)
.await
.map_err(|e| {
log::error!("Failed to extract account ID from URL! {}", e);
log::error!("Failed to extract account ID from URL! {e}");
actix_web::error::ErrorNotFound("Could not fetch account information!")
})
})

View File

@@ -56,7 +56,7 @@ impl FromRequest for AuthExtractor {
};
Box::pin(async move {
// Check for authentication using OpenID
// Check for authentication using API token
if let Some(token) = req.headers().get(constants::API_TOKEN_HEADER) {
let Ok(jwt_token) = token.to_str() else {
return Err(actix_web::error::ErrorBadRequest(
@@ -165,13 +165,13 @@ impl FromRequest for AuthExtractor {
// Update last use (if needed)
if token.shall_update_time_used() {
if let Err(e) = tokens_service::update_time_used(&token).await {
log::error!("Failed to refresh last usage of token! {}", e);
log::error!("Failed to refresh last usage of token! {e}");
}
}
// Handle tokens expiration
if token.is_expired() {
log::error!("Attempted to use expired token! {:?}", token);
log::error!("Attempted to use expired token! {token:?}");
return Err(actix_web::error::ErrorBadRequest("Token has expired!"));
}

View File

@@ -47,7 +47,7 @@ impl FromRequest for FileIdExtractor {
Self::load_file_from_path(&auth, file_id)
.await
.map_err(|e| {
log::error!("Failed to extract file ID from URL! {}", e);
log::error!("Failed to extract file ID from URL! {e}");
actix_web::error::ErrorNotFound("Could not fetch file information!")
})
})

View File

@@ -50,7 +50,7 @@ impl FromRequest for InboxEntryInPath {
Self::load_inbox_entry_from_path(&auth, entry_id)
.await
.map_err(|e| {
log::error!("Failed to extract inbox entry ID from URL! {}", e);
log::error!("Failed to extract inbox entry ID from URL! {e}");
actix_web::error::ErrorNotFound("Could not fetch inbox entry information!")
})
})

View File

@@ -57,7 +57,7 @@ impl FromRequest for MovementInPath {
Self::load_movement_from_path(&auth, account_id)
.await
.map_err(|e| {
log::error!("Failed to extract movement ID from URL! {}", e);
log::error!("Failed to extract movement ID from URL! {e}");
actix_web::error::ErrorNotFound("Could not fetch movement information!")
})
})

View File

@@ -46,3 +46,4 @@ app.*.map.json
*.g.dart
*.freezed.dart

View File

@@ -1,3 +1,5 @@
publish_key.properties
gradle-wrapper.jar
/.gradle
/captures/

View File

@@ -0,0 +1,8 @@
# Android version of application
Generate keystore:
```bash
keytool -genkey -v -keystore ./keystore.jks -keyalg RSA \
-keysize 2048 -validity 20000 -alias moneymgr
```

View File

@@ -1,3 +1,6 @@
import java.util.Properties
import java.io.FileInputStream
plugins {
id("com.android.application")
id("kotlin-android")
@@ -5,8 +8,14 @@ plugins {
id("dev.flutter.flutter-gradle-plugin")
}
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("publish_key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
android {
namespace = "com.example.moneymgr_mobile"
namespace = "org.communiquons.moneymgr"
compileSdk = flutter.compileSdkVersion
// ndkVersion = flutter.ndkVersion
ndkVersion = "27.0.12077973"
@@ -21,8 +30,7 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.moneymgr_mobile"
applicationId = "org.communiquons.moneymgr"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
@@ -31,13 +39,34 @@ android {
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
signingConfigs {
create("publish") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"] as String
}
}
buildTypes {
release {
// signingConfig = signingConfigs.getByName("debug")
}
}
flavorDimensions += "default"
productFlavors {
create("development") {
dimension = "default"
applicationIdSuffix = ".debug"
signingConfig = signingConfigs.getByName("debug")
}
create("publish") {
dimension = "default"
signingConfig = signingConfigs.getByName("publish")
}
}
}
flutter {

View File

@@ -1,7 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />
<!-- In debug mode, unsecure traffic is permitted -->
<application
android:label="MoneyMgr Debug"
android:usesCleartextTraffic="true"
tools:replace="android:label" />
</manifest>

View File

@@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="moneymgr_mobile"
android:label="MoneyMgr"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
@@ -42,4 +42,7 @@
<data android:mimeType="text/plain"/>
</intent>
</queries>
<!-- Communication with backend -->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -1,4 +1,4 @@
package com.example.moneymgr_mobile
package org.communiquons.moneymgr
import io.flutter.embedding.android.FlutterActivity

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="false" />
</manifest>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</cloud-backup>
<device-transfer>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</device-transfer>
</data-extraction-rules>

View File

@@ -0,0 +1,23 @@
#!/bin/bash
SCRIPT_DIR="$(temp=$( realpath "$0" ) && dirname "$temp")"
KEYSTORE_PATH="$SCRIPT_DIR/keystore.jks"
PROPERTIES_PATH="$SCRIPT_DIR/publish_key.properties"
echo Keystore path : $KEYSTORE_PATH
echo Properties path : $PROPERTIES_PATH
[ ! -n "$JKS_KEYSTORE" ] && echo 'Missing JKS_KEYSTORE variable!'&& exit 1
[ ! -n "$JKS_KEYSTORE_PASSWORD" ] && echo 'Missing JKS_KEYSTORE_PASSWORD variable!' && exit 1
# Write keystore
echo $JKS_KEYSTORE | base64 -d > "$KEYSTORE_PATH"
# Write keystore config
cat > "$PROPERTIES_PATH" <<_EOF
storePassword=$JKS_KEYSTORE_PASSWORD
keyPassword=$JKS_KEYSTORE_PASSWORD
keyAlias=moneymgr
storeFile=$KEYSTORE_PATH
_EOF

View File

@@ -0,0 +1,4 @@
storePassword=<password-from-previous-step>
keyPassword=<password-from-previous-step>
keyAlias=upload
storeFile=<keystore-file-location>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

View File

@@ -0,0 +1,34 @@
# flutter pub run flutter_launcher_icons
flutter_launcher_icons:
image_path: "assets/icon/icon.png"
android: "launcher_icon"
# image_path_android: "assets/icon/icon.png"
min_sdk_android: 21 # android min sdk min:16, default 21
# adaptive_icon_background: "assets/icon/background.png"
# adaptive_icon_foreground: "assets/icon/foreground.png"
# adaptive_icon_foreground_inset: 16
# adaptive_icon_monochrome: "assets/icon/monochrome.png"
ios: true
# image_path_ios: "assets/icon/icon.png"
remove_alpha_ios: true
# image_path_ios_dark_transparent: "assets/icon/icon_dark.png"
# image_path_ios_tinted_grayscale: "assets/icon/icon_tinted.png"
# desaturate_tinted_to_grayscale_ios: true
# background_color_ios: "#ffffff"
# web:
# generate: true
# image_path: "path/to/image.png"
# background_color: "#hexcode"
# theme_color: "#hexcode"
# windows:
# generate: true
# image_path: "path/to/image.png"
# icon_size: 48 # min:48, max:256, default: 48
# macos:
# generate: true
# image_path: "path/to/image.png"

View File

@@ -368,7 +368,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@@ -384,7 +384,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -401,7 +401,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
@@ -416,7 +416,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
@@ -427,7 +427,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -484,7 +484,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -547,7 +547,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -569,7 +569,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;

View File

@@ -1,122 +1 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
{"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>moneymgr_mobile</string>
<string>moneymgr</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

View File

@@ -2,10 +2,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/providers/settings.dart';
import 'package:moneymgr_mobile/services/router/router.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
import 'package:moneymgr_mobile/utils/provider_observer.dart';
import 'package:moneymgr_mobile/utils/theme_utils.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
// Inspired from https://github.com/dhafinrayhan/dummymart
@@ -16,10 +20,28 @@ Future<void> main() async {
// app is inserted to the widget tree.
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
runApp(ProviderScope(
observers: [AppProviderObserver()],
child: const MoneyMgrApp(),
));
// Configure logger
Logger.root.level = Level.ALL; // defaults to Level.INFO
Logger.root.onRecord.listen(
(record) =>
// ignore: avoid_print
print('${record.level.name}: ${record.time}: ${record.message}'),
);
// Initialize scanbot sdk
var config = ScanbotSdkConfig(
loggingEnabled: true,
allowGpuAcceleration: true,
allowXnnpackAcceleration: true,
);
ScanbotSdk.initScanbotSdk(config);
runApp(
ProviderScope(
observers: [AppProviderObserver()],
child: const MoneyMgrApp(),
),
);
}
class MoneyMgrApp extends StatelessWidget {
@@ -27,21 +49,18 @@ class MoneyMgrApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const _EagerInitialization(
child: _MainApp(),
);
return const _EagerInitialization(child: _MainApp());
}
}
class _EagerInitialization extends ConsumerWidget {
const _EagerInitialization({required this.child});
final Widget child;
@override
Widget build(BuildContext context, WidgetRef ref) {
final values = [
ref.watch(prefsProvider),
];
final values = [ref.watch(prefsProvider), ref.watch(secureStorageProvider)];
if (values.every((value) => value.hasValue)) {
return child;
@@ -58,7 +77,6 @@ class _MainApp extends StatefulHookConsumerWidget {
ConsumerState<_MainApp> createState() => _MainAppState();
}
class _MainAppState extends ConsumerState<_MainApp> {
@override
void initState() {
@@ -71,15 +89,17 @@ class _MainAppState extends ConsumerState<_MainApp> {
final router = ref.watch(routerProvider);
final themeMode = ref.watch(currentThemeModeProvider);
final (lightTheme, darkTheme) = useMemoized(() => createDualThemeData(
seedColor: Colors.blue,
useMaterial3: true,
transformer: (data) => data.copyWith(
inputDecorationTheme: const InputDecorationTheme(
border: OutlineInputBorder(),
final (lightTheme, darkTheme) = useMemoized(
() => createDualThemeData(
seedColor: Colors.blue,
useMaterial3: true,
transformer: (data) => data.copyWith(
inputDecorationTheme: const InputDecorationTheme(
border: OutlineInputBorder(),
),
),
),
));
);
return MaterialApp.router(
title: 'MoneyMgr',

View File

@@ -0,0 +1,89 @@
import 'package:moneymgr_mobile/services/api/api_client.dart';
import 'package:moneymgr_mobile/services/api/api_token.dart';
import 'package:moneymgr_mobile/services/api/auth_api.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import '../services/router/routes_list.dart';
part 'auth_state.g.dart';
/// The current authentication state of the app.
///
/// This notifier is responsible for saving/removing the token and profile info
/// to the storage through the [setAuthToken] and [logout] methods.
@riverpod
class CurrentAuthState extends _$CurrentAuthState {
@override
AuthState build() {
final secureStorage = ref.watch(secureStorageProvider).requireValue;
final token = secureStorage.token();
return token != null ? AuthState.authenticated : AuthState.unauthenticated;
}
/// Attempts to authenticate with [token] and saves the token and profile info to storage.
/// Will invalidate the state if success and throw an exception in case of failure
Future<void> setAuthToken(ApiToken token) async {
// Attempt to use provided token
await ApiClient(
token: token,
prefs: await ref.watch(prefsProvider.future),
).authInfo();
final secureStorage = ref.read(secureStorageProvider).requireValue;
await secureStorage.setToken(token);
ref
// Invalidate the state so the auth state will be updated to authenticated.
.invalidateSelf();
}
/// Logs out, deletes the saved token and profile info from storage, and invalidates
/// the state.
Future<void> logout() async {
final prefs = ref.read(prefsProvider).requireValue;
final secureStorage = ref.read(secureStorageProvider).requireValue;
await secureStorage.removeToken();
prefs.clearServerConfig();
prefs.clearAuthInfo();
ref
// Invalidate the state so the auth state will be updated to authenticated.
.invalidateSelf();
}
}
/// The possible authentication states of the app.
enum AuthState {
unknown(redirectPath: homePage, allowedPaths: [homePage]),
unauthenticated(
redirectPath: authPage,
allowedPaths: [authPage, qrAuthPath, manualAuthPage, settingsPage],
),
authenticated(
redirectPath: homePage,
allowedPaths: null,
forbiddenPaths: [authPage, manualAuthPage],
);
const AuthState({
required this.redirectPath,
required this.allowedPaths,
this.forbiddenPaths,
});
/// The target path to redirect when the current route is not allowed in this
/// auth state.
final String redirectPath;
/// List of paths allowed when the app is in this auth state. May be set to null if there is no
/// restriction applicable
final List<String>? allowedPaths;
/// List of paths not allowed when the app is in this auth state. May be set to null if there is no
/// restriction applicable
final List<String>? forbiddenPaths;
}

View File

@@ -0,0 +1,50 @@
import 'package:flextras/flextras.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gutter/flutter_gutter.dart';
import 'package:go_router/go_router.dart';
import '../../services/router/routes_list.dart';
class BaseAuthPage extends StatelessWidget {
final List<Widget> children;
final String? title;
final bool? showSettings;
const BaseAuthPage({
super.key,
required this.children,
this.title,
this.showSettings,
});
@override
Widget build(BuildContext context) {
void onSettingsPressed() => context.push(settingsPage);
return Scaffold(
appBar: AppBar(
title: Text(title ?? 'MoneyMgr'),
actions: [
// Settings button
showSettings != false
? IconButton(
onPressed: onSettingsPressed,
icon: const Icon(Icons.settings),
)
: Container(),
],
),
body: SingleChildScrollView(
child: IntrinsicHeight(
child: SeparatedColumn(
padding: EdgeInsets.all(context.gutter),
separatorBuilder: () => const Gutter(),
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: children,
),
),
),
);
}
}

View File

@@ -0,0 +1,66 @@
import 'package:flutter/material.dart';
import 'package:flutter_gutter/flutter_gutter.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/routes/login/base_auth_page.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
class LoginScreen extends HookConsumerWidget {
const LoginScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
return BaseAuthPage(
children: [
Gutter(scaleFactor: 3),
Text(
"This application requires a token from MoneyMgr to be used.\n\nPlease create a token on your Money Manager instance and make sure to click on \"For mobile app\" button. You can then enter here generated credentials.",
textAlign: TextAlign.justify,
),
Expanded(child: Container()),
_LoginChoice(
route: manualAuthPage,
icon: Icons.edit_document,
label: "Enter manually authentication information",
),
_LoginChoice(
route: qrAuthPath,
icon: Icons.qr_code_2,
label: "Scan authentication Qr Code",
),
Gutter(scaleFactor: 3),
],
);
}
}
class _LoginChoice extends StatelessWidget {
const _LoginChoice({
required this.route,
required this.label,
required this.icon,
});
final String route;
final String label;
final IconData icon;
@override
Widget build(BuildContext context) {
return FilledButton(
onPressed: () => context.push(route),
style: ButtonStyle(
padding: WidgetStatePropertyAll(
EdgeInsetsGeometry.symmetric(vertical: 20.0, horizontal: 30.0),
),
),
child: Row(
children: [
Icon(icon, size: 25.0),
Gutter(),
Flexible(child: Text(label)),
],
),
);
}
}

View File

@@ -0,0 +1,91 @@
import 'package:flutter/material.dart';
import 'package:flutter_gutter/flutter_gutter.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/providers/auth_state.dart';
import 'package:moneymgr_mobile/routes/login/base_auth_page.dart';
import 'package:moneymgr_mobile/services/api/api_token.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
import 'package:moneymgr_mobile/widgets/app_button.dart';
class ManualAuthScreen extends HookConsumerWidget {
const ManualAuthScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
var apiUrlController = useTextEditingController();
var tokenIdController = useTextEditingController();
var tokenValueController = useTextEditingController();
Future<void> onSubmit() async {
try {
await ref
.read(currentAuthStateProvider.notifier)
.setAuthToken(
ApiToken(
apiUrl: apiUrlController.text,
tokenId: int.tryParse(tokenIdController.text) ?? 1,
tokenValue: tokenValueController.text,
),
);
if (context.mounted) {
if (context.canPop()) context.pop();
context.replace(profilePage);
}
} catch (e, s) {
Logger.root.severe("Failed to authenticate user! $e $s");
if (context.mounted) {
context.showTextSnackBar("Failed to authenticate user! $e");
}
}
}
return BaseAuthPage(
title: "Manual authentication",
showSettings: false,
children: [
Gutter(scaleFactor: 3),
Text(
"On this screen you can manually enter authentication information.",
),
Gutter(),
TextField(
controller: apiUrlController,
keyboardType: TextInputType.url,
decoration: const InputDecoration(
labelText: 'API URL',
helperText: "Format: http://moneymgr.corp.com/api",
),
textInputAction: TextInputAction.next,
),
Gutter(),
TextField(
controller: tokenIdController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: 'Token ID',
helperText: "The ID of the token",
),
textInputAction: TextInputAction.next,
),
Gutter(),
TextField(
controller: tokenValueController,
keyboardType: TextInputType.text,
decoration: const InputDecoration(
labelText: 'Token value',
helperText: "The value of the token itself",
),
textInputAction: TextInputAction.done,
),
Gutter(),
AppButton(onPressed: onSubmit, label: "Submit"),
Gutter(scaleFactor: 3),
],
);
}
}

View File

@@ -0,0 +1,80 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:moneymgr_mobile/providers/auth_state.dart';
import 'package:moneymgr_mobile/services/api/api_token.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
class QrAuthScreen extends HookConsumerWidget {
const QrAuthScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final loading = useState(false);
handleCapture(BarcodeCapture barcodes) async {
if (loading.value) return;
if (barcodes.barcodes.length != 1) return;
final b = barcodes.barcodes[0];
if (b.format != BarcodeFormat.qrCode) {
context.showTextSnackBar(
"Only QrCode are supported!",
duration: Duration(seconds: 1),
);
return;
}
final value = b.rawValue ?? "";
Logger.root.finest("Decoded QrCode: $value");
if (!value.startsWith("moneymgr://")) {
context.showTextSnackBar(
"Not a MoneyMgr Qr Code!",
duration: Duration(seconds: 1),
);
return;
}
// Decode token
final uri = Uri.parse(
value.replaceFirst("moneymgr://", "http://test.com/?"),
);
final token = ApiToken(
apiUrl: uri.queryParameters["api"] ?? "",
tokenId: int.tryParse(uri.queryParameters["id"] ?? "") ?? 0,
tokenValue: uri.queryParameters["secret"] ?? "",
);
// Attempt to authenticate using token
try {
loading.value = true;
await ref.read(currentAuthStateProvider.notifier).setAuthToken(token);
if (context.mounted) {
if (context.canPop()) context.pop();
context.replace(profilePage);
}
} catch (e, s) {
Logger.root.severe("Failed to authenticate user! $e $s");
if (context.mounted) {
context.showTextSnackBar("Failed to authenticate user! $e");
}
} finally {
loading.value = false;
}
}
return Scaffold(
appBar: AppBar(title: Text('QR Authentication')),
body: MobileScanner(onDetect: handleCapture),
);
}
}

View File

@@ -0,0 +1,112 @@
import 'package:alert_dialog/alert_dialog.dart';
import 'package:confirm_dialog/confirm_dialog.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/providers/auth_state.dart';
import 'package:moneymgr_mobile/services/api/api_client.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
class ProfileScreen extends HookConsumerWidget {
const ProfileScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final data = ref.watch(prefsProvider);
final api = ref.watch(apiServiceProvider);
if (data.value == null) return CircularProgressIndicator();
final profile = data.value?.authInfo();
void onSettingsPressed() => context.push(settingsPage);
handleSignOut() async {
try {
if (!await confirm(
context,
content: Text("Do you really want to sign out of your account?"),
)) {
return;
}
await ref.read(currentAuthStateProvider.notifier).logout();
} catch (e, s) {
Logger.root.warning("Failed to sign out! $e $s");
if (context.mounted) {
await alert(context, content: Text("Failed to sign you out! $e"));
}
}
}
return Scaffold(
appBar: AppBar(
title: Text("Profile"),
actions: [
IconButton(
onPressed: onSettingsPressed,
icon: const Icon(Icons.settings),
),
],
),
body: ListView(
children: [
ListEntry(
title: "Server URL",
value: api?.token.apiUrl,
icon: Icons.link,
),
ListEntry(
title: "Token ID",
value: api?.token.tokenId.toString(),
icon: Icons.key,
),
ListEntry(
title: "User ID",
value: profile?.id.toString(),
icon: Icons.perm_contact_calendar_outlined,
),
ListEntry(
title: "User name",
value: profile?.name,
icon: Icons.person,
),
ListEntry(title: "User mail", value: profile?.mail, icon: Icons.mail),
Divider(),
ListEntry(
title: "Sign out",
icon: Icons.logout,
onTap: handleSignOut,
),
],
),
);
}
}
class ListEntry extends StatelessWidget {
final String title;
final String? value;
final IconData icon;
final Function()? onTap;
const ListEntry({
super.key,
required this.title,
this.value,
required this.icon,
this.onTap,
});
@override
Widget build(BuildContext context) {
return ListTile(
title: Text(title),
subtitle: value != null ? Text(value!) : null,
leading: Icon(icon),
onTap: onTap,
);
}
}

View File

@@ -0,0 +1,111 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/storage/expenses.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/utils/ocr_utils.dart';
import 'package:moneymgr_mobile/utils/pdf_utils.dart';
import 'package:moneymgr_mobile/widgets/expense_editor.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'scan_screen.g.dart';
/// Scan a document & return generated PDF as byte file
@riverpod
Future<(Uint8List?, BaseExpenseInfo?)> _scanDocument(Ref ref) async {
final prefs = ref.watch(prefsProvider).requireValue;
final pdf = await scanDocAsPDF();
final img = await renderPdf(pdfBytes: pdf);
final amount = await extractInfoFromBill(
imgBuff: img,
extractDates: !prefs.disableExtractDates(),
);
return (pdf, amount);
}
class ScanScreen extends HookConsumerWidget {
const ScanScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final scanDocProvider = ref.watch(_scanDocumentProvider);
final expenses = ref.watch(expensesProvider).requireValue;
restartScan() async {
try {
final val = ref.refresh(_scanDocumentProvider);
Logger.root.info("Load again startup result: $val");
} catch (e, s) {
Logger.root.shout("Failed to try again startup loading! $e $s");
}
}
return Padding(
padding: const EdgeInsets.all(8.0),
child: switch (scanDocProvider) {
AsyncData(:final value) when value.$1 != null => ExpenseEditor(
file: value.$1!,
initialData: value.$2,
onFinished: (expense) async {
await expenses.add(
info: expense,
fileContent: value.$1!,
fileMimeType: "application/pdf",
);
restartScan();
},
onRescan: restartScan,
),
// No data
AsyncData(:final value) when value.$1 == null => ScanErrorScreen(
message: "No document scanned!",
onTryAgain: restartScan,
),
// Error
AsyncError(:final error) => ScanErrorScreen(
message: error.toString(),
onTryAgain: restartScan,
),
_ => const Center(child: CircularProgressIndicator()),
},
);
}
}
class ScanErrorScreen extends StatelessWidget {
final String message;
final Function() onTryAgain;
const ScanErrorScreen({
super.key,
required this.message,
required this.onTryAgain,
});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Spacer(flex: 5),
Text("An error occurred while scanning"),
Spacer(flex: 1),
Text(message, textAlign: TextAlign.center),
Spacer(flex: 1),
MaterialButton(
onPressed: onTryAgain,
child: Text("Try again".toUpperCase()),
),
Spacer(flex: 5),
],
),
);
}
}

View File

@@ -0,0 +1,86 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/storage/expenses.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
import 'package:moneymgr_mobile/widgets/expense_editor.dart';
import 'package:moneymgr_mobile/widgets/full_screen_error.dart';
import 'package:moneymgr_mobile/widgets/loading_scaffold.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'scan_details.g.dart';
@riverpod
Future<(Expense, Uint8List)?> _getExpense(Ref ref, {required int id}) async {
final expProvider = ref.watch(expensesProvider).requireValue;
final expense = await expProvider.getById(id);
if (expense == null) return null;
final file = await expProvider.loadFile(expense);
return (expense, file);
}
class ScanDetailScreen extends HookConsumerWidget {
final int id;
const ScanDetailScreen({super.key, required this.id});
@override
Widget build(BuildContext context, WidgetRef ref) {
final expenses = ref.watch(expensesProvider).requireValue;
final expense = ref.watch(_getExpenseProvider(id: id));
handleUpdate(BaseExpenseInfo newInfo) async {
try {
await expenses.updateExpense(expense.requireValue!.$1, newInfo);
if (context.mounted) {
context.pop();
}
ref.invalidate(expensesProvider);
} catch (e, s) {
Logger.root.warning("Failed to update expense! $e$s");
if (context.mounted) {
context.showTextSnackBar("Failed to update expense! $e");
}
}
}
handleDelete() async {
try {
await expenses.deleteExpense(expense.requireValue!.$1);
if (context.mounted) {
context.pop();
}
ref.invalidate(expensesProvider);
} catch (e, s) {
Logger.root.warning("Failed to delete expense! $e$s");
if (context.mounted) {
context.showTextSnackBar("Failed to delete expense! $e");
}
}
}
return switch (expense) {
AsyncData(:final value) when value == null => FullScreenError(
message: "Expense does not exists!",
error: 'NONE',
),
AsyncData(:final value) => ExpenseEditor(
file: value!.$2,
initialData: value.$1.baseExpense,
onFinished: handleUpdate,
onDelete: handleDelete,
),
AsyncError(:final error) => FullScreenError(
message: "Failed to load expense information!",
error: error.toString(),
),
_ => LoadingScaffold(title: "Expense $id"),
};
}
}

View File

@@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
import 'package:moneymgr_mobile/services/storage/expenses.dart';
import 'package:moneymgr_mobile/utils/time_utils.dart';
import 'package:moneymgr_mobile/widgets/full_screen_error.dart';
import 'package:moneymgr_mobile/widgets/loading_scaffold.dart';
import 'package:moneymgr_mobile/widgets/synchronize_button.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'scans_list_screen.g.dart';
@riverpod
Future<ExpensesList> _expensesList(Ref ref) {
final expenses = ref.watch(expensesProvider).requireValue;
return expenses.getList();
}
class ScansListScreen extends HookConsumerWidget {
const ScansListScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final expensesList = ref.watch(_expensesListProvider);
return switch (expensesList) {
AsyncData(:final value) => Scaffold(
appBar: AppBar(
title: Text("Expenses"),
actions: [value.isEmpty ? Container() : SynchronizeButton()],
),
body: _ExpensesList(list: value),
),
AsyncError(:final error) => FullScreenError(
message: "Failed to load the list of expenses",
error: error.toString(),
),
_ => const LoadingScaffold(title: "Expenses"),
};
}
}
class _ExpensesList extends StatelessWidget {
final ExpensesList list;
const _ExpensesList({required this.list});
@override
Widget build(BuildContext context) {
if (list.isEmpty) {
return const Center(
child: Text("There is no entry waiting for upload (yet)"),
);
}
return ListView.builder(
itemBuilder: (context, entryNum) {
final expense = list[entryNum];
return ListTile(
onTap: () => context.push("$scansPage/${expense.id}"),
leading: Icon(Icons.receipt_long),
title: Text(
expense.label ?? "No label",
style: TextStyle(
fontStyle: expense.label == null ? FontStyle.italic : null,
),
),
subtitle: Text(expense.dateTime.simpleDate),
trailing: Text("${expense.cost}", style: TextStyle(fontSize: 20)),
);
},
itemCount: list.length,
);
}
}

View File

@@ -0,0 +1,102 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/providers/settings.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
class SettingsScreen extends ConsumerWidget {
const SettingsScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final prefs = ref.watch(prefsProvider).requireValue;
final themeMode = ref.watch(currentThemeModeProvider);
void onTapThemeMode() =>
showDialog(context: context, builder: (_) => const _ThemeModeDialog());
void onTapLicenses() => context.showAppLicensePage();
handleToggleStartScreen(v) async {
await prefs.setStartOnScansListScreen(v);
ref.invalidate(prefsProvider);
}
handleToggleDisableExtractDate(v) async {
await prefs.setDisableExtractDates(v);
ref.invalidate(prefsProvider);
}
return Scaffold(
appBar: AppBar(title: const Text('Settings')),
body: ListView(
children: [
ListTile(
leading: const Icon(Icons.brightness_6),
title: const Text('Theme mode'),
trailing: Text(themeMode.label),
onTap: onTapThemeMode,
),
SwitchListTile(
value: prefs.startOnScansListScreen(),
onChanged: handleToggleStartScreen,
title: Text("Start on scans screen"),
subtitle: Text(
"Do not start camera automatically on application startup",
),
),
SwitchListTile(
value: prefs.disableExtractDates(),
onChanged: handleToggleDisableExtractDate,
title: Text("Do not extract dates"),
subtitle: Text(
"Do not attempt to extract dates from scanned expenses",
),
),
const Divider(),
ListTile(
leading: const Icon(Icons.info_outline),
title: const Text('Licenses'),
onTap: onTapLicenses,
),
],
),
);
}
}
/// Select theme dialog
class _ThemeModeDialog extends ConsumerWidget {
const _ThemeModeDialog();
@override
Widget build(BuildContext context, WidgetRef ref) {
void onTapOption(ThemeMode themeMode) {
ref.read(currentThemeModeProvider.notifier).set(themeMode);
Navigator.of(context).pop();
}
return SimpleDialog(
clipBehavior: Clip.antiAlias,
children: [
for (final themeMode in ThemeMode.values)
_ThemeModeDialogOption(
value: themeMode,
onTap: () => onTapOption(themeMode),
),
],
);
}
}
class _ThemeModeDialogOption extends StatelessWidget {
const _ThemeModeDialogOption({required this.value, required this.onTap});
final ThemeMode value;
final GestureTapCallback? onTap;
@override
Widget build(BuildContext context) {
return ListTile(onTap: onTap, title: Text(value.label));
}
}

View File

@@ -0,0 +1,78 @@
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
import 'package:dio/dio.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/api/api_token.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
import 'package:moneymgr_mobile/utils/string_utils.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:shared_preferences/shared_preferences.dart';
part 'api_client.g.dart';
/// API token header
const apiTokenHeader = "X-Auth-Token";
/// Client API
class ApiClient {
final ApiToken token;
final Dio client;
final SharedPreferencesWithCache prefs;
ApiClient({required this.token, required this.prefs})
: client = Dio(BaseOptions(baseUrl: token.apiUrl));
/// Get Dio instance
Future<Response<T>> execute<T>(
String uri, {
String method = "GET",
Object? data,
}) async {
Logger.root.fine("Request on ${token.apiUrl} - URI $uri");
return client.request(
uri,
options: Options(
method: method,
headers: {apiTokenHeader: _genJWT(method, uri)},
),
data: data,
);
}
/// Generate authentication JWT
String _genJWT(String method, String uri) {
final jwt = JWT(
{"nonce": getRandomString(15), "met": method, "uri": uri},
header: {"kid": token.tokenId.toString()},
);
return jwt.sign(
SecretKey(token.tokenValue),
algorithm: JWTAlgorithm.HS256,
expiresIn: Duration(minutes: 15),
);
}
}
/// An API service that handles authentication and exposes an [ApiClient].
///
/// Every API call coming from UI should watch/read this provider instead of
/// instantiating the [ApiClient] itself. When being watched, it will force any
/// data provider (provider that fetches data) to refetch when the
/// authentication state changes.
///
/// The API client is kept alive to follow dio's recommendation to use the same
/// client instance for the entire app.
@riverpod
ApiClient? apiService(Ref ref) {
final storage = ref.watch(secureStorageProvider);
final prefs = ref.watch(prefsProvider);
final t = storage.value?.token();
if (t == null || prefs.value == null) return null;
ref.keepAlive();
return ApiClient(token: t, prefs: prefs.value!);
}

View File

@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'api_token.freezed.dart';
part 'api_token.g.dart';
@freezed
abstract class ApiToken with _$ApiToken {
const factory ApiToken({
required String apiUrl,
required int tokenId,
required String tokenValue,
}) = _ApiToken;
factory ApiToken.fromJson(Map<String, dynamic> json) =>
_$ApiTokenFromJson(json);
}

View File

@@ -0,0 +1,52 @@
// ignore_for_file: non_constant_identifier_names
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/api/api_client.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
part 'auth_api.freezed.dart';
part 'auth_api.g.dart';
@freezed
abstract class AuthInfo with _$AuthInfo {
const factory AuthInfo({
required int id,
required String mail,
required String name,
required int time_create,
required int time_update,
}) = _AuthInfo;
factory AuthInfo.fromJson(Map<String, dynamic> json) =>
_$AuthInfoFromJson(json);
}
/// Auth API
extension AuthApi on ApiClient {
/// Get authentication information
Future<AuthInfo> authInfo() async {
final response = await execute("/auth/info", method: "GET");
return AuthInfo.fromJson(response.data);
}
/// Get authentication information, returning cached information in case of failure
Future<AuthInfo> authInfoOrCache() async {
try {
final config = await authInfo();
this.prefs.setAuthInfo(config);
return config;
} catch (e, s) {
Logger.root.warning("Failed to fetch user information! $e $s");
}
final cached = this.prefs.authInfo();
if (cached == null) {
throw Exception(
"Could not fetch user information, cached version is unavailable!",
);
}
return cached;
}
}

View File

@@ -0,0 +1,43 @@
import 'dart:typed_data';
import 'package:dio/dio.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:http_parser/http_parser.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/api/api_client.dart';
part 'files_api.freezed.dart';
part 'files_api.g.dart';
@freezed
abstract class UploadResult with _$UploadResult {
const factory UploadResult({required int id}) = _UploadResult;
factory UploadResult.fromJson(Map<String, dynamic> json) =>
_$UploadResultFromJson(json);
}
extension FilesApi on ApiClient {
/// Upload a file
Future<UploadResult> uploadFile({
required String filename,
required String mimeType,
required Uint8List bytes,
}) async {
final res = await execute(
"/file",
method: "POST",
data: FormData.fromMap({
"file": MultipartFile.fromBytes(
bytes,
filename: filename,
contentType: MediaType.parse(mimeType),
),
}),
);
Logger.root.fine("Successfully uploaded file with response=${res.data}");
return UploadResult.fromJson(res.data);
}
}

View File

@@ -0,0 +1,27 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'api_client.dart';
part 'inbox_api.freezed.dart';
part 'inbox_api.g.dart';
@freezed
abstract class UpdateInboxEntryRequest with _$UpdateInboxEntryRequest {
const factory UpdateInboxEntryRequest({
// ignore: non_constant_identifier_names
required int file_id,
required int time,
required String? label,
required double? amount,
}) = _UpdateInboxEntryRequest;
factory UpdateInboxEntryRequest.fromJson(Map<String, dynamic> json) =>
_$UpdateInboxEntryRequestFromJson(json);
}
extension InboxApi on ApiClient {
/// Create a new inbox entry
Future<void> createInboxEntry(UpdateInboxEntryRequest entry) async {
await execute("/inbox", method: "POST", data: entry.toJson());
}
}

View File

@@ -0,0 +1,67 @@
// ignore_for_file: non_constant_identifier_names
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'api_client.dart';
part 'server_api.freezed.dart';
part 'server_api.g.dart';
@freezed
abstract class ServerConstraint with _$ServerConstraint {
const factory ServerConstraint({required int min, required int max}) =
_ServerConstraint;
factory ServerConstraint.fromJson(Map<String, dynamic> json) =>
_$ServerConstraintFromJson(json);
}
@freezed
abstract class ServerConstraints with _$ServerConstraints {
const factory ServerConstraints({required ServerConstraint inbox_entry_label}) =
_ServerConstraints;
factory ServerConstraints.fromJson(Map<String, dynamic> json) =>
_$ServerConstraintsFromJson(json);
}
@freezed
abstract class ServerConfig with _$ServerConfig {
const factory ServerConfig({required ServerConstraints constraints}) =
_ServerConfig;
factory ServerConfig.fromJson(Map<String, dynamic> json) =>
_$ServerConfigFromJson(json);
}
/// Auth API
extension ServerApi on ApiClient {
/// Get server configuration
Future<ServerConfig> serverConfig() async {
final response = await execute("/server/config", method: "GET");
return ServerConfig.fromJson(response.data);
}
/// Get server configuration, or retrieve cached information (if available, in
/// case of failure)
Future<ServerConfig> serverConfigOrCache() async {
try {
final config = await serverConfig();
this.prefs.setServerConfig(config);
return config;
} catch (e, s) {
Logger.root.warning("Failed to fetch server configuration! $e $s");
}
final cached = this.prefs.serverConfig();
if (cached == null) {
throw Exception(
"Could not fetch server configuration, cached version is unavailable!",
);
}
return cached;
}
}

View File

@@ -0,0 +1,129 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/providers/auth_state.dart';
import 'package:moneymgr_mobile/routes/login/login_screen.dart';
import 'package:moneymgr_mobile/routes/login/manual_auth_screen.dart';
import 'package:moneymgr_mobile/routes/login/qr_auth_screen.dart';
import 'package:moneymgr_mobile/routes/profile/profile_screen.dart';
import 'package:moneymgr_mobile/routes/scan/scan_screen.dart';
import 'package:moneymgr_mobile/routes/scan_details/scan_details.dart';
import 'package:moneymgr_mobile/routes/scans_list/scans_list_screen.dart';
import 'package:moneymgr_mobile/routes/settings/settings_screen.dart';
import 'package:moneymgr_mobile/services/router/routes_list.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/widgets/load_startup_data.dart';
import 'package:moneymgr_mobile/widgets/scaffold_with_navigation.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'router.g.dart';
/// The router config for the app.
@riverpod
GoRouter router(Ref ref) {
// Local notifier for the current auth state. The purpose of this notifier is
// to provide a [Listenable] to the [GoRouter] exposed by this provider.
final authStateNotifier = ValueNotifier(AuthState.unknown);
ref
..onDispose(authStateNotifier.dispose)
..listen(currentAuthStateProvider, (_, value) {
authStateNotifier.value = value;
});
final prefs = ref.read(prefsProvider).requireValue;
// This is the only place you need to define your navigation items. The items
// will be propagated automatically to the router and the navigation bar/rail
// of the scaffold.
//
// To configure the authentication state needed to access a particular item,
// see [AuthState] enum.
final navigationItems = [
NavigationItem(
path: capturePage,
body: (_) => ScanScreen(),
icon: Icons.camera_alt_outlined,
selectedIcon: Icons.camera_alt,
label: "Scan",
),
NavigationItem(
path: scansPage,
body: (_) => ScansListScreen(),
icon: Icons.list,
selectedIcon: Icons.list_alt,
label: "List",
routes: [
GoRoute(
path: ":id",
builder: (_, state) {
final id = int.parse(state.pathParameters["id"]!);
return ScanDetailScreen(id: id);
},
),
],
),
NavigationItem(
path: profilePage,
body: (_) => ProfileScreen(),
icon: Icons.person_outline,
selectedIcon: Icons.person,
label: 'Profile',
),
];
final router = GoRouter(
debugLogDiagnostics: true,
initialLocation: prefs.startOnScansListScreen() ? scansPage : capturePage,
routes: [
GoRoute(path: homePage, builder: (_, _) => const Scaffold()),
GoRoute(path: authPage, builder: (_, _) => const LoginScreen()),
GoRoute(path: qrAuthPath, builder: (_, _) => const QrAuthScreen()),
GoRoute(
path: manualAuthPage,
builder: (_, _) => const ManualAuthScreen(),
),
GoRoute(path: settingsPage, builder: (_, _) => const SettingsScreen()),
// Configuration for the bottom navigation bar routes. The routes themselves
// should be defined in [navigationItems]. Modification to this [ShellRoute]
// config is rarely needed.
ShellRoute(
builder: (_, _, child) => child,
routes: [
for (final (index, item) in navigationItems.indexed)
GoRoute(
path: item.path,
pageBuilder: (context, _) => NoTransitionPage(
child: LoadStartupData(
child: ScaffoldWithNavigation(
selectedIndex: index,
navigationItems: navigationItems,
child: item.body(context),
),
),
),
routes: item.routes,
),
],
),
],
refreshListenable: authStateNotifier,
redirect: (_, state) {
// Get the current auth state.
final authState = ref.read(currentAuthStateProvider);
// Check if the current path is allowed for the current auth state. If not,
// redirect to the redirect target of the current auth state.
if (authState.allowedPaths?.contains(state.fullPath) == false ||
authState.forbiddenPaths?.contains(state.fullPath) == true) {
return authState.redirectPath;
}
// If the current path is allowed for the current auth state, don't redirect.
return null;
},
);
ref.onDispose(router.dispose);
return router;
}

View File

@@ -0,0 +1,23 @@
/// Base home page
const homePage = "/";
/// Authentication path
const authPage = "/login";
/// Qr Code authentication
const qrAuthPath = "/login/qr";
/// Manual authentication
const manualAuthPage = "/login/manual";
/// Settings path
const settingsPage = "/settings";
/// Scan path
const capturePage = "/scan";
/// Scans page
const scansPage = "/scans";
/// Profile path
const profilePage = "/profile";

View File

@@ -0,0 +1,183 @@
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'expenses.freezed.dart';
part 'expenses.g.dart';
typedef ExpensesList = List<Expense>;
@freezed
abstract class BaseExpenseInfo with _$BaseExpenseInfo {
const BaseExpenseInfo._();
const factory BaseExpenseInfo({
required String? label,
required double cost,
required DateTime time,
}) = _BaseExpenseInfo;
/// Get expense time as second
int get timeAsSeconds => (time.millisecondsSinceEpoch / 1000).floor();
}
@freezed
abstract class Expense with _$Expense {
const Expense._();
const factory Expense({
/// Internal id used to identify the expense
required int id,
/// Label of the expense
required String? label,
/// The cost shall always be a positive value
required double cost,
/// Time associated with the expense (seconds since epoch)
required int time,
/// Associated file mime type
required String mimeType,
}) = _Expense;
factory Expense.fromJson(Map<String, dynamic> json) =>
_$ExpenseFromJson(json);
/// Get base expense information
BaseExpenseInfo get baseExpense =>
BaseExpenseInfo(label: label, cost: cost, time: dateTime);
/// Get associated expense file name
String get localFileName {
if (mimeType == "application/pdf") return "$id.pdf";
if (mimeType == "image/jpeg") return "$id.jpeg";
if (mimeType == "image/png") return "$id.png";
return id.toString();
}
/// Get expense date
DateTime get dateTime => DateTime.fromMillisecondsSinceEpoch(time * 1000);
}
@riverpod
Future<ExpensesManager> expenses(Ref ref) async => ExpensesManager.instance();
class ExpensesManager {
final String storagePath;
ExpensesManager._({required this.storagePath});
/// Get an instance of this manager
static Future<ExpensesManager> instance() async {
final appDir = await getApplicationDocumentsDirectory();
final subDir = p.join(appDir.absolute.path, "expenses");
final result = await Directory(subDir).create(recursive: true);
return ExpensesManager._(storagePath: result.absolute.path);
}
/// Get expenses list file path
File get expenseFile => File(p.join(storagePath, "list.json"));
/// Get the files storage path
Directory get filesStoragePath => Directory(p.join(storagePath, "exp_files"));
/// Get the current list of expenses
Future<ExpensesList> getList() async {
// On first save the list does not exists.
if (!await expenseFile.exists()) {
return [];
}
final jsonDec = jsonDecode(await expenseFile.readAsString());
return List<Expense>.from(jsonDec.map((m) => Expense.fromJson(m)));
}
/// Save the list of expenses
Future<void> saveList(ExpensesList list) async {
final jsonDoc = jsonEncode(list.map((t) => t.toJson()).toList());
await expenseFile.writeAsString(jsonDoc);
}
/// Add a new expense to the list
Future<void> add({
required BaseExpenseInfo info,
required List<int> fileContent,
required String fileMimeType,
}) async {
final list = await getList();
final exp = Expense(
id: (list.lastOrNull?.id ?? 0) + Random().nextInt(1000),
label: info.label,
cost: info.cost,
time: info.timeAsSeconds,
mimeType: fileMimeType,
);
// Create files storage directory if required
if (!await filesStoragePath.exists()) {
await filesStoragePath.create(recursive: true);
}
// Save associated file
final file = File(
p.join(filesStoragePath.absolute.path, exp.localFileName),
);
await file.writeAsBytes(fileContent);
// Save the list of expenses
list.add(exp);
await saveList(list);
}
/// Get a single expense information by its ID
Future<Expense?> getById(int id) async {
final list = await getList();
return list.firstWhere((e) => e.id == id);
}
/// Load the file associated with an expense
Future<Uint8List> loadFile(Expense expense) async {
final path = p.join(filesStoragePath.absolute.path, expense.localFileName);
return File(path).readAsBytes();
}
/// Update expense information
Future<void> updateExpense(Expense expense, BaseExpenseInfo newInfo) async {
final list = await getList();
final entry = list.indexWhere((e) => e.id == expense.id);
list[entry] = Expense(
id: expense.id,
label: newInfo.label,
cost: newInfo.cost,
time: newInfo.timeAsSeconds,
mimeType: expense.mimeType,
);
saveList(list);
}
/// Delete an expense
Future<void> deleteExpense(Expense expense) async {
// Remove expense from the list
final list = await getList();
await saveList(list.where((e) => e.id != expense.id).toList());
// Delete associated file, if any
final filePath = File(
p.join(filesStoragePath.absolute.path, expense.localFileName),
);
if (await filePath.exists()) {
await filePath.delete();
}
}
}

View File

@@ -1,4 +1,8 @@
import 'dart:convert';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/services/api/auth_api.dart';
import 'package:moneymgr_mobile/services/api/server_api.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -9,3 +13,49 @@ Future<SharedPreferencesWithCache> prefs(Ref ref) =>
SharedPreferencesWithCache.create(
cacheOptions: const SharedPreferencesWithCacheOptions(),
);
extension MoneyMgrSharedPreferences on SharedPreferencesWithCache {
bool startOnScansListScreen() {
return getBool("startOnScansListScreen") ?? false;
}
Future<void> setStartOnScansListScreen(bool start) async {
await setBool("startOnScansListScreen", start);
}
bool disableExtractDates() {
return getBool("disableExtractDates") ?? false;
}
Future<void> setDisableExtractDates(bool disable) async {
await setBool("disableExtractDates", disable);
}
ServerConfig? serverConfig() {
final json = getString("serverConfig");
if (json != null) return ServerConfig.fromJson(jsonDecode(json));
return null;
}
Future<void> setServerConfig(ServerConfig config) async {
await setString("serverConfig", jsonEncode(config));
}
Future<void> clearServerConfig() async {
await remove("serverConfig");
}
AuthInfo? authInfo() {
final json = getString("authInfo");
if (json != null) return AuthInfo.fromJson(jsonDecode(json));
return null;
}
Future<void> setAuthInfo(AuthInfo info) async {
await setString("authInfo", jsonEncode(info));
}
Future<void> clearAuthInfo() async {
await remove("authInfo");
}
}

View File

@@ -0,0 +1,63 @@
import 'dart:convert';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/services/api/api_token.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'secure_storage.g.dart';
@riverpod
Future<SecureStorage> secureStorage(Ref ref) =>
SecureStorage.getInstance(keys: {'token'});
class SecureStorage {
SecureStorage._(this._flutterSecureStorage, this._cache);
late final FlutterSecureStorage _flutterSecureStorage;
late final Map<String, String> _cache;
static Future<SecureStorage> getInstance({required Set<String> keys}) async {
const flutterSecureStorage = FlutterSecureStorage();
final cache = <String, String>{};
await keys
.map(
(key) => flutterSecureStorage.read(key: key).then((value) {
if (value != null) {
cache[key] = value;
}
}),
)
.wait;
return SecureStorage._(flutterSecureStorage, cache);
}
String? get(String key) => _cache[key];
Future<void> set(String key, String value) {
_cache[key] = value;
return _flutterSecureStorage.write(key: key, value: value);
}
Future<void> remove(String key) {
_cache.remove(key);
return _flutterSecureStorage.delete(key: key);
}
/// Get auth token
ApiToken? token() {
final tokenStr = get("token");
if (tokenStr != null) {
return ApiToken.fromJson(jsonDecode(tokenStr));
}
return null;
}
/// Set auth token
Future<void> setToken(ApiToken token) =>
set("token", jsonEncode(token.toJson()));
/// Remove auth token
Future<void> removeToken() => remove("token");
}

View File

@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
extension BuildContextX on BuildContext {
/// A convenient way to access [ThemeData.colorScheme] of the current context.
///
/// This also prevents confusion with a bunch of other properties of [ThemeData]
/// that are less commonly used.
ColorScheme get colorScheme => Theme.of(this).colorScheme;
/// A convenient way to access [ThemeData.textTheme] of the current context.
///
/// This also prevents confusion with a bunch of other properties of [ThemeData]
/// that are less commonly used.
TextTheme get textTheme => Theme.of(this).textTheme;
/// Shows a floating snack bar with text as its content.
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showTextSnackBar(
String text, {
Duration? duration,
}) => ScaffoldMessenger.of(this).showSnackBar(
SnackBar(
behavior: SnackBarBehavior.floating,
content: Text(text),
duration: duration ?? Duration(milliseconds: 4000),
),
);
void showAppLicensePage() => showLicensePage(
context: this,
useRootNavigator: true,
applicationName: 'MoneyMgr',
applicationLegalese: '(c) Pierre HUBERT 2025 - ${DateTime.now().year}',
);
}
extension ThemeModeX on ThemeMode {
String get label => switch (this) {
ThemeMode.system => 'System',
ThemeMode.light => 'Light',
ThemeMode.dark => 'Dark',
};
}

View File

@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
typedef AsyncTask = ({
ValueNotifier<Future<void>?> pending,
AsyncSnapshot<void> snapshot,
bool hasError,
});
/// Creates a hook that provides a [snapshot] of the current asynchronous task passed
/// to [pending] and a [hasError] value.
AsyncTask useAsyncTask() {
final pending = useState<Future<void>?>(null);
final snapshot = useFuture(pending.value);
final hasError =
snapshot.hasError && snapshot.connectionState != ConnectionState.waiting;
return (pending: pending, snapshot: snapshot, hasError: hasError);
}

View File

@@ -0,0 +1,86 @@
import 'dart:math';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:google_mlkit_text_recognition/google_mlkit_text_recognition.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/storage/expenses.dart';
/// Attempt to extract information from invoice image
Future<BaseExpenseInfo?> extractInfoFromBill({
required Uint8List imgBuff,
required bool extractDates,
}) async {
final decodedImage = await decodeImageFromList(imgBuff);
final byteData = await decodedImage.toByteData(
format: ui.ImageByteFormat.rawRgba,
);
final image = InputImage.fromBitmap(
bitmap: byteData!.buffer.asUint8List(),
width: decodedImage.width,
height: decodedImage.height,
);
final textRecognizer = TextRecognizer(script: TextRecognitionScript.latin);
final extractionResult = await textRecognizer.processImage(image);
Logger.root.fine("Expense text: ${extractionResult.text}");
// Check for highestCost amount on invoice
final costRegexp = RegExp(
r'([0-9]+([ ]*(\\.|,)[ ]*[0-9]{1,2}){0,1})([ \\t\\n]*(EUR|eur|€)|E)',
multiLine: true,
caseSensitive: false,
);
var highestCost = 0.0;
for (final match in costRegexp.allMatches(extractionResult.text)) {
if (match.groupCount == 0) continue;
// Process only numeric value
final value = (match.group(1) ?? "").replaceAll(",", ".");
highestCost = max(highestCost, double.tryParse(value) ?? 0.0);
}
// Check for highestCost amount on invoice
final dateRegexp = RegExp(
r'([0-3][0-9])(\/|-)([0-1][0-9])(\/|-)((20|)[0-9]{2})',
multiLine: false,
caseSensitive: false,
);
final currDate = DateTime.now();
DateTime? newest;
for (final match in dateRegexp.allMatches(extractionResult.text)) {
if (match.groupCount < 6) continue;
int year = int.tryParse(match.group(5)!) ?? currDate.year;
try {
final date = DateTime(
year > 99 ? year : (2000 + year),
int.tryParse(match.group(3)!) ?? currDate.month,
int.tryParse(match.group(1)!) ?? currDate.day,
);
if (newest == null) {
newest = date;
} else {
newest = DateTime.fromMillisecondsSinceEpoch(
max(newest.millisecondsSinceEpoch, date.millisecondsSinceEpoch),
);
}
} catch (e, s) {
Logger.root.warning("Failed to parse date! $e$s");
}
}
return BaseExpenseInfo(
label: null,
cost: highestCost,
time: extractDates && (newest?.isBefore(currDate) ?? false)
? newest!
: currDate,
);
}

View File

@@ -0,0 +1,91 @@
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'package:pdf_image_renderer/pdf_image_renderer.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart' hide IconButton, EdgeInsets;
/// Scan document as PDF
Future<Uint8List> scanDocAsPDF() async {
var configuration = DocumentScanningFlow(
appearance: DocumentFlowAppearanceConfiguration(
statusBarMode: StatusBarMode.DARK,
),
cleanScanningSession: true,
outputSettings: DocumentScannerOutputSettings(pagesScanLimit: 1),
screens: DocumentScannerScreens(
review: ReviewScreenConfiguration(enabled: false),
),
);
var documentResult = await ScanbotSdkUiV2.startDocumentScanner(configuration);
if (documentResult.status != OperationStatus.OK) {
throw Exception("Scanner failed with status ${documentResult.status}");
}
// Convert result to PDF
var result = await ScanbotSdk.document.createPDFForDocument(
PDFFromDocumentParams(
documentID: documentResult.data!.uuid,
pdfConfiguration: PdfConfiguration(),
),
);
final pdfPath = result.pdfFileUri.replaceFirst("file://", "");
return File(pdfPath).readAsBytes();
}
/// Render PDF to image bits
Future<Uint8List> renderPdf({String? path, Uint8List? pdfBytes}) async {
assert(path != null || pdfBytes != null);
// Create temporary file if required
var isTemp = false;
if (path == null) {
path = p.join(
(await getTemporaryDirectory()).absolute.path,
"render-${Random().nextInt(10000).toString()}+.pdf",
);
await File(path).writeAsBytes(pdfBytes!);
isTemp = true;
}
try {
final pdf = PdfImageRenderer(path: path);
await pdf.open();
await pdf.openPage(pageIndex: 0);
// get the render size after the page is loaded
final size = await pdf.getPageSize(pageIndex: 0);
// get the actual image of the page
final img = await pdf.renderPage(
pageIndex: 0,
x: 0,
y: 0,
width: size.width,
// you can pass a custom size here to crop the image
height: size.height,
// you can pass a custom size here to crop the image
scale: 1,
// increase the scale for better quality (e.g. for zooming)
background: Colors.white,
);
// close the page again
await pdf.closePage(pageIndex: 0);
// close the PDF after rendering the page
pdf.close();
return img!;
} finally {
if (isTemp) {
await File(path).delete();
}
}
}

View File

@@ -0,0 +1,12 @@
import 'dart:math';
const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
final _rnd = Random();
/// Generate random string
String getRandomString(int length) => String.fromCharCodes(
Iterable.generate(
length,
(_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length)),
),
);

View File

@@ -0,0 +1,8 @@
int secondsSinceEpoch(DateTime time) {
return time.millisecondsSinceEpoch ~/ 1000;
}
extension SimpleDateFormatting on DateTime {
String get simpleDate =>
"${day.toString().padLeft(2, "0")}/${month.toString().padLeft(2, '0')}/$year";
}

View File

@@ -0,0 +1,43 @@
import 'package:flextras/flextras.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gutter/flutter_gutter.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
import 'package:moneymgr_mobile/utils/hooks.dart';
/// A button that shows a circular progress indicator when the [onPressed] callback
/// is pending.
class AppButton extends HookWidget {
const AppButton({super.key, required this.onPressed, required this.label});
final AsyncCallback? onPressed;
final String label;
@override
Widget build(BuildContext context) {
final (:pending, :snapshot, :hasError) = useAsyncTask();
return FilledButton(
onPressed: onPressed == null ? null : () => pending.value = onPressed!(),
style: ButtonStyle(
backgroundColor: hasError ? WidgetStatePropertyAll(Colors.red) : null,
),
child: SeparatedRow(
separatorBuilder: () => const GutterSmall(),
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (snapshot.connectionState == ConnectionState.waiting)
SizedBox.square(
dimension: 12,
child: CircularProgressIndicator(
strokeWidth: 2,
color: context.colorScheme.onPrimary,
),
),
Text(label),
],
),
);
}
}

View File

@@ -0,0 +1,204 @@
import 'dart:typed_data';
import 'package:confirm_dialog/confirm_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/services/storage/expenses.dart';
import 'package:moneymgr_mobile/services/storage/prefs.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
import 'package:moneymgr_mobile/utils/time_utils.dart';
import 'package:moneymgr_mobile/widgets/pdf_viewer.dart';
import '../utils/hooks.dart';
class ExpenseEditor extends HookConsumerWidget {
final Uint8List file;
final Future<void> Function(BaseExpenseInfo) onFinished;
final Function()? onRescan;
final Function()? onDelete;
final BaseExpenseInfo? initialData;
const ExpenseEditor({
super.key,
required this.file,
required this.onFinished,
this.onRescan,
this.onDelete,
this.initialData,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final serverConfig = ref.watch(prefsProvider).requireValue.serverConfig()!;
final labelController = useTextEditingController(text: initialData?.label);
final costController = useTextEditingController(
text: initialData?.cost.toString(),
);
final timeController = useState(initialData?.time ?? DateTime.now());
final (:pending, :snapshot, :hasError) = useAsyncTask();
// Clear cost value
handleClearCost() {
costController.text = "";
}
// Pick a new date
handlePickDate() async {
final date = await showDatePicker(
context: context,
firstDate: DateTime(2000),
lastDate: DateTime(2099),
initialDate: timeController.value,
);
if (date != null) timeController.value = date;
}
// Save expense
handleSubmit() async {
if (costController.text.isEmpty) {
context.showTextSnackBar("Please specify expense cost!");
return;
}
pending.value = onFinished(
BaseExpenseInfo(
label: labelController.text.isEmpty ? null : labelController.text,
cost: double.tryParse(costController.text) ?? 0,
time: timeController.value,
),
);
// Reset screen after a scan
await pending.value;
labelController.text = "";
costController.text = "";
}
// Cancel operation
handleRescan() async {
if (await confirm(
context,
content: Text("Do you really want to discard this expense?"),
) &&
onRescan != null) {
onRescan!();
}
}
// Delete expense
handleDelete() async {
if (await confirm(
context,
content: Text("Do you really want to delete this expense?"),
) &&
onDelete != null) {
onDelete!();
}
}
// Open invoice in full screen
handleFullScreenInvoice() {
showDialog(
context: context,
builder: (c) => Scaffold(
appBar: AppBar(title: Text("Expense")),
body: SingleChildScrollView(
child: PDFViewer(pdfBytes: file, fit: BoxFit.fitWidth),
),
),
);
}
return Scaffold(
appBar: AppBar(
title: Text("Expense info"),
actions: [
// Rescan expense
onRescan == null
? Container()
: IconButton(
onPressed: handleRescan,
icon: Icon(Icons.restart_alt),
),
// Delete expense
onDelete == null
? Container()
: IconButton(onPressed: handleDelete, icon: Icon(Icons.delete)),
// Submit
snapshot.connectionState == ConnectionState.waiting
? CircularProgressIndicator()
: IconButton(
onPressed: handleSubmit,
icon: Icon(Icons.save),
color: hasError ? Colors.red : null,
),
],
),
body: Column(
children: [
// Expense preview
Expanded(
child: GestureDetector(
onTap: handleFullScreenInvoice,
child: PDFViewer(pdfBytes: file, fit: BoxFit.contain),
),
),
SizedBox(height: 10),
// Cost
TextField(
controller: costController,
keyboardType: TextInputType.numberWithOptions(
decimal: true,
signed: false,
),
decoration: InputDecoration(
labelText: 'Cost',
suffixIcon: IconButton(
onPressed: handleClearCost,
icon: const Icon(Icons.clear),
),
),
textInputAction: TextInputAction.done,
),
SizedBox(height: 10),
// Date
TextField(
enabled: true,
readOnly: true,
controller: TextEditingController(
text: timeController.value.simpleDate,
),
keyboardType: TextInputType.datetime,
decoration: InputDecoration(
labelText: 'Date',
suffixIcon: IconButton(
onPressed: handlePickDate,
icon: const Icon(Icons.date_range),
),
),
),
SizedBox(height: 10),
// Label
TextField(
controller: labelController,
keyboardType: TextInputType.text,
decoration: const InputDecoration(labelText: 'Label'),
textInputAction: TextInputAction.done,
maxLength: serverConfig.constraints.inbox_entry_label.max,
),
],
),
);
}
}

View File

@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
class FullScreenError extends StatelessWidget {
final String message;
final String error;
final List<Widget>? actions;
const FullScreenError({
super.key,
required this.message,
required this.error,
this.actions,
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Error")),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Card(
elevation: 2,
color: Colors.red,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
message,
style: TextStyle(color: Colors.white, fontSize: 20),
),
Text(error, style: TextStyle(color: Colors.white)),
],
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: actions ?? [],
),
],
),
),
);
}
}

View File

@@ -0,0 +1,67 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/providers/auth_state.dart';
import 'package:moneymgr_mobile/services/api/api_client.dart';
import 'package:moneymgr_mobile/services/api/auth_api.dart';
import 'package:moneymgr_mobile/services/api/server_api.dart';
import 'package:moneymgr_mobile/widgets/full_screen_error.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'load_startup_data.g.dart';
@riverpod
Future<void> _loadStartupElements(Ref ref) async {
final svc = ref.watch(apiServiceProvider);
if (svc == null) {
throw Exception("API client has not be initialized yet!");
}
Logger.root.info("Start to load startup elements");
await svc.serverConfigOrCache();
await svc.authInfoOrCache();
Logger.root.info("Finish to load startup elements");
}
class LoadStartupData extends HookConsumerWidget {
final Widget child;
const LoadStartupData({super.key, required this.child});
@override
Widget build(BuildContext context, WidgetRef ref) {
final serverConfig = ref.watch(_loadStartupElementsProvider);
tryAgain() async {
try {
final val = ref.refresh(_loadStartupElementsProvider);
Logger.root.info("Load again startup result: $val");
} catch (e, s) {
Logger.root.shout("Failed to try again startup loading! $e $s");
}
}
handleSignOut() {
ref.watch(currentAuthStateProvider.notifier).logout();
}
return switch (serverConfig) {
AsyncData() => child,
AsyncError(:final error) => FullScreenError(
message: "Failed to load server configuration!",
error: error.toString(),
actions: [
MaterialButton(
onPressed: tryAgain,
child: Text("Try again".toUpperCase()),
),
MaterialButton(
onPressed: handleSignOut,
child: Text("Sign out".toUpperCase()),
),
],
),
_ => const Scaffold(body: Center(child: CircularProgressIndicator())),
};
}
}

View File

@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class LoadingScaffold extends StatelessWidget {
final String title;
const LoadingScaffold({super.key, required this.title});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Center(child: CircularProgressIndicator()),
);
}
}

View File

@@ -0,0 +1,53 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:moneymgr_mobile/utils/pdf_utils.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'pdf_viewer.g.dart';
@riverpod
Future<Uint8List> _renderPdf(
Ref ref, {
String? path,
Uint8List? pdfBytes,
}) async {
return renderPdf(path: path, pdfBytes: pdfBytes);
}
class PDFViewer extends ConsumerWidget {
final String? pdfPath;
final Uint8List? pdfBytes;
final double? width;
final double? height;
final BoxFit? fit;
const PDFViewer({
super.key,
this.pdfPath,
this.pdfBytes,
this.width,
this.height,
this.fit,
}) : assert(pdfPath != null || pdfBytes != null);
@override
Widget build(BuildContext context, WidgetRef ref) {
final provider = ref.watch(
_renderPdfProvider(path: pdfPath, pdfBytes: pdfBytes),
);
// Perform a switch-case on the result to handle loading/error states
return switch (provider) {
AsyncData(:final value) => Image(
image: MemoryImage(value),
width: width,
height: height,
fit: fit,
),
AsyncError(:final error) => Text('PDF error: $error'),
_ => Center(child: const CircularProgressIndicator()),
};
}
}

View File

@@ -0,0 +1,100 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
/// A scaffold that shows navigation bar/rail when the current path is a navigation
/// item.
///
/// When in a navigation item, a [NavigationBar] will be shown if the width of the
/// screen is less than 600dp. Otherwise, a [NavigationRail] will be shown.
class ScaffoldWithNavigation extends StatelessWidget {
const ScaffoldWithNavigation({
super.key,
required this.child,
required this.selectedIndex,
required this.navigationItems,
});
final Widget child;
final int selectedIndex;
final List<NavigationItem> navigationItems;
@override
Widget build(BuildContext context) {
void onDestinationSelected(int index) =>
context.go(navigationItems[index].path);
// Use navigation rail instead of navigation bar when the screen width is
// larger than 600dp.
if (MediaQuery.sizeOf(context).width > 600) {
return Scaffold(
body: Row(
children: [
NavigationRail(
selectedIndex: selectedIndex,
onDestinationSelected: onDestinationSelected,
destinations: [
for (final item in navigationItems)
NavigationRailDestination(
icon: Icon(item.icon),
selectedIcon: item.selectedIcon != null
? Icon(item.selectedIcon)
: null,
label: Text(item.label),
)
],
extended: true,
),
Expanded(child: child),
],
),
);
}
return Scaffold(
body: child,
bottomNavigationBar: NavigationBar(
selectedIndex: selectedIndex,
onDestinationSelected: onDestinationSelected,
destinations: [
for (final item in navigationItems)
NavigationDestination(
icon: Icon(item.icon),
selectedIcon:
item.selectedIcon != null ? Icon(item.selectedIcon) : null,
label: item.label,
)
],
),
);
}
}
/// An item that represents a navigation destination in a navigation bar/rail.
class NavigationItem {
/// Path in the router.
final String path;
/// Widget to show when navigating to this [path].
final WidgetBuilder body;
/// Icon in the navigation bar.
final IconData icon;
/// Icon in the navigation bar when selected.
final IconData? selectedIcon;
/// Label in the navigation bar.
final String label;
/// The subroutes of the route from this [path].
final List<RouteBase> routes;
NavigationItem({
required this.path,
required this.body,
required this.icon,
this.selectedIcon,
required this.label,
this.routes = const [],
});
}

View File

@@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:moneymgr_mobile/services/api/api_client.dart';
import 'package:moneymgr_mobile/services/api/files_api.dart';
import 'package:moneymgr_mobile/services/api/inbox_api.dart';
import 'package:moneymgr_mobile/services/storage/expenses.dart';
import 'package:moneymgr_mobile/utils/extensions.dart';
import 'package:moneymgr_mobile/utils/hooks.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'synchronize_button.g.dart';
/// Synchronize expenses list with backend
@riverpod
Future<void> _performSynchronization(Ref ref) async {
final expenses = ref.watch(expensesProvider).requireValue;
final apiService = ref.watch(apiServiceProvider)!;
final list = await expenses.getList();
for (final exp in list) {
// First, upload file
final bytes = await expenses.loadFile(exp);
final file = await apiService.uploadFile(
filename: exp.localFileName,
mimeType: exp.mimeType,
bytes: bytes,
);
// Then, create the inbox entry
await apiService.createInboxEntry(
UpdateInboxEntryRequest(
file_id: file.id,
time: exp.time,
label: exp.label,
amount: -1 * exp.cost,
),
);
// Lastly delete the local expense
ref.watch(expensesProvider).requireValue.deleteExpense(exp);
}
ref.invalidate(expensesProvider);
}
class SynchronizeButton extends HookConsumerWidget {
const SynchronizeButton({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final (:pending, :snapshot, :hasError) = useAsyncTask();
handleSynchronize() async {
try {
await ref.watch(
_performSynchronizationProvider.selectAsync((it) => it),
);
} catch (e, s) {
Logger.root.warning("Failed to synchronize expenses! $e $s");
if (context.mounted) {
context.showTextSnackBar("Failed to synchronize expenses! $e");
}
}
}
return snapshot.connectionState == ConnectionState.waiting
? Padding(
padding: const EdgeInsets.all(12.0),
child: SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator(strokeWidth: 2),
),
)
: IconButton(
onPressed: () => pending.value = handleSynchronize(),
style: ButtonStyle(
backgroundColor: hasError
? WidgetStatePropertyAll(Colors.red)
: null,
),
icon: Icon(Icons.sync_rounded),
);
}
}

View File

@@ -4,10 +4,10 @@ project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "moneymgr_mobile")
set(BINARY_NAME "moneymgr")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.moneymgr_mobile")
set(APPLICATION_ID "org.communiquons.moneymgr")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.

View File

@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
}

View File

@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "moneymgr_mobile");
gtk_header_bar_set_title(header_bar, "MoneyMgr");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "moneymgr_mobile");
gtk_window_set_title(window, "MoneyMgr");
}
gtk_window_set_default_size(window, 1280, 720);

View File

@@ -5,8 +5,14 @@
import FlutterMacOS
import Foundation
import flutter_secure_storage_macos
import mobile_scanner
import path_provider_foundation
import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}

View File

@@ -385,7 +385,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/moneymgr_mobile.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/moneymgr_mobile";
@@ -399,7 +399,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/moneymgr_mobile.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/moneymgr_mobile";
@@ -413,7 +413,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/moneymgr_mobile.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/moneymgr_mobile";

View File

@@ -5,10 +5,10 @@
// 'flutter create' template.
// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = moneymgr_mobile
PRODUCT_NAME = MoneyMgr
// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.moneymgrMobile
PRODUCT_BUNDLE_IDENTIFIER = org.communiquons.moneymgrMobile
// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved.
PRODUCT_COPYRIGHT = Copyright © 2025 Pierre HUBERT All rights reserved.

View File

@@ -9,6 +9,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "82.0.0"
adaptive_number:
dependency: transitive
description:
name: adaptive_number
sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
alert_dialog:
dependency: "direct main"
description:
name: alert_dialog
sha256: "6f63afeaad3006a489fa5fda92a795219aa3e52dc2991178e99577ceabcf2036"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
analyzer:
dependency: transitive
description:
@@ -125,10 +141,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: "082001b5c3dc495d4a42f1d5789990505df20d8547d42507c29050af6933ee27"
sha256: "0b1b12a0a549605e5f04476031cd0bc91ead1d7c8e830773a18ee54179b3cb62"
url: "https://pub.dev"
source: hosted
version: "8.10.1"
version: "8.11.0"
characters:
dependency: transitive
description:
@@ -145,6 +161,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.4"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
url: "https://pub.dev"
source: hosted
version: "0.4.2"
clock:
dependency: transitive
description:
@@ -169,6 +193,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.19.1"
confirm_dialog:
dependency: "direct main"
description:
name: confirm_dialog
sha256: "99b431d2f13bf64a6056fc8f1b2b85a1fc7be572da3f28a17f8a009438542327"
url: "https://pub.dev"
source: hosted
version: "1.0.4"
convert:
dependency: transitive
description:
@@ -217,6 +249,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0+7.4.5"
dart_jsonwebtoken:
dependency: "direct main"
description:
name: dart_jsonwebtoken
sha256: "21ce9f8a8712f741e8d6876a9c82c0f8a257fe928c4378a91d8527b92a3fd413"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
dart_style:
dependency: transitive
description:
@@ -225,6 +265,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.0"
dio:
dependency: "direct main"
description:
name: dio
sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9"
url: "https://pub.dev"
source: hosted
version: "5.8.0+1"
dio_web_adapter:
dependency: transitive
description:
name: dio_web_adapter
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
ed25519_edwards:
dependency: transitive
description:
name: ed25519_edwards
sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
fake_async:
dependency: transitive
description:
@@ -257,11 +321,35 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
flextras:
dependency: "direct main"
description:
name: flextras
sha256: e73b5c86dd9419569d2a48db470059b41b496012513e4e1bdc56ba2c661048d9
url: "https://pub.dev"
source: hosted
version: "1.0.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_adaptive_scaffold:
dependency: transitive
description:
name: flutter_adaptive_scaffold
sha256: "5eb1d1d174304a4e67c4bb402ed38cb4a5ebdac95ce54099e91460accb33d295"
url: "https://pub.dev"
source: hosted
version: "0.3.3+1"
flutter_gutter:
dependency: "direct main"
description:
name: flutter_gutter
sha256: "2aa99181796d6f7d2de66da962b71b0feb996ec69b7a1ad2ac1c2119f25b041b"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
flutter_hooks:
dependency: "direct main"
description:
@@ -270,14 +358,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.21.2"
flutter_launcher_icons:
dependency: "direct dev"
description:
name: flutter_launcher_icons
sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7"
url: "https://pub.dev"
source: hosted
version: "0.14.4"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
url: "https://pub.dev"
source: hosted
version: "5.0.0"
version: "6.0.0"
flutter_native_splash:
dependency: "direct main"
description:
@@ -294,6 +390,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.6.1"
flutter_secure_storage:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea"
url: "https://pub.dev"
source: hosted
version: "9.2.4"
flutter_secure_storage_linux:
dependency: transitive
description:
name: flutter_secure_storage_linux
sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688
url: "https://pub.dev"
source: hosted
version: "1.2.3"
flutter_secure_storage_macos:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247"
url: "https://pub.dev"
source: hosted
version: "3.1.3"
flutter_secure_storage_platform_interface:
dependency: transitive
description:
name: flutter_secure_storage_platform_interface
sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8
url: "https://pub.dev"
source: hosted
version: "1.1.2"
flutter_secure_storage_web:
dependency: transitive
description:
name: flutter_secure_storage_web
sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9
url: "https://pub.dev"
source: hosted
version: "1.2.1"
flutter_secure_storage_windows:
dependency: transitive
description:
name: flutter_secure_storage_windows
sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709
url: "https://pub.dev"
source: hosted
version: "3.1.2"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -304,14 +448,22 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
freezed_annotation:
dependency: transitive
freezed:
dependency: "direct dev"
description:
name: freezed_annotation
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b
name: freezed
sha256: "2d399f823b8849663744d2a9ddcce01c49268fb4170d0442a655bf6a2f47be22"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "3.1.0"
freezed_annotation:
dependency: "direct main"
description:
name: freezed_annotation
sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
frontend_server_client:
dependency: transitive
description:
@@ -332,10 +484,26 @@ packages:
dependency: "direct main"
description:
name: go_router
sha256: ac294be30ba841830cfa146e5a3b22bb09f8dc5a0fdd9ca9332b04b0bde99ebf
sha256: c489908a54ce2131f1d1b7cc631af9c1a06fac5ca7c449e959192089f9489431
url: "https://pub.dev"
source: hosted
version: "15.2.4"
version: "16.0.0"
google_mlkit_commons:
dependency: transitive
description:
name: google_mlkit_commons
sha256: "8f40fbac10685cad4715d11e6a0d86837d9ad7168684dfcad29610282a88e67a"
url: "https://pub.dev"
source: hosted
version: "0.11.0"
google_mlkit_text_recognition:
dependency: "direct main"
description:
name: google_mlkit_text_recognition
sha256: "96173ad4dd7fd06c660e22ac3f9e9f1798a517fe7e48bee68eeec83853224224"
url: "https://pub.dev"
source: hosted
version: "0.15.0"
graphs:
dependency: transitive
description:
@@ -377,7 +545,7 @@ packages:
source: hosted
version: "3.2.2"
http_parser:
dependency: transitive
dependency: "direct main"
description:
name: http_parser
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
@@ -404,18 +572,26 @@ packages:
dependency: transitive
description:
name: js
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.6.7"
json_annotation:
dependency: transitive
dependency: "direct main"
description:
name: json_annotation
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
url: "https://pub.dev"
source: hosted
version: "4.9.0"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c
url: "https://pub.dev"
source: hosted
version: "6.9.5"
leak_tracker:
dependency: transitive
description:
@@ -444,12 +620,12 @@ packages:
dependency: transitive
description:
name: lints
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
url: "https://pub.dev"
source: hosted
version: "5.1.1"
version: "6.0.0"
logging:
dependency: transitive
dependency: "direct main"
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
@@ -488,6 +664,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.0"
mobile_scanner:
dependency: "direct main"
description:
name: mobile_scanner
sha256: "54005bdea7052d792d35b4fef0f84ec5ddc3a844b250ecd48dc192fb9b4ebc95"
url: "https://pub.dev"
source: hosted
version: "7.0.1"
package_config:
dependency: transitive
description:
@@ -497,13 +681,37 @@ packages:
source: hosted
version: "2.2.0"
path:
dependency: transitive
dependency: "direct main"
description:
name: path
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
path_provider:
dependency: "direct main"
description:
name: path_provider
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
url: "https://pub.dev"
source: hosted
version: "2.1.5"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9
url: "https://pub.dev"
source: hosted
version: "2.2.17"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
path_provider_linux:
dependency: transitive
description:
@@ -528,6 +736,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.0"
pdf_image_renderer:
dependency: "direct main"
description:
name: pdf_image_renderer
sha256: "0ec76118b14663f17f9b6a8c29ec59cb1b82e466a3c16fbb2ed9f1b613fc41b7"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
petitparser:
dependency: transitive
description:
@@ -552,6 +768,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
pool:
dependency: transitive
description:
@@ -616,6 +840,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.6.5"
scanbot_sdk:
dependency: "direct main"
description:
name: scanbot_sdk
sha256: adbd24643e9d7ade1050a0ed4310ace76088cec258970488a7dbe08c3dc5a872
url: "https://pub.dev"
source: hosted
version: "7.0.0"
shared_preferences:
dependency: "direct main"
description:
@@ -701,6 +933,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.0"
source_helper:
dependency: transitive
description:
name: source_helper
sha256: "4f81479fe5194a622cdd1713fe1ecb683a6e6c85cd8cec8e2e35ee5ab3fdf2a1"
url: "https://pub.dev"
source: hosted
version: "1.3.6"
source_span:
dependency: transitive
description:
@@ -853,6 +1093,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.3"
win32:
dependency: transitive
description:
name: win32
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
url: "https://pub.dev"
source: hosted
version: "5.14.0"
xdg_directories:
dependency: transitive
description:
@@ -879,4 +1127,4 @@ packages:
version: "3.1.3"
sdks:
dart: ">=3.8.1 <4.0.0"
flutter: ">=3.27.0"
flutter: ">=3.29.0"

View File

@@ -1,5 +1,5 @@
name: moneymgr_mobile
description: "A new Flutter project."
description: "Mobile application for MoneyMgr"
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
@@ -38,6 +38,9 @@ dependencies:
# Preferences management
shared_preferences: ^2.5.3
# Credentials storage
flutter_secure_storage: ^9.2.4
# Splash screen
flutter_native_splash: ^2.4.6
@@ -49,7 +52,49 @@ dependencies:
flutter_hooks: ^0.21.2
# Router
go_router: ^15.2.4
go_router: ^16.0.0
# Flutter extras widgets for columns and rows
flextras: ^1.0.0
flutter_gutter: ^2.2.0
# Help in models building
freezed_annotation: ^3.0.0
# For JSON serialization
json_annotation: ^4.9.0
# Logger
logging: ^1.3.0
# API authentication
dart_jsonwebtoken: ^3.2.0
# API requests
dio: ^5.8.0+1
http_parser: ^4.1.2
# Qr Code library
mobile_scanner: ^7.0.1
# Show dialogs
confirm_dialog: ^1.0.4
alert_dialog: ^1.0.2
# Document scanner
# flutter_doc_scanner: ^0.0.16 # no bundled support yet
# https://developers.google.com/ml-kit/tips/installation-paths
scanbot_sdk: ^7.0.0
# Get documents path
path_provider: ^2.1.5
path: ^1.9.1
# PDF renderer
pdf_image_renderer: ^1.0.1
# Text extraction
google_mlkit_text_recognition: ^0.15.0
dev_dependencies:
flutter_test:
@@ -60,7 +105,10 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^5.0.0
flutter_lints: ^6.0.0
# Manage app icon
flutter_launcher_icons: ^0.14.4
# Generate source code
build_runner: ^2.5.4
@@ -68,12 +116,23 @@ dev_dependencies:
# Riverpod code generation
riverpod_generator: ^2.6.5
# Freezed code generation
freezed: ^3.0.6
# JSON serialization
json_serializable: ^6.9.5
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# Default Android flavor
default-flavor: development
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.

View File

@@ -1,6 +1,6 @@
{
"name": "moneymgr_mobile",
"short_name": "moneymgr_mobile",
"name": "MoneyMgr",
"short_name": "MoneyMgr",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",

View File

@@ -4,7 +4,7 @@ project(moneymgr_mobile LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "moneymgr_mobile")
set(BINARY_NAME "moneymgr")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.

Some files were not shown because too many files have changed in this diff Show More