Skip to content

Commit

Permalink
Fix a potential sync bug if you refuse to enter any settings, bump ve…
Browse files Browse the repository at this point in the history
…rsion number
  • Loading branch information
matburt committed Nov 27, 2010
1 parent 997179e commit 224d0b7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.matburt.mobileorg"
android:versionCode="46"
android:versionName="0.4.6">
android:versionCode="47"
android:versionName="0.4.7">
<uses-sdk android:minSdkVersion="3"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Expand Down
2 changes: 1 addition & 1 deletion res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<PreferenceScreen
android:key="VersionDisp"
android:title="Version"
android:summary="0.4.6">
android:summary="0.4.7">
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
6 changes: 6 additions & 0 deletions src/com/matburt/mobileorg/MobileOrgActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ else if (userSynchro.equals("sdcard")) {
this.onShowSettings();
return;
}

if (!appSync.checkReady()) {
this.onShowSettings();
return;
}

Thread syncThread = new Thread() {
public void run() {
try {
Expand Down
6 changes: 6 additions & 0 deletions src/com/matburt/mobileorg/SDCardSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ private void putFile(String path,
}
}

public boolean checkReady() {
if (this.appSettings.getString("indexFilePath", "").equals(""))
return false;
return true;
}

public void pull() throws NotFoundException, ReportableError {
String indexFile = this.appSettings.getString("indexFilePath","");
Log.d(LT, "Index file at: " + indexFile);
Expand Down
1 change: 1 addition & 0 deletions src/com/matburt/mobileorg/Synchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public interface Synchronizer
{
public void pull() throws NotFoundException, ReportableError;
public void push() throws NotFoundException, ReportableError;
public boolean checkReady();
public void close();
}
6 changes: 6 additions & 0 deletions src/com/matburt/mobileorg/WebDAVSynchronizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ else if (storageMode.equals("sdcard")) {
}
}

public boolean checkReady() {
if (this.appSettings.getString("webUrl","").equals(""))
return false;
return true;
}

public void pull() throws NotFoundException, ReportableError {
Pattern checkUrl = Pattern.compile("http.*\\.(?:org|txt)$");
String url = this.appSettings.getString("webUrl", "");
Expand Down

0 comments on commit 224d0b7

Please sign in to comment.