From a33df210d626abb19445dec2bad01cf821c01eac Mon Sep 17 00:00:00 2001 From: Arne Date: Mon, 20 Jun 2022 21:17:17 +0200 Subject: [PATCH 1/7] support sasl/temporary-auth-failure (Daniel Gultsch) --- build.gradle | 2 +- .../java/eu/siacs/conversations/Config.java | 2 +- .../siacs/conversations/entities/Account.java | 1 + .../conversations/xmpp/XmppConnection.java | 22 ++++++++++++------- src/main/res/values-de-rDE/strings.xml | 2 ++ src/main/res/values/defaults.xml | 2 +- src/main/res/values/strings.xml | 1 + 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index c240aee63..c6c338c62 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' + classpath 'com.android.tools.build:gradle:7.2.1' } } diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 93bcddb9e..7a63a7ab0 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -57,7 +57,7 @@ public final class Config { public static final String LOGTAG = BuildConfig.LOGTAG; public static final Jid BUG_REPORTS = Jid.of("support@monocles.de"); - public static final Uri HELP = Uri.parse("https://monocles.de/howto"); + public static final Uri HELP = Uri.parse("https://monocles.wiki"); public static final String inviteUserURL = "https://" + monocles() + "/i/"; public static final String inviteMUCURL = "https://" + monocles() + "/j/"; diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index 582ed54dd..c7eac9d2e 100644 --- a/src/main/java/eu/siacs/conversations/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -665,6 +665,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable ONLINE(false), NO_INTERNET(false), UNAUTHORIZED, + TEMPORARY_AUTH_FAILURE, SERVER_NOT_FOUND, REGISTRATION_SUCCESSFUL(false), REGISTRATION_FAILED(true, false), diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 41f9093f0..1f85e36ef 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -53,6 +53,7 @@ import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; +import com.google.common.base.Strings; import eu.siacs.conversations.BuildConfig; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -519,20 +520,25 @@ public class XmppConnection implements Runnable { } else if (nextTag.isStart("failure")) { final Element failure = tagReader.readElement(nextTag); if (Namespace.SASL.equals(failure.getNamespace())) { - final String text = failure.findChildContent("text"); - if (failure.hasChild("account-disabled") && text != null) { - Matcher matcher = Patterns.AUTOLINK_WEB_URL.matcher(text); + if (failure.hasChild("temporary-auth-failure")) { + throw new StateChangingException(Account.State.TEMPORARY_AUTH_FAILURE); + } else if (failure.hasChild("account-disabled")) { + final String text = failure.findChildContent("text"); + if ( Strings.isNullOrEmpty(text)) { + throw new StateChangingException(Account.State.UNAUTHORIZED); + } + final Matcher matcher = Patterns.AUTOLINK_WEB_URL.matcher(text); if (matcher.find()) { final HttpUrl url; try { url = HttpUrl.get(text.substring(matcher.start(), matcher.end())); - if (url.isHttps()) { - this.redirectionUrl = url; - throw new StateChangingException(Account.State.PAYMENT_REQUIRED); - } - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { throw new StateChangingException(Account.State.UNAUTHORIZED); } + if (url.isHttps()) { + this.redirectionUrl = url; + throw new StateChangingException(Account.State.PAYMENT_REQUIRED); + } } } throw new StateChangingException(Account.State.UNAUTHORIZED); diff --git a/src/main/res/values-de-rDE/strings.xml b/src/main/res/values-de-rDE/strings.xml index 4ceba73d8..bcc48f3bd 100644 --- a/src/main/res/values-de-rDE/strings.xml +++ b/src/main/res/values-de-rDE/strings.xml @@ -1176,4 +1176,6 @@ Orbot nicht gefunden Teilnehmer Download fehlgeschlagen: Ungültige Datei + Temporärer Authentifizierungsfehler + diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index b68ad7ff7..0db4e707a 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -119,7 +119,7 @@ - https://monocles.de/howto/ + https://monocles.wiki https://www.jabber.de/support/ https://dismail.de/contact.html https://www.draugr.de/kontakt/ diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 159240d33..793fde1e9 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -1203,4 +1203,5 @@ Participants Download failed: Invalid file Orbot not found + Temporary authentication failure From e0f3a1ee9d2ba502f714ba770a0242e00d67ef8d Mon Sep 17 00:00:00 2001 From: Arne Date: Mon, 20 Jun 2022 21:17:58 +0200 Subject: [PATCH 2/7] delete empty line --- src/main/res/values-de-rDE/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/res/values-de-rDE/strings.xml b/src/main/res/values-de-rDE/strings.xml index bcc48f3bd..647b2b0ff 100644 --- a/src/main/res/values-de-rDE/strings.xml +++ b/src/main/res/values-de-rDE/strings.xml @@ -1177,5 +1177,4 @@ Teilnehmer Download fehlgeschlagen: Ungültige Datei Temporärer Authentifizierungsfehler - From 1088c9dfe485b0ce6eab47a5bb1c7310d7faf94e Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 22 Jun 2022 19:03:45 +0200 Subject: [PATCH 3/7] corrected invite domain --- src/main/java/eu/siacs/conversations/Config.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 7a63a7ab0..04774dde1 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Locale; import java.util.Random; +import eu.siacs.conversations.BuildConfig; import eu.siacs.conversations.crypto.XmppDomainVerifier; import eu.siacs.conversations.services.ProviderService; import eu.siacs.conversations.xmpp.Jid; @@ -59,8 +60,8 @@ public final class Config { public static final Jid BUG_REPORTS = Jid.of("support@monocles.de"); public static final Uri HELP = Uri.parse("https://monocles.wiki"); - public static final String inviteUserURL = "https://" + monocles() + "/i/"; - public static final String inviteMUCURL = "https://" + monocles() + "/j/"; + public static final String inviteUserURL = monocles() + "/i/"; + 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/"; From 504a074a142321593fd09c9f2551cbf29d06677a Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 22 Jun 2022 19:04:13 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=20use=20item=20id=20'current'=20for=20nick?= =?UTF-8?q?=20as=20fallback=20as=20per=20XEP-0060=20=C2=A712.20=20(Daniel?= =?UTF-8?q?=20Gultsch)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/eu/siacs/conversations/generator/IqGenerator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index b952185dc..92ef7651d 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -131,6 +131,7 @@ public class IqGenerator extends AbstractGenerator { public IqPacket publishNick(String nick) { final Element item = new Element("item"); + item.setAttribute("id", "current"); item.addChild("nick", Namespace.NICK).setContent(nick); return publish(Namespace.NICK, item); } From 2d07c88c5026f03e51c4996c0ffe69c05597f253 Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 22 Jun 2022 19:09:37 +0200 Subject: [PATCH 5/7] minor code clean up (Daniel Gultsch) --- .../java/eu/siacs/conversations/ui/ConversationsActivity.java | 4 ++-- .../conversations/xmpp/jingle/JingleConnectionManager.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 2c6e756e6..fa55a5b59 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -192,7 +192,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio Log.d(Config.LOGTAG, "Device is running Android < SDK 23, no restart required: " + FirstStartTime); } - Intent intent = pendingViewIntent.pop(); + final Intent intent = pendingViewIntent.pop(); if (intent != null) { if (processViewIntent(intent)) { if (binding.secondaryFragment != null) { @@ -237,7 +237,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio notifyFragmentOfBackendConnected(id); } - ActivityResult activityResult = postponedActivityResult.pop(); + final ActivityResult activityResult = postponedActivityResult.pop(); if (activityResult != null) { handleActivityResult(activityResult); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index e6e02dbf5..bc9157889 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -569,9 +569,9 @@ public class JingleConnectionManager extends AbstractConnectionManager { } } synchronized (this.rtpSessionProposals) { - for (Map.Entry entry : + for (final Map.Entry entry : this.rtpSessionProposals.entrySet()) { - RtpSessionProposal proposal = entry.getKey(); + final RtpSessionProposal proposal = entry.getKey(); if (proposal.account == contact.getAccount() && contact.getJid().asBareJid().equals(proposal.with)) { final DeviceDiscoveryState preexistingState = entry.getValue(); From 6257be7cc3ee786d1d4067fdc332d88a15061e10 Mon Sep 17 00:00:00 2001 From: Arne Date: Wed, 22 Jun 2022 20:54:32 +0200 Subject: [PATCH 6/7] updated dependencies and set to min. skd 24 --- build.gradle | 22 +++++++++---------- .../conversations/ui/MediaViewerActivity.java | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index c6c338c62..abe2c5f65 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ configurations { } dependencies { - playstoreImplementation('com.google.firebase:firebase-messaging:23.0.2') { + playstoreImplementation('com.google.firebase:firebase-messaging:23.0.5') { 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' @@ -50,7 +50,7 @@ dependencies { //implementation 'org.webrtc:google-webrtc:1.0.32006' implementation 'org.bouncycastle:bcmail-jdk15on:1.64' implementation 'org.gnu.inet:libidn:1.15' - implementation 'com.google.zxing:core:3.3.3' // > 3.3.x not working below SDK 24 + implementation 'com.google.zxing:core:3.5.0' // > 3.3.x not working below SDK 24 implementation 'de.measite.minidns:minidns-hla:0.2.4' implementation 'me.leolin:ShortcutBadger:1.1.22@aar' implementation 'org.whispersystems:signal-protocol-java:2.6.2' @@ -59,20 +59,20 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.6' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.legacy:legacy-support-v13:1.0.0' - implementation 'androidx.appcompat:appcompat:1.3.1' // 1.4.0 needs minCompileSdk 31 + implementation 'androidx.appcompat:appcompat:1.4.2' // 1.4.0 needs minCompileSdk 31 implementation 'androidx.exifinterface:exifinterface:1.3.3' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation "androidx.emoji2:emoji2:1.1.0-rc01" - gitImplementation "androidx.emoji2:emoji2-bundled:1.1.0-rc01" + implementation "androidx.emoji2:emoji2:1.2.0-alpha04" + gitImplementation "androidx.emoji2:emoji2-bundled:1.2.0-alpha04" implementation 'androidx.recyclerview:recyclerview:1.2.1' - implementation 'com.google.android.material:material:1.4.0' + implementation 'com.google.android.material:material:1.6.1' implementation 'androidx.cardview:cardview:1.0.0' // for compatibility implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0' - implementation 'com.google.android.exoplayer:exoplayer-core:2.15.0' - implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.0' + implementation 'com.google.android.exoplayer:exoplayer-core:2.18.0' + implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.0' implementation 'com.wefika:flowlayout:0.4.1' implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5' - implementation 'org.jxmpp:jxmpp-jid:1.0.2' + implementation 'org.jxmpp:jxmpp-jid:1.0.3' implementation 'org.hsluv:hsluv:0.2' implementation 'org.conscrypt:conscrypt-android:2.5.2' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' @@ -80,7 +80,7 @@ dependencies { implementation 'org.osmdroid:osmdroid-android:6.1.11' implementation 'com.leinardi.android:speed-dial:3.2.0' implementation 'com.squareup.picasso:picasso:2.71828' - implementation 'com.squareup.okhttp3:okhttp:4.9.2' + implementation 'com.squareup.okhttp3:okhttp:4.9.3' implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.google.guava:guava:31.0.1-android' @@ -102,7 +102,7 @@ android { compileSdkVersion 31 defaultConfig { - minSdkVersion 21 + minSdkVersion 24 targetSdkVersion 30 //versionNameSuffix " beta_(2021-12-19)" // " beta_(XXXX-XX-XX)" // activate for beta versions diff --git a/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java b/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java index c620100ed..4e9ef7004 100644 --- a/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java @@ -32,6 +32,7 @@ import androidx.databinding.DataBindingUtil; import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; +import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.SimpleExoPlayer; @@ -331,7 +332,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On player.setRepeatMode(Player.REPEAT_MODE_OFF); binding.messageVideoView.setPlayer(player); DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, System.getProperty("http.agent")); - MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri); + MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(uri)); player.prepare(videoSource); requestAudioFocus(); setVolumeControlStream(AudioManager.STREAM_MUSIC); From e4c70bdd6b5c33574de59823395cc7b510378037 Mon Sep 17 00:00:00 2001 From: Arne Date: Thu, 23 Jun 2022 18:21:32 +0200 Subject: [PATCH 7/7] changed defaults to little more privacy --- src/main/res/values/defaults.xml | 6 +++--- src/main/res/xml/preferences.xml | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index 0db4e707a..5a4799abf 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -42,11 +42,11 @@ monocles.live false false - false + true true false true - false + true true true false @@ -96,7 +96,7 @@ false false false - true + false 0