├── .editorconfig
├── .eslintrc.json
├── .gitignore
├── .npmrc
├── .stylelintrc.json
├── App_Resources
├── Android
│ ├── app.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── res
│ │ │ ├── drawable-hdpi
│ │ │ ├── background.png
│ │ │ ├── icon.png
│ │ │ └── logo.png
│ │ │ ├── drawable-ldpi
│ │ │ ├── background.png
│ │ │ ├── icon.png
│ │ │ └── logo.png
│ │ │ ├── drawable-mdpi
│ │ │ ├── background.png
│ │ │ ├── icon.png
│ │ │ └── logo.png
│ │ │ ├── drawable-nodpi
│ │ │ └── splash_screen.xml
│ │ │ ├── drawable-xhdpi
│ │ │ ├── background.png
│ │ │ ├── icon.png
│ │ │ └── logo.png
│ │ │ ├── drawable-xxhdpi
│ │ │ ├── background.png
│ │ │ ├── icon.png
│ │ │ └── logo.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ ├── background.png
│ │ │ ├── icon.png
│ │ │ └── logo.png
│ │ │ ├── values-v21
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── release
│ │ └── AndroidManifest.xml
└── iOS
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── icon-1024.png
│ │ ├── icon-20.png
│ │ ├── icon-20@2x.png
│ │ ├── icon-20@3x.png
│ │ ├── icon-29.png
│ │ ├── icon-29@2x.png
│ │ ├── icon-29@3x.png
│ │ ├── icon-40.png
│ │ ├── icon-40@2x.png
│ │ ├── icon-40@3x.png
│ │ ├── icon-60@2x.png
│ │ ├── icon-60@3x.png
│ │ ├── icon-76.png
│ │ ├── icon-76@2x.png
│ │ └── icon-83.5@2x.png
│ ├── Contents.json
│ ├── LaunchImage.launchimage
│ │ ├── Contents.json
│ │ ├── Default-1125h.png
│ │ ├── Default-568h@2x.png
│ │ ├── Default-667h@2x.png
│ │ ├── Default-736h@3x.png
│ │ ├── Default-Landscape-X.png
│ │ ├── Default-Landscape-XR.png
│ │ ├── Default-Landscape-XS-Max.png
│ │ ├── Default-Landscape.png
│ │ ├── Default-Landscape@2x.png
│ │ ├── Default-Landscape@3x.png
│ │ ├── Default-Portrait-XR.png
│ │ ├── Default-Portrait-XS-Max.png
│ │ ├── Default-Portrait.png
│ │ ├── Default-Portrait@2x.png
│ │ ├── Default.png
│ │ └── Default@2x.png
│ ├── LaunchScreen.AspectFill.imageset
│ │ ├── Contents.json
│ │ ├── LaunchScreen-AspectFill.png
│ │ ├── LaunchScreen-AspectFill@2x.png
│ │ └── LaunchScreen-AspectFill@3x.png
│ └── LaunchScreen.Center.imageset
│ │ ├── Contents.json
│ │ ├── LaunchScreen-Center.png
│ │ ├── LaunchScreen-Center@2x.png
│ │ └── LaunchScreen-Center@3x.png
│ ├── Info.plist
│ ├── LaunchScreen.storyboard
│ └── build.xcconfig
├── CHANGELOG.md
├── LICENSE
├── README.md
├── angular.json
├── artwork
├── feature.xcf
├── logo.xcf
├── logo_circle.png
└── logo_rounded.png
├── metadata
└── en-US
│ └── images
│ ├── featureGraphic.png
│ └── phoneScreenshots
│ ├── screenshot_new_txn.png
│ ├── screenshot_select_account.png
│ └── screenshot_text.png
├── nativescript.config.ts
├── package-lock.json
├── package.json
├── reference.d.ts
├── scripts
├── check-changelog.js
└── copy-fonts.js
├── src
├── _app-variables.scss
├── app.scss
├── app
│ ├── about
│ │ ├── about.component.html
│ │ ├── about.component.scss
│ │ └── about.component.ts
│ ├── account-form
│ │ ├── account-form.component.html
│ │ ├── account-form.component.scss
│ │ └── account-form.component.ts
│ ├── app-routing.module.ts
│ ├── app.component.html
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── balance-form
│ │ ├── balance-form.component.html
│ │ ├── balance-form.component.scss
│ │ └── balance-form.component.ts
│ ├── commodity-form
│ │ ├── commodity-form.component.html
│ │ ├── commodity-form.component.scss
│ │ └── commodity-form.component.ts
│ ├── plaintext
│ │ ├── plaintext.component.html
│ │ ├── plaintext.component.scss
│ │ └── plaintext.component.ts
│ ├── settings
│ │ ├── settings.component.html
│ │ ├── settings.component.scss
│ │ └── settings.component.ts
│ ├── shared
│ │ ├── account.model.ts
│ │ ├── balance.model.ts
│ │ ├── beancount-file-content.ts
│ │ ├── beancount-file-picker.ts
│ │ ├── beancount-file.service.ts
│ │ ├── commodity.model.ts
│ │ ├── constants.ts
│ │ ├── date-picker.ts
│ │ ├── misc.ts
│ │ ├── sidedrawer.service.ts
│ │ ├── transaction.model.ts
│ │ └── validators.ts
│ ├── transaction-form
│ │ ├── account-modal
│ │ │ ├── account-modal.component.html
│ │ │ ├── account-modal.component.scss
│ │ │ └── account-modal.component.ts
│ │ ├── commodity-modal
│ │ │ ├── commodity-modal.component.html
│ │ │ ├── commodity-modal.component.scss
│ │ │ └── commodity-modal.component.ts
│ │ ├── payee-modal
│ │ │ ├── payee-modal.component.html
│ │ │ ├── payee-modal.component.scss
│ │ │ └── payee-modal.component.ts
│ │ ├── transaction-form.component.html
│ │ ├── transaction-form.component.scss
│ │ └── transaction-form.component.ts
│ └── welcome
│ │ ├── welcome.component.html
│ │ ├── welcome.component.scss
│ │ ├── welcome.component.ts
│ │ └── welcome.guard.ts
├── main.ts
└── tests
│ ├── beancount-file-content.spec.ts
│ └── beancount-file.service.spec.ts
├── tsconfig.json
└── tsconfig.tns.json
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | insert_final_newline = true
6 | trim_trailing_whitespace = true
7 | charset = utf-8
8 | indent_style = space
9 | indent_size = 4
10 |
11 | [*.html]
12 | indent_size = 2
13 |
14 | [*.gradle]
15 | indent_size = 2
16 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "@typescript-eslint/parser",
3 | "plugins": [
4 | "@typescript-eslint",
5 | "jasmine"
6 | ],
7 | "env": {
8 | "browser": true,
9 | "es6": true,
10 | "jasmine": true
11 | },
12 | "extends": [
13 | "standard",
14 | "plugin:@typescript-eslint/recommended"
15 | ],
16 | "parserOptions": {
17 | "ecmaVersion": 2018,
18 | "sourceType": "module"
19 | },
20 | "rules": {
21 | "indent": [
22 | "error",
23 | 4
24 | ],
25 | "comma-dangle": [
26 | "error",
27 | "always-multiline"
28 | ],
29 | "no-useless-constructor": "off",
30 | "space-before-function-paren": [
31 | "error",
32 | {
33 | "named": "never"
34 | }
35 | ],
36 | "padded-blocks": "off",
37 | "object-curly-spacing": "off",
38 | "@typescript-eslint/explicit-function-return-type": "off",
39 | "@typescript-eslint/no-explicit-any": "off"
40 | },
41 | "globals": {
42 | "android": true
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # NativeScript
2 | hooks/
3 | node_modules/
4 | platforms/
5 | src/fonts/
6 |
7 | # NativeScript Template
8 | *.js.map
9 | *.js
10 | !scripts/*.js
11 |
12 | # Logs
13 | logs
14 | *.log
15 | npm-debug.log*
16 | yarn-debug.log*
17 | yarn-error.log*
18 |
19 | # General
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 | .idea
24 | .cloud
25 | .project
26 | tmp/
27 | typings/
28 |
29 | # Visual Studio Code
30 | .vscode/*
31 | !.vscode/settings.json
32 | !.vscode/tasks.json
33 | !.vscode/launch.json
34 | !.vscode/extensions.json
35 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | message="Version %s"
2 | save-prefix=~
3 |
--------------------------------------------------------------------------------
/.stylelintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "stylelint-config-sass-guidelines",
3 | "rules": {
4 | "indentation": 4,
5 | "color-hex-case": null,
6 | "color-hex-length": null,
7 | "selector-max-id": 1,
8 | "max-nesting-depth": 2,
9 | "property-no-unknown": [
10 | true,
11 | {
12 | "ignoreProperties": [
13 | "android-elevation",
14 | "android-dynamic-elevation-offset",
15 | "horizontal-align",
16 | "link-color",
17 | "placeholder-color",
18 | "ripple-color",
19 | "separator-color"
20 | ]
21 | }
22 | ],
23 | "selector-pseudo-element-no-unknown": [
24 | true,
25 | {
26 | "ignorePseudoElements": [
27 | "ng-deep"
28 | ]
29 | }
30 | ]
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | // https://stackoverflow.com/a/39040755/1868395
2 | def packageJsonFile = file("./../../../package.json")
3 | def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
4 | def version = packageJson.version
5 | // https://blog.jayway.com/2015/03/11/automatic-versioncode-generation-in-android-gradle/
6 | def (major, minor, patch) = version.split(/\./).collect{it.toInteger()}
7 | def versionInt = (major * 1000000) + (minor * 10000) + (patch * 100)
8 |
9 | android {
10 | defaultConfig {
11 | versionCode versionInt
12 | versionName "$version"
13 |
14 | minSdkVersion 17
15 | generatedDensities = []
16 | }
17 |
18 | // Read signing config from gradle properties instead of CLI args
19 | signingConfigs {
20 | release {
21 | if (project.hasProperty("release")) {
22 | if (project.hasProperty("BEANCOUNT_RELEASE_STORE_FILE") &&
23 | project.hasProperty("BEANCOUNT_RELEASE_STORE_PASSWORD") &&
24 | project.hasProperty("BEANCOUNT_RELEASE_KEY_ALIAS") &&
25 | project.hasProperty("BEANCOUNT_RELEASE_KEY_PASSWORD")) {
26 |
27 | storeFile file(BEANCOUNT_RELEASE_STORE_FILE)
28 | storePassword BEANCOUNT_RELEASE_STORE_PASSWORD
29 | keyAlias BEANCOUNT_RELEASE_KEY_ALIAS
30 | keyPassword BEANCOUNT_RELEASE_KEY_PASSWORD
31 | }
32 | }
33 | }
34 | }
35 | // Enable building of unsigned release APK
36 | // https://github.com/NativeScript/nativescript-cli/issues/3444
37 | buildTypes {
38 | release {
39 | if (System.getenv("RELEASE_UNSIGNED") == "1") {
40 | signingConfig null
41 | }
42 | }
43 | }
44 |
45 | aaptOptions {
46 | additionalParameters "--no-version-vectors"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-hdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-hdpi/background.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-ldpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-ldpi/background.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-mdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-mdpi/background.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 | -
6 |
7 |
8 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/values-v21/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #99ACBF
4 |
5 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
14 |
15 |
16 |
19 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F5F5F5
4 | #163754
5 | #99ACBF
6 | #205081
7 |
8 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Beancount Mobile
4 | Beancount
5 |
6 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
18 |
20 |
21 |
22 |
29 |
30 |
32 |
33 |
34 |
39 |
40 |
42 |
43 |
--------------------------------------------------------------------------------
/App_Resources/Android/src/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "icon-20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "icon-20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "icon-29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "icon-29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "icon-40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "icon-40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "icon-60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "icon-60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "icon-20.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "icon-20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "icon-29.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "icon-29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "icon-40.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "icon-40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "icon-76.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "icon-76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "icon-83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "icon-1024.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "2688h",
7 | "filename" : "Default-Portrait-XS-Max.png",
8 | "minimum-system-version" : "12.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "extent" : "full-screen",
14 | "idiom" : "iphone",
15 | "subtype" : "2688h",
16 | "filename" : "Default-Landscape-XS-Max.png",
17 | "minimum-system-version" : "12.0",
18 | "orientation" : "landscape",
19 | "scale" : "3x"
20 | },
21 | {
22 | "extent" : "full-screen",
23 | "idiom" : "iphone",
24 | "subtype" : "1792h",
25 | "filename" : "Default-Portrait-XR.png",
26 | "minimum-system-version" : "12.0",
27 | "orientation" : "portrait",
28 | "scale" : "2x"
29 | },
30 | {
31 | "extent" : "full-screen",
32 | "idiom" : "iphone",
33 | "subtype" : "1792h",
34 | "filename" : "Default-Landscape-XR.png",
35 | "minimum-system-version" : "12.0",
36 | "orientation" : "landscape",
37 | "scale" : "2x"
38 | },
39 | {
40 | "extent" : "full-screen",
41 | "idiom" : "iphone",
42 | "subtype" : "2436h",
43 | "filename" : "Default-1125h.png",
44 | "minimum-system-version" : "11.0",
45 | "orientation" : "portrait",
46 | "scale" : "3x"
47 | },
48 | {
49 | "extent" : "full-screen",
50 | "idiom" : "iphone",
51 | "subtype" : "2436h",
52 | "filename" : "Default-Landscape-X.png",
53 | "minimum-system-version" : "11.0",
54 | "orientation" : "landscape",
55 | "scale" : "3x"
56 | },
57 | {
58 | "extent" : "full-screen",
59 | "idiom" : "iphone",
60 | "subtype" : "736h",
61 | "filename" : "Default-736h@3x.png",
62 | "minimum-system-version" : "8.0",
63 | "orientation" : "portrait",
64 | "scale" : "3x"
65 | },
66 | {
67 | "extent" : "full-screen",
68 | "idiom" : "iphone",
69 | "subtype" : "736h",
70 | "filename" : "Default-Landscape@3x.png",
71 | "minimum-system-version" : "8.0",
72 | "orientation" : "landscape",
73 | "scale" : "3x"
74 | },
75 | {
76 | "extent" : "full-screen",
77 | "idiom" : "iphone",
78 | "subtype" : "667h",
79 | "filename" : "Default-667h@2x.png",
80 | "minimum-system-version" : "8.0",
81 | "orientation" : "portrait",
82 | "scale" : "2x"
83 | },
84 | {
85 | "orientation" : "portrait",
86 | "idiom" : "iphone",
87 | "filename" : "Default@2x.png",
88 | "extent" : "full-screen",
89 | "minimum-system-version" : "7.0",
90 | "scale" : "2x"
91 | },
92 | {
93 | "extent" : "full-screen",
94 | "idiom" : "iphone",
95 | "subtype" : "retina4",
96 | "filename" : "Default-568h@2x.png",
97 | "minimum-system-version" : "7.0",
98 | "orientation" : "portrait",
99 | "scale" : "2x"
100 | },
101 | {
102 | "orientation" : "portrait",
103 | "idiom" : "ipad",
104 | "filename" : "Default-Portrait.png",
105 | "extent" : "full-screen",
106 | "minimum-system-version" : "7.0",
107 | "scale" : "1x"
108 | },
109 | {
110 | "orientation" : "landscape",
111 | "idiom" : "ipad",
112 | "filename" : "Default-Landscape.png",
113 | "extent" : "full-screen",
114 | "minimum-system-version" : "7.0",
115 | "scale" : "1x"
116 | },
117 | {
118 | "orientation" : "portrait",
119 | "idiom" : "ipad",
120 | "filename" : "Default-Portrait@2x.png",
121 | "extent" : "full-screen",
122 | "minimum-system-version" : "7.0",
123 | "scale" : "2x"
124 | },
125 | {
126 | "orientation" : "landscape",
127 | "idiom" : "ipad",
128 | "filename" : "Default-Landscape@2x.png",
129 | "extent" : "full-screen",
130 | "minimum-system-version" : "7.0",
131 | "scale" : "2x"
132 | },
133 | {
134 | "orientation" : "portrait",
135 | "idiom" : "iphone",
136 | "filename" : "Default.png",
137 | "extent" : "full-screen",
138 | "scale" : "1x"
139 | },
140 | {
141 | "orientation" : "portrait",
142 | "idiom" : "iphone",
143 | "filename" : "Default@2x.png",
144 | "extent" : "full-screen",
145 | "scale" : "2x"
146 | },
147 | {
148 | "orientation" : "portrait",
149 | "idiom" : "iphone",
150 | "filename" : "Default-568h@2x.png",
151 | "extent" : "full-screen",
152 | "subtype" : "retina4",
153 | "scale" : "2x"
154 | },
155 | {
156 | "orientation" : "portrait",
157 | "idiom" : "ipad",
158 | "extent" : "to-status-bar",
159 | "scale" : "1x"
160 | },
161 | {
162 | "orientation" : "portrait",
163 | "idiom" : "ipad",
164 | "filename" : "Default-Portrait.png",
165 | "extent" : "full-screen",
166 | "scale" : "1x"
167 | },
168 | {
169 | "orientation" : "landscape",
170 | "idiom" : "ipad",
171 | "extent" : "to-status-bar",
172 | "scale" : "1x"
173 | },
174 | {
175 | "orientation" : "landscape",
176 | "idiom" : "ipad",
177 | "filename" : "Default-Landscape.png",
178 | "extent" : "full-screen",
179 | "scale" : "1x"
180 | },
181 | {
182 | "orientation" : "portrait",
183 | "idiom" : "ipad",
184 | "extent" : "to-status-bar",
185 | "scale" : "2x"
186 | },
187 | {
188 | "orientation" : "portrait",
189 | "idiom" : "ipad",
190 | "filename" : "Default-Portrait@2x.png",
191 | "extent" : "full-screen",
192 | "scale" : "2x"
193 | },
194 | {
195 | "orientation" : "landscape",
196 | "idiom" : "ipad",
197 | "extent" : "to-status-bar",
198 | "scale" : "2x"
199 | },
200 | {
201 | "orientation" : "landscape",
202 | "idiom" : "ipad",
203 | "filename" : "Default-Landscape@2x.png",
204 | "extent" : "full-screen",
205 | "scale" : "2x"
206 | }
207 | ],
208 | "info" : {
209 | "version" : 1,
210 | "author" : "xcode"
211 | }
212 | }
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-AspectFill.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-AspectFill@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchScreen-AspectFill@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-Center.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-Center@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchScreen-Center@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png
--------------------------------------------------------------------------------
/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiresFullScreen
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/App_Resources/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/App_Resources/iOS/build.xcconfig:
--------------------------------------------------------------------------------
1 | // You can add custom settings here
2 | // for example you can uncomment the following line to force distribution code signing
3 | // CODE_SIGN_IDENTITY = iPhone Distribution
4 | // To build for device with XCode 8 you need to specify your development team.
5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID;
6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
8 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## 1.6.0
4 |
5 | - Upgraded to NativeScript 7.0.
6 | - Do not add second linebreak at the end of file.
7 | - Added support for `indent` fava option.
8 | - Added balance form (#15).
9 |
10 | ## 1.5.0
11 |
12 | - Enabled error indication in forms.
13 | - Enabled date validation in forms.
14 | - Allowed to swap "from" and "to" accounts in transaction form.
15 |
16 | ## 1.4.0
17 |
18 | - Allowed arithmetic expressions in amount field.
19 | - Added 'About' page.
20 | - Move cursor to the end of line after tapping on item in account and payee lists.
21 |
22 | ## 1.3.3
23 |
24 | - Fixed file loading on Android 10.
25 |
26 | ## 1.3.2
27 |
28 | - Add newline at the end when appending an entry to beancount file.
29 |
30 | ## 1.3.1
31 |
32 | - Removed internet permission from release manifest file.
33 |
34 | ## 1.3.0
35 |
36 | - Added currency form.
37 | - Show alert when choosing file from external storage.
38 | - Fixed incorrect current date on transaction form.
39 | - Dim application screen when loading file.
40 | - Circle shape for Android icon.
41 |
42 | ## 1.2.0
43 |
44 | - Sort accounts and payees in selection dialogs by frequency of use.
45 | - Show all locations in file picker by default.
46 |
47 | ## 1.1.0
48 |
49 | - Added transaction flag switch to transaction form.
50 | - Don't focus on currency field after entering amount in transaction form.
51 | - Fixed some performance issues.
52 |
53 | ## 1.0.0
54 |
55 | - New designs for forms and dialogs.
56 | - Enabled content scrolling for Welcome screen and transaction form.
57 | - Added datepickers to transaction and account forms.
58 | - Changed field order on transaction and account forms.
59 | - Enabled autofocus on name field on account form opening.
60 |
61 | ## 0.6.0
62 |
63 | - Upgraded project to NativeScript 6.0.
64 | - Enabled auto-scrolling to bottom after adding transaction or account.
65 | - Fixed bug in file reloading mechanism.
66 | - Focus on amount field when opening transaction form.
67 |
68 | ## 0.5.1
69 |
70 | - Enabled building of unsigned release APK.
71 |
72 | ## 0.5.0
73 |
74 | - Improved transaction form.
75 | - Set 'save' buttons in action bar to 'disabled' state initially.
76 | - Removed extra 'save' buttons from forms.
77 | - Moved 'scroll to bottom' button to action bar, added 'scroll to top' button.
78 | - Changed appearance of buttons on file content page, added action bar menu.
79 |
80 | ## 0.4.0
81 |
82 | - New design for Welcome screen.
83 | - Show toast on file reload.
84 | - Added "save" action bar button to all forms.
85 | - Improved account and payee selection UI.
86 | - Prevent unnecessary reloading after saving.
87 |
88 | ## 0.3.0
89 |
90 | - Autoreload the beancount file on changes.
91 | - Added app version to app title in side drawer.
92 | - Fixed wrong version in APK file.
93 |
94 | ## 0.2.0
95 |
96 | - Added "scroll to bottom" button to file content page.
97 | - Fixed scrolling issue on file content page.
98 |
99 | ## 0.1.0
100 |
101 | - Initial release.
102 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Beancount Mobile App
2 |
3 | [](https://github.com/xuhcc/beancount-mobile/releases)
4 | [](https://github.com/xuhcc/beancount-mobile/blob/HEAD/LICENSE)
5 |
6 | This is a companion mobile application for [Beancount](https://beancount.github.io/) plain-text accounting system.
7 |
8 | **Currently available only on Android.** Version 6.0 (Marshmallow) or later is recommended.
9 |
10 | ## Features
11 |
12 | * Add transactions
13 | * Open accounts
14 | * Declare currencies
15 | * View beancount file as plain text
16 | * Switch between files
17 |
18 |
19 |
20 | Note: Beancount Mobile currently has no file synchronization functionality, but it's possible to use software like [Syncthing](https://syncthing.net/) to sync Beancount file across multiple devices.
21 |
22 | ## Configuration
23 |
24 | Beancount Mobile makes use of these configuration options:
25 |
26 | * `option "title" "..."` - the title of ledger file.
27 | * `option "operating_currency" "..."` - default currency for transactions.
28 | * `1970-01-01 custom "fava-option" "indent" "4"` - number spaces for indentation.
29 | * `1970-01-01 custom "bcm_option" "transaction_flags" "['*', '!']"` - allowed transaction flags.
30 | * `1970-01-01 custom "bcm_option" "account_order" "to_from"` - show "to" account before "from" account in transaction form.
31 |
32 | ## Change log
33 |
34 | See [CHANGELOG](CHANGELOG.md).
35 |
36 | ## Development
37 |
38 | Prerequisites:
39 |
40 | * Node.js & NPM
41 | * [NativeScript CLI](https://docs.nativescript.org/angular/start/quick-setup#step-2-install-the-nativescript-cli) 7.0
42 |
43 | Install required packages:
44 |
45 | ```
46 | npm install
47 | ```
48 |
49 | ### Android
50 |
51 | Run on emulator:
52 |
53 | ```
54 | npm run android
55 | ```
56 |
57 | Build APK:
58 |
59 | ```
60 | npm run android-debug
61 | ```
62 |
63 | ### Testing
64 |
65 | ```
66 | npm run lint
67 | npm run test
68 | ```
69 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "cli": {
6 | "defaultCollection": "@nativescript/schematics"
7 | },
8 | "projects": {
9 | "beancount": {
10 | "root": "",
11 | "sourceRoot": "src",
12 | "projectType": "application",
13 | "prefix": "bc",
14 | "schematics": {
15 | "@nativescript/schematics:component": {
16 | "styleext": "scss"
17 | }
18 | }
19 | }
20 | },
21 | "defaultProject": "beancount"
22 | }
23 |
--------------------------------------------------------------------------------
/artwork/feature.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/artwork/feature.xcf
--------------------------------------------------------------------------------
/artwork/logo.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/artwork/logo.xcf
--------------------------------------------------------------------------------
/artwork/logo_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/artwork/logo_circle.png
--------------------------------------------------------------------------------
/artwork/logo_rounded.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/artwork/logo_rounded.png
--------------------------------------------------------------------------------
/metadata/en-US/images/featureGraphic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/metadata/en-US/images/featureGraphic.png
--------------------------------------------------------------------------------
/metadata/en-US/images/phoneScreenshots/screenshot_new_txn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/metadata/en-US/images/phoneScreenshots/screenshot_new_txn.png
--------------------------------------------------------------------------------
/metadata/en-US/images/phoneScreenshots/screenshot_select_account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/metadata/en-US/images/phoneScreenshots/screenshot_select_account.png
--------------------------------------------------------------------------------
/metadata/en-US/images/phoneScreenshots/screenshot_text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xuhcc/beancount-mobile/6c73d6034b6358a31474d97a38cd19711f0ebe1e/metadata/en-US/images/phoneScreenshots/screenshot_text.png
--------------------------------------------------------------------------------
/nativescript.config.ts:
--------------------------------------------------------------------------------
1 | import { NativeScriptConfig } from '@nativescript/core'
2 |
3 | export default {
4 | id: 'link.beancount.mobile',
5 | appResourcesPath: 'App_Resources',
6 | android: {
7 | v8Flags: '--expose_gc',
8 | markingMode: 'none',
9 | codeCache: true,
10 | },
11 | appPath: 'src',
12 | } as NativeScriptConfig
13 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "beancount-mobile",
3 | "version": "1.6.0",
4 | "description": "Beancount Mobile App",
5 | "license": "GPL-3.0-or-later",
6 | "repository": "https://github.com/xuhcc/beancount-mobile",
7 | "private": true,
8 | "dependencies": {
9 | "@angular/animations": "~10.2.3",
10 | "@angular/common": "~10.2.3",
11 | "@angular/compiler": "~10.2.3",
12 | "@angular/core": "~10.2.3",
13 | "@angular/forms": "~10.2.3",
14 | "@angular/platform-browser": "~10.2.3",
15 | "@angular/platform-browser-dynamic": "~10.2.3",
16 | "@angular/router": "~10.2.3",
17 | "@nativescript/angular": "~10.1.7",
18 | "@nativescript/core": "~7.0.0",
19 | "@nativescript/imagepicker": "~1.0.0",
20 | "@nativescript/schematics": "^10.0.0",
21 | "@nativescript/unit-test-runner": "~1.0.2",
22 | "@nativescript/webpack": "~3.0.8",
23 | "@nstudio/nativescript-floatingactionbutton": "~3.0.4",
24 | "@nstudio/nativescript-pulltorefresh": "~3.0.1",
25 | "@triniwiz/nativescript-toasty": "~4.0.3",
26 | "material-design-icons-iconfont": "^5.0.1",
27 | "nativescript-foss-sidedrawer": "^2.0.0",
28 | "nativescript-modal-datetimepicker": "~2.1.5",
29 | "nativescript-permissions": "^1.3.6",
30 | "reflect-metadata": "~0.1.12",
31 | "rxjs": "~6.5.0",
32 | "zone.js": "~0.10.3"
33 | },
34 | "devDependencies": {
35 | "@angular/compiler-cli": "~10.2.3",
36 | "@nativescript/android": "7.0.1",
37 | "@nativescript/types": "~7.0.0",
38 | "@ngtools/webpack": "~10.2.0",
39 | "@types/jasmine": "3.5.14",
40 | "@typescript-eslint/eslint-plugin": "^2.0.0",
41 | "@typescript-eslint/parser": "^2.0.0",
42 | "eslint": "^6.0.1",
43 | "eslint-config-standard": "^12.0.0",
44 | "eslint-plugin-import": "^2.18.0",
45 | "eslint-plugin-jasmine": "^2.10.1",
46 | "eslint-plugin-node": "^9.1.0",
47 | "eslint-plugin-promise": "^4.2.1",
48 | "eslint-plugin-standard": "^4.0.0",
49 | "karma": "5.2.3",
50 | "karma-jasmine": "4.0.1",
51 | "karma-nativescript-launcher": "0.4.0",
52 | "karma-webpack": "3.0.5",
53 | "node-sass": "^4.12.0",
54 | "stylelint": "~13.12.0",
55 | "stylelint-config-sass-guidelines": "~8.0.0",
56 | "typescript": "3.9.7"
57 | },
58 | "scripts": {
59 | "postinstall": "./scripts/copy-fonts.js",
60 | "build-icons": "nsc resources generate icons artwork/logo_circle.png",
61 | "build-splashes": "nsc resources generate splashes artwork/logo_rounded.png --background \"#205081\"",
62 | "android": "nsc debug android --no-hmr",
63 | "android-debug": "nsc build android",
64 | "android-release": "nsc build android --release --clean --key-store-path /dev/null --key-store-alias NULL --key-store-password NULL --key-store-alias-password NULL",
65 | "android-unsigned": "RELEASE_UNSIGNED=1 nsc build android --release --clean --key-store-path /dev/null --key-store-alias NULL --key-store-password NULL --key-store-alias-password NULL || true",
66 | "test": "nsc test android --no-watch",
67 | "lint": "npx eslint 'src/**/*.ts' && stylelint 'src/**/*.scss'",
68 | "clean": "rm -rf platforms",
69 | "version": "./scripts/check-changelog.js"
70 | },
71 | "main": "main.js"
72 | }
73 |
--------------------------------------------------------------------------------
/reference.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/scripts/check-changelog.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const { exec } = require('child_process');
4 |
5 | exec(`grep ${process.env.npm_package_version} CHANGELOG.md`, (error, stdout) => {
6 | if (error) {
7 | throw error;
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/scripts/copy-fonts.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const fs = require('fs');
4 | const path = require('path');
5 |
6 | const FONT_FIR = 'src/fonts';
7 | const FONTS = [
8 | 'node_modules/material-design-icons-iconfont/dist/fonts/MaterialIcons-Regular.ttf',
9 | ];
10 |
11 | if (!fs.existsSync(FONT_FIR)){
12 | fs.mkdirSync(FONT_FIR);
13 | }
14 |
15 | FONTS.forEach((filePath) => {
16 | let fileName = path.basename(filePath);
17 | fs.copyFile(filePath, path.join(FONT_FIR, fileName), (error) => {
18 | if (error) {
19 | throw error;
20 | }
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/src/_app-variables.scss:
--------------------------------------------------------------------------------
1 | $main-color: #255C8C;
2 | $main-text-color: #E2E9F0;
3 | $secondary-color: #F49D96;
4 |
5 | $button-color: #507CA3;
6 | $button-text-color: #CAD7E3;
7 |
8 | $form-label-color: #808080;
9 | $form-field-color: $button-color;
10 | $form-placeholder-color: #CCCCCC;
11 | $form-underline-color: #D9D9D9;
12 | $form-error-color: #FF0000;
13 |
--------------------------------------------------------------------------------
/src/app.scss:
--------------------------------------------------------------------------------
1 | /*
2 | In NativeScript, the app.css file is where you place CSS rules that
3 | you would like to apply to your entire application. Check out
4 | http://docs.nativescript.org/ui/styling for a full list of the CSS
5 | selectors and properties you can use to style UI components.
6 | */
7 | @import 'app-variables';
8 |
9 | .page {
10 | padding: 20;
11 | }
12 |
13 | .loader {
14 | background-color: #33252525;
15 | }
16 |
17 | .btn {
18 | android-elevation: 3;
19 | background-color: $button-color;
20 | border-radius: 10;
21 | color: $button-text-color;
22 | font-size: 14;
23 | font-weight: 500;
24 | letter-spacing: 0.1;
25 | margin: 5 0;
26 | }
27 |
28 | .btn-disabled {
29 | background-color: #E3E3E3;
30 | color: #B5B5B5;
31 | }
32 |
33 | .secondary-btn {
34 | android-dynamic-elevation-offset: 0;
35 | android-elevation: 0;
36 | background-color: transparent;
37 | border-color: $button-color;
38 | border-width: 1;
39 | color: $button-color;
40 |
41 | &:highlighted {
42 | background-color: $button-color;
43 | color: $button-text-color;
44 | }
45 | }
46 |
47 | .icon {
48 | font-family: 'Material Icons', 'MaterialIcons-Regular';
49 | }
50 |
51 | /* Action bar */
52 |
53 | .action-bar {
54 | background-color: $main-color;
55 | color: $main-text-color;
56 |
57 | .icon {
58 | font-size: 11;
59 |
60 | &.nav-icon {
61 | font-size: 9;
62 | }
63 |
64 | &.disabled {
65 | color: #4581B5;
66 | }
67 | }
68 | }
69 |
70 | .action-bar-title {
71 | font-size: 20;
72 | font-weight: 500;
73 | horizontal-align: left;
74 | }
75 |
76 | /* Forms */
77 |
78 | .label {
79 | color: $form-label-color;
80 | font-size: 14;
81 | margin: 0 0 5;
82 | padding: 0;
83 | }
84 |
85 | .field-wrapper {
86 | margin-bottom: 20;
87 | }
88 |
89 | .field {
90 | border-bottom-color: $form-underline-color;
91 | border-bottom-width: 1;
92 | color: $form-field-color;
93 | flex-grow: 1;
94 | font-size: 16;
95 | margin: 0;
96 | padding: 0;
97 | placeholder-color: $form-placeholder-color;
98 | }
99 |
100 | .field-addon {
101 | border-bottom-color: $form-underline-color;
102 | border-bottom-width: 1;
103 | color: $form-field-color;
104 | font-size: 20;
105 | margin: 0;
106 | padding: 3 0 0;
107 | text-align: right;
108 | width: 30;
109 | }
110 |
111 | .field-error {
112 | .field,
113 | .field-addon {
114 | border-bottom-color: $form-error-color;
115 | }
116 | }
117 |
118 | /* Modals */
119 |
120 | .modal {
121 | margin: 20;
122 | padding: 0;
123 | width: 250;
124 | }
125 |
126 | .modal-header {
127 | color: $main-color;
128 | font-size: 18;
129 | font-weight: 500;
130 | margin: 0 0 20;
131 | padding: 0;
132 | text-align: center;
133 | }
134 |
135 | .modal .btn {
136 | margin: 0;
137 | }
138 |
139 | /* Lists */
140 |
141 | .list {
142 | margin: 0;
143 | padding: 0;
144 | separator-color: transparent;
145 | }
146 |
147 | .list-item {
148 | color: $form-field-color;
149 | font-size: 16;
150 | padding: 10 0;
151 | }
152 |
153 | .list-empty {
154 | margin: 20;
155 | text-align: center;
156 | }
157 |
158 | /* Misc */
159 |
160 | .calendar-addon {
161 | font-size: 21;
162 | width: 100;
163 | }
164 |
--------------------------------------------------------------------------------
/src/app/about/about.component.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
15 |
20 |
21 |
26 |
27 |
--------------------------------------------------------------------------------
/src/app/about/about.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../app-variables';
2 |
3 | #app-name {
4 | font-size: 16;
5 | margin-bottom: 10;
6 | }
7 |
8 | #app-description {
9 | margin-bottom: 10;
10 | }
11 |
--------------------------------------------------------------------------------
/src/app/about/about.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core'
2 |
3 | import { openUrl } from 'tns-core-modules/utils/utils'
4 |
5 | import { APP_NAME } from '../shared/constants'
6 | import { getAppVersion } from '../shared/misc'
7 | import { SideDrawerService } from '../shared/sidedrawer.service'
8 |
9 | const APP_BUGTRACKER = 'https://github.com/xuhcc/beancount-mobile/issues'
10 |
11 | @Component({
12 | selector: 'bc-about',
13 | templateUrl: './about.component.html',
14 | styleUrls: ['./about.component.scss'],
15 | })
16 | export class AboutComponent {
17 |
18 | constructor(private sideDrawer: SideDrawerService) { }
19 |
20 | get appName(): string {
21 | return `${APP_NAME} v${getAppVersion()}`
22 | }
23 |
24 | openDrawer() {
25 | this.sideDrawer.open()
26 | }
27 |
28 | openBugTracker() {
29 | openUrl(APP_BUGTRACKER)
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/app/account-form/account-form.component.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
31 |
36 |
37 |
38 |
39 |
44 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/app/account-form/account-form.component.scss:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/app/account-form/account-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core'
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'
3 | import { RouterExtensions } from '@nativescript/angular'
4 |
5 | import { TextField } from '@nativescript/core/ui/text-field'
6 |
7 | import { Account } from '../shared/account.model'
8 | import { BeancountFileService } from '../shared/beancount-file.service'
9 | import { showDatePicker } from '../shared/date-picker'
10 | import { getTodayStr, getDateStr, showKeyboard, configureSaveButton } from '../shared/misc'
11 | import { UniqueValidator, validateDate } from '../shared/validators'
12 |
13 | @Component({
14 | selector: 'bc-account-form',
15 | templateUrl: './account-form.component.html',
16 | styleUrls: ['./account-form.component.scss'],
17 | })
18 | export class AccountFormComponent implements OnInit {
19 |
20 | form: FormGroup;
21 | accounts: string[];
22 |
23 | showValidationErrors = false;
24 |
25 | constructor(
26 | private formBuilder: FormBuilder,
27 | private routerExtensions: RouterExtensions,
28 | private beancountFile: BeancountFileService,
29 | ) {
30 | this.accounts = this.beancountFile.content.getAccounts()
31 | }
32 |
33 | ngOnInit() {
34 | const nameRegexp = this.beancountFile.content.getAccountNameRegexp()
35 | this.form = this.formBuilder.group({
36 | date: [
37 | getTodayStr(),
38 | [Validators.required, validateDate],
39 | ],
40 | name: [
41 | '',
42 | [
43 | Validators.required,
44 | Validators.pattern(nameRegexp),
45 | UniqueValidator(this.accounts),
46 | ],
47 | ],
48 | })
49 | }
50 |
51 | onActionBarLoaded(event) {
52 | const actionBar = event.object
53 | configureSaveButton(actionBar, this.form.statusChanges)
54 | }
55 |
56 | onNameFieldLoaded(event) {
57 | const nameField = event.object as TextField
58 | showKeyboard(nameField)
59 | }
60 |
61 | hasError(fieldName: string): boolean {
62 | const field = this.form.get(fieldName)
63 | return this.showValidationErrors && field.invalid
64 | }
65 |
66 | showDatePicker(): void {
67 | showDatePicker().then((date: Date) => {
68 | this.form.controls.date.setValue(getDateStr(date))
69 | }).catch((error) => {
70 | console.warn(error)
71 | })
72 | }
73 |
74 | goBack() {
75 | this.routerExtensions.backToPreviousPage()
76 | }
77 |
78 | save(): void {
79 | if (!this.form.valid) {
80 | this.showValidationErrors = true
81 | return
82 | }
83 | const account = new Account(this.form.value)
84 | const beancountAccount = account.toBeancount()
85 | this.beancountFile.append(beancountAccount)
86 | this.routerExtensions.navigate(['/plaintext', {scroll: 'bottom'}])
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core'
2 | import { Routes } from '@angular/router'
3 | import { NativeScriptRouterModule } from '@nativescript/angular'
4 |
5 | import { WelcomeComponent } from './welcome/welcome.component'
6 | import { WelcomeGuard } from './welcome/welcome.guard'
7 | import { PlainTextComponent } from './plaintext/plaintext.component'
8 | import { TransactionFormComponent } from './transaction-form/transaction-form.component'
9 | import { SettingsComponent } from './settings/settings.component'
10 | import { AccountFormComponent } from './account-form/account-form.component'
11 | import { CommodityFormComponent } from './commodity-form/commodity-form.component'
12 | import { BalanceFormComponent } from './balance-form/balance-form.component'
13 | import { AboutComponent } from './about/about.component'
14 |
15 | const routes: Routes = [
16 | {
17 | path: '',
18 | redirectTo: '/welcome',
19 | pathMatch: 'full',
20 | },
21 | {
22 | path: 'welcome',
23 | component: WelcomeComponent,
24 | canActivate: [WelcomeGuard],
25 | },
26 | {
27 | path: 'plaintext',
28 | component: PlainTextComponent,
29 | },
30 | {
31 | path: 'add-transaction',
32 | component: TransactionFormComponent,
33 | },
34 | {
35 | path: 'add-account',
36 | component: AccountFormComponent,
37 | },
38 | {
39 | path: 'add-commodity',
40 | component: CommodityFormComponent,
41 | },
42 | {
43 | path: 'add-balance',
44 | component: BalanceFormComponent,
45 | },
46 | {
47 | path: 'settings',
48 | component: SettingsComponent,
49 | },
50 | {
51 | path: 'about',
52 | component: AboutComponent,
53 | },
54 | ]
55 |
56 | @NgModule({
57 | imports: [NativeScriptRouterModule.forRoot(routes)],
58 | exports: [NativeScriptRouterModule],
59 | })
60 | export class AppRoutingModule { }
61 |
--------------------------------------------------------------------------------
/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core'
2 |
3 | import { BeancountFileService } from './shared/beancount-file.service'
4 |
5 | @Component({
6 | moduleId: module.id,
7 | selector: 'bc-app',
8 | templateUrl: 'app.component.html',
9 | })
10 | export class AppComponent {
11 |
12 | constructor(
13 | private beancountFile: BeancountFileService,
14 | ) { }
15 |
16 | get isLoading(): boolean {
17 | return this.beancountFile.isLoading
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'
2 | import { ReactiveFormsModule } from '@angular/forms'
3 | import { NativeScriptModule, NativeScriptFormsModule } from '@nativescript/angular'
4 |
5 | import { AppRoutingModule } from './app-routing.module'
6 | import { AppComponent } from './app.component'
7 |
8 | import { WelcomeComponent } from './welcome/welcome.component'
9 | import { PlainTextComponent } from './plaintext/plaintext.component'
10 | import { TransactionFormComponent } from './transaction-form/transaction-form.component'
11 | import { AccountModalComponent } from './transaction-form/account-modal/account-modal.component'
12 | import { CommodityModalComponent } from './transaction-form/commodity-modal/commodity-modal.component'
13 | import { PayeeModalComponent } from './transaction-form/payee-modal/payee-modal.component'
14 | import { SettingsComponent } from './settings/settings.component'
15 | import { AccountFormComponent } from './account-form/account-form.component'
16 | import { CommodityFormComponent } from './commodity-form/commodity-form.component'
17 | import { BalanceFormComponent } from './balance-form/balance-form.component'
18 | import { AboutComponent } from './about/about.component'
19 |
20 | @NgModule({
21 | bootstrap: [
22 | AppComponent,
23 | ],
24 | imports: [
25 | NativeScriptModule,
26 | ReactiveFormsModule,
27 | NativeScriptFormsModule,
28 | AppRoutingModule,
29 | ],
30 | declarations: [
31 | AppComponent,
32 | WelcomeComponent,
33 | PlainTextComponent,
34 | TransactionFormComponent,
35 | AccountModalComponent,
36 | CommodityModalComponent,
37 | PayeeModalComponent,
38 | SettingsComponent,
39 | AccountFormComponent,
40 | CommodityFormComponent,
41 | BalanceFormComponent,
42 | AboutComponent,
43 | ],
44 | entryComponents: [
45 | AccountModalComponent,
46 | CommodityModalComponent,
47 | PayeeModalComponent,
48 | ],
49 | schemas: [
50 | NO_ERRORS_SCHEMA,
51 | ],
52 | })
53 | export class AppModule { }
54 |
--------------------------------------------------------------------------------
/src/app/balance-form/balance-form.component.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
31 |
36 |
37 |
38 |
39 |
44 |
51 |
56 |
57 |
58 |
59 |
64 |
72 |
77 |
78 |
79 |
80 |
85 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/app/balance-form/balance-form.component.scss:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/app/balance-form/balance-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, ViewContainerRef } from '@angular/core'
2 | import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms'
3 | import { ModalDialogOptions, ModalDialogService, RouterExtensions } from '@nativescript/angular'
4 |
5 | import { TextField } from '@nativescript/core/ui/text-field'
6 | import { ad as androidUtils } from '@nativescript/core/utils/utils'
7 |
8 | import { showDatePicker } from '../shared/date-picker'
9 | import { Balance, evaluateArithmeticExpression } from '../shared/balance.model'
10 | import { BeancountFileService } from '../shared/beancount-file.service'
11 | import { AccountModalComponent } from '../transaction-form/account-modal/account-modal.component'
12 | import { CommodityModalComponent } from '../transaction-form/commodity-modal/commodity-modal.component'
13 | import { getDateStr, getTodayStr, showKeyboard, configureSaveButton } from '../shared/misc'
14 | import { validateDate } from '../shared/validators'
15 |
16 | function validateAmount(control: AbstractControl): {[key: string]: any} | null {
17 | const error = {invalidExpression: {value: control.value}}
18 | let amount
19 | try {
20 | amount = evaluateArithmeticExpression(control.value)
21 | } catch {
22 | return error
23 | }
24 | if (isNaN(amount) || amount <= 0) {
25 | return error
26 | }
27 | }
28 |
29 | @Component({
30 | selector: 'bc-balance-form',
31 | templateUrl: './balance-form.component.html',
32 | styleUrls: ['./balance-form.component.scss'],
33 | })
34 | export class BalanceFormComponent implements OnInit {
35 |
36 | form: FormGroup;
37 | accounts: string[] = [];
38 | commodities: string[] = [];
39 |
40 | showValidationErrors = false;
41 |
42 | amountFieldKeyboardType = 'number';
43 |
44 | constructor(
45 | private formBuilder: FormBuilder,
46 | private modalService: ModalDialogService,
47 | private viewContainerRef: ViewContainerRef,
48 | private routerExtensions: RouterExtensions,
49 | private beancountFile: BeancountFileService,
50 | ) {
51 | this.accounts = this.beancountFile.content.getAccounts()
52 | this.commodities = this.beancountFile.content.getCommodities()
53 | }
54 |
55 | ngOnInit() {
56 | this.form = this.formBuilder.group({
57 | date: [
58 | getTodayStr(),
59 | [Validators.required, validateDate],
60 | ],
61 | account: [
62 | '',
63 | Validators.required,
64 | ],
65 | commodity: [
66 | '',
67 | Validators.required,
68 | ],
69 | amount: [
70 | '',
71 | [Validators.required, validateAmount],
72 | ],
73 | })
74 | }
75 |
76 | onActionBarLoaded(event) {
77 | const actionBar = event.object
78 | configureSaveButton(actionBar, this.form.statusChanges)
79 | }
80 |
81 | onAmountFieldLoaded(event) {
82 | const amountField = event.object as TextField
83 | showKeyboard(amountField)
84 | }
85 |
86 | hasError(fieldName: string): boolean {
87 | const field = this.form.get(fieldName)
88 | return this.showValidationErrors && field.invalid
89 | }
90 |
91 | enableArithmeticExpressions() {
92 | this.amountFieldKeyboardType = 'phone'
93 | }
94 |
95 | hideKeyboard() {
96 | androidUtils.dismissSoftInput()
97 | }
98 |
99 | showDatePicker(): void {
100 | showDatePicker().then((date: Date) => {
101 | this.form.controls.date.setValue(getDateStr(date))
102 | }).catch((error) => {
103 | console.warn(error)
104 | })
105 | }
106 |
107 | showAccountPicker(): void {
108 | const options: ModalDialogOptions = {
109 | viewContainerRef: this.viewContainerRef,
110 | context: this.accounts,
111 | }
112 | this.modalService.showModal(AccountModalComponent, options).then((account: string) => {
113 | if (account) {
114 | this.form.controls.account.setValue(account)
115 | }
116 | })
117 | }
118 |
119 | showCommodityPicker(): void {
120 | const options: ModalDialogOptions = {
121 | viewContainerRef: this.viewContainerRef,
122 | context: this.commodities,
123 | }
124 | this.modalService.showModal(CommodityModalComponent, options).then((commodity: string) => {
125 | if (commodity) {
126 | this.form.controls.commodity.setValue(commodity)
127 | }
128 | })
129 | }
130 |
131 | goBack() {
132 | this.routerExtensions.backToPreviousPage()
133 | }
134 |
135 | save(): void {
136 | if (!this.form.valid) {
137 | this.showValidationErrors = true
138 | return
139 | }
140 | const balance = new Balance(this.form.value)
141 | const beancountBalance = balance.toBeancount()
142 | this.beancountFile.append(beancountBalance)
143 | this.routerExtensions.navigate(['/plaintext', {scroll: 'bottom'}])
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/src/app/commodity-form/commodity-form.component.html:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
31 |
36 |
37 |
38 |
39 |
44 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/app/commodity-form/commodity-form.component.scss:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/app/commodity-form/commodity-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core'
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'
3 | import { RouterExtensions } from '@nativescript/angular'
4 |
5 | import { TextField } from 'tns-core-modules/ui/text-field'
6 |
7 | import { Commodity } from '../shared/commodity.model'
8 | import { COMMODITY_NAME_REGEXP } from '../shared/beancount-file-content'
9 | import { BeancountFileService } from '../shared/beancount-file.service'
10 | import { showDatePicker } from '../shared/date-picker'
11 | import { getTodayStr, getDateStr, showKeyboard, configureSaveButton } from '../shared/misc'
12 | import { UniqueValidator, validateDate } from '../shared/validators'
13 |
14 | @Component({
15 | selector: 'bc-commodity-form',
16 | templateUrl: './commodity-form.component.html',
17 | styleUrls: ['./commodity-form.component.scss'],
18 | })
19 | export class CommodityFormComponent implements OnInit {
20 |
21 | form: FormGroup;
22 | commodities: string[];
23 |
24 | showValidationErrors = false;
25 |
26 | constructor(
27 | private formBuilder: FormBuilder,
28 | private router: RouterExtensions,
29 | private beancountFile: BeancountFileService,
30 | ) {
31 | this.commodities = this.beancountFile.content.getCommodities()
32 | }
33 |
34 | ngOnInit() {
35 | this.form = this.formBuilder.group({
36 | date: [
37 | getTodayStr(),
38 | [Validators.required, validateDate],
39 | ],
40 | name: [
41 | '',
42 | [
43 | Validators.required,
44 | Validators.pattern(COMMODITY_NAME_REGEXP),
45 | UniqueValidator(this.commodities),
46 | ],
47 | ],
48 | })
49 | }
50 |
51 | onActionBarLoaded(event) {
52 | const actionBar = event.object
53 | configureSaveButton(actionBar, this.form.statusChanges)
54 | }
55 |
56 | onNameFieldLoaded(event) {
57 | const nameField = event.object as TextField
58 | showKeyboard(nameField)
59 | }
60 |
61 | hasError(fieldName: string): boolean {
62 | const field = this.form.get(fieldName)
63 | return this.showValidationErrors && field.invalid
64 | }
65 |
66 | showDatePicker(): void {
67 | showDatePicker().then((date: Date) => {
68 | this.form.controls.date.setValue(getDateStr(date))
69 | }).catch((error) => {
70 | console.warn(error)
71 | })
72 | }
73 |
74 | goBack() {
75 | this.router.backToPreviousPage()
76 | }
77 |
78 | save(): void {
79 | if (!this.form.valid) {
80 | this.showValidationErrors = true
81 | return
82 | }
83 | const commodity = new Commodity(this.form.value)
84 | const beancountCommodity = commodity.toBeancount()
85 | this.beancountFile.append(beancountCommodity)
86 | this.router.navigate(['/plaintext', {scroll: 'bottom'}])
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/src/app/plaintext/plaintext.component.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
20 |
25 |
30 |
35 |
40 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
52 |
57 |
58 |
--------------------------------------------------------------------------------
/src/app/plaintext/plaintext.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../app-variables';
2 |
3 | #file-content {
4 | color: #707070;
5 | font-family: monospace;
6 | font-size: 12;
7 | padding: 10;
8 | }
9 |
10 | .fab-button {
11 | background-color: $main-color;
12 | color: $main-text-color;
13 | font-family: 'normal';
14 | font-size: 12;
15 | font-weight: 300;
16 | height: 70;
17 | horizontal-align: right;
18 | ripple-color: $main-text-color;
19 | vertical-align: bottom;
20 | width: 70;
21 | }
22 |
23 | .add-transaction {
24 | margin: 0 20 20 0;
25 | }
26 |
--------------------------------------------------------------------------------
/src/app/plaintext/plaintext.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, OnDestroy, AfterViewInit, ViewChild, ElementRef, NgZone } from '@angular/core'
2 | import { RouterExtensions, PageRoute, registerElement } from '@nativescript/angular'
3 |
4 | import { isAndroid } from '@nativescript/core/platform'
5 | import { Subscription } from 'rxjs'
6 | import { switchMap } from 'rxjs/operators'
7 | import { Page } from '@nativescript/core/ui/page'
8 | import { Fab } from '@nstudio/nativescript-floatingactionbutton'
9 | import { PullToRefresh } from '@nstudio/nativescript-pulltorefresh'
10 | import { Toasty, ToastPosition, ToastDuration } from '@triniwiz/nativescript-toasty'
11 |
12 | import { BeancountFileService } from '../shared/beancount-file.service'
13 | import { BeancountFileContent } from '../shared/beancount-file-content'
14 | import { SideDrawerService } from '../shared/sidedrawer.service'
15 | import { ACTION_BAR_BUTTON_COLOR, AFTERVIEWINIT_DELAY } from '../shared/constants'
16 | import { setIconColor } from '../shared/misc'
17 |
18 | registerElement('PullToRefresh', () => PullToRefresh)
19 | registerElement('Fab', () => Fab)
20 |
21 | @Component({
22 | selector: 'bc-plaintext',
23 | templateUrl: './plaintext.component.html',
24 | styleUrls: ['./plaintext.component.scss'],
25 | })
26 | export class PlainTextComponent implements OnInit, OnDestroy, AfterViewInit {
27 |
28 | fileTitle: string;
29 | fileText: string;
30 | private fileSubscription: Subscription;
31 |
32 | @ViewChild('fileTextView', {static: false})
33 | fileTextView: ElementRef;
34 |
35 | private scrollOnLoad: string;
36 |
37 | constructor(
38 | private ngZone: NgZone,
39 | private routerExtensions: RouterExtensions,
40 | private page: Page,
41 | private pageRoute: PageRoute,
42 | private beancountFile: BeancountFileService,
43 | private sideDrawer: SideDrawerService,
44 | ) { }
45 |
46 | private show(content: BeancountFileContent) {
47 | if (!content) {
48 | return
49 | }
50 | this.fileText = content.text
51 | this.fileTitle = content.getTitle()
52 | }
53 |
54 | private fileSubscribe() {
55 | this.fileSubscription = this.beancountFile.contentStream.subscribe((content: BeancountFileContent) => {
56 | if (this.fileText) {
57 | const toast = new Toasty({
58 | text: 'File reloaded',
59 | position: ToastPosition.BOTTOM,
60 | duration: ToastDuration.LONG,
61 | })
62 | toast.show()
63 | }
64 | this.show(content)
65 | })
66 | }
67 |
68 | private fileUnsubscribe() {
69 | this.fileSubscription.unsubscribe()
70 | }
71 |
72 | ngOnInit() {
73 | this.pageRoute.activatedRoute
74 | .pipe(
75 | switchMap(activatedRoute => activatedRoute.params),
76 | )
77 | .forEach((params) => {
78 | // Scroll to bottom after init when 'scroll' route parameter is present
79 | if ('scroll' in params) {
80 | this.scrollOnLoad = params.scroll
81 | }
82 | })
83 | this.show(this.beancountFile.content)
84 | this.page.on('navigatedTo', () => {
85 | // Re-subscribe each time because
86 | // ngOnInit is not called after back-navigation
87 | this.fileSubscribe()
88 | // Ask for content if initial show() call was too early
89 | if (this.fileText === undefined) {
90 | this.ngZone.run(() => {
91 | this.beancountFile.load()
92 | })
93 | }
94 | })
95 | this.page.on('navigatingFrom', () => {
96 | // ngOnDestroy is not called by default when leaving page
97 | // https://github.com/NativeScript/nativescript-angular/issues/1049
98 | this.fileUnsubscribe()
99 | })
100 | }
101 |
102 | ngAfterViewInit(): void {
103 | if (this.scrollOnLoad === 'bottom') {
104 | delete this.scrollOnLoad
105 | // Use timeout to make it run on the next angular cycle
106 | // Otherwise scrollableHeight will be 0
107 | setTimeout(() => {
108 | this.scrollToBottom()
109 | }, AFTERVIEWINIT_DELAY)
110 | }
111 | }
112 |
113 | onActionBarLoaded(event) {
114 | const actionBar = event.object
115 | if (isAndroid) {
116 | // Set color of the 'overflow' button
117 | const overflowIcon = actionBar.nativeView.getOverflowIcon()
118 | setIconColor(overflowIcon, ACTION_BAR_BUTTON_COLOR)
119 | }
120 | }
121 |
122 | reloadFile(event) {
123 | const pullRefresh = event.object as PullToRefresh
124 | setTimeout(() => {
125 | // Force reload
126 | this.beancountFile.load(true).then(() => {
127 | pullRefresh.refreshing = false
128 | })
129 | }, 0)
130 | }
131 |
132 | openDrawer() {
133 | this.sideDrawer.open()
134 | }
135 |
136 | addTransaction() {
137 | this.routerExtensions.navigate(['/add-transaction'])
138 | }
139 |
140 | addAccount() {
141 | this.routerExtensions.navigate(['/add-account'])
142 | }
143 |
144 | addCommodity() {
145 | this.routerExtensions.navigate(['/add-commodity'])
146 | }
147 |
148 | addBalance() {
149 | this.routerExtensions.navigate(['/add-balance'])
150 | }
151 |
152 | scrollToTop() {
153 | const element = this.fileTextView.nativeElement
154 | element.scrollToVerticalOffset(0)
155 | }
156 |
157 | scrollToBottom() {
158 | const element = this.fileTextView.nativeElement
159 | element.scrollToVerticalOffset(element.scrollableHeight)
160 | }
161 |
162 | ngOnDestroy() {
163 | this.fileUnsubscribe()
164 | }
165 |
166 | }
167 |
--------------------------------------------------------------------------------
/src/app/settings/settings.component.html:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
16 |
20 |
21 |
22 |
28 |
29 |
30 |
31 |
36 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/app/settings/settings.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../app-variables';
2 |
3 | .btn {
4 | margin-top: 20;
5 | }
6 |
7 | #reset-text {
8 | color: #ADADAD;
9 | font-size: 14;
10 | margin: 0;
11 | padding: 0;
12 | }
13 |
--------------------------------------------------------------------------------
/src/app/settings/settings.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core'
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'
3 | import { RouterExtensions } from '@nativescript/angular'
4 |
5 | import { BeancountFileService, BeancountFilePathValidator } from '../shared/beancount-file.service'
6 | import { openFilePicker } from '../shared/beancount-file-picker'
7 | import { SideDrawerService } from '../shared/sidedrawer.service'
8 |
9 | @Component({
10 | selector: 'bc-settings',
11 | templateUrl: './settings.component.html',
12 | styleUrls: ['./settings.component.scss'],
13 | })
14 | export class SettingsComponent implements OnInit {
15 |
16 | form: FormGroup;
17 |
18 | constructor(
19 | private formBuilder: FormBuilder,
20 | private routerExtensions: RouterExtensions,
21 | private beancountFile: BeancountFileService,
22 | private sideDrawer: SideDrawerService,
23 | ) { }
24 |
25 | ngOnInit() {
26 | this.form = this.formBuilder.group({
27 | filePath: [
28 | this.beancountFile.path,
29 | [Validators.required, BeancountFilePathValidator()],
30 | ],
31 | })
32 | }
33 |
34 | openDrawer() {
35 | this.sideDrawer.open()
36 | }
37 |
38 | openFilePicker() {
39 | openFilePicker().then((filePath) => {
40 | this.form.controls.filePath.setValue(filePath)
41 | })
42 | }
43 |
44 | canSave(): boolean {
45 | return this.form.valid && !this.form.pristine
46 | }
47 |
48 | save() {
49 | const filePath = this.form.value.filePath
50 | this.beancountFile.setPath(filePath)
51 | this.routerExtensions.navigate(['/plaintext'])
52 | }
53 |
54 | reset() {
55 | this.beancountFile.reset()
56 | this.routerExtensions.navigate(['/welcome'], {
57 | clearHistory: true,
58 | })
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/app/shared/account.model.ts:
--------------------------------------------------------------------------------
1 | import { getDateStr } from './misc'
2 |
3 | export class Account {
4 |
5 | date: Date;
6 | name: string;
7 |
8 | constructor(options: any) {
9 | this.date = new Date(options.date)
10 | this.name = options.name
11 | }
12 |
13 | toBeancount(): string {
14 | const dateStr = getDateStr(this.date)
15 | return `${dateStr} open ${this.name}\n`
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/shared/balance.model.ts:
--------------------------------------------------------------------------------
1 | import { getDateStr } from './misc'
2 |
3 | export function evaluateArithmeticExpression(expression: string): number {
4 | return Number(eval(expression)) // eslint-disable-line no-eval
5 | }
6 |
7 | export class Balance {
8 | date: Date;
9 | account: string;
10 | amount: number;
11 | commodity: string;
12 |
13 | constructor(options: any) {
14 | this.date = new Date(options.date)
15 | this.account = options.account
16 | this.amount = evaluateArithmeticExpression(options.amount)
17 | this.commodity = options.commodity
18 | }
19 |
20 | toBeancount(): string {
21 | const dateStr = getDateStr(this.date)
22 | return `${dateStr} balance ${this.account} ${this.amount} ${this.commodity}\n`
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/app/shared/beancount-file-content.ts:
--------------------------------------------------------------------------------
1 | const DEFAULT_ROOT_ACCOUNTS = [
2 | 'Assets',
3 | 'Liabilities',
4 | 'Equity',
5 | 'Income',
6 | 'Expenses',
7 | ]
8 | export const COMMODITY_NAME_REGEXP = /^[A-Z]+$/
9 | const COMMODITY_REGEXP = /^[\d-]{10} commodity ([A-Z]+)$/umg
10 | const PAYEE_REGEXP = /^[\d-]{10} (txn|\*) "([^"]+)" ".*/umg
11 |
12 | function getOptionRegexp(name: string): RegExp {
13 | return new RegExp(`^option "${name}"\\s+"(.+)"`, 'um')
14 | }
15 |
16 | function getCustomOptionRegexp(name: string): RegExp {
17 | return new RegExp(
18 | `^[\\d-]{10} custom "(?:bcm_option|fava-option)" "${name}" "(.+)"`,
19 | 'um',
20 | )
21 | }
22 |
23 | function parseOptionArrayValue(value: string): any[] {
24 | const result = JSON.parse(value.replace(/'/g, '"'))
25 | if (!Array.isArray(result)) {
26 | throw new Error('Invalid option value.')
27 | }
28 | return result
29 | }
30 |
31 | function uniqueAndSortedByCount(items: string[]): string[] {
32 | // Count and remove duplicates
33 | const counts = items.reduce((result: {}, item: string) => {
34 | if (!result[item]) {
35 | result[item] = 1
36 | } else {
37 | result[item] += 1
38 | }
39 | return result
40 | }, {})
41 | return Object
42 | .keys(counts)
43 | .sort((v1: string, v2: string) => {
44 | return -(counts[v1] - counts[v2])
45 | })
46 | }
47 |
48 | export class BeancountFileContent {
49 |
50 | text: string;
51 |
52 | constructor(text: string) {
53 | this.text = text
54 | }
55 |
56 | private getRootAccounts(): string[] {
57 | return DEFAULT_ROOT_ACCOUNTS.map((name: string) => {
58 | const regexp = getOptionRegexp(`name_${name.toLowerCase()}`)
59 | const match = this.text.match(regexp)
60 | return match ? match[1] : name
61 | })
62 | }
63 |
64 | getTitle(): string {
65 | const regexp = getOptionRegexp('title')
66 | const match = this.text.match(regexp)
67 | return match ? match[1] : 'Untitled'
68 | }
69 |
70 | getOperatingCurrency(): string {
71 | const regexp = getOptionRegexp('operating_currency')
72 | const match = this.text.match(regexp)
73 | return match ? match[1] : ''
74 | }
75 |
76 | getTransactionFlags(): string[] {
77 | const regexp = getCustomOptionRegexp('transaction_flags')
78 | const match = this.text.match(regexp)
79 | if (match) {
80 | try {
81 | return parseOptionArrayValue(match[1])
82 | } catch {
83 | }
84 | }
85 | return ['*', '!']
86 | }
87 |
88 | getAccountOrder(): string {
89 | const regexp = getCustomOptionRegexp('account_order')
90 | const match = this.text.match(regexp)
91 | return match ? match[1] : 'from_to'
92 | }
93 |
94 | getIndentation(): number {
95 | const regexp = getCustomOptionRegexp('indent')
96 | const match = this.text.match(regexp)
97 | if (match) {
98 | try {
99 | return parseInt(match[1])
100 | } catch {
101 | }
102 | }
103 | return 4
104 | }
105 |
106 | getAccountNameRegexp(): RegExp {
107 | const roots = this.getRootAccounts().join('|')
108 | // Currently there is no support for \p{L}, so we use [^\s]
109 | // https://github.com/microsoft/TypeScript/issues/32214
110 | return new RegExp(`^(${roots}):[^\\s]+[^\\s:]$`)
111 | }
112 |
113 | getAccounts(): string[] {
114 | const roots = this.getRootAccounts().join('|')
115 | const accountRegexp = new RegExp(
116 | `\\s+((${roots}):[^\\s]+[^\\s:])(\\s|$)`,
117 | 'umg',
118 | )
119 | // No support for matchAll in TypeScript
120 | // https://stackoverflow.com/questions/55499555/
121 | const matches = this.text['matchAll'](accountRegexp)
122 | const accounts = Array.from(matches, (match) => match[1])
123 | return uniqueAndSortedByCount(accounts)
124 | }
125 |
126 | getCommodities(): string[] {
127 | const matches = this.text['matchAll'](COMMODITY_REGEXP)
128 | const commodities = Array
129 | .from(matches, (match) => match[1])
130 | .sort()
131 | return commodities
132 | }
133 |
134 | getPayees(): string[] {
135 | const matches = this.text['matchAll'](PAYEE_REGEXP)
136 | const payees = Array.from(matches, (match) => match[2])
137 | return uniqueAndSortedByCount(payees)
138 | }
139 |
140 | append(text: string): void {
141 | let prefix
142 | if (this.text.endsWith('\n\n')) {
143 | prefix = ''
144 | } else if (this.text.endsWith('\n')) {
145 | prefix = '\n'
146 | } else {
147 | prefix = '\n\n'
148 | }
149 | this.text += `${prefix}${text}`
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/src/app/shared/beancount-file-picker.ts:
--------------------------------------------------------------------------------
1 | import { ImageAsset } from '@nativescript/core/image-asset'
2 | import { alert } from '@nativescript/core/ui/dialogs'
3 | import { ImagePicker, ImagePickerMediaType } from '@nativescript/imagepicker'
4 |
5 | class FilePicker extends ImagePicker {
6 |
7 | get mimeTypes() {
8 | const mimeTypes = Array.create(java.lang.String, 1) // eslint-disable-line no-undef
9 | mimeTypes[0] = '*/*'
10 | return mimeTypes
11 | }
12 | }
13 |
14 | export function openFilePicker(): Promise {
15 | const filePicker = new FilePicker({
16 | mode: 'single',
17 | mediaType: ImagePickerMediaType.Any,
18 | showAdvanced: true,
19 | })
20 | return filePicker.authorize()
21 | .then(() => filePicker.present())
22 | .then((selection: ImageAsset[]) => {
23 | const filePath = selection[0].android
24 | if (!filePath) {
25 | alert('Failed to access the selected file.')
26 | }
27 | return filePath
28 | })
29 | .catch((error) => {
30 | if (error.message === 'Image picker activity result code 0') {
31 | // Picker has been cancelled
32 | return null
33 | } else {
34 | throw error
35 | }
36 | })
37 | }
38 |
--------------------------------------------------------------------------------
/src/app/shared/beancount-file.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable, OnDestroy, NgZone } from '@angular/core'
2 | import { AbstractControl, ValidatorFn } from '@angular/forms'
3 |
4 | import * as appSettings from '@nativescript/core/application-settings'
5 | import { File, Folder } from '@nativescript/core/file-system'
6 | import { isAndroid } from '@nativescript/core/platform'
7 |
8 | import { Subject, Subscription, interval } from 'rxjs'
9 | import * as permissions from 'nativescript-permissions'
10 |
11 | import { BEANCOUNT_PATH_SETTING } from './constants'
12 | import { BeancountFileContent } from './beancount-file-content'
13 |
14 | const BEANCOUNT_FILE_WATCH_INTERVAL = 60 * 1000
15 |
16 | @Injectable({
17 | providedIn: 'root',
18 | })
19 | export class BeancountFileService implements OnDestroy {
20 |
21 | path: string;
22 | content: BeancountFileContent; // Cached content
23 | contentStream: Subject;
24 | watcher: Subscription;
25 | isLoading = false;
26 |
27 | constructor(
28 | private zone: NgZone,
29 | ) {
30 | this.path = appSettings.getString(BEANCOUNT_PATH_SETTING)
31 | this.contentStream = new Subject()
32 | // Initial load
33 | if (this.path) {
34 | this.load()
35 | }
36 | // Periodic reload
37 | this.watcher = interval(BEANCOUNT_FILE_WATCH_INTERVAL).subscribe(() => {
38 | if (!this.path) {
39 | // No path to watch
40 | return
41 | }
42 | this.watcherLoad()
43 | })
44 | }
45 |
46 | static isValidPath(path: string): boolean {
47 | if (path && File.exists(path) && !Folder.exists(path)) {
48 | return true
49 | }
50 | return false
51 | }
52 |
53 | setPath(path: string) {
54 | if (!path) {
55 | throw Error('Path can not be empty.')
56 | }
57 | appSettings.setString(BEANCOUNT_PATH_SETTING, path)
58 | this.path = path
59 | this.clearCache()
60 | }
61 |
62 | private async checkPermission(): Promise {
63 | let hasPermission = true
64 | if (isAndroid) {
65 | const permissionName = 'android.permission.WRITE_EXTERNAL_STORAGE'
66 | hasPermission = permissions.hasPermission(permissionName)
67 | if (!hasPermission) {
68 | try {
69 | const result = await permissions.requestPermission(
70 | permissionName,
71 | 'Your permission is required.',
72 | )
73 | hasPermission = result[permissionName]
74 | } catch (error) {
75 | console.warn('permission denied')
76 | hasPermission = false
77 | }
78 | }
79 | }
80 | return hasPermission
81 | }
82 |
83 | private clearCache(): void {
84 | delete this.content
85 | }
86 |
87 | private async read(): Promise {
88 | this.isLoading = true
89 | let fileText
90 | const hasPermission = await this.checkPermission()
91 | if (hasPermission) {
92 | const file = File.fromPath(this.path)
93 | fileText = await file.readText()
94 | if (fileText.charCodeAt(fileText.length - 1) !== 10) {
95 | // File.writeText may strip newline at the and of file
96 | // Add it on every read to avoid unnecessary reloading by watcher
97 | fileText += '\n'
98 | }
99 | } else {
100 | // No permission; return empty string
101 | fileText = ''
102 | }
103 | this.zone.run(() => {
104 | this.isLoading = false
105 | })
106 | return fileText
107 | }
108 |
109 | async load(force = false): Promise {
110 | if (force || this.content === undefined) {
111 | const fileText = await this.read()
112 | this.content = new BeancountFileContent(fileText)
113 | }
114 | this.contentStream.next(this.content)
115 | return this.content
116 | }
117 |
118 | private async watcherLoad() {
119 | const fileText = await this.read()
120 | if (!this.content || this.content.text !== fileText) {
121 | // Content changed; update cache and send to stream
122 | this.content = new BeancountFileContent(fileText)
123 | this.contentStream.next(this.content)
124 | }
125 | }
126 |
127 | append(text: string) {
128 | this.content.append(text)
129 | this.save()
130 | }
131 |
132 | async save(): Promise {
133 | const file = File.fromPath(this.path)
134 | try {
135 | await file.writeText(this.content.text)
136 | } catch (error) {
137 | console.warn('file not saved:', error)
138 | }
139 | }
140 |
141 | reset() {
142 | appSettings.remove(BEANCOUNT_PATH_SETTING)
143 | delete this.path
144 | this.clearCache()
145 | }
146 |
147 | ngOnDestroy(): void {
148 | // Stop file watcher when service is destroyed
149 | this.watcher.unsubscribe()
150 | }
151 |
152 | }
153 |
154 | export function BeancountFilePathValidator(): ValidatorFn {
155 | return (control: AbstractControl): {[key: string]: any} | null => {
156 | const path = control.value
157 | if (!BeancountFileService.isValidPath(path)) {
158 | return {
159 | invalidPath: {
160 | value: control.value,
161 | },
162 | }
163 | } else {
164 | return null
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/src/app/shared/commodity.model.ts:
--------------------------------------------------------------------------------
1 | import { getDateStr } from './misc'
2 |
3 | export class Commodity {
4 |
5 | date: Date;
6 | name: string;
7 |
8 | constructor(options: any) {
9 | this.date = new Date(options.date)
10 | this.name = options.name
11 | }
12 |
13 | toBeancount(): string {
14 | const dateStr = getDateStr(this.date)
15 | return `${dateStr} commodity ${this.name}\n`
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/app/shared/constants.ts:
--------------------------------------------------------------------------------
1 | export const APP_NAME = 'Beancount Mobile'
2 | export const BEANCOUNT_PATH_SETTING = 'beancountFilePath'
3 |
4 | export const ACTION_BAR_BUTTON_COLOR = '#E2E9F0'
5 |
6 | export const AFTERVIEWINIT_DELAY = 100
7 |
--------------------------------------------------------------------------------
/src/app/shared/date-picker.ts:
--------------------------------------------------------------------------------
1 | import { ModalDatetimepicker } from 'nativescript-modal-datetimepicker'
2 |
3 | export function showDatePicker(): Promise {
4 | const picker = new ModalDatetimepicker()
5 | return picker.pickDate({
6 | title: 'Select date',
7 | theme: 'light',
8 | maxDate: new Date(),
9 | }).then((result) => {
10 | if (!result) {
11 | throw new Error('Picker cancelled')
12 | }
13 | const date = new Date(Date.UTC(result.year, result.month - 1, result.day))
14 | return date
15 | })
16 | }
17 |
--------------------------------------------------------------------------------
/src/app/shared/misc.ts:
--------------------------------------------------------------------------------
1 | import { Observable } from 'rxjs'
2 | import { getNativeApplication } from '@nativescript/core/application'
3 | import { ActionBar } from '@nativescript/core/ui/action-bar'
4 | import { TextField } from '@nativescript/core/ui/text-field'
5 | import { Color } from '@nativescript/core/color'
6 | import { ad } from '@nativescript/core/utils/utils'
7 |
8 | import { AFTERVIEWINIT_DELAY } from '../shared/constants'
9 |
10 | export function getDateStr(date: Date): string {
11 | const year = date.getFullYear()
12 | const month = ((date.getMonth() + 1 < 10) ? '0' : '') + (date.getMonth() + 1)
13 | const day = ((date.getDate() < 10) ? '0' : '') + date.getDate()
14 | return `${year}-${month}-${day}`
15 | }
16 |
17 | export function getTodayStr(): string {
18 | return getDateStr(new Date())
19 | }
20 |
21 | export function showKeyboard(textField: TextField): void {
22 | // Show keyboard on init (this function must be called in ngAfterViewInit hook)
23 | // Timeout is required:
24 | // https://discourse.nativescript.org/t/having-trouble-getting-focus-to-work-on-textfield/1098/3
25 | // https://stackoverflow.com/a/52008858/1868395
26 | setTimeout(() => {
27 | textField.focus()
28 | }, AFTERVIEWINIT_DELAY)
29 | }
30 |
31 | export function getColor(name: string): Color {
32 | const app = getNativeApplication()
33 | const resources = app.getResources()
34 | const colorId = resources.getIdentifier(name, 'color', app.getPackageName())
35 | const color = new Color(resources.getColor(colorId))
36 | return color
37 | }
38 |
39 | export function getAppVersion(): string {
40 | // https://github.com/EddyVerbruggen/nativescript-appversion
41 | const context = ad.getApplicationContext()
42 | const packageManager = context.getPackageManager()
43 | return packageManager.getPackageInfo(context.getPackageName(), 0).versionName
44 | }
45 |
46 | export function setIconColor(
47 | icon: any,
48 | color: string | null,
49 | ) {
50 | // https://github.com/NativeScript/NativeScript/issues/5536#issuecomment-373284855
51 | if (color === null) {
52 | icon.setColorFilter(null)
53 | } else {
54 | icon.setColorFilter(
55 | android.graphics.Color.parseColor(color),
56 | android.graphics.PorterDuff.Mode.SRC_ATOP,
57 | )
58 | }
59 | }
60 |
61 | export function configureSaveButton(
62 | actionBar: ActionBar,
63 | statusChanges: Observable,
64 | ) {
65 | // Workaround for https://github.com/NativeScript/NativeScript/issues/8211
66 | statusChanges.subscribe(() => {
67 | // Delay update so it will be done after class toggle
68 | setTimeout(() => {
69 | actionBar.update()
70 | }, 0)
71 | })
72 | }
73 |
--------------------------------------------------------------------------------
/src/app/shared/sidedrawer.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable, NgZone } from '@angular/core'
2 | import { RouterExtensions } from '@nativescript/angular'
3 |
4 | import { android as androidApplication } from '@nativescript/core/application'
5 | import { Color } from '@nativescript/core/color'
6 | import { TnsSideDrawerClass } from 'nativescript-foss-sidedrawer'
7 |
8 | import { APP_NAME } from './constants'
9 | import { getAppVersion } from './misc'
10 |
11 | // https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html
12 | const LOCK_MODE_LOCKED_CLOSED = 1
13 | const LOCK_MODE_UNDEFINED = 3
14 |
15 | declare let com: any
16 |
17 | class CustomSideDrawerClass extends TnsSideDrawerClass {
18 |
19 | drawer: any;
20 |
21 | build(opts: any) {
22 | const activity: android.app.Activity = androidApplication.foregroundActivity
23 |
24 | const profile = new com.mikepenz.materialdrawer.model.ProfileDrawerItem()
25 | profile.withName(opts.title)
26 | profile.withEmail(opts.subtitle)
27 |
28 | const bg = android.graphics.Bitmap.createBitmap(8, 8, android.graphics.Bitmap.Config.ARGB_8888)
29 | bg.eraseColor(opts.headerBackgroundColor.android)
30 |
31 | const header = new com.mikepenz.materialdrawer.AccountHeaderBuilder()
32 | header.withActivity(activity)
33 | header.withHeaderBackground(new com.mikepenz.materialdrawer.holder.ImageHolder(bg))
34 | header.addProfiles([profile])
35 | header.withProfileImagesVisible(false)
36 | header.withSelectionListEnabledForSingleProfile(false)
37 | header.withProfileImagesClickable(false)
38 | header.withTextColor(opts.headerTextColor.android)
39 |
40 | const items = opts.templates.map((template, index) => {
41 | const item = new com.mikepenz.materialdrawer.model.PrimaryDrawerItem()
42 | item.withIdentifier(index)
43 | item.withName(template.title)
44 | item.withTextColor(opts.textColor.android)
45 | item.withSelectedColor(opts.selectedColor.android)
46 | item.withSelectedTextColor(opts.selectedTextColor.android)
47 | return item
48 | })
49 |
50 | const drawer = new com.mikepenz.materialdrawer.DrawerBuilder()
51 | drawer.withActivity(activity)
52 | drawer.withAccountHeader(header.build())
53 | drawer.withSliderBackgroundColor(opts.backgroundColor.android)
54 | drawer.addDrawerItems(items)
55 | drawer.withSelectedItem(-1)
56 | drawer.withOnDrawerItemClickListener(new com.mikepenz.materialdrawer.Drawer.OnDrawerItemClickListener({
57 | onItemClick: (view: android.view.View, index: number): boolean => {
58 | opts.listener(index - 1)
59 | return false
60 | },
61 | }))
62 | this.drawer = drawer.build()
63 | }
64 | }
65 |
66 | @Injectable({
67 | providedIn: 'root',
68 | })
69 | export class SideDrawerService {
70 |
71 | private navigationMenu = [
72 | {
73 | title: 'File content',
74 | url: '/plaintext',
75 | }, {
76 | title: 'Settings',
77 | url: '/settings',
78 | }, {
79 | title: 'About',
80 | url: '/about',
81 | },
82 | ];
83 | private drawer: CustomSideDrawerClass;
84 | loaded: Promise;
85 |
86 | constructor(
87 | private ngZone: NgZone,
88 | private routerExtensions: RouterExtensions,
89 | ) {
90 | this.drawer = new CustomSideDrawerClass()
91 |
92 | const config = {
93 | templates: this.navigationMenu,
94 | title: APP_NAME,
95 | subtitle: `v${getAppVersion()}`,
96 | headerBackgroundColor: new Color('#255C8C'), // $main-color
97 | backgroundColor: new Color('#255C8C'), // $main-color
98 | headerTextColor: new Color('#E2E9F0'), // $main-text-color
99 | textColor: new Color('#E2E9F0'), // $main-text-color
100 | selectedColor: new Color('#255C8C'), // $main-color
101 | selectedTextColor: new Color('#F49D96'), // $secondary-color
102 | listener: (index: number) => {
103 | const url = this.navigationMenu[index].url
104 | // Use NgZone because this is a callback from external JS library
105 | this.ngZone.run(() => {
106 | this.routerExtensions.navigateByUrl(url)
107 | })
108 | },
109 | }
110 | this.loaded = new Promise((resolve) => {
111 | // https://gitlab.com/burke-software/nativescript-foss-sidedrawer/issues/2
112 | setTimeout(() => {
113 | this.drawer.build(config)
114 | resolve()
115 | }, 0)
116 | })
117 | }
118 |
119 | private get nativeDrawer(): any {
120 | return (this.drawer as any).drawer
121 | }
122 |
123 | open() {
124 | this.drawer.open()
125 | }
126 |
127 | async lock() {
128 | await this.loaded
129 | const layout = this.nativeDrawer.getDrawerLayout()
130 | layout.setDrawerLockMode(LOCK_MODE_LOCKED_CLOSED)
131 | }
132 |
133 | async unlock() {
134 | await this.loaded
135 | const layout = this.nativeDrawer.getDrawerLayout()
136 | layout.setDrawerLockMode(LOCK_MODE_UNDEFINED)
137 | }
138 |
139 | }
140 |
--------------------------------------------------------------------------------
/src/app/shared/transaction.model.ts:
--------------------------------------------------------------------------------
1 | import { getDateStr } from './misc'
2 |
3 | export function evaluateArithmeticExpression(expression: string): number {
4 | return Number(eval(expression)) // eslint-disable-line no-eval
5 | }
6 |
7 | interface TransactionData {
8 | date: string;
9 | flag: string;
10 | amount: string;
11 | commodity: string;
12 | accountFrom: string;
13 | accountTo: string;
14 | payee: string;
15 | narration: string;
16 | swapFromToAccounts: boolean;
17 | }
18 |
19 | export class Transaction {
20 |
21 | date: Date;
22 | flag: string;
23 | payee: string;
24 | narration: string;
25 | postings: {
26 | account: string;
27 | amount: number;
28 | commodity: string;
29 | }[];
30 |
31 | constructor(data: TransactionData) {
32 | this.date = new Date(data.date)
33 | this.flag = data.flag || 'txn'
34 | this.payee = data.payee
35 | this.narration = data.narration
36 | const amount = evaluateArithmeticExpression(data.amount)
37 | this.postings = [{
38 | account: data.accountFrom,
39 | amount: -amount,
40 | commodity: data.commodity,
41 | }, {
42 | account: data.accountTo,
43 | amount: amount,
44 | commodity: data.commodity,
45 | }]
46 | if (data.swapFromToAccounts) {
47 | this.postings.reverse()
48 | }
49 | }
50 |
51 | toBeancount(indentation: number): string {
52 | const dateStr = getDateStr(this.date)
53 | let result = `${dateStr} ${this.flag}`
54 | if (this.payee) {
55 | result += ` "${this.payee}"`
56 | }
57 | result += ` "${this.narration}"\n`
58 | for (const posting of this.postings) {
59 | result += `${' '.repeat(indentation)}${posting.account} ${posting.amount} ${posting.commodity}\n`
60 | }
61 | return result
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/app/shared/validators.ts:
--------------------------------------------------------------------------------
1 | import { AbstractControl, ValidatorFn } from '@angular/forms'
2 |
3 | export function UniqueValidator(uniqueList: any[]): ValidatorFn {
4 | return (control: AbstractControl): {[key: string]: any} | null => {
5 | if (uniqueList.indexOf(control.value) !== -1) {
6 | return {
7 | nonUnique: {
8 | value: control.value,
9 | },
10 | }
11 | }
12 | }
13 | }
14 |
15 | export function ListValidator(allowList: any[]): ValidatorFn {
16 | return (control: AbstractControl): {[key: string]: any} | null => {
17 | if (allowList.indexOf(control.value) === -1) {
18 | return {
19 | notInList: {
20 | value: control.value,
21 | },
22 | }
23 | }
24 | }
25 | }
26 |
27 | export function validateDate(control: AbstractControl): {[key: string]: any} | null {
28 | if (!/^\d{4}-\d{2}-\d{2}$/.test(control.value)) {
29 | return {
30 | invalid: {
31 | value: control.value,
32 | },
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/app/transaction-form/account-modal/account-modal.component.html:
--------------------------------------------------------------------------------
1 |
2 |
6 |
13 |
14 | 0"
16 | class="list"
17 | [items]="accounts"
18 | >
19 |
20 |
25 |
26 |
27 |
28 |
33 |
34 |
40 |
41 |
--------------------------------------------------------------------------------
/src/app/transaction-form/account-modal/account-modal.component.scss:
--------------------------------------------------------------------------------
1 | .list {
2 | height: 120;
3 | margin: 20 0;
4 | }
5 |
6 | .list-item {
7 | color: #747474;
8 | }
9 |
--------------------------------------------------------------------------------
/src/app/transaction-form/account-modal/account-modal.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, AfterViewInit, ViewChild, ElementRef } from '@angular/core'
2 | import { FormControl } from '@angular/forms'
3 | import { ModalDialogParams } from '@nativescript/angular'
4 |
5 | import { showKeyboard } from '../../shared/misc'
6 | import { ListValidator } from '../../shared/validators'
7 |
8 | @Component({
9 | selector: 'bc-account-modal',
10 | templateUrl: './account-modal.component.html',
11 | styleUrls: ['./account-modal.component.scss'],
12 | })
13 | export class AccountModalComponent implements AfterViewInit {
14 |
15 | @ViewChild('accountField', {static: false})
16 | accountField: ElementRef;
17 |
18 | account: FormControl;
19 | accounts: string[];
20 |
21 | constructor(private modalParams: ModalDialogParams) {
22 | this.accounts = modalParams.context
23 | this.account = new FormControl('', [
24 | ListValidator(this.accounts),
25 | ])
26 | }
27 |
28 | ngAfterViewInit(): void {
29 | showKeyboard(this.accountField.nativeElement)
30 | }
31 |
32 | filterAccounts(): void {
33 | const regexp = new RegExp(this.account.value, 'iu')
34 | this.accounts = this.modalParams.context.filter((account) => {
35 | return account.search(regexp) !== -1
36 | }).sort()
37 | }
38 |
39 | onAccountTap(account: string): void {
40 | if (account === this.account.value) {
41 | // Item already selected, close modal on second tap
42 | this.select()
43 | } else {
44 | this.account.setValue(account)
45 | // Move cursor to the end of string
46 | this.accountField.nativeElement.android.setSelection(account.length)
47 | }
48 | }
49 |
50 | select(): void {
51 | this.modalParams.closeCallback(this.account.value)
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/app/transaction-form/commodity-modal/commodity-modal.component.html:
--------------------------------------------------------------------------------
1 |
2 |
6 | 0"
8 | class="list"
9 | [items]="commodities"
10 | >
11 |
12 |
17 |
18 |
19 |
25 |
26 |
--------------------------------------------------------------------------------
/src/app/transaction-form/commodity-modal/commodity-modal.component.scss:
--------------------------------------------------------------------------------
1 | .modal {
2 | margin: 20 30;
3 | }
4 |
5 | .modal-header {
6 | margin-bottom: 10;
7 | }
8 |
9 | .list {
10 | height: 350;
11 | }
12 |
--------------------------------------------------------------------------------
/src/app/transaction-form/commodity-modal/commodity-modal.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core'
2 |
3 | import { ModalDialogParams } from '@nativescript/angular'
4 |
5 | @Component({
6 | selector: 'bc-commodity-modal',
7 | templateUrl: './commodity-modal.component.html',
8 | styleUrls: ['./commodity-modal.component.scss'],
9 | })
10 | export class CommodityModalComponent {
11 |
12 | commodities: string[]; selectedIndex: number;
13 |
14 | constructor(private modalParams: ModalDialogParams) {
15 | this.commodities = modalParams.context
16 | }
17 |
18 | select(commodity: string): void {
19 | this.modalParams.closeCallback(commodity)
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/transaction-form/payee-modal/payee-modal.component.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
12 |
13 | 0"
15 | class="list"
16 | [items]="payees"
17 | >
18 |
19 |
24 |
25 |
26 |
27 |
32 |
38 |
39 |
--------------------------------------------------------------------------------
/src/app/transaction-form/payee-modal/payee-modal.component.scss:
--------------------------------------------------------------------------------
1 | .list {
2 | height: 120;
3 | margin: 20 0;
4 | }
5 |
6 | .list-item {
7 | color: #747474;
8 | }
9 |
--------------------------------------------------------------------------------
/src/app/transaction-form/payee-modal/payee-modal.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, AfterViewInit, ViewChild, ElementRef } from '@angular/core'
2 | import { FormControl, Validators } from '@angular/forms'
3 | import { ModalDialogParams } from '@nativescript/angular'
4 |
5 | import { showKeyboard } from '../../shared/misc'
6 |
7 | @Component({
8 | selector: 'bc-payee-modal',
9 | templateUrl: './payee-modal.component.html',
10 | styleUrls: ['./payee-modal.component.scss'],
11 | })
12 | export class PayeeModalComponent implements AfterViewInit {
13 |
14 | @ViewChild('payeeField', {static: false})
15 | payeeField: ElementRef;
16 |
17 | payee: FormControl;
18 | payees: string[];
19 |
20 | constructor(private modalParams: ModalDialogParams) {
21 | this.payee = new FormControl('', Validators.required)
22 | this.payees = modalParams.context
23 | }
24 |
25 | ngAfterViewInit(): void {
26 | showKeyboard(this.payeeField.nativeElement)
27 | }
28 |
29 | filterPayees(): void {
30 | const regexp = new RegExp(this.payee.value, 'iu')
31 | const filtered = this.modalParams.context.filter((payee) => {
32 | return payee.search(regexp) !== -1
33 | }).sort()
34 | this.payees = filtered
35 | }
36 |
37 | onPayeeTap(payee: string): void {
38 | if (payee === this.payee.value) {
39 | // Item already selected, close modal on second tap
40 | this.select()
41 | } else {
42 | this.payee.setValue(payee)
43 | // Move cursor to the end of string
44 | this.payeeField.nativeElement.android.setSelection(payee.length)
45 | }
46 | }
47 |
48 | select(): void {
49 | this.modalParams.closeCallback(this.payee.value)
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/app/transaction-form/transaction-form.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
32 |
37 |
38 |
39 |
40 |
45 |
54 |
62 |
63 |
64 |
65 |
70 |
77 |
82 |
83 |
84 |
88 |
93 |
100 |
105 |
106 |
107 |
111 |
116 |
123 |
128 |
129 |
130 |
131 |
136 |
143 |
148 |
149 |
150 |
151 |
156 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/src/app/transaction-form/transaction-form.component.scss:
--------------------------------------------------------------------------------
1 | #amount-field {
2 | font-size: 28;
3 | }
4 |
5 | #flag-field {
6 | font-family: monospace;
7 | font-weight: bold;
8 | min-width: 50;
9 | padding-right: 5;
10 | width: auto;
11 | }
12 |
--------------------------------------------------------------------------------
/src/app/transaction-form/transaction-form.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, AfterViewInit, ViewChild, ElementRef, ViewContainerRef } from '@angular/core'
2 | import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms'
3 | import { ModalDialogOptions, ModalDialogService, RouterExtensions } from '@nativescript/angular'
4 |
5 | import { isAndroid } from '@nativescript/core/platform'
6 | import { TextField } from '@nativescript/core/ui/text-field'
7 | import { ad as androidUtils } from '@nativescript/core/utils/utils'
8 |
9 | import { showDatePicker } from '../shared/date-picker'
10 | import { Transaction, evaluateArithmeticExpression } from '../shared/transaction.model'
11 | import { BeancountFileService } from '../shared/beancount-file.service'
12 | import { AccountModalComponent } from './account-modal/account-modal.component'
13 | import { CommodityModalComponent } from './commodity-modal/commodity-modal.component'
14 | import { PayeeModalComponent } from './payee-modal/payee-modal.component'
15 | import { getDateStr, getTodayStr, showKeyboard, configureSaveButton } from '../shared/misc'
16 | import { AFTERVIEWINIT_DELAY } from '../shared/constants'
17 | import { ListValidator, validateDate } from '../shared/validators'
18 |
19 | function validateAmount(control: AbstractControl): {[key: string]: any} | null {
20 | const error = {invalidExpression: {value: control.value}}
21 | let amount
22 | try {
23 | amount = evaluateArithmeticExpression(control.value)
24 | } catch {
25 | return error
26 | }
27 | if (isNaN(amount) || amount <= 0) {
28 | return error
29 | }
30 | }
31 |
32 | @Component({
33 | selector: 'bc-transaction-form',
34 | templateUrl: './transaction-form.component.html',
35 | styleUrls: ['./transaction-form.component.scss'],
36 | })
37 | export class TransactionFormComponent implements OnInit, AfterViewInit {
38 |
39 | form: FormGroup;
40 | flags: string[] = [];
41 | accounts: string[] = [];
42 | commodities: string[] = [];
43 | payees: string[] = [];
44 |
45 | swapFromToAccounts: boolean;
46 | showValidationErrors = false;
47 |
48 | amountFieldKeyboardType = 'number';
49 |
50 | @ViewChild('descriptionField', {static: false})
51 | descriptionField: ElementRef;
52 |
53 | constructor(
54 | private formBuilder: FormBuilder,
55 | private modalService: ModalDialogService,
56 | private viewContainerRef: ViewContainerRef,
57 | private routerExtensions: RouterExtensions,
58 | private beancountFile: BeancountFileService,
59 | ) {
60 | this.flags = this.beancountFile.content.getTransactionFlags()
61 | this.swapFromToAccounts = this.beancountFile.content.getAccountOrder() === 'to_from'
62 |
63 | this.accounts = this.beancountFile.content.getAccounts()
64 | this.commodities = this.beancountFile.content.getCommodities()
65 | this.payees = this.beancountFile.content.getPayees()
66 | }
67 |
68 | ngOnInit() {
69 | const defaultCurrency = this.beancountFile.content.getOperatingCurrency()
70 | this.form = this.formBuilder.group({
71 | date: [
72 | getTodayStr(),
73 | [Validators.required, validateDate],
74 | ],
75 | flag: [
76 | this.flags[0],
77 | ListValidator(this.flags),
78 | ],
79 | amount: [
80 | '',
81 | [Validators.required, validateAmount],
82 | ],
83 | commodity: [
84 | defaultCurrency,
85 | Validators.required,
86 | ],
87 | accountFrom: [
88 | '',
89 | Validators.required,
90 | ],
91 | accountTo: [
92 | '',
93 | Validators.required,
94 | ],
95 | payee: [
96 | '',
97 | Validators.maxLength(50),
98 | ],
99 | narration: [
100 | '',
101 | Validators.maxLength(100),
102 | ],
103 | })
104 | }
105 |
106 | ngAfterViewInit(): void {
107 | setTimeout(() => {
108 | if (isAndroid) {
109 | // Fix autosuggestion
110 | const descriptionField = this.descriptionField.nativeElement.android
111 | const inputType = descriptionField.getInputType()
112 | descriptionField.setInputType(
113 | inputType ^ android.text.InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE,
114 | )
115 | }
116 | }, AFTERVIEWINIT_DELAY)
117 | }
118 |
119 | onActionBarLoaded(event) {
120 | const actionBar = event.object
121 | configureSaveButton(actionBar, this.form.statusChanges)
122 | }
123 |
124 | onAmountFieldLoaded(event) {
125 | const amountField = event.object as TextField
126 | showKeyboard(amountField)
127 | }
128 |
129 | hasError(fieldName: string): boolean {
130 | const field = this.form.get(fieldName)
131 | return this.showValidationErrors && field.invalid
132 | }
133 |
134 | enableArithmeticExpressions() {
135 | this.amountFieldKeyboardType = 'phone'
136 | }
137 |
138 | hideKeyboard() {
139 | androidUtils.dismissSoftInput()
140 | }
141 |
142 | changeTransactionFlag() {
143 | const index = this.flags.indexOf(this.form.controls.flag.value)
144 | const nextIndex = index < this.flags.length - 1 ? index + 1 : 0
145 | const nextFlag = this.flags[nextIndex]
146 | this.form.controls.flag.setValue(nextFlag)
147 | }
148 |
149 | showDatePicker(): void {
150 | showDatePicker().then((date: Date) => {
151 | this.form.controls.date.setValue(getDateStr(date))
152 | }).catch((error) => {
153 | console.warn(error)
154 | })
155 | }
156 |
157 | get account1Name(): string {
158 | return this.swapFromToAccounts ? 'accountTo' : 'accountFrom'
159 | }
160 |
161 | get account2Name(): string {
162 | return this.swapFromToAccounts ? 'accountFrom' : 'accountTo'
163 | }
164 |
165 | get account1Label(): string {
166 | return this.swapFromToAccounts ? 'To account' : 'From account'
167 | }
168 |
169 | get account2Label(): string {
170 | return this.swapFromToAccounts ? 'From account' : 'To account'
171 | }
172 |
173 | showAccountPicker(fieldName: string): void {
174 | const options: ModalDialogOptions = {
175 | viewContainerRef: this.viewContainerRef,
176 | context: this.accounts,
177 | }
178 | this.modalService.showModal(AccountModalComponent, options).then((account: string) => {
179 | if (account) {
180 | this.form.controls[fieldName].setValue(account)
181 | }
182 | })
183 | }
184 |
185 | showCommodityPicker(): void {
186 | const options: ModalDialogOptions = {
187 | viewContainerRef: this.viewContainerRef,
188 | context: this.commodities,
189 | }
190 | this.modalService.showModal(CommodityModalComponent, options).then((commodity: string) => {
191 | if (commodity) {
192 | this.form.controls.commodity.setValue(commodity)
193 | }
194 | })
195 | }
196 |
197 | showPayeePicker(): void {
198 | const options: ModalDialogOptions = {
199 | viewContainerRef: this.viewContainerRef,
200 | context: this.payees,
201 | }
202 | this.modalService.showModal(PayeeModalComponent, options).then((payee: string) => {
203 | if (payee) {
204 | this.form.controls.payee.setValue(payee)
205 | }
206 | })
207 | }
208 |
209 | goBack() {
210 | this.routerExtensions.backToPreviousPage()
211 | }
212 |
213 | save(): void {
214 | if (!this.form.valid) {
215 | this.showValidationErrors = true
216 | return
217 | }
218 | const transaction = new Transaction({
219 | ...this.form.value,
220 | swapFromToAccounts: this.swapFromToAccounts,
221 | })
222 | const indentation = this.beancountFile.content.getIndentation()
223 | const beancountTxn = transaction.toBeancount(indentation)
224 | this.beancountFile.append(beancountTxn)
225 | this.routerExtensions.navigate(['/plaintext', {scroll: 'bottom'}])
226 | }
227 |
228 | }
229 |
--------------------------------------------------------------------------------
/src/app/welcome/welcome.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
14 |
21 |
22 |
27 |
31 |
32 |
33 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/app/welcome/welcome.component.scss:
--------------------------------------------------------------------------------
1 | @import '../../app-variables';
2 |
3 | .page {
4 | background: linear-gradient(to bottom, #205081, #236E8C);
5 | }
6 |
7 | $welcome-text-color: #A6C0CF;
8 |
9 | .welcome-label {
10 | color: $welcome-text-color;
11 | font-size: 16;
12 | letter-spacing: 0.04;
13 | margin-bottom: 0;
14 | }
15 |
16 | #welcome-title {
17 | color: #FFF;
18 | font-size: 46;
19 | font-weight: 300;
20 | margin-bottom: 16;
21 | }
22 |
23 | #welcome-text {
24 | margin-bottom: 16;
25 | }
26 |
27 | #file-path-input {
28 | border-bottom-width: 1;
29 | border-color: $welcome-text-color;
30 | color: $welcome-text-color;
31 | font-size: 16;
32 | margin-bottom: 8;
33 | padding-bottom: 1;
34 | }
35 |
36 | .btn {
37 | background-color: #F7F4D3;
38 | border-radius: 15;
39 | color: $button-color;
40 | height: 48;
41 | margin: 8 0;
42 | }
43 |
44 | .btn-highlighted {
45 | background-color: $secondary-color;
46 | }
47 |
48 | .btn-disabled {
49 | background-color: #F7F7F7;
50 | color: #999999;
51 | }
52 |
--------------------------------------------------------------------------------
/src/app/welcome/welcome.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit, NgZone, ViewChild, ElementRef } from '@angular/core'
2 | import { RouterExtensions } from '@nativescript/angular'
3 |
4 | import { openUrl } from '@nativescript/core/utils/utils'
5 | import { Page } from '@nativescript/core/ui/page'
6 | import { Color } from '@nativescript/core/color'
7 |
8 | import { BeancountFileService } from '../shared/beancount-file.service'
9 | import { openFilePicker } from '../shared/beancount-file-picker'
10 | import { SideDrawerService } from '../shared/sidedrawer.service'
11 |
12 | const BEANCOUNT_WEBSITE = 'https://beancount.github.io/'
13 |
14 | @Component({
15 | selector: 'bc-welcome',
16 | templateUrl: './welcome.component.html',
17 | styleUrls: ['./welcome.component.scss'],
18 | })
19 | export class WelcomeComponent implements OnInit {
20 |
21 | welcomeText = 'Beancount is a plain-text accounting system. ' +
22 | 'You can read more about it at the ' +
23 | `Beancount website.`;
24 | filePath: string;
25 |
26 | @ViewChild('welcomeTextView', {static: false})
27 | welcomeTextView: ElementRef;
28 |
29 | constructor(
30 | private ngZone: NgZone,
31 | private page: Page,
32 | private routerExtensions: RouterExtensions,
33 | private sideDrawer: SideDrawerService,
34 | private beancountFile: BeancountFileService,
35 | ) {
36 | page.actionBarHidden = true
37 | }
38 |
39 | ngOnInit() {
40 | this.sideDrawer.lock()
41 | this.filePath = this.beancountFile.path
42 | }
43 |
44 | onWelcomeTextLoaded() {
45 | // https://github.com/NativeScript/NativeScript/issues/4746#issuecomment-475841566
46 | const element = this.welcomeTextView.nativeElement.android
47 | // See welcome-text class in component CSS
48 | element.setTextSize(16)
49 | element.setLetterSpacing(0.04)
50 | const textColor = new Color(255 * 0.6, 255, 255, 255).android
51 | element.setTextColor(textColor)
52 | element.setLinkTextColor(textColor)
53 | }
54 |
55 | openBeancountWebsite() {
56 | openUrl(BEANCOUNT_WEBSITE)
57 | }
58 |
59 | openFilePicker(): void {
60 | openFilePicker().then((filePath: string) => {
61 | if (filePath) {
62 | this.filePath = filePath
63 | }
64 | }).catch((error) => {
65 | console.warn(error)
66 | })
67 | }
68 |
69 | isValidPath(): boolean {
70 | return BeancountFileService.isValidPath(this.filePath)
71 | }
72 |
73 | onContinueTap() {
74 | this.beancountFile.setPath(this.filePath)
75 | // Can't use async/await with angular
76 | // https://github.com/angular/zone.js/issues/740
77 | this.beancountFile.load()
78 | .then(() => {
79 | this.sideDrawer.unlock()
80 | this.routerExtensions.navigate(['/plaintext'], {
81 | clearHistory: true,
82 | })
83 | })
84 | .catch((error) => {
85 | this.beancountFile.reset()
86 | console.warn(error)
87 | })
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/src/app/welcome/welcome.guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core'
2 | import { CanActivate } from '@angular/router'
3 | import { RouterExtensions } from '@nativescript/angular'
4 |
5 | import { BeancountFileService } from '../shared/beancount-file.service'
6 |
7 | @Injectable({
8 | providedIn: 'root',
9 | })
10 | export class WelcomeGuard implements CanActivate {
11 |
12 | constructor(
13 | private beancountFile: BeancountFileService,
14 | private router: RouterExtensions,
15 | ) {}
16 |
17 | canActivate() {
18 | if (this.beancountFile.path) {
19 | // Skip welcome screen
20 | this.router.navigate(['/plaintext'])
21 | return false
22 | } else {
23 | return true
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | // this import should be first in order to load some required settings (like globals and reflect-metadata)
2 | import { platformNativeScriptDynamic } from '@nativescript/angular'
3 |
4 | import { AppModule } from './app/app.module'
5 |
6 | platformNativeScriptDynamic().bootstrapModule(AppModule)
7 |
--------------------------------------------------------------------------------
/src/tests/beancount-file-content.spec.ts:
--------------------------------------------------------------------------------
1 | import { BeancountFileContent } from '../app/shared/beancount-file-content'
2 |
3 | describe('beancount file content tests', () => {
4 | it('should initialize successfully', () => {
5 | const text = 'test text'
6 | const content = new BeancountFileContent(text)
7 | expect(content.text).toBe(text)
8 | })
9 |
10 | it('should parse title', () => {
11 | const content = new BeancountFileContent(
12 | 'option "title" "BeanTest"\n' +
13 | 'option "operating_currency" "USD"\n')
14 | expect(content.getTitle()).toBe('BeanTest')
15 | expect(content.getOperatingCurrency()).toBe('USD')
16 | expect(content.getTransactionFlags()).toEqual(['*', '!'])
17 | })
18 |
19 | it('should parse transaction flags option', () => {
20 | const content = new BeancountFileContent(
21 | '2019-01-01 custom "bcm_option" "transaction_flags" "[\'!\', \'?\']"\n' +
22 | '2019-01-02 commodity USD\n')
23 | expect(content.getTransactionFlags()).toEqual(['!', '?'])
24 | })
25 |
26 | it('should parse indentation size', () => {
27 | const content = new BeancountFileContent(
28 | '1970-01-01 custom "fava-option" "indent" "4"\n' +
29 | '2019-01-02 commodity USD\n')
30 | expect(content.getIndentation()).toEqual(4)
31 | })
32 |
33 | describe('account name regexp tests', () => {
34 | let regexp
35 | beforeEach(() => {
36 | const content = new BeancountFileContent('')
37 | regexp = content.getAccountNameRegexp()
38 | })
39 |
40 | it('should allow valid account names', () => {
41 | expect(regexp.test('Assets:Test-Account')).toBe(true)
42 | expect(regexp.test('Assets:Cash:Test-Account')).toBe(true)
43 | })
44 |
45 | it('should not allow account name with whitespace', () => {
46 | expect(regexp.test('Assets:Test Account')).toBe(false)
47 | })
48 | it('should not allow top level accounts', () => {
49 | expect(regexp.test('Assets')).toBe(false)
50 | })
51 | it('should not allow invalid top level account', () => {
52 | expect(regexp.test('Test:Test-Account')).toBe(false)
53 | })
54 | it('should not allow colon at the end', () => {
55 | expect(regexp.test('Assets:Test-Account:')).toBe(false)
56 | })
57 |
58 | it('should allow unicode account name', () => {
59 | const content = new BeancountFileContent(
60 | 'option "name_assets" "Активы"\n')
61 | regexp = content.getAccountNameRegexp()
62 | expect(regexp.test('Активы:Тест-Счёт')).toBe(true)
63 | })
64 | })
65 |
66 | it('should parse accounts', () => {
67 | const content = new BeancountFileContent(
68 | '2019-09-07 open Assets:Account1\n' +
69 | '2019-09-07 open Assets:Account2\n' +
70 | '2019-09-07 open Assets:Account3\n' +
71 | '2019-09-07 txn "Tx1"\n' +
72 | ' Assets:Account1 -100 USD\n' +
73 | ' Assets:Account2 +100 USD\n' +
74 | '2019-09-07 txn "Tx2"\n' +
75 | ' Assets:Account1 -100 USD\n' +
76 | ' Assets:Account2 +50 USD\n' +
77 | ' Assets:Account2 +50 USD\n')
78 | expect(content.getAccounts()).toEqual([
79 | 'Assets:Account2',
80 | 'Assets:Account1',
81 | 'Assets:Account3',
82 | ])
83 | })
84 |
85 | it('should parse payees', () => {
86 | const content = new BeancountFileContent(
87 | '2019-09-07 txn "Payee1" "Tx1"\n' +
88 | '2019-09-07 txn "Payee2" "Tx2"\n' +
89 | '2019-09-07 txn "Payee2" "Tx3"\n' +
90 | '2019-09-07 txn "Payee3" "Tx4"\n' +
91 | '2019-09-07 txn "Payee3" "Tx5"\n' +
92 | '2019-09-07 txn "Payee2" "Tx6"\n')
93 | expect(content.getPayees()).toEqual([
94 | 'Payee2',
95 | 'Payee3',
96 | 'Payee1',
97 | ])
98 | })
99 | })
100 |
--------------------------------------------------------------------------------
/src/tests/beancount-file.service.spec.ts:
--------------------------------------------------------------------------------
1 | import * as appSettings from '@nativescript/core/application-settings'
2 | import { File } from '@nativescript/core/file-system'
3 |
4 | import { BeancountFileService } from '../app/shared/beancount-file.service'
5 | import { BeancountFileContent } from '../app/shared/beancount-file-content'
6 |
7 | // TODO: spyOn does not work after upgrade to NS7, possible because of esNext target
8 | // Skip tests temporarily, we don't need them anyway
9 | xdescribe('beancount file service', () => {
10 | const fileMock = {
11 | writeText: () => Promise.resolve(),
12 | } as any
13 | const filePath = '/path/to/file'
14 | let service
15 |
16 | beforeEach(() => {
17 | spyOn(appSettings, 'getString').and.callFake(() => {
18 | return filePath
19 | })
20 | spyOn(File, 'fromPath').and.returnValue(fileMock)
21 |
22 | service = new BeancountFileService({} as any)
23 | })
24 |
25 | it('should be initialized with path', () => {
26 | expect(service).toBeTruthy()
27 | expect(service.path).toEqual(filePath)
28 | })
29 |
30 | it('should save file', () => {
31 | spyOn(fileMock, 'writeText').and.callThrough()
32 | const fileText = 'test-content'
33 | service.content = new BeancountFileContent(fileText)
34 | service.save()
35 | expect(fileMock.writeText).toHaveBeenCalledWith(fileText)
36 | })
37 |
38 | it('should append to file', () => {
39 | spyOn(service, 'save')
40 | service.content = new BeancountFileContent('2019-01-01 txn "test1"\n')
41 | service.append('2019-01-02 txn "test2"\n')
42 | expect(service.content.text).toBe(
43 | '2019-01-01 txn "test1"\n\n' +
44 | '2019-01-02 txn "test2"\n')
45 | expect(service.save).toHaveBeenCalled()
46 | })
47 |
48 | it('should append to file with no linebreak at the end', () => {
49 | service.content = new BeancountFileContent('2019-01-01 txn "test1"')
50 | service.append('2019-01-02 txn "test2"\n')
51 | expect(service.content.text).toBe(
52 | '2019-01-01 txn "test1"\n\n' +
53 | '2019-01-02 txn "test2"\n')
54 | })
55 | })
56 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "esnext",
4 | "target": "es2017",
5 | "experimentalDecorators": true,
6 | "emitDecoratorMetadata": true,
7 | "noEmitHelpers": true,
8 | "noEmitOnError": true,
9 | "lib": [
10 | "es6",
11 | "dom",
12 | "es2015.iterable",
13 | "es2017"
14 | ],
15 | "baseUrl": ".",
16 | "paths": {
17 | "~/*": [
18 | "src/*"
19 | ]
20 | },
21 | "moduleResolution": "node",
22 | "removeComments": false
23 | },
24 | "exclude": [
25 | "node_modules",
26 | "platforms"
27 | ]
28 | }
--------------------------------------------------------------------------------
/tsconfig.tns.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "compilerOptions": {
4 | "module": "esNext",
5 | "moduleResolution": "node"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------