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

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

View File

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

View File

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

View File

@ -218,9 +218,10 @@ namespace keepass2android
App.SetErrorReportMode(this, App.ErrorReportMode.Disabled); App.SetErrorReportMode(this, App.ErrorReportMode.Disabled);
launchNextActivity(); 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"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="91" android:versionCode="92"
android:versionName="1.01-e" android:versionName="1.01-f"
package="keepass2android.keepass2android" package="keepass2android.keepass2android"
android:installLocation="auto"> android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />

View File

@ -163,7 +163,7 @@ namespace keepass2android
Kp2aLog.Log("OnRequestPermissionsResult " + (requestCode == FingerprintPermissionRequestCode) + Kp2aLog.Log("OnRequestPermissionsResult " + (requestCode == FingerprintPermissionRequestCode) +
((grantResults.Length > 0) && (grantResults[0] == Permission.Granted))); ((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); var btn = FindViewById<ImageButton>(Resource.Id.fingerprintbtn);
btn.Click += (sender, args) => btn.Click += (sender, args) =>

View File

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

View File

@ -316,6 +316,8 @@ namespace keepass2android
} }
public Drawable GetResourceDrawable(string key) 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); var field = typeof(Resource.Drawable).GetField(key);
if (field == null) if (field == null)
throw new Exception("Invalid key " + key); throw new Exception("Invalid key " + key);