diff --git a/build.gradle b/build.gradle index f9babe900..eacfb26ad 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' + classpath 'com.android.tools.build:gradle:7.1.1' } } @@ -69,8 +69,8 @@ dependencies { implementation 'com.google.android.material:material:1.5.0' 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.16.1' + implementation 'com.google.android.exoplayer:exoplayer-ui:2.16.1' 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' @@ -106,8 +106,8 @@ android { targetSdkVersion 31 //versionNameSuffix " beta_(2021-12-19)" // " beta_(XXXX-XX-XX)" // activate for beta versions - versionCode 111 - versionName "1.5" + versionCode 112 + versionName "1.5.1" //resConfigs "en" archivesBaseName += "-$versionName" diff --git a/gradle.properties b/gradle.properties index 71a0944a3..8d943d677 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,6 @@ # org.gradle.parallel=true #Sat Jan 22 19:25:52 CET 2022 org.gradle.parallel=true -org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M" +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 android.enableJetifier=true android.useAndroidX=true \ No newline at end of file diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 4a19e49c5..a4b20cacd 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -180,6 +180,11 @@ public class IqGenerator extends AbstractGenerator { info.setAttribute("type", avatar.type); return publish("urn:xmpp:avatar:metadata", item, options); } + public IqPacket deleteAvatar() { + final Element item = new Element("item"); + item.addChild("metadata", "urn:xmpp:avatar:metadata"); + return publish("urn:xmpp:avatar:metadata", item); + } public IqPacket retrievePepAvatar(final Avatar avatar) { final Element item = new Element("item"); diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 94399ac4a..b54fab955 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -320,6 +320,10 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } else if (mXmppConnectionService.isDataSaverDisabled()) { mXmppConnectionService.fetchAvatar(account, avatar); } + } else { + final Contact c = account.getRoster().getContact(from); + mXmppConnectionService.getAvatarService().clear(c); + mXmppConnectionService.getFileBackend().deleteAvatar(c.getAvatarFilename()); } } else if (Namespace.NICK.equals(node)) { final Element i = items.findChild("item"); diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 04359d363..06bd35809 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -1311,6 +1311,16 @@ public class FileBackend { final File file = getAvatarFile(avatar.getFilename()); return file.exists(); } + public boolean deleteAvatar(final String avatarFilename) { + final File file = getAvatarFile(avatarFilename); + return deleteAvatar(file); + } + + public boolean deleteAvatar(final Avatar avatar) { + final File file = getAvatarFile(avatar.getFilename()); + return deleteAvatar(file); + } + public boolean deleteAvatar(final File avatar) { if (avatar.exists()) { return avatar.delete(); diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index cae116604..0b48565ac 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -4079,7 +4079,7 @@ public class XmppConnectionService extends Service { public void deleteAvatar(Account account) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": deleting avatar"); - IqPacket packet = this.mIqGenerator.deleteNode("urn:xmpp:avatar:data"); + IqPacket packet = this.mIqGenerator.deleteAvatar(); this.sendIqPacket(account, packet, new OnIqPacketReceived() { @Override @@ -4088,7 +4088,9 @@ public class XmppConnectionService extends Service { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": avatar deletion succeed"); if (account.getAvatar() != null) { if (getFileBackend().deleteAvatar(getFileBackend().getAvatarFile(account.getAvatar()))) { - mAvatarService.clear(account); + getAvatarService().clear(account); + databaseBackend.updateAccount(account); + notifyAccountAvatarHasChanged(account); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": local avatar cache deletion succeed"); } } diff --git a/src/main/res/menu/activity_publish_avatar.xml b/src/main/res/menu/activity_publish_avatar.xml index d981a9a03..7e64fe50d 100644 --- a/src/main/res/menu/activity_publish_avatar.xml +++ b/src/main/res/menu/activity_publish_avatar.xml @@ -4,7 +4,7 @@ \ No newline at end of file