Add permissions request, comment out debug print statements.
This commit is contained in:
parent
a1d9ffa6c6
commit
23df75fd15
|
@ -27,6 +27,8 @@ import android.content.IntentSender;
|
|||
import android.content.IntentSender.OnFinished;
|
||||
import android.content.IntentSender.SendIntentException;
|
||||
import android.os.Bundle;
|
||||
import android.Manifest;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
public class PgpConnect extends Fragment {
|
||||
Activity act;
|
||||
|
@ -34,6 +36,7 @@ public class PgpConnect extends Fragment {
|
|||
Handler handler;
|
||||
OpenPgpServiceConnection mServiceConnection;
|
||||
ClipboardManager cb;
|
||||
final int PERMISSIONS_REQUEST = 1;
|
||||
|
||||
public PgpConnect(Activity act) {
|
||||
Log.d("gio", "PgpConnect(Activity)");
|
||||
|
@ -49,6 +52,10 @@ public class PgpConnect extends Fragment {
|
|||
FragmentTransaction ft = fm.beginTransaction();
|
||||
ft.add(frag, "PgpConnect");
|
||||
ft.commitNow();
|
||||
|
||||
if (ctx.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ctx.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -160,7 +167,7 @@ public class PgpConnect extends Fragment {
|
|||
Log.d("gio","_getid: success");
|
||||
try {
|
||||
String ret = os.toString("UTF-8");
|
||||
Log.d(OpenPgpApi.TAG, "output: " + ret);
|
||||
//Log.d(OpenPgpApi.TAG, "output: " + ret);
|
||||
stringResult(chint, ret);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e("gio", "UnsupportedEncodingException", e);
|
||||
|
@ -197,7 +204,7 @@ public class PgpConnect extends Fragment {
|
|||
case OpenPgpApi.RESULT_CODE_SUCCESS: {
|
||||
try {
|
||||
String ret = os.toString("UTF-8");
|
||||
Log.d(OpenPgpApi.TAG, "output: " + ret);
|
||||
//Log.d(OpenPgpApi.TAG, "output: " + ret);
|
||||
stringResult(chint, ret);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e("gio", "UnsupportedEncodingException", e);
|
||||
|
|
|
@ -77,18 +77,18 @@ func (s *Store) nativeDecrypt(name string) (string, error) {
|
|||
return "", fmt.Errorf("Error reading file: %s", err)
|
||||
}
|
||||
ret, err := pgp.Decrypt(string(data))
|
||||
log.Printf("nativeDecrypt(): got %s", ret)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (s *Store) nativeEncrypt(pw string) ([]byte, error) {
|
||||
connect()
|
||||
ret, err := pgp.Encrypt(s.Id, pw)
|
||||
log.Printf("nativeEncrypt(): got %s", ret)
|
||||
return []byte(ret), err
|
||||
}
|
||||
|
||||
func nativeIdentities() ([]string, error) {
|
||||
//NOT IMPLEMENTED ON ANDROID
|
||||
return []string{}, nil
|
||||
log.Printf("nativeIdentities()")
|
||||
connect()
|
||||
log.Printf("calling pgp.GetId()")
|
||||
|
|
Loading…
Reference in New Issue
Block a user