Merge pull request 'master' (#15) from Arne/monocles_chat:master into master

Reviewed-on: https://codeberg.org/Pirujo/monocles_chat_translate/pulls/15
This commit is contained in:
Pirujo 2022-10-07 15:24:27 +02:00
commit bd72a4467d
13 changed files with 67 additions and 33 deletions

View file

@ -35,7 +35,7 @@ configurations {
}
dependencies {
playstoreImplementation('com.google.firebase:firebase-messaging:23.0.7') {
playstoreImplementation('com.google.firebase:firebase-messaging:23.0.8') {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
@ -61,7 +61,7 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.exifinterface:exifinterface:1.3.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.emoji2:emoji2:1.2.0'
gitImplementation "androidx.emoji2:emoji2-bundled:1.2.0"
@ -82,7 +82,7 @@ dependencies {
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation 'org.osmdroid:osmdroid-android:6.1.14'
implementation 'com.leinardi.android:speed-dial:3.3.0'
implementation 'com.squareup.picasso:picasso:2.8'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
@ -108,8 +108,8 @@ android {
targetSdkVersion 32
//versionNameSuffix " beta_(2021-12-19)" // " beta_(XXXX-XX-XX)" // activate for beta versions
versionCode 122
versionName "1.5.11"
versionCode 123
versionName "1.5.12"
//resConfigs "en"
archivesBaseName += "-$versionName"

View file

@ -39,10 +39,15 @@ public final class Config {
return (ENCRYPTION_MASK & OTR) != 0;
}
public static boolean supportOmemo() {
return (ENCRYPTION_MASK & OMEMO) != 0;
}
public static boolean omemoOnly() {
return !multipleEncryptionChoices() && supportOmemo();
}
public static boolean multipleEncryptionChoices() {
return (ENCRYPTION_MASK & (ENCRYPTION_MASK - 1)) != 0;
}
@ -64,8 +69,8 @@ public final class Config {
public static final String inviteMUCURL = monocles() + "/j/";
public static final String inviteHostURL = monocles(); // without http(s)
public static final String INVITE_DOMAIN = monocles();
public static final String termsOfUseURL = "https://monocles.de/impressum/";
public static final String privacyURL = "https://monocles.de/impressum/";
public static final String termsOfUseURL = "https://monocles.eu/legal-privacy/";
public static final String privacyURL = "https://monocles.eu/legal-privacy/";
public static final String migrationURL = Locale.getDefault().getLanguage().equalsIgnoreCase("de") ? "https://codeberg.org/Arne/monocles_chat" : "https://codeberg.org/Arne/monocles_chat";
public static final String CHANGELOG_URL = "https://codeberg.org/Arne/monocles_chat/src/branch/master/CHANGELOG.md";
@ -116,7 +121,7 @@ public final class Config {
public static final int VIDEO_FAST_UPLOAD_SIZE = 10 * 1024 * 1024;
public static final int AVATAR_SIZE = 720;
public static final int AVATAR_SIZE = 480;
public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.JPEG;
public static final int AVATAR_CHAR_LIMIT = 9400;

View file

@ -32,6 +32,9 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.google.common.base.Strings;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.ui.SettingsActivity;
@ -55,8 +58,13 @@ public class OmemoSetting {
}
public static void load(final Context context, final SharedPreferences sharedPreferences) {
if (Config.omemoOnly()) {
always = true;
encryption = Message.ENCRYPTION_AXOLOTL;
return;
}
final String value = sharedPreferences.getString(SettingsActivity.OMEMO_SETTING, context.getResources().getString(R.string.omemo_setting_default));
switch (value) {
switch (Strings.nullToEmpty(value)) {
case "always":
always = true;
never = false;

View file

@ -1,5 +1,6 @@
package eu.siacs.conversations.entities;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
@ -109,6 +110,7 @@ public class Contact implements ListItem, Blockable {
this.keys = new JSONObject();
}
@SuppressLint("Range")
public static Contact fromCursor(final Cursor cursor) {
final Jid jid;
try {

View file

@ -1,10 +1,11 @@
package eu.siacs.conversations.generator;
import static eu.siacs.conversations.ui.SettingsActivity.PERSISTENT_ROOM;
import android.os.Bundle;
import android.util.Base64;
import android.util.Log;
import static eu.siacs.conversations.ui.SettingsActivity.PERSISTENT_ROOM;
import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.ecc.ECPublicKey;
@ -30,14 +31,15 @@ import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
public class IqGenerator extends AbstractGenerator {
private static XmppConnectionService xmppConnectionService;
public IqGenerator(final XmppConnectionService service) {
@ -205,6 +207,7 @@ public class IqGenerator extends AbstractGenerator {
packet.addChild("vCard", "vcard-temp");
return packet;
}
public IqPacket retrieveVcardAvatar(final Jid to) {
final IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
packet.setTo(to);
@ -604,6 +607,7 @@ public class IqGenerator extends AbstractGenerator {
packet.addChild("query", Namespace.DISCO_INFO);
return packet;
}
private static boolean persistentRoom() {
return xmppConnectionService.getBooleanPreference(PERSISTENT_ROOM, R.bool.enable_persistent_rooms);
}

View file

@ -19,9 +19,9 @@ import eu.siacs.conversations.entities.Presence;
import eu.siacs.conversations.generator.IqGenerator;
import eu.siacs.conversations.generator.PresenceGenerator;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnPresencePacketReceived;

View file

@ -6,6 +6,7 @@ import static eu.siacs.conversations.utils.StorageHelper.getGlobalDocumentsPath;
import static eu.siacs.conversations.utils.StorageHelper.getGlobalPicturesPath;
import static eu.siacs.conversations.utils.StorageHelper.getGlobalVideosPath;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
@ -452,7 +453,7 @@ public class FileBackend {
try {
final Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
long size = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE));
@SuppressLint("Range") long size = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE));
cursor.close();
return size;
} else {

View file

@ -208,8 +208,9 @@ public class AttachFileToConversationRunnable implements Runnable, TranscoderLis
if (p > currentProgress) {
currentProgress = p;
mXmppConnectionService.getNotificationService().updateFileAddingNotification(p, message);
callback.progress(currentProgress);
isCompressingVideo = new String[]{conversation.getUuid(), String.valueOf(currentProgress)};
callback.progress(currentProgress);
mXmppConnectionService.getHttpConnectionManager().updateConversationUi(false);
}
}

View file

@ -14,6 +14,7 @@ import android.view.View.OnLongClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
@ -155,7 +156,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
super.onSaveInstanceState(outState);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@ -256,7 +256,6 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
Log.d(Config.LOGTAG, "unable to load avatar into image view", e);
}
}
if (bm == null) {
togglePublishButton(false, R.string.publish);
this.hintOrWarning.setVisibility(View.VISIBLE);

View file

@ -505,6 +505,9 @@ public class RtpSessionActivity extends XmppActivity
@StringRes int res;
final String firstDenied =
getFirstDenied(permissionResult.grantResults, permissionResult.permissions);
if (firstDenied == null) {
return;
}
if (Manifest.permission.RECORD_AUDIO.equals(firstDenied)) {
res = R.string.no_microphone_permission;
} else if (Manifest.permission.CAMERA.equals(firstDenied)) {

View file

@ -396,6 +396,14 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
deleteOmemoPreference.setOnPreferenceClickListener(
preference -> deleteOmemoIdentities());
}
if (Config.omemoOnly()) {
final PreferenceScreen securityScreen =
(PreferenceScreen) mSettingsFragment.findPreference("security");
final Preference omemoPreference = mSettingsFragment.findPreference(OMEMO_SETTING);
if (omemoPreference != null) {
securityScreen.removePreference(omemoPreference);
}
}
PreferenceScreen ExpertPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("expert");
final Preference useBundledEmojis = mSettingsFragment.findPreference("use_bundled_emoji");
@ -477,26 +485,25 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
}
private void changeOmemoSettingSummary() {
ListPreference omemoPreference =
final ListPreference omemoPreference =
(ListPreference) mSettingsFragment.findPreference(OMEMO_SETTING);
if (omemoPreference != null) {
String value = omemoPreference.getValue();
switch (value) {
case "always":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_always);
break;
case "default_on":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_default_on);
break;
case "default_off":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_default_off);
break;
if (omemoPreference == null) {
return;
}
final String value = omemoPreference.getValue();
switch (value) {
case "always":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_always);
break;
case "default_on":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_default_on);
break;
case "default_off":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_default_off);
break;
case "always_off":
omemoPreference.setSummary(R.string.pref_omemo_setting_summary_always_off);
break;
}
} else {
Log.d(Config.LOGTAG, "unable to find preference named " + OMEMO_SETTING);
}
}

View file

@ -2,8 +2,8 @@ package eu.siacs.conversations.xmpp.pep;
import android.os.Bundle;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
public class PublishOptions {

View file

@ -437,6 +437,7 @@
<string name="no_update_available">No hay actualizaciones disponibles</string>
<string name="download_started">Se ha iniciado la descarga</string>
<string name="account_status_tor_unavailable">Red Tor no disponible</string>
<string name="account_status_i2p_unavailable">Red I2P no disponible</string>
<string name="account_status_bind_failure">Fallo de enlace</string>
<string name="account_status_host_unknown">El servidor no es responsable del dominio</string>
<string name="server_info_broken">Error</string>
@ -655,6 +656,8 @@
<string name="pref_use_auto_rotate">Girar multimedia en pantalla completa</string>
<string name="pref_use_tor">Conectar via Tor</string>
<string name="pref_use_tor_summary">Todas las conexiones se realizan a través de la red TOR. Requiere Orbot</string>
<string name="pref_use_i2p">Conectar via I2P</string>
<string name="pref_use_i2p_summary">Todas las conexiones por tunel por red I2P. Requiere cliente I2P</string>
<string name="pref_connection_options">Conexión</string>
<string name="image_low">baja (720p)</string>
<string name="image_mid">medio (1920p)</string>
@ -1075,6 +1078,7 @@
<string name="outgoing_call_time">%s · Llamada en curso</string>
<string name="outgoing_call">Llamada en curso</string>
<string name="disable_tor_to_make_call">Deshabilita Tor para hacer llamadas</string>
<string name="no_i2p_calls">No se pueden hacer llamadas via I2P</string>
<string name="help">Ayuda</string>
<string name="switch_to_conversation">Cambiar a conversación</string>
<string name="only_one_call_at_a_time">Solo puedes estar en una llamada a la vez.</string>