diff --git a/app.config.js b/app.config.js index 27f370b..a4fa212 100644 --- a/app.config.js +++ b/app.config.js @@ -9,7 +9,7 @@ export default { 'ios', 'android', ], - version: '0.18.0', + version: '0.19.0', orientation: 'portrait', updates: { enabled: true, @@ -38,7 +38,7 @@ export default { usesNonExemptEncryption: false, }, bundleIdentifier: IS_DEV ? 'abacus.fireflyiii.ios.app.dev' : 'abacus.ios.app', - buildNumber: '0.18.0', + buildNumber: '0.19.0', }, android: { icon: './src/images/icon-abacus.png', @@ -56,7 +56,7 @@ export default { }, playStoreUrl: 'https://play.google.com/store/apps/details?id=abacus.fireflyiii.android.app', package: IS_DEV ? 'abacus.fireflyiii.android.app.dev' : 'abacus.fireflyiii.android.app', - versionCode: 26, + versionCode: 30, }, scheme: 'abacusfiiiapp', githubUrl: 'https://github.com/victorbalssa/abacus', diff --git a/package-lock.json b/package-lock.json index c0b61e7..9db11fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "abacus", - "version": "0.18.0", + "version": "0.19.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "abacus", - "version": "0.18.0", + "version": "0.19.0", "dependencies": { "@expo/config-plugins": "~8.0.0", "@expo/metro-runtime": "~3.2.1", diff --git a/package.json b/package.json index a121c08..9de4712 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "abacus", - "version": "0.18.0", + "version": "0.19.0", "private": true, "homepage": "https://github.com/victorbalssa/abacus", "scripts": { diff --git a/src/components/Charts/AssetsHistoryChart.tsx b/src/components/Charts/AssetsHistoryChart.tsx index 6f587c0..5a313e0 100644 --- a/src/components/Charts/AssetsHistoryChart.tsx +++ b/src/components/Charts/AssetsHistoryChart.tsx @@ -253,18 +253,18 @@ export default function AssetsHistoryChart() { }} /> {accounts.map((chart) => chart.entries.length > 0 && ( - + ))} )} diff --git a/src/components/Screens/HomeScreen.tsx b/src/components/Screens/HomeScreen.tsx index b63382a..0e1298e 100644 --- a/src/components/Screens/HomeScreen.tsx +++ b/src/components/Screens/HomeScreen.tsx @@ -372,8 +372,8 @@ function Bills() { function PiggyBanks() { const { colors } = useThemeColors(); - const piggyBanks = useSelector((state: RootState) => state.piggybank.piggyBanks); - const loading = useSelector((state: RootState) => state.loading.effects.piggybanks?.getPiggyBanks?.loading); + const piggyBanks = useSelector((state: RootState) => state.piggyBanks.piggyBanks); + const loading = useSelector((state: RootState) => state.loading.effects.piggyBanks?.getPiggyBanks?.loading); const dispatch = useDispatch(); return ( @@ -383,7 +383,7 @@ function PiggyBanks() { Promise.all([ - dispatch.piggybank.getPiggyBanks(), + dispatch.piggyBanks.getPiggyBanks(), dispatch.firefly.getNetWorth(), ])} /> @@ -392,7 +392,7 @@ function PiggyBanks() { {translate('home_piggy_banks')} - {piggyBanks.map((pb) => ( + {piggyBanks.filter((pb) => pb.attributes?.percentage).map((pb) => ( - {`${pb.attributes.percentage.toFixed(0)}%`} + {`${pb.attributes.percentage?.toFixed(0)}%`} @@ -572,7 +572,7 @@ export default function HomeScreen() { dispatch.categories.getInsightCategories(); dispatch.budgets.getInsightBudgets(); dispatch.bills.getBills(); - dispatch.piggybank.getPiggyBanks(); + dispatch.piggyBanks.getPiggyBanks(); } }; diff --git a/src/models/configuration.ts b/src/models/configuration.ts index 78e7519..0dd7217 100644 --- a/src/models/configuration.ts +++ b/src/models/configuration.ts @@ -216,7 +216,7 @@ export default createModel()({ dispatch.currencies.resetState(), dispatch.firefly.resetState(), dispatch.transactions.resetState(), - dispatch.piggybank.resetState(), + dispatch.piggyBanks.resetState(), ]); }, }), diff --git a/src/models/firefly.ts b/src/models/firefly.ts index 2528355..c501944 100644 --- a/src/models/firefly.ts +++ b/src/models/firefly.ts @@ -296,7 +296,7 @@ export default createModel()({ } = rootState; const accountIdsParam = (selectedAccountIds && selectedAccountIds.length > 0) ? `&accounts[]=${selectedAccountIds.join('&accounts[]=')}` : ''; - const { data: accounts } = await dispatch.configuration.apiFetch({ url: `/api/v2/chart/account/dashboard?start=${start}&end=${end}${accountIdsParam}` }) as { data: AssetAccountType[] }; + const { data: accounts } = await dispatch.configuration.apiFetch({ url: `/api/v1/chart/account/overview?start=${start}&end=${end}${accountIdsParam}` }) as { data: AssetAccountType[] }; let colorIndex = 0; accounts diff --git a/src/models/index.ts b/src/models/index.ts index a2eceb2..ee1f24d 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -7,12 +7,12 @@ import configuration from './configuration'; import currencies from './currencies'; import firefly from './firefly'; import transactions from './transactions'; -import piggybank from './piggybank'; +import piggyBanks from './piggyBanks'; export interface RootModel extends Models { accounts: typeof accounts bills: typeof bills - piggybank : typeof piggybank + piggyBanks : typeof piggyBanks budgets: typeof budgets categories: typeof categories configuration: typeof configuration @@ -24,7 +24,7 @@ export interface RootModel extends Models { export const models: RootModel = { accounts, bills, - piggybank, + piggyBanks, budgets, categories, configuration, diff --git a/src/models/piggybank.ts b/src/models/piggyBanks.ts similarity index 53% rename from src/models/piggybank.ts rename to src/models/piggyBanks.ts index 8a2d4f4..01152b7 100644 --- a/src/models/piggybank.ts +++ b/src/models/piggyBanks.ts @@ -7,30 +7,29 @@ import { RootModel } from './index'; * {@link https://api-docs.firefly-iii.org/#/piggy_banks/listPiggyBank|Piggy Bank API} */ export type PiggyBank = { - id : string, - type: string, - attributes: { - createdAt: string, - updatedAt: string, - accountId: string, - accountName: string, - name: string, - currencyId: string, - currencyCode: string, - currencySymbol: string, - targetAmount: number, - percentage: number, - currentAmount: number, - leftToSave: number, - savePerMonth: number, - } + id: string, type: string, attributes: { + createdAt: string, + updatedAt: string, + accountId: string, + accountName: string, + name: string, + currencyId: string, + currencyCode: string, + currencySymbol: string, + targetAmount: number, + percentage: number, + currentAmount: number, + leftToSave: number, + savePerMonth: number, + active: boolean, + } } type PiggyBankState = { - piggyBanks : PiggyBank[] + piggyBanks: PiggyBank[] } -const INITIAL_STATE : PiggyBankState = { piggyBanks: [] }; +const INITIAL_STATE: PiggyBankState = { piggyBanks: [] }; export default createModel()({ state: INITIAL_STATE, @@ -45,9 +44,11 @@ export default createModel()({ }, effects: (dispatch) => ({ - async getPiggyBanks(_ : void): Promise { - const { data: piggyBanks } = await dispatch.configuration.apiFetch({ url: '/api/v1/piggy-banks' }) as {data : PiggyBank[]}; - dispatch.piggybank.setPiggyBanks({ piggyBanks }); + async getPiggyBanks(_: void): Promise { + const { data: piggyBanks } = await dispatch.configuration.apiFetch({ url: '/api/v1/piggy-banks' }) as { + data: PiggyBank[] + }; + dispatch.piggyBanks.setPiggyBanks({ piggyBanks }); }, }), });