several fixes for potential crashes -> 1.01f

This commit is contained in:
Philipp Crocoll 2017-02-05 04:20:14 +01:00
parent defd8e7904
commit c1f8e91a3f
10 changed files with 28 additions and 21 deletions

View File

@ -83,21 +83,23 @@ public class OneDriveStorage extends JavaFileStorageBase
private boolean isConnected(Activity activity) {
if (oneDriveClient == null)
{
Log.d("KP2AJ", "trying silent login");
if (msaAuthenticator.loginSilent() != null)
try
{
Log.d("KP2AJ", "ok: silent login");
try
Log.d("KP2AJ", "trying silent login");
if (msaAuthenticator.loginSilent() != null)
{
oneDriveClient = buildClient(activity);
}
catch (Exception e)
{
e.printStackTrace();
}
Log.d("KP2AJ", "ok: silent login");
oneDriveClient = buildClient(activity);
}
else Log.d("KP2AJ", "trying silent login failed.");
}
catch (Exception e)
{
e.printStackTrace();
}
else Log.d("KP2AJ", "trying silent login failed.");
}
return oneDriveClient != null;
}

View File

@ -33,8 +33,9 @@ namespace keepass2android
});
b.SetNegativeButton(Resource.String.cancel, delegate { });
b.SetTitle(GetString(AppNames.AppNameResource));
b.SetOnDismissListener(this);
var dialog = b.Create();
dialog.SetOnDismissListener(this);
dialog.Show();
}

View File

@ -26,7 +26,7 @@ namespace keepass2android
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
List<string> changeLog = new List<string>{
ctx.GetString(Resource.String.ChangeLog_1_01e),
ctx.GetString(Resource.String.ChangeLog_1_01f),
ctx.GetString(Resource.String.ChangeLog_1_01d),
ctx.GetString(Resource.String.ChangeLog_1_01),
ctx.GetString(Resource.String.ChangeLog_1_0_0e),

View File

@ -218,9 +218,10 @@ namespace keepass2android
App.SetErrorReportMode(this, App.ErrorReportMode.Disabled);
launchNextActivity();
});
b.SetOnDismissListener(this);
var dialog = b.Create();
dialog.SetOnDismissListener(this);
b.Show();
dialog.Show();
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="91"
android:versionName="1.01-e"
android:versionCode="92"
android:versionName="1.01-f"
package="keepass2android.keepass2android"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />

View File

@ -158,12 +158,12 @@ namespace keepass2android
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
Kp2aLog.Log("OnRequestPermissionsResult " + (requestCode == FingerprintPermissionRequestCode) +
((grantResults.Length > 0) && (grantResults[0] == Permission.Granted)));
if (requestCode == FingerprintPermissionRequestCode && grantResults[0] == Permission.Granted)
if ((requestCode == FingerprintPermissionRequestCode) && (grantResults.Length > 0) && (grantResults[0] == Permission.Granted))
{
var btn = FindViewById<ImageButton>(Resource.Id.fingerprintbtn);
btn.Click += (sender, args) =>

View File

@ -680,10 +680,11 @@
<string name="ActivateAutoFillService_btnAutoFill">Use AutoFill service</string>
<string name="ActivateAutoFillService_toast">Please enable the Keepass2Android service.</string>
<string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string>
<string name="ChangeLog_1_01e">
Version 1.01-e\n
<string name="ChangeLog_1_01f">
Version 1.01-f\n
* Fix for crash when trying to work offline\n
* Fix for incorrect encoding of FTP(S) credentials\n
* Fix for crashes when using OneDrive and on older Android versions\n
* Display times as local time in entry screen\n
</string>
<string name="ChangeLog_1_01d">

View File

@ -316,6 +316,8 @@ namespace keepass2android
}
public Drawable GetResourceDrawable(string key)
{
if (key == "ic_storage_skydrive")
key = "ic_storage_onedrive"; //resource was renamed. do this to avoid crashes with legacy file entries.
var field = typeof(Resource.Drawable).GetField(key);
if (field == null)
throw new Exception("Invalid key " + key);