Skip to content

Commit

Permalink
Merge pull request #14 from cmtanko/APP-010-backup-restore-db
Browse files Browse the repository at this point in the history
[App-010] Add ability to backup restore db
  • Loading branch information
cmtanko authored May 5, 2021
2 parents ca26861 + 30cdc31 commit fe9d743
Show file tree
Hide file tree
Showing 24 changed files with 1,232 additions and 33 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ android {
applicationId "io.newplanet.reactnativestarterkit"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 31
versionName "0.1.2"
versionCode 34
versionName "0.1.3"
}
signingConfigs {
release {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
React Native Starter Kit
A personal expense manager app to manage all your income and expenses, It help budget your finance and get easy reports.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
React Native Starter Kit
A personal expense manager app to manage all your income and expenses
2 changes: 1 addition & 1 deletion android/fastlane/metadata/android/en-US/title.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
React Native Starter Kit
Personal Expense Manager
12 changes: 12 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ PODS:
- React-Core
- react-native-sqlite-storage (5.0.0):
- React
- react-native-viewpager (5.0.11):
- React-Core
- React-RCTActionSheet (0.63.3):
- React-Core/RCTActionSheetHeaders (= 0.63.3)
- React-RCTAnimation (0.63.3):
Expand Down Expand Up @@ -304,6 +306,8 @@ PODS:
- React-Core (= 0.63.3)
- React-cxxreact (= 0.63.3)
- React-jsi (= 0.63.3)
- rn-fetch-blob (0.12.0):
- React-Core
- RNCMaskedView (0.1.10):
- React
- RNCPicker (1.8.1):
Expand Down Expand Up @@ -363,6 +367,7 @@ DEPENDENCIES:
- react-native-image-picker (from `../node_modules/react-native-image-picker`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-sqlite-storage (from `../node_modules/react-native-sqlite-storage`)
- "react-native-viewpager (from `../node_modules/@react-native-community/viewpager`)"
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
Expand All @@ -373,6 +378,7 @@ DEPENDENCIES:
- React-RCTText (from `../node_modules/react-native/Libraries/Text`)
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- rn-fetch-blob (from `../node_modules/rn-fetch-blob`)
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
- "RNCPicker (from `../node_modules/@react-native-community/picker`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
Expand Down Expand Up @@ -436,6 +442,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-safe-area-context"
react-native-sqlite-storage:
:path: "../node_modules/react-native-sqlite-storage"
react-native-viewpager:
:path: "../node_modules/@react-native-community/viewpager"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
Expand All @@ -456,6 +464,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
rn-fetch-blob:
:path: "../node_modules/rn-fetch-blob"
RNCMaskedView:
:path: "../node_modules/@react-native-community/masked-view"
RNCPicker:
Expand Down Expand Up @@ -504,6 +514,7 @@ SPEC CHECKSUMS:
react-native-image-picker: 5b2f1ea1f9230b131abbfb8a4aa1eb209aba9ed9
react-native-safe-area-context: 86612d2c9a9e94e288319262d10b5f93f0b395f5
react-native-sqlite-storage: ce71689c5a73b79390a1ab213555ae80979a5dc7
react-native-viewpager: d054b58bf3d377e6b99558da6766463ff7e9b220
React-RCTActionSheet: 53ea72699698b0b47a6421cb1c8b4ab215a774aa
React-RCTAnimation: 1befece0b5183c22ae01b966f5583f42e69a83c2
React-RCTBlob: 0b284339cbe4b15705a05e2313a51c6d8b51fa40
Expand All @@ -514,6 +525,7 @@ SPEC CHECKSUMS:
React-RCTText: 65a6de06a7389098ce24340d1d3556015c38f746
React-RCTVibration: 8e9fb25724a0805107fc1acc9075e26f814df454
ReactCommon: 4167844018c9ed375cc01a843e9ee564399e53c3
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
RNCMaskedView: f5c7d14d6847b7b44853f7acb6284c1da30a3459
RNCPicker: 914b557e20b3b8317b084aca9ff4b4edb95f61e4
RNGestureHandler: 9b7e605a741412e20e13c512738a31bd1611759b
Expand Down
41 changes: 40 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react_native_starter_kit",
"version": "0.1.2",
"version": "0.1.3",
"private": true,
"scripts": {
"install-deps-android": "cd android && bundle update && bundle install",
Expand Down Expand Up @@ -41,7 +41,9 @@
"@react-navigation/stack": "^5.12.8",
"@types/styled-components": "^5.1.9",
"axios": "^0.21.0",
"convert-csv-to-json": "^1.3.0",
"eslint-plugin-prettier": "^3.1.4",
"fs": "0.0.1-security",
"lodash": "^4.17.20",
"moment": "^2.29.1",
"native-base": "^2.13.14",
Expand Down Expand Up @@ -69,6 +71,7 @@
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.12.0",
"styled-components": "^5.2.3",
"uuid": "^8.3.1",
"victory-native": "^35.3.1"
Expand All @@ -94,4 +97,4 @@
"jest": {
"preset": "react-native"
}
}
}
12 changes: 12 additions & 0 deletions src/actions/Account/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
insertAccount,
removeAccount,
updateAccount,
insertAccounts,
} from '../../helpers/db';

import {
Expand Down Expand Up @@ -115,3 +116,14 @@ export const deleteAccount = ({id, callback}) => {
}
};
};

export const addAccounts = (sqlQuery) => {
return async (dispatch) => {
try {
const dbResult = await insertAccounts(sqlQuery);
dispatch({type: ACCOUNT_CREATE, payload: {}});
} catch (error) {
throw error;
}
};
};
44 changes: 44 additions & 0 deletions src/actions/Backup/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import {insertBackup, fetchBackup, resetData} from '../../helpers/db';

export const getBackup = () => {
return async (dispatch) => {
try {
const dbResult = await fetchBackup();
dispatch({
type: 'backup_fetch_success',
payload: dbResult,
});
} catch (error) {
throw error;
}
};
};

export const addBackup = ({title, date, callback}) => {
return async (dispatch) => {
try {
const dbResult = await insertBackup(title, date);
const backupData = {
id: dbResult.insertId.toString(),
title: title,
date: date,
};
dispatch({type: 'backup_created_success', payload: backupData});
callback();
} catch (error) {
throw error;
}
};
};

export const resetDatabase = (accounts, categories, records, callback) => {
return async (dispatch) => {
try {
const dbResult = await resetData(accounts, categories, records);
dispatch({type: 'database_reset_success', payload: {}});
callback();
} catch (error) {
throw error;
}
};
};
5 changes: 3 additions & 2 deletions src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './Category';
export * from './Account';
export * from './Backup';
export * from './Record';
export * from './Report';
export * from './Account';
export * from './Category';
Loading

0 comments on commit fe9d743

Please sign in to comment.