[go: up one dir, main page]

Skip to content

Commit

Permalink
Properly handle crashes during backup file migration
Browse files Browse the repository at this point in the history
Add documentation folder
Update README and CONTRIBUTORS
  • Loading branch information
codinguser committed Apr 18, 2017
1 parent 4e95e9e commit a835707
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 42 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Change Log
===============================================================================
Version 2.1.7 *(2017-04-18)*
----------------------------
* Properly handle crashes during migration of backup/export files to new location
* Update README and CONTRIBUTORS

Version 2.1.6 *(2017-04-15)*
----------------------------
* Fixed #664: Rotating device in transaction view causes crash
Expand Down
82 changes: 53 additions & 29 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,59 @@ project through the early phases (as Google Summer of Code project 2012) and pro
* Ngewi Fet <ngewif@gmail.com> - Project maintainer
* Yongxin Wang <fefe.wyx@gmail.com>
* Oleksandr Tyshkovets <olexandr.tyshkovets@gmail.com>
* Àlex Magaz Graça <rivaldi8@gmail.com>
* Àlex Magaz Graça <alexandre.magaz@gmail.com>

### Other Contributors
The following (incomplete list of) people (in no particular order) contributed (patches and translations) to GnuCash Android:
* Christian Stimming <christian@cstimming.de>
* Cristian Marchi <cri.penta@gmail.com>
* Menelaos Maglis <mmaglis@metacom.gr>
* Kjell Thomas Pedersen <kjelltp@gmail.com>
* Alexander Galanin <al@galanin.nnov.ru>
* Jorge Martínez López <jorgeml@gmail.com>
* Israel Buitron <israel.buitron@gmail.com>
* Geert Janssens <janssens-geert@telenet.be>
* Nicolas Barranger <wicowyn@gmail.com>
* Sigurd Gartmann <sigurdga-github@sigurdga.no>
* Pedro Abel <pedroabel@gmail.com>
* windwarrior <lennartbuit@gmail.com>
* Alex Lei <lxbzmy@gmail.com>
* Matthew Hague <matthewhague@zoho.com>
* Spanti Nicola <rydroid_dev@yahoo.com>
* Jesse Shieh <jesse.shieh.pub@gmail.com>
* Terry Chung <terrywmc@gmail.com>
* Caesar Wirth <cjwirth@gmail.com>
* Alceu Rodrigues Neto <alceurneto@gmail.com>
* Carlo Zancanaro <carlo@zancanaro.id.au>
* Eric Daly <edaly@hpsnet.com>
* Weslly Oliveira <weslly99@hotmail.com>
* Felipe Morato <me@fmorato.com>
* Alceu Rodrigues Neto <alceurneto@gmail.com>
* Salama AB <aksalj@aksalj.me>
* Juan Villa <juan64@gmail.com>
The following people (in alphabetical order) contributed (commits on GitHub) to GnuCash Android:
* aerkefiende
* Alceu Rodrigues Neto
* Aleksey Ivanovski
* Àlex Magaz Graça
* Alexander Galanin
* Alexandr Makaric
* Caesar Wirth
* Carlo Zancanaro
* choni wani@dri-h.net
* Christian Stimming
* Cristian Marchi
* David Landry
* Eric Daly
* Falk Brockmann
* Felipe Morato
* Geert Janssens
* Jörg Möller
* Israel Buitron
* Jesse Shieh
* Jorge Martínez López
* Juan Villa
* Kjell Thomas Pedersen
* Lian Kai
* lxb leixb@agilean.cn
* Alex Lei
* Mark Haanen
* Matthew Hague
* Menelaos Maglis
* moshe.w@invest.com
* Ngewi Fet
* Nicolas Barranger
* Oleg Kosmakov
* Oleksandr Tyshkovets
* PBNeves bastosdasneves@gmail.com
* Pedro Abel
* Salama AB
* Sandro Santilli
* Sigurd Gartmann
* smisger sameer.misger@prospectasoftware.com
* Spanti Nicola
* Stephan Windmüller
* Terry Chung
* thesebas thesebas@thesebas.net
* Vladimir Rutsky
* Weslly Oliveira
* windwarrior lennartbuit@gmail.com
* yapiti wicowyn@gmail.com
* Yongxin Wang

Please visit https://crowdin.com/project/gnucash-android for a more complete list of translation contributions

### Translators
Please visit https://crowdin.com/project/gnucash-android for a more complete list of translation contributions
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
GnuCash Android is a companion expense-tracker application for GnuCash (desktop) designed for Android.
It allows you to record transactions on-the-go and later import the data into GnuCash for the desktop.

Accounts | Transactions | Reports
:-------------------------:|:-------------------------:|:-------------------------:
![Accounts List](docs/images/v2.0.0_home.png) | ![Transactions List](docs/images/v2.0.0_transactions_list.png) | ![Reports](docs/images/v2.0.0_reports.png)

The application supports Android 2.3.3 Gingerbread (API level 10) and above.

Features include:
Expand Down Expand Up @@ -66,7 +70,7 @@ The app is configured to allow you to install a development and production versi

### With Android Studio
The easiest way to build is to install [Android Studio](https://developer.android.com/sdk/index.html) v2.+
with [Gradle](https://www.gradle.org/) v2.10
with [Gradle](https://www.gradle.org/) v3.4.1
Once installed, then you can import the project into Android Studio:

1. Open `File`
Expand All @@ -89,7 +93,7 @@ Please visit [CrowdIn](https://crowdin.com/project/gnucash-android) in order to

* You could as well contribute code, fixing bugs, new features or automated tests. Pull requests are always welcome.
Take a look at the [bug tracker](https://github.com/codinguser/gnucash-android/issues?state=open)
for ideas where to start.
for ideas where to start. Also take a look at the [contribution guidlines](https://github.com/codinguser/gnucash-android/blob/master/.github/CONTRIBUTING.md)

For development, it is recommended to use the Android Studio for development which is available for free.
Import the project into the IDE using the build.gradle file. The IDE will resolve dependencies automatically.
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ apply plugin: 'android-apt'

def versionMajor = 2
def versionMinor = 1
def versionPatch = 6
def versionPatch = 7
def versionBuild = 0

def buildTime() {
Expand Down
38 changes: 28 additions & 10 deletions app/src/main/java/org/gnucash/android/db/MigrationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1488,10 +1488,25 @@ static int upgradeDbToVersion13(SQLiteDatabase db){
* @param srcDir Source directory which should already exist
* @param dstDir Destination directory which should already exist
* @see #moveFile(File, File)
* @throws IOException if the {@code srcDir} does not exist or {@code dstDir} could not be created
* @throws IllegalArgumentException if {@code srcDir} is not a directory
*/
private static void moveDirectory(File srcDir, File dstDir){
if (!srcDir.exists() || !srcDir.isDirectory() || !dstDir.isDirectory() || !dstDir.exists()){
throw new IllegalArgumentException("Source is not a directory, use MigrationHelper.moveFile(...)");
private static void moveDirectory(File srcDir, File dstDir) throws IOException {
if (!srcDir.isDirectory()){
throw new IllegalArgumentException("Source is not a directory: " + srcDir.getPath());
}

if (!srcDir.exists()){
String msg = String.format(Locale.US, "Source directory %s does not exist", srcDir.getPath());
Log.e(LOG_TAG, msg);
throw new IOException(msg);
}

if (!dstDir.exists() || !dstDir.isDirectory()){
Log.w(LOG_TAG, "Target directory does not exist. Attempting to create..." + dstDir.getPath());
if (!dstDir.mkdirs()){
throw new IOException(String.format("Target directory %s does not exist and could not be created", dstDir.getPath()));
}
}

for (File src : srcDir.listFiles()){
Expand Down Expand Up @@ -1521,7 +1536,7 @@ private static void moveDirectory(File srcDir, File dstDir){
* It moves the backup files to a new backup location which does not require SD CARD write permission
* </p>
* @param db SQLite database to be upgraded
* @return
* @return New database version
*/
public static int upgradeDbToVersion14(SQLiteDatabase db){
Log.i(DatabaseHelper.LOG_TAG, "Upgrading database to version 14");
Expand All @@ -1534,17 +1549,20 @@ public static int upgradeDbToVersion14(SQLiteDatabase db){
public void run() {
File srcDir = new File(Exporter.LEGACY_BASE_FOLDER_PATH);
File dstDir = new File(Exporter.BASE_FOLDER_PATH);
moveDirectory(srcDir, dstDir);
File readmeFile = new File(Exporter.LEGACY_BASE_FOLDER_PATH, "README.txt");
FileWriter writer = null;
try {
moveDirectory(srcDir, dstDir);
File readmeFile = new File(Exporter.LEGACY_BASE_FOLDER_PATH, "README.txt");
FileWriter writer = null;
writer = new FileWriter(readmeFile);
writer.write("Backup files have been moved to " + dstDir.getPath() +
"\nYou can now delete this folder");
writer.flush();
} catch (IOException e) {
e.printStackTrace();
Log.e(LOG_TAG, "Error creating README file");
} catch (IOException | IllegalArgumentException ex) {
ex.printStackTrace();
String msg = String.format("Error moving files from %s to %s", srcDir.getPath(), dstDir.getPath());
Log.e(LOG_TAG, msg);
Crashlytics.log(msg);
Crashlytics.logException(ex);
}

}
Expand Down
Binary file added docs/images/v2.0.0_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/v2.0.0_reports.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/v2.0.0_transactions_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a835707

Please sign in to comment.