catch exception when trying to read display name. fixes #4163 (Daniel Gultsch), Improve OTR verification choices, continue to remove app update service

This commit is contained in:
Christian Schneppe 2021-09-17 22:44:54 +02:00 committed by Arne
parent 534b3b76ed
commit b111f6263c
7 changed files with 22 additions and 15 deletions

View file

@ -125,7 +125,7 @@ android {
buildConfigField("String", "DOMAIN_LOCK", 'null')
buildConfigField("String", "MAGIC_CREATE_DOMAIN", '"monocles.de"')
buildConfigField("boolean", "SHOW_INTRO", 'true')
buildConfigField("String", "UPDATE_URL", '"https://monocles.de/chat/update/"')
//buildConfigField("String", "UPDATE_URL", '"https://monocles.de/chat/update/"')
resValue "string", "applicationId", applicationId
signingConfig signingConfigs.'monocles chat'
def appName = "monocles chat"

View file

@ -358,12 +358,7 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.SettingsActivity" />
</activity>
<activity
android:name=".ui.UpdaterActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_updater"
android:launchMode="singleTask"
android:theme="@style/ConversationsTheme" />
<activity
android:name=".ui.ShortcutActivity"
android:label="@string/contact"

View file

@ -166,8 +166,8 @@ public final class Config {
public static final int EXPIRY_INTERVAL = 30 * 60 * 1000; // 30 minutes
public static final String UPDATE_URL = BuildConfig.UPDATE_URL;
public static final long UPDATE_CHECK_TIMER = 24 * 60 * 60; // 24 h in seconds
//public static final String UPDATE_URL = BuildConfig.UPDATE_URL;
//public static final long UPDATE_CHECK_TIMER = 24 * 60 * 60; // 24 h in seconds
public static final String ISSUE_URL = "xmpp://support@conference.monocles.de?join";

View file

@ -70,11 +70,11 @@ public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapp
HttpsURLConnection.setDefaultSSLSocketFactory(NoSSLv3Factory);
HttpsURLConnection connection = null;
try {
URL url = new URL(Config.UPDATE_URL);
// URL url = new URL(Config.UPDATE_URL);
if (mUseTor) {
connection = (HttpsURLConnection) url.openConnection(getProxy());
// connection = (HttpsURLConnection) url.openConnection(getProxy());
} else {
connection = (HttpsURLConnection) url.openConnection();
// connection = (HttpsURLConnection) url.openConnection();
}
connection.setConnectTimeout(Config.SOCKET_TIMEOUT * 1000);
connection.setReadTimeout(Config.SOCKET_TIMEOUT * 1000);

View file

@ -460,6 +460,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
UriHandlerActivity.onRequestPermissionResult(this, requestCode, grantResults);
if (grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
@ -987,9 +988,15 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
intent.putExtra("contact", conversation.getContact().getJid().asBareJid().toString());
intent.putExtra(EXTRA_ACCOUNT, conversation.getAccount().getJid().asBareJid().toString());
switch (menuItem.getItemId()) {
case R.id.scan_fingerprint:
intent.putExtra("mode", VerifyOTRActivity.MODE_SCAN_FINGERPRINT);
break;
case R.id.ask_question:
intent.putExtra("mode", VerifyOTRActivity.MODE_ASK_QUESTION);
break;
case R.id.manual_verification:
intent.putExtra("mode", VerifyOTRActivity.MODE_MANUAL_VERIFICATION);
break;
}
startActivity(intent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
@ -1080,7 +1087,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
SharedPreferences UpdateTimeStamp = getApplicationContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
long lastUpdateTime = UpdateTimeStamp.getLong("lastUpdateTime", 0);
Log.d(Config.LOGTAG, "AppUpdater: LastUpdateTime: " + lastUpdateTime);
if ((lastUpdateTime + (Config.UPDATE_CHECK_TIMER * 1000)) < System.currentTimeMillis()) {
// if ((lastUpdateTime + (Config.UPDATE_CHECK_TIMER * 1000)) < System.currentTimeMillis()) {
lastUpdateTime = System.currentTimeMillis();
SharedPreferences.Editor editor = UpdateTimeStamp.edit();
editor.putLong("lastUpdateTime", lastUpdateTime);
@ -1090,10 +1097,10 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
Log.d(Config.LOGTAG, "AppUpdater started");
openInstallFromUnknownSourcesDialogIfNeeded(false);
}
} else {
// } else {
Log.d(Config.LOGTAG, "AppUpdater stopped");
}
}
// }
@Override
public void onRoomDestroySucceeded() {

View file

@ -571,6 +571,8 @@ public final class MimeUtils {
if (cursor != null && cursor.moveToFirst()) {
return cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
}
} catch (Exception e) {
return null;
}
return null;
}

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/scan_fingerprint"
android:title="@string/scan_qr_code" />
<item
android:id="@+id/ask_question"
android:title="@string/ask_question" />