diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/app-debug.apk | bin | 1717752 -> 1717862 bytes | |||
-rw-r--r-- | app/app-release.apk | bin | 1717643 -> 1717723 bytes | |||
-rw-r--r-- | app/build.gradle | 4 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java | 1 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/GitHandler.java | 19 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 7 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/UserPreference.java | 4 |
7 files changed, 19 insertions, 16 deletions
diff --git a/app/app-debug.apk b/app/app-debug.apk Binary files differindex 4622e5aa..4586e48c 100644 --- a/app/app-debug.apk +++ b/app/app-debug.apk diff --git a/app/app-release.apk b/app/app-release.apk Binary files differindex a633ffc2..25ec5480 100644 --- a/app/app-release.apk +++ b/app/app-release.apk diff --git a/app/build.gradle b/app/build.gradle index f44b837a..26a2cd04 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.zeapo.pwdstore" minSdkVersion 15 targetSdkVersion 19 - versionCode 9 - versionName "1.1-b4" + versionCode 11 + versionName "1.1-b5" } buildTypes { release { diff --git a/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java b/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java index 11071018..c2a6f28f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java @@ -51,6 +51,7 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, Integer> { return -2; } catch (Exception e) { e.printStackTrace(); + return -98; } totalSize++; } diff --git a/app/src/main/java/com/zeapo/pwdstore/GitHandler.java b/app/src/main/java/com/zeapo/pwdstore/GitHandler.java index ecbf68af..ba42f867 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitHandler.java @@ -11,13 +11,11 @@ import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.InputType; -import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; -import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; @@ -27,7 +25,6 @@ import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; import com.jcraft.jsch.UserInfo; -import com.zeapo.pwdstore.crypto.PgpHandler; import com.zeapo.pwdstore.utils.PasswordRepository; import org.eclipse.jgit.api.CloneCommand; @@ -39,7 +36,6 @@ import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.api.errors.TransportException; import org.eclipse.jgit.errors.UnsupportedCredentialItem; -import org.eclipse.jgit.merge.MergeStrategy; import org.eclipse.jgit.transport.CredentialItem; import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.CredentialsProviderUserInfo; @@ -75,7 +71,7 @@ public class GitHandler extends Activity { public static final int REQUEST_CLONE = 103; public static final int REQUEST_INIT = 104; - private static final int GET_SSH_KEY = 201; + private static final int GET_SSH_KEY_FROM_CLONE = 201; @Override protected void onCreate(Bundle savedInstanceState) { @@ -199,6 +195,7 @@ public class GitHandler extends Activity { e.printStackTrace(); } return true; + } return super.onOptionsItemSelected(item); } @@ -460,9 +457,9 @@ public class GitHandler extends Activity { public void pullOperation(UsernamePasswordCredentialsProvider provider) { - if (settings.getString("git_remote_username", "user").isEmpty() || - settings.getString("git_remote_server", "server.com").isEmpty() || - settings.getString("git_remote_location", "path/to/repository").isEmpty() ) + if (settings.getString("git_remote_username", "").isEmpty() || + settings.getString("git_remote_server", "").isEmpty() || + settings.getString("git_remote_location", "").isEmpty() ) new AlertDialog.Builder(this) .setMessage("You have to set the information about the server before synchronizing with the server") .setPositiveButton("On my way!", new DialogInterface.OnClickListener() { @@ -584,7 +581,7 @@ public class GitHandler extends Activity { public void onClick(DialogInterface dialog, int id) { try { Intent intent = new Intent(getApplicationContext(), UserPreference.class); - startActivityForResult(intent, GET_SSH_KEY); + startActivityForResult(intent, GET_SSH_KEY_FROM_CLONE); } catch (Exception e) { System.out.println("Exception caught :("); e.printStackTrace(); @@ -693,8 +690,8 @@ public class GitHandler extends Activity { case REQUEST_PUSH: authenticateAndRun("pushOperation"); break; - case GET_SSH_KEY: - authenticateAndRun("pullOperation"); + case GET_SSH_KEY_FROM_CLONE: + authenticateAndRun("cloneOperation"); } } diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 9819edef..3234c1f6 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -137,7 +137,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI public void getClone(View view){ Intent intent = new Intent(this, GitHandler.class); intent.putExtra("Operation", GitHandler.REQUEST_CLONE); - startActivity(intent); + startActivityForResult(intent, GitHandler.REQUEST_CLONE); } private void createRepository() { @@ -358,7 +358,10 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI refreshListAdapter(); if (resultCode == RESULT_OK) { - refreshListAdapter(); + if (requestCode == GitHandler.REQUEST_CLONE) + checkLocalRepository(); + else + refreshListAdapter(); switch (requestCode) { case PgpHandler.REQUEST_CODE_ENCRYPT : diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index 09e61fbf..26b3c3fa 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -70,8 +70,10 @@ public class UserPreference extends PreferenceActivity implements Preference.OnP if (requestCode == 1) { // Uri sshFile = data.getData(); try { - byte[] privateKey = IOUtils.toByteArray(this.getContentResolver().openInputStream(data.getData())); + InputStream sshKey = this.getContentResolver().openInputStream(data.getData()); + byte[] privateKey = IOUtils.toByteArray(sshKey); FileUtils.writeByteArrayToFile(new File(getFilesDir() + "/.ssh_key"), privateKey); + sshKey.close(); Log.i("PREF", "Got key"); setResult(RESULT_OK); |