Corrected an issue on kitkat when opening ssh-key
This happens when you select a file using kitkat's file manager
This commit is contained in:
parent
5c53fcb4a0
commit
3764db17c9
8 changed files with 20 additions and 17 deletions
Binary file not shown.
Binary file not shown.
|
@ -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 {
|
||||
|
|
|
@ -51,6 +51,7 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, Integer> {
|
|||
return -2;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return -98;
|
||||
}
|
||||
totalSize++;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 :
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e515a49027fc5de36b8977cf8b096afc9838a9be
|
||||
Subproject commit 6aaf8fde5e2541a614b1b0f8633372588eaee710
|
Loading…
Reference in a new issue