Compare commits
189 Commits
28d47917cf
...
renovate/n
Author | SHA1 | Date | |
---|---|---|---|
be4fbfa51d | |||
11fb50af9a | |||
76d1430ecb | |||
22848bcec4 | |||
d2f948c8fa | |||
05aff4bbfb | |||
74b1a4dbcc | |||
8ad7b589ce | |||
ff20cb7bc9 | |||
1c345127b4 | |||
71e54b8d72 | |||
13a8bbad1d | |||
ec212902e9 | |||
6786ed6075 | |||
c881f58cf4 | |||
586204dcba | |||
da56f99ce6 | |||
57d2b1bf6a | |||
831ccd073c | |||
c5269a587b | |||
71ce57d205 | |||
d57107cfc1 | |||
68a3eb4218 | |||
514f140527 | |||
4bac50b676 | |||
884b86daa9 | |||
64365916bd | |||
77c0640ec0 | |||
96c80eb18c | |||
0cde9f5635 | |||
5e35dae02f | |||
f321376990 | |||
86b86d4d68 | |||
35c629a339 | |||
da0d5adcb9 | |||
2214387010 | |||
667ce69be8 | |||
57f4ed53f6 | |||
deb884a1f0 | |||
0e5d878e30 | |||
b266cbcadb | |||
91bca2b6b1 | |||
a741662251 | |||
34f0493c51 | |||
b538b6fcb3 | |||
9d18d975d0 | |||
43049bc229 | |||
19ca17b43a | |||
572046f418 | |||
24af473dd3 | |||
8a57c57ec4 | |||
50a5e7745f | |||
675e4d9ecd | |||
83c214af7d | |||
bfa6af5749 | |||
6ab157504c | |||
bb98ea5e46 | |||
2d104a54b5 | |||
3b0ff29bc8 | |||
4ade72a0ee | |||
6021b44a13 | |||
eb92e8c0c5 | |||
d98305908c | |||
ae5ef99e3a | |||
2f592183e4 | |||
74291a258c | |||
df8cd6a046 | |||
079fbbf154 | |||
ba443629e6 | |||
2c07a69b90 | |||
0de551f1de | |||
2488ef0125 | |||
aa2e764262 | |||
1202219e98 | |||
112597084c | |||
4f64404ffa | |||
c39b53c721 | |||
bd2e343601 | |||
85ee2b2549 | |||
154551aeaf | |||
7b10c3508a | |||
61c96629a1 | |||
8644075a09 | |||
81bfa75eec | |||
de0dd4e36a | |||
f9d7a63738 | |||
0ef6f8288f | |||
2f23e4dadb | |||
5cf5fac8f4 | |||
8e143db354 | |||
1237c9706e | |||
1add0b4cfe | |||
6920d6d9b0 | |||
27e92660f1 | |||
743e5ba410 | |||
8039b1c807 | |||
9ef84ba63a | |||
56e5ae6629 | |||
4443131516 | |||
365d7589b1 | |||
23cc189e53 | |||
3098d12e8a | |||
0943104cc8 | |||
3beaba806a | |||
1788e7f184 | |||
71d32d72ef | |||
28f61a3099 | |||
f61e3541fb | |||
fb7891d913 | |||
d9ede224cf | |||
fc9334b20b | |||
c4cbd7ec8b | |||
a4ef3e74dc | |||
dbb988f2b5 | |||
b2aff4902d | |||
6f578b39f9 | |||
de519ecb6c | |||
3049e545e9 | |||
1f1c01a287 | |||
92885b8af6 | |||
44320db760 | |||
1f2a28aa65 | |||
f9566315eb | |||
63bed07015 | |||
4b84d926d4 | |||
8191a28986 | |||
8c30b50d0c | |||
389b2c96ba | |||
5a08b0c971 | |||
b3fd066633 | |||
5c987473a5 | |||
c3d2612f9a | |||
130cc1ef0d | |||
aebefd114a | |||
34d3e08149 | |||
ccd3540804 | |||
b9b871224b | |||
17a22d7a4c | |||
8db2cf3ece | |||
e45648e038 | |||
55144da943 | |||
5065f780f2 | |||
28d8b96ebe | |||
baf62aa2a5 | |||
8a9a8d6b14 | |||
c19d46a50f | |||
f001c618cd | |||
f9d46e46a5 | |||
96f1bf589c | |||
8ec6e48938 | |||
235fda5c72 | |||
2568ea14b4 | |||
467393dad0 | |||
f619f26e93 | |||
cecb7a0cd1 | |||
50812af2fc | |||
547e9b7aad | |||
dd035f8a15 | |||
768706e2d4 | |||
70023242e9 | |||
951338b6e4 | |||
6531d73c93 | |||
51ba649b6e | |||
cc4ce19af2 | |||
192dc5827b | |||
37674a6229 | |||
ef86667029 | |||
07f63a96fa | |||
fa88a3c9ed | |||
85c6a0b955 | |||
21ee97b8a4 | |||
119f026a21 | |||
d72acfac9b | |||
77c8866bb8 | |||
133f235639 | |||
a4b630c66e | |||
52bbcf708f | |||
5b16ca6162 | |||
7ef0499abf | |||
1383da4483 | |||
74bb31ecc1 | |||
0a87ac572b | |||
4f1a9d0865 | |||
31803feaa9 | |||
aad32f9c25 | |||
1ea2bd6acf | |||
a085116018 | |||
952a66042c | |||
6cf6ab5a37 |
61
.drone.yml
61
.drone.yml
@@ -4,9 +4,17 @@ type: docker
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# Needs a full git clone
|
||||||
|
- name: fetch
|
||||||
|
image: alpine/git
|
||||||
|
commands:
|
||||||
|
- git fetch --tags
|
||||||
|
|
||||||
# Frontend
|
# Frontend
|
||||||
- name: web_build
|
- name: web_build
|
||||||
image: node:23
|
image: node:24
|
||||||
|
depends_on:
|
||||||
|
- fetch
|
||||||
volumes:
|
volumes:
|
||||||
- name: web_app
|
- name: web_app
|
||||||
path: /tmp/web_build
|
path: /tmp/web_build
|
||||||
@@ -20,6 +28,8 @@ steps:
|
|||||||
# Backend
|
# Backend
|
||||||
- name: backend_fetch_deps
|
- name: backend_fetch_deps
|
||||||
image: rust
|
image: rust
|
||||||
|
depends_on:
|
||||||
|
- fetch
|
||||||
volumes:
|
volumes:
|
||||||
- name: rust_registry
|
- name: rust_registry
|
||||||
path: /usr/local/cargo/registry
|
path: /usr/local/cargo/registry
|
||||||
@@ -54,6 +64,9 @@ steps:
|
|||||||
|
|
||||||
- name: backend_build
|
- name: backend_build
|
||||||
image: rust
|
image: rust
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
volumes:
|
volumes:
|
||||||
- name: rust_registry
|
- name: rust_registry
|
||||||
path: /usr/local/cargo/registry
|
path: /usr/local/cargo/registry
|
||||||
@@ -72,12 +85,58 @@ steps:
|
|||||||
- ls -lah target/release/moneymgr_backend target/release/examples/api_curl
|
- ls -lah target/release/moneymgr_backend target/release/examples/api_curl
|
||||||
- cp target/release/moneymgr_backend target/release/examples/api_curl /tmp/release
|
- 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
|
# Release
|
||||||
- name: gitea_release
|
- name: gitea_release
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend_build
|
- backend_build
|
||||||
|
- mobile_app_build
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
@@ -77,3 +77,4 @@ services:
|
|||||||
- S3_SECRET_KEY=$MINIO_ROOT_PASSWORD
|
- S3_SECRET_KEY=$MINIO_ROOT_PASSWORD
|
||||||
- REDIS_HOSTNAME=redis
|
- REDIS_HOSTNAME=redis
|
||||||
- REDIS_PASSWORD=${REDIS_PASS:-secretredis}
|
- REDIS_PASSWORD=${REDIS_PASS:-secretredis}
|
||||||
|
- UNSECURE_AUTO_LOGIN_EMAIL=$UNSECURE_AUTO_LOGIN_EMAIL
|
||||||
|
69
moneymgr_backend/Cargo.lock
generated
69
moneymgr_backend/Cargo.lock
generated
@@ -36,9 +36,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-files"
|
name = "actix-files"
|
||||||
version = "0.6.6"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0773d59061dedb49a8aed04c67291b9d8cf2fe0b60130a381aab53c6dd86e9be"
|
checksum = "6c0d87f10d70e2948ad40e8edea79c8e77c6c66e0250a4c1f09b690465199576"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-http",
|
"actix-http",
|
||||||
"actix-service",
|
"actix-service",
|
||||||
@@ -46,7 +46,7 @@ dependencies = [
|
|||||||
"actix-web",
|
"actix-web",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytes",
|
"bytes",
|
||||||
"derive_more 0.99.20",
|
"derive_more 2.0.1",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"http-range",
|
"http-range",
|
||||||
"log",
|
"log",
|
||||||
@@ -87,7 +87,7 @@ dependencies = [
|
|||||||
"mime",
|
"mime",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"rand 0.9.1",
|
"rand 0.9.2",
|
||||||
"sha1",
|
"sha1",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"tokio",
|
"tokio",
|
||||||
@@ -364,12 +364,6 @@ dependencies = [
|
|||||||
"alloc-no-stdlib",
|
"alloc-no-stdlib",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android-tzdata"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "android_system_properties"
|
name = "android_system_properties"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@@ -431,9 +425,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.98"
|
version = "1.0.100"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
|
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arbitrary"
|
name = "arbitrary"
|
||||||
@@ -700,16 +694,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.41"
|
version = "0.4.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
|
checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-link",
|
"windows-link 0.2.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -724,9 +717,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.40"
|
version = "4.5.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f"
|
checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@@ -734,9 +727,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.40"
|
version = "4.5.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e"
|
checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
@@ -746,9 +739,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.5.40"
|
version = "4.5.47"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce"
|
checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -1100,9 +1093,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diesel"
|
name = "diesel"
|
||||||
version = "2.2.11"
|
version = "2.2.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a917a9209950404d5be011c81d081a2692a822f73c3d6af586f0cab5ff50f614"
|
checksum = "229850a212cd9b84d4f0290ad9d294afc0ae70fccaa8949dbe8b43ffafa1e20c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@@ -2157,9 +2150,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.27"
|
version = "0.4.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lzma-rs"
|
name = "lzma-rs"
|
||||||
@@ -2298,7 +2291,7 @@ dependencies = [
|
|||||||
"light-openid",
|
"light-openid",
|
||||||
"log",
|
"log",
|
||||||
"mime_guess",
|
"mime_guess",
|
||||||
"rand 0.9.1",
|
"rand 0.9.2",
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
"rust-s3",
|
"rust-s3",
|
||||||
"rust_xlsxwriter",
|
"rust_xlsxwriter",
|
||||||
@@ -2741,9 +2734,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.9.1"
|
version = "0.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand_chacha 0.9.0",
|
"rand_chacha 0.9.0",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.3",
|
||||||
@@ -3232,9 +3225,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.140"
|
version = "1.0.142"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -3994,7 +3987,7 @@ checksum = "46ec44dc15085cea82cf9c78f85a9114c463a369786585ad2882d1ff0b0acf40"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-implement",
|
"windows-implement",
|
||||||
"windows-interface",
|
"windows-interface",
|
||||||
"windows-link",
|
"windows-link 0.1.1",
|
||||||
"windows-result",
|
"windows-result",
|
||||||
"windows-strings 0.4.1",
|
"windows-strings 0.4.1",
|
||||||
]
|
]
|
||||||
@@ -4027,6 +4020,12 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
|
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-registry"
|
name = "windows-registry"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@@ -4044,7 +4043,7 @@ version = "0.3.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4b895b5356fc36103d0f64dd1e94dfa7ac5633f1c9dd6e80fe9ec4adef69e09d"
|
checksum = "4b895b5356fc36103d0f64dd1e94dfa7ac5633f1c9dd6e80fe9ec4adef69e09d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.1.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4053,7 +4052,7 @@ version = "0.3.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
|
checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.1.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4062,7 +4061,7 @@ version = "0.4.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2a7ab927b2637c19b3dbe0965e75d8f2d30bdd697a1516191cad2ec4df8fb28a"
|
checksum = "2a7ab927b2637c19b3dbe0965e75d8f2d30bdd697a1516191cad2ec4df8fb28a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-link",
|
"windows-link 0.1.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@@ -5,26 +5,26 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "0.11.8"
|
env_logger = "0.11.8"
|
||||||
log = "0.4.27"
|
log = "0.4.28"
|
||||||
diesel = { version = "2.2.11", features = ["postgres", "r2d2"] }
|
diesel = { version = "2.2.12", features = ["postgres", "r2d2"] }
|
||||||
diesel_migrations = "2.2.0"
|
diesel_migrations = "2.2.0"
|
||||||
clap = { version = "4.5.40", features = ["env", "derive"] }
|
clap = { version = "4.5.48", features = ["env", "derive"] }
|
||||||
actix-web = "4.11.0"
|
actix-web = "4.11.0"
|
||||||
actix-cors = "0.7.1"
|
actix-cors = "0.7.1"
|
||||||
actix-multipart = "0.7.2"
|
actix-multipart = "0.7.2"
|
||||||
actix-remote-ip = "0.1.0"
|
actix-remote-ip = "0.1.0"
|
||||||
actix-session = { version = "0.10.1", features = ["redis-session"] }
|
actix-session = { version = "0.10.1", features = ["redis-session"] }
|
||||||
actix-files = "0.6.6"
|
actix-files = "0.6.8"
|
||||||
lazy_static = "1.5.0"
|
lazy_static = "1.5.0"
|
||||||
anyhow = "1.0.98"
|
anyhow = "1.0.100"
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
rust-s3 = "0.36.0-beta.2"
|
rust-s3 = "0.36.0-beta.2"
|
||||||
thiserror = "2.0.12"
|
thiserror = "2.0.12"
|
||||||
tokio = "1.45.1"
|
tokio = "1.45.1"
|
||||||
futures-util = "0.3.31"
|
futures-util = "0.3.31"
|
||||||
serde_json = "1.0.140"
|
serde_json = "1.0.142"
|
||||||
light-openid = "1.0.4"
|
light-openid = "1.0.4"
|
||||||
rand = "0.9.1"
|
rand = "0.9.2"
|
||||||
ipnet = { version = "2.11.0", features = ["serde"] }
|
ipnet = { version = "2.11.0", features = ["serde"] }
|
||||||
lazy-regex = "3.4.1"
|
lazy-regex = "3.4.1"
|
||||||
jwt-simple = { version = "0.12.12", default-features = false, features = ["pure-rust"] }
|
jwt-simple = { version = "0.12.12", default-features = false, features = ["pure-rust"] }
|
||||||
@@ -33,7 +33,7 @@ rust-embed = { version = "8.7.2" }
|
|||||||
sha2 = "0.11.0-rc.0"
|
sha2 = "0.11.0-rc.0"
|
||||||
base16ct = "0.2.0"
|
base16ct = "0.2.0"
|
||||||
httpdate = "1.0.3"
|
httpdate = "1.0.3"
|
||||||
chrono = "0.4.41"
|
chrono = "0.4.42"
|
||||||
tempfile = "3.20.0"
|
tempfile = "3.20.0"
|
||||||
zip = "3.0.0"
|
zip = "3.0.0"
|
||||||
rust_xlsxwriter = "0.87.0"
|
rust_xlsxwriter = "0.87.0"
|
@@ -29,7 +29,7 @@ pub struct AppConfig {
|
|||||||
/// Unsecure : for development, bypass authentication, using the account with the given
|
/// Unsecure : for development, bypass authentication, using the account with the given
|
||||||
/// email address by default
|
/// email address by default
|
||||||
#[clap(long, env)]
|
#[clap(long, env)]
|
||||||
pub unsecure_auto_login_email: Option<String>,
|
unsecure_auto_login_email: Option<String>,
|
||||||
|
|
||||||
/// PostgreSQL database host
|
/// PostgreSQL database host
|
||||||
#[clap(long, env, default_value = "localhost")]
|
#[clap(long, env, default_value = "localhost")]
|
||||||
@@ -126,6 +126,14 @@ pub struct AppConfig {
|
|||||||
/// Redis password
|
/// Redis password
|
||||||
#[clap(long, env, default_value = "secretredis")]
|
#[clap(long, env, default_value = "secretredis")]
|
||||||
redis_password: String,
|
redis_password: String,
|
||||||
|
|
||||||
|
/// Application download URL
|
||||||
|
#[clap(
|
||||||
|
long,
|
||||||
|
env,
|
||||||
|
default_value = "https://gitea.communiquons.org/pierre/MoneyMgr/releases/download/latest/moneymgr_mobile_arm64-v8a.apk"
|
||||||
|
)]
|
||||||
|
pub apk_download_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
@@ -140,9 +148,17 @@ impl AppConfig {
|
|||||||
&ARGS
|
&ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get auto login email (if not empty)
|
||||||
|
pub fn unsecure_auto_login_email(&self) -> Option<&str> {
|
||||||
|
match self.unsecure_auto_login_email.as_deref() {
|
||||||
|
None | Some("") => None,
|
||||||
|
s => s,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if auth is disabled
|
/// Check if auth is disabled
|
||||||
pub fn is_auth_disabled(&self) -> bool {
|
pub fn is_auth_disabled(&self) -> bool {
|
||||||
self.unsecure_auto_login_email.is_some()
|
self.unsecure_auto_login_email().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get auth cookie domain
|
/// Get auth cookie domain
|
||||||
|
@@ -70,6 +70,7 @@ impl Default for ServerConstraints {
|
|||||||
struct ServerConfig {
|
struct ServerConfig {
|
||||||
auth_disabled: bool,
|
auth_disabled: bool,
|
||||||
oidc_provider_name: &'static str,
|
oidc_provider_name: &'static str,
|
||||||
|
apk_download_url: &'static str,
|
||||||
accounts_types: &'static [AccountTypeDesc],
|
accounts_types: &'static [AccountTypeDesc],
|
||||||
constraints: ServerConstraints,
|
constraints: ServerConstraints,
|
||||||
}
|
}
|
||||||
@@ -79,6 +80,7 @@ impl Default for ServerConfig {
|
|||||||
Self {
|
Self {
|
||||||
auth_disabled: AppConfig::get().is_auth_disabled(),
|
auth_disabled: AppConfig::get().is_auth_disabled(),
|
||||||
oidc_provider_name: AppConfig::get().openid_provider().name,
|
oidc_provider_name: AppConfig::get().openid_provider().name,
|
||||||
|
apk_download_url: AppConfig::get().apk_download_url.as_str(),
|
||||||
constraints: Default::default(),
|
constraints: Default::default(),
|
||||||
accounts_types: &ACCOUNT_TYPES,
|
accounts_types: &ACCOUNT_TYPES,
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ impl FromRequest for AuthExtractor {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Box::pin(async move {
|
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) {
|
if let Some(token) = req.headers().get(constants::API_TOKEN_HEADER) {
|
||||||
let Ok(jwt_token) = token.to_str() else {
|
let Ok(jwt_token) = token.to_str() else {
|
||||||
return Err(actix_web::error::ErrorBadRequest(
|
return Err(actix_web::error::ErrorBadRequest(
|
||||||
@@ -182,7 +182,7 @@ impl FromRequest for AuthExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if login is hard-coded as program argument
|
// Check if login is hard-coded as program argument
|
||||||
if let Some(email) = &AppConfig::get().unsecure_auto_login_email {
|
if let Some(email) = &AppConfig::get().unsecure_auto_login_email() {
|
||||||
let user = users_service::get_user_by_email(email).map_err(|e| {
|
let user = users_service::get_user_by_email(email).map_err(|e| {
|
||||||
log::error!("Failed to retrieve dev user: {e}");
|
log::error!("Failed to retrieve dev user: {e}");
|
||||||
ErrorPreconditionFailed("Unable to retrieve dev user!")
|
ErrorPreconditionFailed("Unable to retrieve dev user!")
|
||||||
|
@@ -38,7 +38,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
db_connection::initialize_conn().expect("Failed to connect to PostgresSQL database!");
|
db_connection::initialize_conn().expect("Failed to connect to PostgresSQL database!");
|
||||||
|
|
||||||
// Auto create default account, if requested
|
// Auto create default account, if requested
|
||||||
if let Some(mail) = &AppConfig::get().unsecure_auto_login_email {
|
if let Some(mail) = &AppConfig::get().unsecure_auto_login_email() {
|
||||||
users_service::create_or_update_user(mail, "Anonymous")
|
users_service::create_or_update_user(mail, "Anonymous")
|
||||||
.await
|
.await
|
||||||
.expect("Failed to create default account!");
|
.expect("Failed to create default account!");
|
||||||
|
2
moneymgr_mobile/android/.gitignore
vendored
2
moneymgr_mobile/android/.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
publish_key.properties
|
||||||
|
|
||||||
gradle-wrapper.jar
|
gradle-wrapper.jar
|
||||||
/.gradle
|
/.gradle
|
||||||
/captures/
|
/captures/
|
||||||
|
8
moneymgr_mobile/android/README.md
Normal file
8
moneymgr_mobile/android/README.md
Normal 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
|
||||||
|
```
|
@@ -1,3 +1,6 @@
|
|||||||
|
import java.util.Properties
|
||||||
|
import java.io.FileInputStream
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
@@ -5,6 +8,12 @@ plugins {
|
|||||||
id("dev.flutter.flutter-gradle-plugin")
|
id("dev.flutter.flutter-gradle-plugin")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
val keystorePropertiesFile = rootProject.file("publish_key.properties")
|
||||||
|
if (keystorePropertiesFile.exists()) {
|
||||||
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "org.communiquons.moneymgr"
|
namespace = "org.communiquons.moneymgr"
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
@@ -21,7 +30,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
||||||
applicationId = "org.communiquons.moneymgr"
|
applicationId = "org.communiquons.moneymgr"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||||
@@ -31,13 +39,34 @@ android {
|
|||||||
versionName = flutter.versionName
|
versionName = flutter.versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
signingConfigs {
|
||||||
release {
|
create("publish") {
|
||||||
// TODO: Add your own signing config for the release build.
|
keyAlias = keystoreProperties["keyAlias"] as String
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
keyPassword = keystoreProperties["keyPassword"] as String
|
||||||
signingConfig = signingConfigs.getByName("debug")
|
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 {
|
flutter {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<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 INTERNET permission is required for development. Specifically,
|
||||||
the Flutter tool needs it to communicate with the running application
|
the Flutter tool needs it to communicate with the running application
|
||||||
to allow setting breakpoints, to provide hot reload, etc.
|
to allow setting breakpoints, to provide hot reload, etc.
|
||||||
@@ -6,5 +7,8 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<!-- In debug mode, unsecure traffic is permitted -->
|
<!-- In debug mode, unsecure traffic is permitted -->
|
||||||
<application android:usesCleartextTraffic="true" />
|
<application
|
||||||
|
android:label="MoneyMgr Debug"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
|
tools:replace="android:label" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@@ -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>
|
@@ -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>
|
23
moneymgr_mobile/android/ci_write_keystore.sh
Normal file
23
moneymgr_mobile/android/ci_write_keystore.sh
Normal 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
|
4
moneymgr_mobile/android/publish_key.properties.sample
Normal file
4
moneymgr_mobile/android/publish_key.properties.sample
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
storePassword=<password-from-previous-step>
|
||||||
|
keyPassword=<password-from-previous-step>
|
||||||
|
keyAlias=upload
|
||||||
|
storeFile=<keystore-file-location>
|
3
moneymgr_mobile/devtools_options.yaml
Normal file
3
moneymgr_mobile/devtools_options.yaml
Normal 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:
|
@@ -9,6 +9,7 @@ import 'package:moneymgr_mobile/services/storage/prefs.dart';
|
|||||||
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
|
import 'package:moneymgr_mobile/services/storage/secure_storage.dart';
|
||||||
import 'package:moneymgr_mobile/utils/provider_observer.dart';
|
import 'package:moneymgr_mobile/utils/provider_observer.dart';
|
||||||
import 'package:moneymgr_mobile/utils/theme_utils.dart';
|
import 'package:moneymgr_mobile/utils/theme_utils.dart';
|
||||||
|
import 'package:scanbot_sdk/scanbot_sdk.dart';
|
||||||
|
|
||||||
// Inspired from https://github.com/dhafinrayhan/dummymart
|
// Inspired from https://github.com/dhafinrayhan/dummymart
|
||||||
|
|
||||||
@@ -27,6 +28,14 @@ Future<void> main() async {
|
|||||||
print('${record.level.name}: ${record.time}: ${record.message}'),
|
print('${record.level.name}: ${record.time}: ${record.message}'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Initialize scanbot sdk
|
||||||
|
var config = ScanbotSdkConfig(
|
||||||
|
loggingEnabled: true,
|
||||||
|
allowGpuAcceleration: true,
|
||||||
|
allowXnnpackAcceleration: true,
|
||||||
|
);
|
||||||
|
ScanbotSdk.initScanbotSdk(config);
|
||||||
|
|
||||||
runApp(
|
runApp(
|
||||||
ProviderScope(
|
ProviderScope(
|
||||||
observers: [AppProviderObserver()],
|
observers: [AppProviderObserver()],
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import 'package:moneymgr_mobile/services/api/api_client.dart';
|
import 'package:moneymgr_mobile/services/api/api_client.dart';
|
||||||
import 'package:moneymgr_mobile/services/api/api_token.dart';
|
import 'package:moneymgr_mobile/services/api/api_token.dart';
|
||||||
import 'package:moneymgr_mobile/services/api/auth_api.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:moneymgr_mobile/services/storage/secure_storage.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
@@ -25,7 +26,10 @@ class CurrentAuthState extends _$CurrentAuthState {
|
|||||||
/// Will invalidate the state if success and throw an exception in case of failure
|
/// Will invalidate the state if success and throw an exception in case of failure
|
||||||
Future<void> setAuthToken(ApiToken token) async {
|
Future<void> setAuthToken(ApiToken token) async {
|
||||||
// Attempt to use provided token
|
// Attempt to use provided token
|
||||||
await ApiClient(token: token).authInfo();
|
await ApiClient(
|
||||||
|
token: token,
|
||||||
|
prefs: await ref.watch(prefsProvider.future),
|
||||||
|
).authInfo();
|
||||||
|
|
||||||
final secureStorage = ref.read(secureStorageProvider).requireValue;
|
final secureStorage = ref.read(secureStorageProvider).requireValue;
|
||||||
await secureStorage.setToken(token);
|
await secureStorage.setToken(token);
|
||||||
@@ -37,19 +41,18 @@ class CurrentAuthState extends _$CurrentAuthState {
|
|||||||
|
|
||||||
/// Logs out, deletes the saved token and profile info from storage, and invalidates
|
/// Logs out, deletes the saved token and profile info from storage, and invalidates
|
||||||
/// the state.
|
/// the state.
|
||||||
void logout() {
|
Future<void> logout() async {
|
||||||
// TODO : implement logic
|
final prefs = ref.read(prefsProvider).requireValue;
|
||||||
/*final secureStorage = ref.read(secureStorageProvider).requireValue;
|
|
||||||
|
|
||||||
// Delete the current [token] and [profile] from secure storage.
|
final secureStorage = ref.read(secureStorageProvider).requireValue;
|
||||||
secureStorage.remove('token');
|
await secureStorage.removeToken();
|
||||||
|
|
||||||
|
prefs.clearServerConfig();
|
||||||
|
prefs.clearAuthInfo();
|
||||||
|
|
||||||
ref
|
ref
|
||||||
// Invalidate the state so the auth state will be updated to unauthenticated.
|
// Invalidate the state so the auth state will be updated to authenticated.
|
||||||
..invalidateSelf()
|
.invalidateSelf();
|
||||||
// Invalidate the token provider so the API service will no longer use the
|
|
||||||
// previous token.
|
|
||||||
..invalidate(tokenProvider);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +61,7 @@ enum AuthState {
|
|||||||
unknown(redirectPath: homePage, allowedPaths: [homePage]),
|
unknown(redirectPath: homePage, allowedPaths: [homePage]),
|
||||||
unauthenticated(
|
unauthenticated(
|
||||||
redirectPath: authPage,
|
redirectPath: authPage,
|
||||||
allowedPaths: [authPage, manualAuthPage, settingsPage],
|
allowedPaths: [authPage, qrAuthPath, manualAuthPage, settingsPage],
|
||||||
),
|
),
|
||||||
authenticated(
|
authenticated(
|
||||||
redirectPath: homePage,
|
redirectPath: homePage,
|
||||||
|
@@ -35,12 +35,14 @@ class BaseAuthPage extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: SeparatedColumn(
|
child: IntrinsicHeight(
|
||||||
padding: EdgeInsets.all(context.gutter),
|
child: SeparatedColumn(
|
||||||
separatorBuilder: () => const Gutter(),
|
padding: EdgeInsets.all(context.gutter),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
separatorBuilder: () => const Gutter(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: children,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: children,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@@ -24,7 +24,7 @@ class LoginScreen extends HookConsumerWidget {
|
|||||||
label: "Enter manually authentication information",
|
label: "Enter manually authentication information",
|
||||||
),
|
),
|
||||||
_LoginChoice(
|
_LoginChoice(
|
||||||
route: manualAuthPage,
|
route: qrAuthPath,
|
||||||
icon: Icons.qr_code_2,
|
icon: Icons.qr_code_2,
|
||||||
label: "Scan authentication Qr Code",
|
label: "Scan authentication Qr Code",
|
||||||
),
|
),
|
||||||
|
80
moneymgr_mobile/lib/routes/login/qr_auth_screen.dart
Normal file
80
moneymgr_mobile/lib/routes/login/qr_auth_screen.dart
Normal 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),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
112
moneymgr_mobile/lib/routes/profile/profile_screen.dart
Normal file
112
moneymgr_mobile/lib/routes/profile/profile_screen.dart
Normal 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
115
moneymgr_mobile/lib/routes/scan/scan_screen.dart
Normal file
115
moneymgr_mobile/lib/routes/scan/scan_screen.dart
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
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/router/routes_list.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 {
|
||||||
|
ref.invalidate(_scanDocumentProvider);
|
||||||
|
Logger.root.info("Load again startup");
|
||||||
|
} 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",
|
||||||
|
);
|
||||||
|
if (context.mounted) {
|
||||||
|
context.pushReplacement(scansPage);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
86
moneymgr_mobile/lib/routes/scan_details/scan_details.dart
Normal file
86
moneymgr_mobile/lib/routes/scan_details/scan_details.dart
Normal 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"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
76
moneymgr_mobile/lib/routes/scans_list/scans_list_screen.dart
Normal file
76
moneymgr_mobile/lib/routes/scans_list/scans_list_screen.dart
Normal 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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:moneymgr_mobile/providers/settings.dart';
|
import 'package:moneymgr_mobile/providers/settings.dart';
|
||||||
|
import 'package:moneymgr_mobile/services/storage/prefs.dart';
|
||||||
import 'package:moneymgr_mobile/utils/extensions.dart';
|
import 'package:moneymgr_mobile/utils/extensions.dart';
|
||||||
|
|
||||||
class SettingsScreen extends ConsumerWidget {
|
class SettingsScreen extends ConsumerWidget {
|
||||||
@@ -8,6 +9,7 @@ class SettingsScreen extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final prefs = ref.watch(prefsProvider).requireValue;
|
||||||
final themeMode = ref.watch(currentThemeModeProvider);
|
final themeMode = ref.watch(currentThemeModeProvider);
|
||||||
|
|
||||||
void onTapThemeMode() =>
|
void onTapThemeMode() =>
|
||||||
@@ -15,6 +17,16 @@ class SettingsScreen extends ConsumerWidget {
|
|||||||
|
|
||||||
void onTapLicenses() => context.showAppLicensePage();
|
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(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Settings')),
|
appBar: AppBar(title: const Text('Settings')),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
@@ -25,6 +37,22 @@ class SettingsScreen extends ConsumerWidget {
|
|||||||
trailing: Text(themeMode.label),
|
trailing: Text(themeMode.label),
|
||||||
onTap: onTapThemeMode,
|
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(),
|
const Divider(),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.info_outline),
|
leading: const Icon(Icons.info_outline),
|
||||||
|
@@ -1,9 +1,13 @@
|
|||||||
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.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/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:moneymgr_mobile/utils/string_utils.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
part 'api_client.g.dart';
|
part 'api_client.g.dart';
|
||||||
|
|
||||||
@@ -14,18 +18,25 @@ const apiTokenHeader = "X-Auth-Token";
|
|||||||
class ApiClient {
|
class ApiClient {
|
||||||
final ApiToken token;
|
final ApiToken token;
|
||||||
final Dio client;
|
final Dio client;
|
||||||
|
final SharedPreferencesWithCache prefs;
|
||||||
|
|
||||||
ApiClient({required this.token})
|
ApiClient({required this.token, required this.prefs})
|
||||||
: client = Dio(BaseOptions(baseUrl: token.apiUrl));
|
: client = Dio(BaseOptions(baseUrl: token.apiUrl));
|
||||||
|
|
||||||
/// Get Dio instance
|
/// Get Dio instance
|
||||||
Future<Response<T>> execute<T>(String uri, {String method = "GET"}) async {
|
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(
|
return client.request(
|
||||||
uri,
|
uri,
|
||||||
options: Options(
|
options: Options(
|
||||||
method: method,
|
method: method,
|
||||||
headers: {apiTokenHeader: _genJWT(method, uri)},
|
headers: {apiTokenHeader: _genJWT(method, uri)},
|
||||||
),
|
),
|
||||||
|
data: data,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,19 +65,14 @@ class ApiClient {
|
|||||||
/// The API client is kept alive to follow dio's recommendation to use the same
|
/// The API client is kept alive to follow dio's recommendation to use the same
|
||||||
/// client instance for the entire app.
|
/// client instance for the entire app.
|
||||||
@riverpod
|
@riverpod
|
||||||
ApiClient apiService(Ref ref) {
|
ApiClient? apiService(Ref ref) {
|
||||||
/*final token = ref.watch(currentAuthStateProvider);
|
final storage = ref.watch(secureStorageProvider);
|
||||||
|
final prefs = ref.watch(prefsProvider);
|
||||||
|
|
||||||
final ApiClient client;
|
final t = storage.value?.token();
|
||||||
|
if (t == null || prefs.value == null) return null;
|
||||||
|
|
||||||
const mock = bool.fromEnvironment('MOCK_API', defaultValue: false);
|
|
||||||
client = switch (mock) {
|
|
||||||
true =>
|
|
||||||
token != null ? MockedApiClient.withToken(token) : MockedApiClient(),
|
|
||||||
false => token != null ? ApiClient.withToken(token) : ApiClient(),
|
|
||||||
};
|
|
||||||
ref.keepAlive();
|
ref.keepAlive();
|
||||||
|
|
||||||
return client;*/
|
return ApiClient(token: t, prefs: prefs.value!);
|
||||||
throw Exception("TODO"); // TODO
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
// ignore_for_file: non_constant_identifier_names
|
// ignore_for_file: non_constant_identifier_names
|
||||||
|
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
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/api/api_client.dart';
|
||||||
|
import 'package:moneymgr_mobile/services/storage/prefs.dart';
|
||||||
|
|
||||||
part 'auth_api.g.dart';
|
|
||||||
part 'auth_api.freezed.dart';
|
part 'auth_api.freezed.dart';
|
||||||
|
part 'auth_api.g.dart';
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class AuthInfo with _$AuthInfo {
|
abstract class AuthInfo with _$AuthInfo {
|
||||||
@@ -27,4 +29,24 @@ extension AuthApi on ApiClient {
|
|||||||
final response = await execute("/auth/info", method: "GET");
|
final response = await execute("/auth/info", method: "GET");
|
||||||
return AuthInfo.fromJson(response.data);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
43
moneymgr_mobile/lib/services/api/files_api.dart
Normal file
43
moneymgr_mobile/lib/services/api/files_api.dart
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
27
moneymgr_mobile/lib/services/api/inbox_api.dart
Normal file
27
moneymgr_mobile/lib/services/api/inbox_api.dart
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
67
moneymgr_mobile/lib/services/api/server_api.dart
Normal file
67
moneymgr_mobile/lib/services/api/server_api.dart
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -4,8 +4,15 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
import 'package:moneymgr_mobile/providers/auth_state.dart';
|
import 'package:moneymgr_mobile/providers/auth_state.dart';
|
||||||
import 'package:moneymgr_mobile/routes/login/login_screen.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/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/routes/settings/settings_screen.dart';
|
||||||
import 'package:moneymgr_mobile/services/router/routes_list.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:moneymgr_mobile/widgets/scaffold_with_navigation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
@@ -23,6 +30,8 @@ GoRouter router(Ref ref) {
|
|||||||
authStateNotifier.value = value;
|
authStateNotifier.value = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final prefs = ref.read(prefsProvider).requireValue;
|
||||||
|
|
||||||
// This is the only place you need to define your navigation items. The items
|
// 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
|
// will be propagated automatically to the router and the navigation bar/rail
|
||||||
// of the scaffold.
|
// of the scaffold.
|
||||||
@@ -31,24 +40,31 @@ GoRouter router(Ref ref) {
|
|||||||
// see [AuthState] enum.
|
// see [AuthState] enum.
|
||||||
final navigationItems = [
|
final navigationItems = [
|
||||||
NavigationItem(
|
NavigationItem(
|
||||||
path: '/products',
|
path: capturePage,
|
||||||
body: (_) => const Text("product screen"),
|
body: (_) => ScanScreen(),
|
||||||
icon: Icons.widgets_outlined,
|
icon: Icons.camera_alt_outlined,
|
||||||
selectedIcon: Icons.widgets,
|
selectedIcon: Icons.camera_alt,
|
||||||
label: 'Products',
|
label: "Scan",
|
||||||
|
),
|
||||||
|
NavigationItem(
|
||||||
|
path: scansPage,
|
||||||
|
body: (_) => ScansListScreen(),
|
||||||
|
icon: Icons.list,
|
||||||
|
selectedIcon: Icons.list_alt,
|
||||||
|
label: "List",
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: ':id',
|
path: ":id",
|
||||||
builder: (_, state) {
|
builder: (_, state) {
|
||||||
final id = int.parse(state.pathParameters['id']!);
|
final id = int.parse(state.pathParameters["id"]!);
|
||||||
return Text("product screen $id");
|
return ScanDetailScreen(id: id);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
NavigationItem(
|
NavigationItem(
|
||||||
path: profilePage,
|
path: profilePage,
|
||||||
body: (_) => const Text("Profile"),
|
body: (_) => ProfileScreen(),
|
||||||
icon: Icons.person_outline,
|
icon: Icons.person_outline,
|
||||||
selectedIcon: Icons.person,
|
selectedIcon: Icons.person,
|
||||||
label: 'Profile',
|
label: 'Profile',
|
||||||
@@ -57,30 +73,33 @@ GoRouter router(Ref ref) {
|
|||||||
|
|
||||||
final router = GoRouter(
|
final router = GoRouter(
|
||||||
debugLogDiagnostics: true,
|
debugLogDiagnostics: true,
|
||||||
initialLocation: navigationItems.first.path,
|
initialLocation: prefs.startOnScansListScreen() ? scansPage : capturePage,
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(path: homePage, builder: (_, __) => const Scaffold()),
|
GoRoute(path: homePage, builder: (_, _) => const Scaffold()),
|
||||||
GoRoute(path: authPage, builder: (_, __) => const LoginScreen()),
|
GoRoute(path: authPage, builder: (_, _) => const LoginScreen()),
|
||||||
|
GoRoute(path: qrAuthPath, builder: (_, _) => const QrAuthScreen()),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: manualAuthPage,
|
path: manualAuthPage,
|
||||||
builder: (_, __) => const ManualAuthScreen(),
|
builder: (_, _) => const ManualAuthScreen(),
|
||||||
),
|
),
|
||||||
GoRoute(path: settingsPage, builder: (_, __) => const SettingsScreen()),
|
GoRoute(path: settingsPage, builder: (_, _) => const SettingsScreen()),
|
||||||
|
|
||||||
// Configuration for the bottom navigation bar routes. The routes themselves
|
// Configuration for the bottom navigation bar routes. The routes themselves
|
||||||
// should be defined in [navigationItems]. Modification to this [ShellRoute]
|
// should be defined in [navigationItems]. Modification to this [ShellRoute]
|
||||||
// config is rarely needed.
|
// config is rarely needed.
|
||||||
ShellRoute(
|
ShellRoute(
|
||||||
builder: (_, __, child) => child,
|
builder: (_, _, child) => child,
|
||||||
routes: [
|
routes: [
|
||||||
for (final (index, item) in navigationItems.indexed)
|
for (final (index, item) in navigationItems.indexed)
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: item.path,
|
path: item.path,
|
||||||
pageBuilder: (context, _) => NoTransitionPage(
|
pageBuilder: (context, _) => NoTransitionPage(
|
||||||
child: ScaffoldWithNavigation(
|
child: LoadStartupData(
|
||||||
selectedIndex: index,
|
child: ScaffoldWithNavigation(
|
||||||
navigationItems: navigationItems,
|
selectedIndex: index,
|
||||||
child: item.body(context),
|
navigationItems: navigationItems,
|
||||||
|
child: item.body(context),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
routes: item.routes,
|
routes: item.routes,
|
||||||
|
@@ -4,11 +4,20 @@ const homePage = "/";
|
|||||||
/// Authentication path
|
/// Authentication path
|
||||||
const authPage = "/login";
|
const authPage = "/login";
|
||||||
|
|
||||||
|
/// Qr Code authentication
|
||||||
|
const qrAuthPath = "/login/qr";
|
||||||
|
|
||||||
/// Manual authentication
|
/// Manual authentication
|
||||||
const manualAuthPage = "/login/manual";
|
const manualAuthPage = "/login/manual";
|
||||||
|
|
||||||
/// Settings path
|
/// Settings path
|
||||||
const settingsPage = "/settings";
|
const settingsPage = "/settings";
|
||||||
|
|
||||||
// Profile path
|
/// Scan path
|
||||||
|
const capturePage = "/scan";
|
||||||
|
|
||||||
|
/// Scans page
|
||||||
|
const scansPage = "/scans";
|
||||||
|
|
||||||
|
/// Profile path
|
||||||
const profilePage = "/profile";
|
const profilePage = "/profile";
|
183
moneymgr_mobile/lib/services/storage/expenses.dart
Normal file
183
moneymgr_mobile/lib/services/storage/expenses.dart
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,8 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
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:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
@@ -9,3 +13,49 @@ Future<SharedPreferencesWithCache> prefs(Ref ref) =>
|
|||||||
SharedPreferencesWithCache.create(
|
SharedPreferencesWithCache.create(
|
||||||
cacheOptions: const SharedPreferencesWithCacheOptions(),
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -51,6 +51,7 @@ class SecureStorage {
|
|||||||
if (tokenStr != null) {
|
if (tokenStr != null) {
|
||||||
return ApiToken.fromJson(jsonDecode(tokenStr));
|
return ApiToken.fromJson(jsonDecode(tokenStr));
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set auth token
|
/// Set auth token
|
||||||
|
@@ -15,18 +15,21 @@ extension BuildContextX on BuildContext {
|
|||||||
|
|
||||||
/// Shows a floating snack bar with text as its content.
|
/// Shows a floating snack bar with text as its content.
|
||||||
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showTextSnackBar(
|
ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showTextSnackBar(
|
||||||
String text,
|
String text, {
|
||||||
) =>
|
Duration? duration,
|
||||||
ScaffoldMessenger.of(this).showSnackBar(SnackBar(
|
}) => ScaffoldMessenger.of(this).showSnackBar(
|
||||||
behavior: SnackBarBehavior.floating,
|
SnackBar(
|
||||||
content: Text(text),
|
behavior: SnackBarBehavior.floating,
|
||||||
));
|
content: Text(text),
|
||||||
|
duration: duration ?? Duration(milliseconds: 4000),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
void showAppLicensePage() => showLicensePage(
|
void showAppLicensePage() => showLicensePage(
|
||||||
context: this,
|
context: this,
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
applicationName: 'MoneyMgr',
|
applicationName: 'MoneyMgr',
|
||||||
applicationLegalese: '(c) Pierre HUBERT 2025 - ${DateTime.now().year}'
|
applicationLegalese: '(c) Pierre HUBERT 2025 - ${DateTime.now().year}',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
86
moneymgr_mobile/lib/utils/ocr_utils.dart
Normal file
86
moneymgr_mobile/lib/utils/ocr_utils.dart
Normal 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,
|
||||||
|
);
|
||||||
|
}
|
91
moneymgr_mobile/lib/utils/pdf_utils.dart
Normal file
91
moneymgr_mobile/lib/utils/pdf_utils.dart
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,3 +1,8 @@
|
|||||||
int secondsSinceEpoch(DateTime time) {
|
int secondsSinceEpoch(DateTime time) {
|
||||||
return time.millisecondsSinceEpoch ~/ 1000;
|
return time.millisecondsSinceEpoch ~/ 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension SimpleDateFormatting on DateTime {
|
||||||
|
String get simpleDate =>
|
||||||
|
"${day.toString().padLeft(2, "0")}/${month.toString().padLeft(2, '0')}/$year";
|
||||||
|
}
|
||||||
|
213
moneymgr_mobile/lib/widgets/expense_editor.dart
Normal file
213
moneymgr_mobile/lib/widgets/expense_editor.dart
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
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();
|
||||||
|
|
||||||
|
// Force refresh of field if required
|
||||||
|
final previousData = useState<BaseExpenseInfo?>(null);
|
||||||
|
if (initialData != previousData.value) {
|
||||||
|
previousData.value = initialData;
|
||||||
|
labelController.text = initialData?.label ?? "";
|
||||||
|
costController.text = initialData?.cost.toString() ?? "";
|
||||||
|
timeController.value = initialData?.time ?? DateTime.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
49
moneymgr_mobile/lib/widgets/full_screen_error.dart
Normal file
49
moneymgr_mobile/lib/widgets/full_screen_error.dart
Normal 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 ?? [],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
67
moneymgr_mobile/lib/widgets/load_startup_data.dart
Normal file
67
moneymgr_mobile/lib/widgets/load_startup_data.dart
Normal 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())),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
15
moneymgr_mobile/lib/widgets/loading_scaffold.dart
Normal file
15
moneymgr_mobile/lib/widgets/loading_scaffold.dart
Normal 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()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
53
moneymgr_mobile/lib/widgets/pdf_viewer.dart
Normal file
53
moneymgr_mobile/lib/widgets/pdf_viewer.dart
Normal 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()),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
87
moneymgr_mobile/lib/widgets/synchronize_button.dart
Normal file
87
moneymgr_mobile/lib/widgets/synchronize_button.dart
Normal 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),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -6,11 +6,13 @@ import FlutterMacOS
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import flutter_secure_storage_macos
|
import flutter_secure_storage_macos
|
||||||
|
import mobile_scanner
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
import shared_preferences_foundation
|
import shared_preferences_foundation
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||||
|
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
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:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -133,10 +141,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: built_value
|
name: built_value
|
||||||
sha256: "082001b5c3dc495d4a42f1d5789990505df20d8547d42507c29050af6933ee27"
|
sha256: "0b1b12a0a549605e5f04476031cd0bc91ead1d7c8e830773a18ee54179b3cb62"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.10.1"
|
version: "8.11.0"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -185,6 +193,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
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:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -354,10 +370,10 @@ packages:
|
|||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: flutter_lints
|
name: flutter_lints
|
||||||
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
|
sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.0"
|
version: "6.0.0"
|
||||||
flutter_native_splash:
|
flutter_native_splash:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -436,18 +452,18 @@ packages:
|
|||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: freezed
|
name: freezed
|
||||||
sha256: "6022db4c7bfa626841b2a10f34dd1e1b68e8f8f9650db6112dcdeeca45ca793c"
|
sha256: "2d399f823b8849663744d2a9ddcce01c49268fb4170d0442a655bf6a2f47be22"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.6"
|
version: "3.1.0"
|
||||||
freezed_annotation:
|
freezed_annotation:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: freezed_annotation
|
name: freezed_annotation
|
||||||
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b
|
sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.1.0"
|
||||||
frontend_server_client:
|
frontend_server_client:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -468,10 +484,26 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: go_router
|
name: go_router
|
||||||
sha256: ac294be30ba841830cfa146e5a3b22bb09f8dc5a0fdd9ca9332b04b0bde99ebf
|
sha256: c489908a54ce2131f1d1b7cc631af9c1a06fac5ca7c449e959192089f9489431
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
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:
|
graphs:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -513,7 +545,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.2"
|
version: "3.2.2"
|
||||||
http_parser:
|
http_parser:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: http_parser
|
name: http_parser
|
||||||
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
|
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
|
||||||
@@ -588,10 +620,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: lints
|
name: lints
|
||||||
sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7
|
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.1.1"
|
version: "6.0.0"
|
||||||
logging:
|
logging:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -632,6 +664,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
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:
|
package_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -641,7 +681,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.2.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"
|
||||||
@@ -649,7 +689,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.9.1"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
|
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
|
||||||
@@ -696,6 +736,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
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:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -792,6 +840,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.5"
|
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:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -881,10 +937,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_helper
|
name: source_helper
|
||||||
sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c"
|
sha256: "4f81479fe5194a622cdd1713fe1ecb683a6e6c85cd8cec8e2e35ee5ab3fdf2a1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.5"
|
version: "1.3.6"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1071,4 +1127,4 @@ packages:
|
|||||||
version: "3.1.3"
|
version: "3.1.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.8.1 <4.0.0"
|
dart: ">=3.8.1 <4.0.0"
|
||||||
flutter: ">=3.27.0"
|
flutter: ">=3.29.0"
|
||||||
|
@@ -49,10 +49,10 @@ dependencies:
|
|||||||
riverpod_annotation: ^2.6.1
|
riverpod_annotation: ^2.6.1
|
||||||
|
|
||||||
# Implement React hooks in Flutter
|
# Implement React hooks in Flutter
|
||||||
flutter_hooks: ^0.21.2
|
flutter_hooks: ^0.21.3+1
|
||||||
|
|
||||||
# Router
|
# Router
|
||||||
go_router: ^15.2.4
|
go_router: ^16.0.0
|
||||||
|
|
||||||
# Flutter extras widgets for columns and rows
|
# Flutter extras widgets for columns and rows
|
||||||
flextras: ^1.0.0
|
flextras: ^1.0.0
|
||||||
@@ -72,6 +72,29 @@ dependencies:
|
|||||||
|
|
||||||
# API requests
|
# API requests
|
||||||
dio: ^5.8.0+1
|
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.1
|
||||||
|
|
||||||
|
# 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:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@@ -82,13 +105,13 @@ dev_dependencies:
|
|||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
# activated in the `analysis_options.yaml` file located at the root of your
|
||||||
# package. See that file for information about deactivating specific lint
|
# package. See that file for information about deactivating specific lint
|
||||||
# rules and activating additional ones.
|
# rules and activating additional ones.
|
||||||
flutter_lints: ^5.0.0
|
flutter_lints: ^6.0.0
|
||||||
|
|
||||||
# Manage app icon
|
# Manage app icon
|
||||||
flutter_launcher_icons: ^0.14.4
|
flutter_launcher_icons: ^0.14.4
|
||||||
|
|
||||||
# Generate source code
|
# Generate source code
|
||||||
build_runner: ^2.5.4
|
build_runner: ^2.6.1
|
||||||
|
|
||||||
# Riverpod code generation
|
# Riverpod code generation
|
||||||
riverpod_generator: ^2.6.5
|
riverpod_generator: ^2.6.5
|
||||||
@@ -107,6 +130,9 @@ dev_dependencies:
|
|||||||
# The following section is specific to Flutter packages.
|
# The following section is specific to Flutter packages.
|
||||||
flutter:
|
flutter:
|
||||||
|
|
||||||
|
# Default Android flavor
|
||||||
|
default-flavor: development
|
||||||
|
|
||||||
# The following line ensures that the Material Icons font is
|
# The following line ensures that the Material Icons font is
|
||||||
# included with your application, so that you can use the icons in
|
# included with your application, so that you can use the icons in
|
||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
|
2890
moneymgr_web/package-lock.json
generated
2890
moneymgr_web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,39 +11,39 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.14.0",
|
"@emotion/react": "^11.14.0",
|
||||||
"@emotion/styled": "^11.14.0",
|
"@emotion/styled": "^11.14.1",
|
||||||
"@fontsource/roboto": "^5.2.6",
|
"@fontsource/roboto": "^5.2.8",
|
||||||
"@jsonjoy.com/base64": "^1.1.2",
|
"@jsonjoy.com/base64": "^1.1.2",
|
||||||
"@mdi/js": "^7.4.47",
|
"@mdi/js": "^7.4.47",
|
||||||
"@mdi/react": "^1.6.1",
|
"@mdi/react": "^1.6.1",
|
||||||
"@mui/icons-material": "^7.1.2",
|
"@mui/icons-material": "^7.1.2",
|
||||||
"@mui/material": "^7.1.2",
|
"@mui/material": "^7.1.2",
|
||||||
"@mui/x-charts": "^8.5.3",
|
"@mui/x-charts": "^8.10.2",
|
||||||
"@mui/x-data-grid": "^8.5.3",
|
"@mui/x-data-grid": "^8.9.2",
|
||||||
"@mui/x-date-pickers": "^8.5.3",
|
"@mui/x-date-pickers": "^8.9.2",
|
||||||
"date-and-time": "^3.6.0",
|
"date-and-time": "^3.6.0",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.18",
|
||||||
"filesize": "^10.1.6",
|
"filesize": "^10.1.6",
|
||||||
"qrcode.react": "^4.2.0",
|
"qrcode.react": "^4.2.0",
|
||||||
"react": "^19.1.0",
|
"react": "^19.2.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.2.0",
|
||||||
"react-router": "^7.6.2",
|
"react-router": "^7.6.3",
|
||||||
"react-router-dom": "^7.6.2",
|
"react-router-dom": "^7.6.3",
|
||||||
"ts-pattern": "^5.7.1"
|
"ts-pattern": "^5.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.29.0",
|
"@eslint/js": "^9.33.0",
|
||||||
"@types/react": "^19.1.8",
|
"@types/react": "^19.2.0",
|
||||||
"@types/react-dom": "^19.1.6",
|
"@types/react-dom": "^19.2.0",
|
||||||
"@vitejs/plugin-react": "^4.6.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
"eslint": "^9.26.0",
|
"eslint": "^9.32.0",
|
||||||
"eslint-plugin-react-dom": "^1.49.0",
|
"eslint-plugin-react-dom": "^1.52.4",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"eslint-plugin-react-refresh": "^00.4.20",
|
"eslint-plugin-react-refresh": "^00.4.20",
|
||||||
"eslint-plugin-react-x": "^1.52.2",
|
"eslint-plugin-react-x": "^1.52.9",
|
||||||
"globals": "^16.2.0",
|
"globals": "^16.3.0",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"typescript-eslint": "^8.32.1",
|
"typescript-eslint": "^8.32.1",
|
||||||
"vite": "^6.3.5"
|
"vite": "^6.3.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ import { APIClient } from "./ApiClient";
|
|||||||
export interface ServerConfig {
|
export interface ServerConfig {
|
||||||
auth_disabled: boolean;
|
auth_disabled: boolean;
|
||||||
oidc_provider_name: string;
|
oidc_provider_name: string;
|
||||||
|
apk_download_url: string;
|
||||||
accounts_types: AccountType[];
|
accounts_types: AccountType[];
|
||||||
constraints: ServerConstraints;
|
constraints: ServerConstraints;
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,11 @@ import DeleteIcon from "@mui/icons-material/DeleteOutlined";
|
|||||||
import DriveFileMoveOutlineIcon from "@mui/icons-material/DriveFileMoveOutline";
|
import DriveFileMoveOutlineIcon from "@mui/icons-material/DriveFileMoveOutline";
|
||||||
import LinkOffIcon from "@mui/icons-material/LinkOff";
|
import LinkOffIcon from "@mui/icons-material/LinkOff";
|
||||||
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
||||||
|
import ClearIcon from "@mui/icons-material/Clear";
|
||||||
import RefreshIcon from "@mui/icons-material/Refresh";
|
import RefreshIcon from "@mui/icons-material/Refresh";
|
||||||
import {
|
import {
|
||||||
IconButton,
|
IconButton,
|
||||||
|
InputAdornment,
|
||||||
ListItemIcon,
|
ListItemIcon,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
TextField,
|
TextField,
|
||||||
@@ -392,6 +394,19 @@ function MovementsTable(p: {
|
|||||||
setFilter(e.target.value);
|
setFilter(e.target.value);
|
||||||
}}
|
}}
|
||||||
style={{ padding: "0px", flex: 1 }}
|
style={{ padding: "0px", flex: 1 }}
|
||||||
|
slotProps={{
|
||||||
|
input: {
|
||||||
|
endAdornment: filter.length > 0 && (
|
||||||
|
<InputAdornment position="end">
|
||||||
|
<Tooltip title="Clear current filter">
|
||||||
|
<IconButton size="small" onClick={() => { setFilter(""); }}>
|
||||||
|
<ClearIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</InputAdornment>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<span style={{ flex: 1 }}></span>
|
<span style={{ flex: 1 }}></span>
|
||||||
<Tooltip title="Refresh table">
|
<Tooltip title="Refresh table">
|
||||||
|
@@ -280,6 +280,8 @@ function CreatedToken(p: { token: TokenWithSecret }): React.ReactElement {
|
|||||||
The API token was successfully created. Please note the following
|
The API token was successfully created. Please note the following
|
||||||
information as they won't be available next.
|
information as they won't be available next.
|
||||||
<br />
|
<br />
|
||||||
|
API URL : <CopyTextChip text={APIClient.ActualBackendURL()} />
|
||||||
|
<br />
|
||||||
Token ID: <CopyTextChip text={p.token.id.toString()} />
|
Token ID: <CopyTextChip text={p.token.id.toString()} />
|
||||||
<br />
|
<br />
|
||||||
Token value: <CopyTextChip text={p.token.token} />
|
Token value: <CopyTextChip text={p.token.token} />
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { mdiApi, mdiCash } from "@mdi/js";
|
import { mdiApi, mdiCash } from "@mdi/js";
|
||||||
import Icon from "@mdi/react";
|
import Icon from "@mdi/react";
|
||||||
|
import AndroidIcon from "@mui/icons-material/Android";
|
||||||
import CloudDownloadIcon from "@mui/icons-material/CloudDownload";
|
import CloudDownloadIcon from "@mui/icons-material/CloudDownload";
|
||||||
import LogoutIcon from "@mui/icons-material/Logout";
|
import LogoutIcon from "@mui/icons-material/Logout";
|
||||||
import SettingsIcon from "@mui/icons-material/Settings";
|
import SettingsIcon from "@mui/icons-material/Settings";
|
||||||
@@ -10,6 +11,7 @@ import MenuItem from "@mui/material/MenuItem";
|
|||||||
import Toolbar from "@mui/material/Toolbar";
|
import Toolbar from "@mui/material/Toolbar";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
import { ServerApi } from "../api/ServerApi";
|
||||||
import { useAuthInfo } from "./BaseAuthenticatedPage";
|
import { useAuthInfo } from "./BaseAuthenticatedPage";
|
||||||
import { DarkThemeButton } from "./DarkThemeButtonWidget";
|
import { DarkThemeButton } from "./DarkThemeButtonWidget";
|
||||||
import { PublicModeButton } from "./PublicModeButtonWidget";
|
import { PublicModeButton } from "./PublicModeButtonWidget";
|
||||||
@@ -100,6 +102,18 @@ export function MoneyWebAppBar(p: {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
|
||||||
|
{/* APK download */}
|
||||||
|
<RouterLink to={ServerApi.Config.apk_download_url}>
|
||||||
|
<MenuItem>
|
||||||
|
<ListItemIcon>
|
||||||
|
<AndroidIcon />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText secondary="Scan expenses from your smartphone">
|
||||||
|
Mobile Application
|
||||||
|
</ListItemText>
|
||||||
|
</MenuItem>
|
||||||
|
</RouterLink>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
{/* Sign out */}
|
{/* Sign out */}
|
||||||
|
Reference in New Issue
Block a user