Merge commit '63cc5f96edd53598a68059d3450eb93c938b1325' (2.6.0-beta) into develop

This commit is contained in:
genofire 2019-11-10 14:45:08 +01:00
commit 01e47183ff
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
39 changed files with 749 additions and 310 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
### Version 2.6.0
* Introduce expert setting to perform channel discovery on local server instead of [search.jabber.network](https://search.jabber.network)
* Enable delivery check marks by default and remove setting
* Enable Send button indicates status by default and remove setting
* Move Backup and Foreground Service settings to main screen
### Version 2.5.12 ### Version 2.5.12
* Jingle file transfer fixes * Jingle file transfer fixes
* Fixed OMEMO self healing (after backup restore) on servers w/o MAM * Fixed OMEMO self healing (after backup restore) on servers w/o MAM

View File

@ -93,11 +93,13 @@ build your apk file.
XMPP, like email, is a federated protocol, which means that there is not one company you can create an *official XMPP account* with. Instead there are hundreds, or even thousands, of providers out there. One of those providers is our very own [chat.sum7.eu](https://chat.sum7.eu). If you dont like to use *chat.sum7.eu* use a web search engine of your choice to find another provider. Or maybe your university has one. Or you can run your own. Or ask a friend to run one. Once you've found one, you can use Conversations to create an account. Just select *register new account* on server within the create account dialog. XMPP, like email, is a federated protocol, which means that there is not one company you can create an *official XMPP account* with. Instead there are hundreds, or even thousands, of providers out there. One of those providers is our very own [chat.sum7.eu](https://chat.sum7.eu). If you dont like to use *chat.sum7.eu* use a web search engine of your choice to find another provider. Or maybe your university has one. Or you can run your own. Or ask a friend to run one. Once you've found one, you can use Conversations to create an account. Just select *register new account* on server within the create account dialog.
##### Running your own ##### Running your own
If you already have a server somewhere and are willing and able to put the necessary work in, one alternative-in the spirit of federation-is to run your own. We recommend either [Prosody](https://prosody.im/) or [ejabberd](https://www.ejabberd.im/). Both of which have their own strengths. Ejabberd is slightly more mature nowadays but Prosody is arguably easier to set up. If you already have a server somewhere and are willing and able to put the necessary work in you can run your own XMPP server.
For Prosody you need a couple of so called [community modules](https://modules.prosody.im/) most of which are maintained by the same people that develop Prosody. As of 2019 we recommend you use [ejabberd](https://ejabberd.im). The default configuration file already enables everything you need to pass the [Conversations Compliance Suite](https://compliance.conversations.im). Make sure your Linux distribution ships a fairly recent version.
If you pick ejabberd make sure you use the latest version. Linux Distributions might bundle some very old versions of it. With a little bit of effort [Prosody](https://prosody.im) can be configured to support all necessary extensions as well. However you will have to rely on so called [Community Modules](https://modules.prosody.im/) of varying quality. Prosody can be interesting to people who like to modify their server and create / prototype own modules.
Performance wise - for small deployments - both ejabberd and Prosody should be fine.
#### Where can I set up a custom hostname / port #### Where can I set up a custom hostname / port
Conversations will automatically look up the SRV records for your domain name Conversations will automatically look up the SRV records for your domain name

View File

@ -68,7 +68,7 @@ dependencies {
implementation "com.leinardi.android:speed-dial:2.0.1" implementation "com.leinardi.android:speed-dial:2.0.1"
implementation 'com.squareup.retrofit2:retrofit:2.6.1' implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1' implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.squareup.okhttp3:okhttp:3.12.5' implementation 'com.squareup.okhttp3:okhttp:3.12.6'
implementation 'com.google.guava:guava:27.1-android' implementation 'com.google.guava:guava:27.1-android'
quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.10.16' quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.10.16'
} }
@ -84,8 +84,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 25 targetSdkVersion 25
versionCode 346 versionCode 347
versionName "2.5.12" versionName "2.6.0-beta"
archivesBaseName += "-$versionName" archivesBaseName += "-$versionName"
applicationId "eu.sum7.conversations" applicationId "eu.sum7.conversations"
resValue "string", "applicationId", applicationId resValue "string", "applicationId", applicationId

View File

@ -90,7 +90,7 @@ public final class Config {
public static final int REFRESH_UI_INTERVAL = 500; public static final int REFRESH_UI_INTERVAL = 500;
public static final int MAX_DISPLAY_MESSAGE_CHARS = 4096; public static final int MAX_DISPLAY_MESSAGE_CHARS = 4096;
public static final int MAX_STORAGE_MESSAGE_CHARS = 1024 * 1024 * 1024; public static final int MAX_STORAGE_MESSAGE_CHARS = 1024 * 1024; //1MB
public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; public static final long MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000;

View File

@ -201,6 +201,9 @@ public class PgpDecryptionService {
if (fixedFile.getParentFile().mkdirs()) { if (fixedFile.getParentFile().mkdirs()) {
Log.d(Config.LOGTAG,"created parent directories for "+fixedFile.getAbsolutePath()); Log.d(Config.LOGTAG,"created parent directories for "+fixedFile.getAbsolutePath());
} }
synchronized (mXmppConnectionService.FILENAMES_TO_IGNORE_DELETION) {
mXmppConnectionService.FILENAMES_TO_IGNORE_DELETION.add(outputFile.getAbsolutePath());
}
if (outputFile.renameTo(fixedFile)) { if (outputFile.renameTo(fixedFile)) {
Log.d(Config.LOGTAG, "renamed " + outputFile.getAbsolutePath() + " to " + fixedFile.getAbsolutePath()); Log.d(Config.LOGTAG, "renamed " + outputFile.getAbsolutePath() + " to " + fixedFile.getAbsolutePath());
message.setRelativeFilePath(path); message.setRelativeFilePath(path);

View File

@ -335,7 +335,7 @@ public class MucOptions {
} }
public boolean isContactInRoom(Contact contact) { public boolean isContactInRoom(Contact contact) {
return findUserByRealJid(contact.getJid().asBareJid()) != null; return contact != null && findUserByRealJid(contact.getJid().asBareJid()) != null;
} }
public boolean isUserInRoom(Jid jid) { public boolean isUserInRoom(Jid jid) {

View File

@ -0,0 +1,90 @@
package eu.siacs.conversations.entities;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.ComparisonChain;
import java.util.Comparator;
import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.utils.LanguageUtils;
import eu.siacs.conversations.utils.UIHelper;
import rocks.xmpp.addr.Jid;
public class Room implements AvatarService.Avatarable, Comparable<Room> {
public String address;
public String name;
public String description;
public String language;
public int nusers;
public Room(String address, String name, String description, String language, int nusers) {
this.address = address;
this.name = name;
this.description = description;
this.language = language;
this.nusers = nusers;
}
public Room() {
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public Jid getRoom() {
try {
return Jid.of(address);
} catch (IllegalArgumentException e) {
return null;
}
}
public String getLanguage() {
return LanguageUtils.convert(language);
}
@Override
public int getAvatarBackgroundColor() {
Jid room = getRoom();
return UIHelper.getColorForName(room != null ? room.asBareJid().toEscapedString() : name);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Room room = (Room) o;
return Objects.equal(address, room.address) &&
Objects.equal(name, room.name) &&
Objects.equal(description, room.description);
}
@Override
public int hashCode() {
return Objects.hashCode(address, name, description);
}
public boolean contains(String needle) {
return Strings.nullToEmpty(name).contains(needle)
|| Strings.nullToEmpty(description).contains(needle)
|| Strings.nullToEmpty(address).contains(needle);
}
@Override
public int compareTo(Room o) {
return ComparisonChain.start()
.compare(o.nusers, nusers)
.compare(Strings.nullToEmpty(name), Strings.nullToEmpty(o.name))
.compare(Strings.nullToEmpty(address), Strings.nullToEmpty(o.address))
.result();
}
}

View File

@ -565,4 +565,18 @@ public class IqGenerator extends AbstractGenerator {
} }
return packet; return packet;
} }
public IqPacket queryDiscoItems(Jid jid) {
IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
packet.setTo(jid);
packet.addChild("query",Namespace.DISCO_ITEMS);
return packet;
}
public IqPacket queryDiscoInfo(Jid jid) {
IqPacket packet = new IqPacket(IqPacket.TYPE.GET);
packet.setTo(jid);
packet.addChild("query",Namespace.DISCO_INFO);
return packet;
}
} }

View File

@ -37,16 +37,14 @@ public class MessageGenerator extends AbstractGenerator {
if (conversation.getMode() == Conversation.MODE_SINGLE) { if (conversation.getMode() == Conversation.MODE_SINGLE) {
packet.setTo(message.getCounterpart()); packet.setTo(message.getCounterpart());
packet.setType(MessagePacket.TYPE_CHAT); packet.setType(MessagePacket.TYPE_CHAT);
if (this.mXmppConnectionService.indicateReceived() && !isWithSelf) { if (!isWithSelf) {
packet.addChild("request", "urn:xmpp:receipts"); packet.addChild("request", "urn:xmpp:receipts");
} }
} else if (message.isPrivateMessage()) { } else if (message.isPrivateMessage()) {
packet.setTo(message.getCounterpart()); packet.setTo(message.getCounterpart());
packet.setType(MessagePacket.TYPE_CHAT); packet.setType(MessagePacket.TYPE_CHAT);
packet.addChild("x", "http://jabber.org/protocol/muc#user"); packet.addChild("x", "http://jabber.org/protocol/muc#user");
if (this.mXmppConnectionService.indicateReceived()) { packet.addChild("request", "urn:xmpp:receipts");
packet.addChild("request", "urn:xmpp:receipts");
}
} else { } else {
packet.setTo(message.getCounterpart().asBareJid()); packet.setTo(message.getCounterpart().asBareJid());
packet.setType(MessagePacket.TYPE_GROUPCHAT); packet.setType(MessagePacket.TYPE_GROUPCHAT);

View File

@ -1,20 +1,15 @@
package eu.siacs.conversations.http.services; package eu.siacs.conversations.http.services;
import com.google.common.base.Objects;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import eu.siacs.conversations.services.AvatarService; import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.utils.LanguageUtils;
import eu.siacs.conversations.utils.UIHelper;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Query; import retrofit2.http.Query;
import rocks.xmpp.addr.Jid;
public interface MuclumbusService { public interface MuclumbusService {
@ -31,55 +26,6 @@ public interface MuclumbusService {
public List<Room> items; public List<Room> items;
} }
class Room implements AvatarService.Avatarable {
public String address;
public String name;
public String description;
public String language;
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public Jid getRoom() {
try {
return Jid.of(address);
} catch (IllegalArgumentException e) {
return null;
}
}
public String getLanguage() {
return LanguageUtils.convert(language);
}
@Override
public int getAvatarBackgroundColor() {
Jid room = getRoom();
return UIHelper.getColorForName(room != null ? room.asBareJid().toEscapedString() : name);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Room room = (Room) o;
return Objects.equal(address, room.address) &&
Objects.equal(name, room.name) &&
Objects.equal(description, room.description);
}
@Override
public int hashCode() {
return Objects.hashCode(address, name, description);
}
}
class SearchRequest { class SearchRequest {
public final Set<String> keywords; public final Set<String> keywords;

View File

@ -1,6 +1,7 @@
package eu.siacs.conversations.parser; package eu.siacs.conversations.parser;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
@ -27,12 +28,15 @@ import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.services.ChannelDiscoveryService;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import rocks.xmpp.addr.Jid; import rocks.xmpp.addr.Jid;
@ -417,4 +421,55 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
} }
} }
public static List<Jid> items(IqPacket packet) {
ArrayList<Jid> items = new ArrayList<>();
final Element query = packet.findChild("query", Namespace.DISCO_ITEMS);
if (query == null) {
return items;
}
for(Element child : query.getChildren()) {
if ("item".equals(child.getName())) {
Jid jid = child.getAttributeAsJid("jid");
if (jid != null) {
items.add(jid);
}
}
}
return items;
}
public static Room parseRoom(IqPacket packet) {
final Element query = packet.findChild("query", Namespace.DISCO_INFO);
if(query == null) {
return null;
}
final Element x = query.findChild("x");
if (x == null) {
return null;
}
final Element identity = query.findChild("identity");
Data data = Data.parse(x);
String address = packet.getFrom().toEscapedString();
String name = identity == null ? null : identity.getAttribute("name");
String roomName = data.getValue("muc#roomconfig_roomname");;
String description = data.getValue("muc#roominfo_description");
String language = data.getValue("muc#roominfo_lang");
String occupants = data.getValue("muc#roominfo_occupants");
int nusers;
try {
nusers = occupants == null ? 0 : Integer.parseInt(occupants);
} catch (NumberFormatException e) {
nusers = 0;
}
return new Room(
address,
TextUtils.isEmpty(roomName) ? name : roomName,
description,
language,
nusers
);
}
} }

View File

@ -827,6 +827,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
final Jid sender = InvalidJid.getNullForInvalid(displayed.getAttributeAsJid("sender")); final Jid sender = InvalidJid.getNullForInvalid(displayed.getAttributeAsJid("sender"));
if (packet.fromAccount(account) && !selfAddressed) { if (packet.fromAccount(account) && !selfAddressed) {
dismissNotification(account, counterpart, query); dismissNotification(account, counterpart, query);
if (query == null) {
activateGracePeriod(account);
}
} else if (isTypeGroupChat) { } else if (isTypeGroupChat) {
Conversation conversation = mXmppConnectionService.find(account, counterpart.asBareJid()); Conversation conversation = mXmppConnectionService.find(account, counterpart.asBareJid());
if (conversation != null && id != null && sender != null) { if (conversation != null && id != null && sender != null) {

View File

@ -356,7 +356,8 @@ public class FileBackend {
if (stream != null) { if (stream != null) {
try { try {
stream.close(); stream.close();
} catch (IOException e) { } catch (Exception e) {
Log.d(Config.LOGTAG, "unable to close stream", e);
} }
} }
} }
@ -366,6 +367,7 @@ public class FileBackend {
try { try {
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
Log.d(Config.LOGTAG, "unable to close socket", e);
} }
} }
} }
@ -375,6 +377,7 @@ public class FileBackend {
try { try {
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
Log.d(Config.LOGTAG, "unable to close server socket", e);
} }
} }
} }

View File

@ -38,6 +38,7 @@ import eu.siacs.conversations.entities.ListItem;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.RawBlockable; import eu.siacs.conversations.entities.RawBlockable;
import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.http.services.MuclumbusService;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded;
@ -81,14 +82,14 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
return get((ListItem) avatarable, size, cachedOnly); return get((ListItem) avatarable, size, cachedOnly);
} else if (avatarable instanceof MucOptions.User) { } else if (avatarable instanceof MucOptions.User) {
return get((MucOptions.User) avatarable, size, cachedOnly); return get((MucOptions.User) avatarable, size, cachedOnly);
} else if (avatarable instanceof MuclumbusService.Room) { } else if (avatarable instanceof Room) {
return get((MuclumbusService.Room) avatarable, size, cachedOnly); return get((Room) avatarable, size, cachedOnly);
} }
throw new AssertionError("AvatarService does not know how to generate avatar from "+avatarable.getClass().getName()); throw new AssertionError("AvatarService does not know how to generate avatar from "+avatarable.getClass().getName());
} }
private Bitmap get(final MuclumbusService.Room result, final int size, boolean cacheOnly) { private Bitmap get(final Room result, final int size, boolean cacheOnly) {
final Jid room = result.getRoom(); final Jid room = result.getRoom();
Conversation conversation = room != null ? mXmppConnectionService.findFirstMuc(room) : null; Conversation conversation = room != null ? mXmppConnectionService.findFirstMuc(room) : null;
if (conversation != null) { if (conversation != null) {

View File

@ -7,14 +7,27 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.http.services.MuclumbusService;
import eu.siacs.conversations.parser.IqParser;
import eu.siacs.conversations.utils.LanguageUtils;
import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.ResponseBody; import okhttp3.ResponseBody;
import retrofit2.Call; import retrofit2.Call;
@ -22,6 +35,7 @@ import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
import rocks.xmpp.addr.Jid;
public class ChannelDiscoveryService { public class ChannelDiscoveryService {
@ -30,7 +44,7 @@ public class ChannelDiscoveryService {
private MuclumbusService muclumbusService; private MuclumbusService muclumbusService;
private final Cache<String, List<MuclumbusService.Room>> cache; private final Cache<String, List<Room>> cache;
ChannelDiscoveryService(XmppConnectionService service) { ChannelDiscoveryService(XmppConnectionService service) {
this.service = service; this.service = service;
@ -56,21 +70,28 @@ public class ChannelDiscoveryService {
this.muclumbusService = retrofit.create(MuclumbusService.class); this.muclumbusService = retrofit.create(MuclumbusService.class);
} }
void discover(String query, OnChannelSearchResultsFound onChannelSearchResultsFound) { void cleanCache() {
final boolean all = query == null || query.trim().isEmpty(); cache.invalidateAll();
List<MuclumbusService.Room> result = cache.getIfPresent(all ? "" : query); }
void discover(@NonNull final String query, Method method, OnChannelSearchResultsFound onChannelSearchResultsFound) {
List<Room> result = cache.getIfPresent(key(method, query));
if (result != null) { if (result != null) {
onChannelSearchResultsFound.onChannelSearchResultsFound(result); onChannelSearchResultsFound.onChannelSearchResultsFound(result);
return; return;
} }
if (all) { if (method == Method.LOCAL_SERVER) {
discoverChannels(onChannelSearchResultsFound); discoverChannelsLocalServers(query, onChannelSearchResultsFound);
} else { } else {
discoverChannels(query, onChannelSearchResultsFound); if (query.isEmpty()) {
discoverChannelsJabberNetwork(onChannelSearchResultsFound);
} else {
discoverChannelsJabberNetwork(query, onChannelSearchResultsFound);
}
} }
} }
private void discoverChannels(OnChannelSearchResultsFound listener) { private void discoverChannelsJabberNetwork(OnChannelSearchResultsFound listener) {
Call<MuclumbusService.Rooms> call = muclumbusService.getRooms(1); Call<MuclumbusService.Rooms> call = muclumbusService.getRooms(1);
try { try {
call.enqueue(new Callback<MuclumbusService.Rooms>() { call.enqueue(new Callback<MuclumbusService.Rooms>() {
@ -82,7 +103,7 @@ public class ChannelDiscoveryService {
logError(response); logError(response);
return; return;
} }
cache.put("", body.items); cache.put(key(Method.JABBER_NETWORK, ""), body.items);
listener.onChannelSearchResultsFound(body.items); listener.onChannelSearchResultsFound(body.items);
} }
@ -97,7 +118,7 @@ public class ChannelDiscoveryService {
} }
} }
private void discoverChannels(final String query, OnChannelSearchResultsFound listener) { private void discoverChannelsJabberNetwork(final String query, OnChannelSearchResultsFound listener) {
MuclumbusService.SearchRequest searchRequest = new MuclumbusService.SearchRequest(query); MuclumbusService.SearchRequest searchRequest = new MuclumbusService.SearchRequest(query);
Call<MuclumbusService.SearchResult> searchResultCall = muclumbusService.search(searchRequest); Call<MuclumbusService.SearchResult> searchResultCall = muclumbusService.search(searchRequest);
@ -110,7 +131,7 @@ public class ChannelDiscoveryService {
logError(response); logError(response);
return; return;
} }
cache.put(query, body.result.items); cache.put(key(Method.JABBER_NETWORK, query), body.result.items);
listener.onChannelSearchResultsFound(body.result.items); listener.onChannelSearchResultsFound(body.result.items);
} }
@ -122,6 +143,102 @@ public class ChannelDiscoveryService {
}); });
} }
private void discoverChannelsLocalServers(final String query, final OnChannelSearchResultsFound listener) {
final Map<Jid, Account> localMucService = getLocalMucServices();
Log.d(Config.LOGTAG, "checking with " + localMucService.size() + " muc services");
if (localMucService.size() == 0) {
listener.onChannelSearchResultsFound(Collections.emptyList());
return;
}
if (!query.isEmpty()) {
final List<Room> cached = cache.getIfPresent(key(Method.LOCAL_SERVER, ""));
if (cached != null) {
final List<Room> results = copyMatching(cached, query);
cache.put(key(Method.LOCAL_SERVER, query), results);
listener.onChannelSearchResultsFound(results);
}
}
final AtomicInteger queriesInFlight = new AtomicInteger();
final List<Room> rooms = new ArrayList<>();
for (Map.Entry<Jid, Account> entry : localMucService.entrySet()) {
IqPacket itemsRequest = service.getIqGenerator().queryDiscoItems(entry.getKey());
queriesInFlight.incrementAndGet();
service.sendIqPacket(entry.getValue(), itemsRequest, (account, itemsResponse) -> {
if (itemsResponse.getType() == IqPacket.TYPE.RESULT) {
final List<Jid> items = IqParser.items(itemsResponse);
for (Jid item : items) {
IqPacket infoRequest = service.getIqGenerator().queryDiscoInfo(item);
queriesInFlight.incrementAndGet();
service.sendIqPacket(account, infoRequest, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(Account account, IqPacket infoResponse) {
if (infoResponse.getType() == IqPacket.TYPE.RESULT) {
final Room room = IqParser.parseRoom(infoResponse);
if (room != null) {
rooms.add(room);
}
if (queriesInFlight.decrementAndGet() <= 0) {
finishDiscoSearch(rooms, query, listener);
}
} else {
queriesInFlight.decrementAndGet();
}
}
});
}
}
if (queriesInFlight.decrementAndGet() <= 0) {
finishDiscoSearch(rooms, query, listener);
}
});
}
}
private void finishDiscoSearch(List<Room> rooms, String query, OnChannelSearchResultsFound listener) {
Collections.sort(rooms);
cache.put(key(Method.LOCAL_SERVER, ""), rooms);
if (query.isEmpty()) {
listener.onChannelSearchResultsFound(rooms);
} else {
List<Room> results = copyMatching(rooms, query);
cache.put(key(Method.LOCAL_SERVER, query), results);
listener.onChannelSearchResultsFound(rooms);
}
}
private static List<Room> copyMatching(List<Room> haystack, String needle) {
ArrayList<Room> result = new ArrayList<>();
for (Room room : haystack) {
if (room.contains(needle)) {
result.add(room);
}
}
return result;
}
private Map<Jid, Account> getLocalMucServices() {
final HashMap<Jid, Account> localMucServices = new HashMap<>();
for (Account account : service.getAccounts()) {
if (account.isEnabled()) {
final XmppConnection xmppConnection = account.getXmppConnection();
if (xmppConnection == null) {
continue;
}
for (final String mucService : xmppConnection.getMucServers()) {
Jid jid = Jid.of(mucService);
if (!localMucServices.containsKey(jid)) {
localMucServices.put(jid, account);
}
}
}
}
return localMucServices;
}
private static String key(Method method, String query) {
return String.format("%s\00%s", method, query);
}
private static void logError(final Response response) { private static void logError(final Response response) {
final ResponseBody errorBody = response.errorBody(); final ResponseBody errorBody = response.errorBody();
Log.d(Config.LOGTAG, "code from muclumbus=" + response.code()); Log.d(Config.LOGTAG, "code from muclumbus=" + response.code());
@ -129,13 +246,18 @@ public class ChannelDiscoveryService {
return; return;
} }
try { try {
Log.d(Config.LOGTAG,"error body="+errorBody.string()); Log.d(Config.LOGTAG, "error body=" + errorBody.string());
} catch (IOException e) { } catch (IOException e) {
//ignored //ignored
} }
} }
public interface OnChannelSearchResultsFound { public interface OnChannelSearchResultsFound {
void onChannelSearchResultsFound(List<MuclumbusService.Room> results); void onChannelSearchResultsFound(List<Room> results);
}
public enum Method {
JABBER_NETWORK,
LOCAL_SERVER
} }
} }

View File

@ -442,6 +442,8 @@ public class NotificationService {
} catch (SecurityException e) { } catch (SecurityException e) {
Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString()); Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString());
} }
} else {
mBuilder.setLocalOnly(true);
} }
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mBuilder.setCategory(Notification.CATEGORY_MESSAGE); mBuilder.setCategory(Notification.CATEGORY_MESSAGE);
@ -563,14 +565,16 @@ public class NotificationService {
if (addedActionsCount < 3) { if (addedActionsCount < 3) {
final Message firstLocationMessage = getFirstLocationMessage(messages); final Message firstLocationMessage = getFirstLocationMessage(messages);
if (firstLocationMessage != null) { if (firstLocationMessage != null) {
String label = mXmppConnectionService.getResources().getString(R.string.show_location); final PendingIntent pendingShowLocationIntent = createShowLocationIntent(firstLocationMessage);
PendingIntent pendingShowLocationIntent = createShowLocationIntent(firstLocationMessage); if (pendingShowLocationIntent != null) {
NotificationCompat.Action locationAction = new NotificationCompat.Action.Builder( final String label = mXmppConnectionService.getResources().getString(R.string.show_location);
R.drawable.ic_room_white_24dp, NotificationCompat.Action locationAction = new NotificationCompat.Action.Builder(
label, R.drawable.ic_room_white_24dp,
pendingShowLocationIntent).build(); label,
mBuilder.addAction(locationAction); pendingShowLocationIntent).build();
++addedActionsCount; mBuilder.addAction(locationAction);
++addedActionsCount;
}
} }
} }
if (addedActionsCount < 3) { if (addedActionsCount < 3) {
@ -766,7 +770,7 @@ public class NotificationService {
return PendingIntent.getActivity(mXmppConnectionService, generateRequestCode(message.getConversation(), 18), intent, PendingIntent.FLAG_UPDATE_CURRENT); return PendingIntent.getActivity(mXmppConnectionService, generateRequestCode(message.getConversation(), 18), intent, PendingIntent.FLAG_UPDATE_CURRENT);
} }
} }
return createOpenConversationsIntent(); return null;
} }
private PendingIntent createContentIntent(final String conversationUuid, final String downloadMessageUuid) { private PendingIntent createContentIntent(final String conversationUuid, final String downloadMessageUuid) {
@ -906,7 +910,10 @@ public class NotificationService {
} }
} }
mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled)); mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled));
mBuilder.setContentIntent(createOpenConversationsIntent()); final PendingIntent openIntent = createOpenConversationsIntent();
if (openIntent != null) {
mBuilder.setContentIntent(openIntent);
}
mBuilder.setWhen(0); mBuilder.setWhen(0);
mBuilder.setPriority(Notification.PRIORITY_MIN); mBuilder.setPriority(Notification.PRIORITY_MIN);
mBuilder.setSmallIcon(connected > 0 ? R.drawable.ic_link_white_24dp : R.drawable.ic_link_off_white_24dp); mBuilder.setSmallIcon(connected > 0 ? R.drawable.ic_link_white_24dp : R.drawable.ic_link_off_white_24dp);
@ -920,7 +927,11 @@ public class NotificationService {
} }
private PendingIntent createOpenConversationsIntent() { private PendingIntent createOpenConversationsIntent() {
return PendingIntent.getActivity(mXmppConnectionService, 0, new Intent(mXmppConnectionService, ConversationsActivity.class), 0); try {
return PendingIntent.getActivity(mXmppConnectionService, 0, new Intent(mXmppConnectionService, ConversationsActivity.class), 0);
} catch (RuntimeException e) {
return null;
}
} }
void updateErrorNotification() { void updateErrorNotification() {

View File

@ -34,6 +34,7 @@ import android.provider.ContactsContract;
import android.security.KeyChain; import android.security.KeyChain;
import android.support.annotation.BoolRes; import android.support.annotation.BoolRes;
import android.support.annotation.IntegerRes; import android.support.annotation.IntegerRes;
import android.support.annotation.NonNull;
import android.support.v4.app.RemoteInput; import android.support.v4.app.RemoteInput;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.TextUtils; import android.text.TextUtils;
@ -42,6 +43,8 @@ import android.util.Log;
import android.util.LruCache; import android.util.LruCache;
import android.util.Pair; import android.util.Pair;
import com.google.common.base.Strings;
import org.conscrypt.Conscrypt; import org.conscrypt.Conscrypt;
import org.openintents.openpgp.IOpenPgpService2; import org.openintents.openpgp.IOpenPgpService2;
import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi;
@ -277,6 +280,9 @@ public class XmppConnectionService extends Service {
private final Object LISTENER_LOCK = new Object(); private final Object LISTENER_LOCK = new Object();
public final Set<String> FILENAMES_TO_IGNORE_DELETION = new HashSet<>();
private final OnBindListener mOnBindListener = new OnBindListener() { private final OnBindListener mOnBindListener = new OnBindListener() {
@Override @Override
@ -854,8 +860,8 @@ public class XmppConnectionService extends Service {
mChannelDiscoveryService.initializeMuclumbusService(); mChannelDiscoveryService.initializeMuclumbusService();
} }
public void discoverChannels(String query, ChannelDiscoveryService.OnChannelSearchResultsFound onChannelSearchResultsFound) { public void discoverChannels(String query, ChannelDiscoveryService.Method method, ChannelDiscoveryService.OnChannelSearchResultsFound onChannelSearchResultsFound) {
mChannelDiscoveryService.discover(query, onChannelSearchResultsFound); mChannelDiscoveryService.discover(Strings.nullToEmpty(query).trim(), method, onChannelSearchResultsFound);
} }
public boolean isDataSaverDisabled() { public boolean isDataSaverDisabled() {
@ -1831,6 +1837,12 @@ public class XmppConnectionService extends Service {
} }
private void markFileDeleted(final String path) { private void markFileDeleted(final String path) {
synchronized (FILENAMES_TO_IGNORE_DELETION) {
if (FILENAMES_TO_IGNORE_DELETION.remove(path)) {
Log.d(Config.LOGTAG,"ignored deletion of "+path);
return;
}
}
final File file = new File(path); final File file = new File(path);
final boolean isInternalFile = fileBackend.isInternalFile(file); final boolean isInternalFile = fileBackend.isInternalFile(file);
final List<String> uuids = databaseBackend.markFileAsDeleted(file, isInternalFile); final List<String> uuids = databaseBackend.markFileAsDeleted(file, isInternalFile);
@ -1951,9 +1963,13 @@ public class XmppConnectionService extends Service {
* This will find all conferences with the contact as member and also the conference that is the contact (that 'fake' contact is used to store the avatar) * This will find all conferences with the contact as member and also the conference that is the contact (that 'fake' contact is used to store the avatar)
*/ */
public List<Conversation> findAllConferencesWith(Contact contact) { public List<Conversation> findAllConferencesWith(Contact contact) {
ArrayList<Conversation> results = new ArrayList<>(); final ArrayList<Conversation> results = new ArrayList<>();
for (final Conversation c : conversations) { for (final Conversation c : conversations) {
if (c.getMode() == Conversation.MODE_MULTI && (c.getJid().asBareJid().equals(contact.getJid().asBareJid()) || c.getMucOptions().isContactInRoom(contact))) { if (c.getMode() != Conversation.MODE_MULTI) {
continue;
}
final MucOptions mucOptions = c.getMucOptions();
if (c.getJid().asBareJid().equals(contact.getJid().asBareJid()) || (mucOptions != null && mucOptions.isContactInRoom(contact))) {
results.add(c); results.add(c);
} }
} }
@ -2231,6 +2247,7 @@ public class XmppConnectionService extends Service {
getNotificationService().updateErrorNotification(); getNotificationService().updateErrorNotification();
toggleForegroundService(); toggleForegroundService();
syncEnabledAccountSetting(); syncEnabledAccountSetting();
mChannelDiscoveryService.cleanCache();
return true; return true;
} else { } else {
return false; return false;
@ -3073,9 +3090,7 @@ public class XmppConnectionService extends Service {
} }
public void fetchConferenceConfiguration(final Conversation conversation, final OnConferenceConfigurationFetched callback) { public void fetchConferenceConfiguration(final Conversation conversation, final OnConferenceConfigurationFetched callback) {
IqPacket request = new IqPacket(IqPacket.TYPE.GET); IqPacket request = mIqGenerator.queryDiscoInfo(conversation.getJid().asBareJid());
request.setTo(conversation.getJid().asBareJid());
request.query("http://jabber.org/protocol/disco#info");
sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() { sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
@ -3891,10 +3906,6 @@ public class XmppConnectionService extends Service {
return getBooleanPreference("autojoin", R.bool.autojoin); return getBooleanPreference("autojoin", R.bool.autojoin);
} }
public boolean indicateReceived() {
return getBooleanPreference("indicate_received", R.bool.indicate_received);
}
public boolean useTorToConnect() { public boolean useTorToConnect() {
return QuickConversationsService.isConversations() && getBooleanPreference("use_tor", R.bool.use_tor); return QuickConversationsService.isConversations() && getBooleanPreference("use_tor", R.bool.use_tor);
} }
@ -4424,7 +4435,7 @@ public class XmppConnectionService extends Service {
request.setTo(jid); request.setTo(jid);
final String node = presence.getNode(); final String node = presence.getNode();
final String ver = presence.getVer(); final String ver = presence.getVer();
final Element query = request.query("http://jabber.org/protocol/disco#info"); final Element query = request.query(Namespace.DISCO_INFO);
if (node != null && ver != null) { if (node != null && ver != null) {
query.setAttribute("node", node + "#" + ver); query.setAttribute("node", node + "#" + ver);
} }

View File

@ -7,8 +7,10 @@ import android.content.SharedPreferences;
import android.databinding.DataBindingUtil; import android.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -27,11 +29,12 @@ import eu.siacs.conversations.databinding.ActivityChannelDiscoveryBinding;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Bookmark; import eu.siacs.conversations.entities.Bookmark;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.services.ChannelDiscoveryService; import eu.siacs.conversations.services.ChannelDiscoveryService;
import eu.siacs.conversations.ui.adapter.ChannelSearchResultAdapter; import eu.siacs.conversations.ui.adapter.ChannelSearchResultAdapter;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.AccountUtils;
import rocks.xmpp.addr.Jid; import rocks.xmpp.addr.Jid;
@ -45,6 +48,8 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
private MenuItem mMenuSearchView; private MenuItem mMenuSearchView;
private EditText mSearchEditText; private EditText mSearchEditText;
private ChannelDiscoveryService.Method method = ChannelDiscoveryService.Method.LOCAL_SERVER;
private boolean optedIn = false; private boolean optedIn = false;
@Override @Override
@ -54,14 +59,15 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
@Override @Override
void onBackendConnected() { void onBackendConnected() {
if (optedIn) { if (optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) {
String query; final String query;
if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) { if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) {
query = mSearchEditText.getText().toString(); query = mSearchEditText.getText().toString();
} else { } else {
query = mInitialSearchValue.peek(); query = mInitialSearchValue.peek();
} }
xmppConnectionService.discoverChannels(query, this); toggleLoadingScreen();
xmppConnectionService.discoverChannels(query, this.method, this);
} }
} }
@ -73,29 +79,39 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
configureActionBar(getSupportActionBar(), true); configureActionBar(getSupportActionBar(), true);
binding.list.setAdapter(this.adapter); binding.list.setAdapter(this.adapter);
this.adapter.setOnChannelSearchResultSelectedListener(this); this.adapter.setOnChannelSearchResultSelectedListener(this);
optedIn = getPreferences().getBoolean(CHANNEL_DISCOVERY_OPT_IN, false); this.optedIn = getPreferences().getBoolean(CHANNEL_DISCOVERY_OPT_IN, false);
final String search = savedInstanceState == null ? null : savedInstanceState.getString("search"); final String search = savedInstanceState == null ? null : savedInstanceState.getString("search");
if (search != null) { if (search != null) {
mInitialSearchValue.push(search); mInitialSearchValue.push(search);
} }
}
private static ChannelDiscoveryService.Method getMethod(final Context c) {
final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(c);
final String m = p.getString("channel_discovery_method", c.getString(R.string.default_channel_discovery));
try {
return ChannelDiscoveryService.Method.valueOf(m);
} catch (IllegalArgumentException e) {
return ChannelDiscoveryService.Method.JABBER_NETWORK;
}
} }
@Override @Override
public boolean onCreateOptionsMenu(final Menu menu) { public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.muc_users_activity, menu); getMenuInflater().inflate(R.menu.channel_discovery_activity, menu);
AccountUtils.showHideMenuItems(menu);
mMenuSearchView = menu.findItem(R.id.action_search); mMenuSearchView = menu.findItem(R.id.action_search);
final View mSearchView = mMenuSearchView.getActionView(); final View mSearchView = mMenuSearchView.getActionView();
mSearchEditText = mSearchView.findViewById(R.id.search_field); mSearchEditText = mSearchView.findViewById(R.id.search_field);
mSearchEditText.setHint(R.string.search_channels); mSearchEditText.setHint(R.string.search_channels);
String initialSearchValue = mInitialSearchValue.pop(); final String initialSearchValue = mInitialSearchValue.pop();
if (initialSearchValue != null) { if (initialSearchValue != null) {
mMenuSearchView.expandActionView(); mMenuSearchView.expandActionView();
mSearchEditText.append(initialSearchValue); mSearchEditText.append(initialSearchValue);
mSearchEditText.requestFocus(); mSearchEditText.requestFocus();
if (optedIn && xmppConnectionService != null) { if ((optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) && xmppConnectionService != null) {
xmppConnectionService.discoverChannels(initialSearchValue, this); xmppConnectionService.discoverChannels(initialSearchValue, this.method, this);
} }
} }
mSearchEditText.setOnEditorActionListener(this); mSearchEditText.setOnEditorActionListener(this);
@ -119,8 +135,8 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
mSearchEditText.setText(""); mSearchEditText.setText("");
toggleLoadingScreen(); toggleLoadingScreen();
if (optedIn) { if (optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) {
xmppConnectionService.discoverChannels(null, this); xmppConnectionService.discoverChannels(null, this.method, this);
} }
return true; return true;
} }
@ -128,12 +144,14 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
private void toggleLoadingScreen() { private void toggleLoadingScreen() {
adapter.submitList(Collections.emptyList()); adapter.submitList(Collections.emptyList());
binding.progressBar.setVisibility(View.VISIBLE); binding.progressBar.setVisibility(View.VISIBLE);
binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
} }
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
if (!optedIn) { this.method = getMethod(this);
if (!optedIn && method == ChannelDiscoveryService.Method.JABBER_NETWORK) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this); final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.channel_discovery_opt_in_title); builder.setTitle(R.string.channel_discovery_opt_in_title);
builder.setMessage(Html.fromHtml(getString(R.string.channel_discover_opt_in_message))); builder.setMessage(Html.fromHtml(getString(R.string.channel_discover_opt_in_message)));
@ -141,11 +159,25 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
builder.setPositiveButton(R.string.confirm, (dialog, which) -> optIn()); builder.setPositiveButton(R.string.confirm, (dialog, which) -> optIn());
builder.setOnCancelListener(dialog -> finish()); builder.setOnCancelListener(dialog -> finish());
final AlertDialog dialog = builder.create(); final AlertDialog dialog = builder.create();
dialog.setOnShowListener(d -> {
final TextView textView = dialog.findViewById(android.R.id.message);
if (textView == null) {
return;
}
textView.setMovementMethod(LinkMovementMethod.getInstance());
});
dialog.setCanceledOnTouchOutside(false); dialog.setCanceledOnTouchOutside(false);
dialog.show(); dialog.show();
holdLoading();
} }
} }
private void holdLoading() {
adapter.submitList(Collections.emptyList());
binding.progressBar.setVisibility(View.GONE);
binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
}
@Override @Override
public void onSaveInstanceState(Bundle savedInstanceState) { public void onSaveInstanceState(Bundle savedInstanceState) {
if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) { if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) {
@ -158,31 +190,36 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
SharedPreferences preferences = getPreferences(); SharedPreferences preferences = getPreferences();
preferences.edit().putBoolean(CHANNEL_DISCOVERY_OPT_IN, true).apply(); preferences.edit().putBoolean(CHANNEL_DISCOVERY_OPT_IN, true).apply();
optedIn = true; optedIn = true;
xmppConnectionService.discoverChannels(null, this); toggleLoadingScreen();
xmppConnectionService.discoverChannels(null, this.method, this);
} }
@Override @Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (optedIn) { if (optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) {
xmppConnectionService.discoverChannels(v.getText().toString(), this); toggleLoadingScreen();
SoftKeyboardUtils.hideSoftKeyboard(this);
xmppConnectionService.discoverChannels(v.getText().toString(), this.method, this);
} }
toggleLoadingScreen();
SoftKeyboardUtils.hideSoftKeyboard(this);
return true; return true;
} }
@Override @Override
public void onChannelSearchResultsFound(List<MuclumbusService.Room> results) { public void onChannelSearchResultsFound(final List<Room> results) {
runOnUiThread(() -> { runOnUiThread(() -> {
adapter.submitList(results); adapter.submitList(results);
binding.list.setVisibility(View.VISIBLE);
binding.progressBar.setVisibility(View.GONE); binding.progressBar.setVisibility(View.GONE);
if (results.size() == 0) {
binding.list.setBackground(StyledAttributes.getDrawable(this, R.attr.activity_primary_background_no_results));
} else {
binding.list.setBackgroundColor(StyledAttributes.getColor(this, R.attr.color_background_primary));
}
}); });
} }
@Override @Override
public void onChannelSearchResult(final MuclumbusService.Room result) { public void onChannelSearchResult(final Room result) {
List<String> accounts = AccountUtils.getEnabledAccounts(xmppConnectionService); List<String> accounts = AccountUtils.getEnabledAccounts(xmppConnectionService);
if (accounts.size() == 1) { if (accounts.size() == 1) {
joinChannelSearchResult(accounts.get(0), result); joinChannelSearchResult(accounts.get(0), result);
@ -200,7 +237,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
@Override @Override
public boolean onContextItemSelected(MenuItem item) { public boolean onContextItemSelected(MenuItem item) {
final MuclumbusService.Room room = adapter.getCurrent(); final Room room = adapter.getCurrent();
if (room != null) { if (room != null) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.share_with: case R.id.share_with:
@ -218,7 +255,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
return false; return false;
} }
public void joinChannelSearchResult(String selectedAccount, MuclumbusService.Room result) { public void joinChannelSearchResult(String selectedAccount, Room result) {
final Jid jid = Config.DOMAIN_LOCK == null ? Jid.of(selectedAccount) : Jid.of(selectedAccount, Config.DOMAIN_LOCK, null); final Jid jid = Config.DOMAIN_LOCK == null ? Jid.of(selectedAccount) : Jid.of(selectedAccount, Config.DOMAIN_LOCK, null);
final boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin); final boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin);
final Account account = xmppConnectionService.findAccountByJid(jid); final Account account = xmppConnectionService.findAccountByJid(jid);

View File

@ -5,6 +5,7 @@ import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -78,7 +79,12 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity {
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toString()); intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toString());
intent.setData(uri); intent.setData(uri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent); try {
startActivity(intent);
} catch (SecurityException e) {
Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
return;
}
} }
finish(); finish();
} }

View File

@ -2267,7 +2267,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
public void updateSendButton() { public void updateSendButton() {
boolean hasAttachments = mediaPreviewAdapter != null && mediaPreviewAdapter.hasAttachments(); boolean hasAttachments = mediaPreviewAdapter != null && mediaPreviewAdapter.hasAttachments();
boolean useSendButtonToIndicateStatus = activity != null && PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("send_button_status", getResources().getBoolean(R.bool.send_button_status));
final Conversation c = this.conversation; final Conversation c = this.conversation;
final Presence.Status status; final Presence.Status status;
final String text = this.binding.textinput == null ? "" : this.binding.textinput.getText().toString(); final String text = this.binding.textinput == null ? "" : this.binding.textinput.getText().toString();
@ -2277,7 +2276,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} else { } else {
action = SendButtonTool.getAction(getActivity(), c, text); action = SendButtonTool.getAction(getActivity(), c, text);
} }
if (useSendButtonToIndicateStatus && c.getAccount().getStatus() == Account.State.ONLINE) { if (c.getAccount().getStatus() == Account.State.ONLINE) {
if (activity != null && activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) { if (activity != null && activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) {
status = Presence.Status.OFFLINE; status = Presence.Status.OFFLINE;
} else if (c.getMode() == Conversation.MODE_SINGLE) { } else if (c.getMode() == Conversation.MODE_SINGLE) {

View File

@ -228,20 +228,22 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
removeErrorsOnAllBut(binding.hostnameLayout); removeErrorsOnAllBut(binding.hostnameLayout);
return; return;
} }
try { if (!hostname.isEmpty()) {
numericPort = Integer.parseInt(port); try {
if (numericPort < 0 || numericPort > 65535) { numericPort = Integer.parseInt(port);
if (numericPort < 0 || numericPort > 65535) {
binding.portLayout.setError(getString(R.string.not_a_valid_port));
removeErrorsOnAllBut(binding.portLayout);
binding.port.requestFocus();
return;
}
} catch (NumberFormatException e) {
binding.portLayout.setError(getString(R.string.not_a_valid_port)); binding.portLayout.setError(getString(R.string.not_a_valid_port));
removeErrorsOnAllBut(binding.portLayout); removeErrorsOnAllBut(binding.portLayout);
binding.port.requestFocus(); binding.port.requestFocus();
return; return;
} }
} catch (NumberFormatException e) {
binding.portLayout.setError(getString(R.string.not_a_valid_port));
removeErrorsOnAllBut(binding.portLayout);
binding.port.requestFocus();
return;
} }
} }
@ -477,8 +479,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
private void updatePortLayout() { private void updatePortLayout() {
String hostname = this.binding.hostname.getText().toString(); final String hostname = this.binding.hostname.getText().toString();
this.binding.portLayout.setEnabled(!TextUtils.isEmpty(hostname)); if (TextUtils.isEmpty(hostname)) {
this.binding.portLayout.setEnabled(false);
this.binding.portLayout.setError(null);
} else {
this.binding.portLayout.setEnabled(true);
}
} }
protected void updateSaveButton() { protected void updateSaveButton() {
@ -613,7 +620,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
private void refreshAvatar() { private void refreshAvatar() {
AvatarWorkerTask.loadAvatar(mAccount,binding.avater,R.dimen.avatar_on_details_screen_size); AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size);
} }
@Override @Override
@ -683,9 +690,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
boolean init = intent.getBooleanExtra("init", false); boolean init = intent.getBooleanExtra("init", false);
boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false); boolean openedFromNotification = intent.getBooleanExtra(EXTRA_OPENED_FROM_NOTIFICATION, false);
Log.d(Config.LOGTAG,"extras "+intent.getExtras()); Log.d(Config.LOGTAG, "extras " + intent.getExtras());
this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER,false) : null; this.mForceRegister = intent.hasExtra(EXTRA_FORCE_REGISTER) ? intent.getBooleanExtra(EXTRA_FORCE_REGISTER, false) : null;
Log.d(Config.LOGTAG,"force register="+mForceRegister); Log.d(Config.LOGTAG, "force register=" + mForceRegister);
this.mInitMode = init || this.jidToEdit == null; this.mInitMode = init || this.jidToEdit == null;
this.messageFingerprint = intent.getStringExtra("fingerprint"); this.messageFingerprint = intent.getStringExtra("fingerprint");
if (!mInitMode) { if (!mInitMode) {
@ -975,7 +982,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (!mInitMode) { if (!mInitMode) {
this.binding.avater.setVisibility(View.VISIBLE); this.binding.avater.setVisibility(View.VISIBLE);
AvatarWorkerTask.loadAvatar(mAccount,binding.avater,R.dimen.avatar_on_details_screen_size); AvatarWorkerTask.loadAvatar(mAccount, binding.avater, R.dimen.avatar_on_details_screen_size);
} else { } else {
this.binding.avater.setVisibility(View.GONE); this.binding.avater.setVisibility(View.GONE);
} }

View File

@ -200,7 +200,12 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
intent.putExtra(Intent.EXTRA_TEXT, share.text); intent.putExtra(Intent.EXTRA_TEXT, share.text);
intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote); intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote);
} }
startActivity(intent); try {
startActivity(intent);
} catch (SecurityException e) {
Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
return;
}
finish(); finish();
} }

View File

@ -16,26 +16,26 @@ import java.util.Locale;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.SearchResultItemBinding; import eu.siacs.conversations.databinding.SearchResultItemBinding;
import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.XmppActivity;
import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.AvatarWorkerTask;
import rocks.xmpp.addr.Jid; import rocks.xmpp.addr.Jid;
public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Room, ChannelSearchResultAdapter.ViewHolder> implements View.OnCreateContextMenuListener { public class ChannelSearchResultAdapter extends ListAdapter<Room, ChannelSearchResultAdapter.ViewHolder> implements View.OnCreateContextMenuListener {
private static final DiffUtil.ItemCallback<MuclumbusService.Room> DIFF = new DiffUtil.ItemCallback<MuclumbusService.Room>() { private static final DiffUtil.ItemCallback<Room> DIFF = new DiffUtil.ItemCallback<Room>() {
@Override @Override
public boolean areItemsTheSame(@NonNull MuclumbusService.Room a, @NonNull MuclumbusService.Room b) { public boolean areItemsTheSame(@NonNull Room a, @NonNull Room b) {
return a.address != null && a.address.equals(b.address); return a.address != null && a.address.equals(b.address);
} }
@Override @Override
public boolean areContentsTheSame(@NonNull MuclumbusService.Room a, @NonNull MuclumbusService.Room b) { public boolean areContentsTheSame(@NonNull Room a, @NonNull Room b) {
return a.equals(b); return a.equals(b);
} }
}; };
private OnChannelSearchResultSelected listener; private OnChannelSearchResultSelected listener;
private MuclumbusService.Room current; private Room current;
public ChannelSearchResultAdapter() { public ChannelSearchResultAdapter() {
super(DIFF); super(DIFF);
@ -49,7 +49,7 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) { public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {
final MuclumbusService.Room searchResult = getItem(position); final Room searchResult = getItem(position);
viewHolder.binding.name.setText(searchResult.getName()); viewHolder.binding.name.setText(searchResult.getName());
final String description = searchResult.getDescription(); final String description = searchResult.getDescription();
final String language = searchResult.getLanguage(); final String language = searchResult.getLanguage();
@ -78,7 +78,7 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo
this.listener = listener; this.listener = listener;
} }
public MuclumbusService.Room getCurrent() { public Room getCurrent() {
return this.current; return this.current;
} }
@ -86,15 +86,14 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
final Activity activity = XmppActivity.find(v); final Activity activity = XmppActivity.find(v);
final Object tag = v.getTag(); final Object tag = v.getTag();
if (activity != null && tag instanceof MuclumbusService.Room) { if (activity != null && tag instanceof Room) {
activity.getMenuInflater().inflate(R.menu.channel_item_context, menu); activity.getMenuInflater().inflate(R.menu.channel_item_context, menu);
this.current = (MuclumbusService.Room) tag; this.current = (Room) tag;
} }
} }
public interface OnChannelSearchResultSelected { public interface OnChannelSearchResultSelected {
void onChannelSearchResult(MuclumbusService.Room result); void onChannelSearchResult(Room result);
} }
public static class ViewHolder extends RecyclerView.ViewHolder { public static class ViewHolder extends RecyclerView.ViewHolder {

View File

@ -89,7 +89,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
private DisplayMetrics metrics; private DisplayMetrics metrics;
private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureClicked mOnContactPictureClickedListener;
private OnContactPictureLongClicked mOnContactPictureLongClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener;
private boolean mIndicateReceived = false;
private OnQuoteListener onQuoteListener; private OnQuoteListener onQuoteListener;
public MessageAdapter(XmppActivity activity, List<Message> messages) { public MessageAdapter(XmppActivity activity, List<Message> messages) {
super(activity, 0, messages); super(activity, 0, messages);
@ -207,9 +206,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
break; break;
case Message.STATUS_SEND_RECEIVED: case Message.STATUS_SEND_RECEIVED:
case Message.STATUS_SEND_DISPLAYED: case Message.STATUS_SEND_DISPLAYED:
if (mIndicateReceived) { viewHolder.indicatorReceived.setVisibility(View.VISIBLE);
viewHolder.indicatorReceived.setVisibility(View.VISIBLE);
}
break; break;
case Message.STATUS_SEND_FAILED: case Message.STATUS_SEND_FAILED:
final String errorMessage = message.getErrorMessage(); final String errorMessage = message.getErrorMessage();
@ -903,7 +900,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
public void updatePreferences() { public void updatePreferences() {
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity); SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(activity);
this.mIndicateReceived = p.getBoolean("indicate_received", activity.getResources().getBoolean(R.bool.indicate_received));
} }

View File

@ -70,8 +70,8 @@ public class FixedURLSpan extends URLSpan {
public void onClick(View widget) { public void onClick(View widget) {
final Uri uri = Uri.parse(getURL()); final Uri uri = Uri.parse(getURL());
final Context context = widget.getContext(); final Context context = widget.getContext();
final boolean candidateToProcessDirecty = "xmpp".equals(uri.getScheme()) || ("https".equals(uri.getScheme()) && "conversations.im".equals(uri.getHost()) && uri.getPathSegments().size() > 1 && Arrays.asList("j","i").contains(uri.getPathSegments().get(0))); final boolean candidateToProcessDirectly = "xmpp".equals(uri.getScheme()) || ("https".equals(uri.getScheme()) && "conversations.im".equals(uri.getHost()) && uri.getPathSegments().size() > 1 && Arrays.asList("j","i").contains(uri.getPathSegments().get(0)));
if (candidateToProcessDirecty && context instanceof ConversationsActivity) { if (candidateToProcessDirectly && context instanceof ConversationsActivity) {
if (((ConversationsActivity) context).onXmppUriClicked(uri)) { if (((ConversationsActivity) context).onXmppUriClicked(uri)) {
widget.playSoundEffect(0); widget.playSoundEffect(0);
return; return;

View File

@ -13,6 +13,7 @@ import android.view.View;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.MucOptions;
@ -71,8 +72,8 @@ public final class MucDetailsContextMenuHelper {
startConversation.setVisible(true); startConversation.setVisible(true);
final Contact contact = user.getContact(); final Contact contact = user.getContact();
final User self = conversation.getMucOptions().getSelf(); final User self = conversation.getMucOptions().getSelf();
if (contact != null && contact.showInRoster()) { if ((contact != null && contact.showInRoster()) || mucOptions.isPrivateAndNonAnonymous()) {
showContactDetails.setVisible(!contact.isSelf()); showContactDetails.setVisible(contact == null || !contact.isSelf());
} }
if ((activity instanceof ConferenceDetailsActivity || activity instanceof MucUsersActivity) && user.getRole() == MucOptions.Role.NONE) { if ((activity instanceof ConferenceDetailsActivity || activity instanceof MucUsersActivity) && user.getRole() == MucOptions.Role.NONE) {
invite.setVisible(true); invite.setVisible(true);
@ -135,7 +136,9 @@ public final class MucDetailsContextMenuHelper {
Jid jid = user.getRealJid(); Jid jid = user.getRealJid();
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_contact_details: case R.id.action_contact_details:
Contact contact = user.getContact(); final Jid realJid = user.getRealJid();
final Account account = conversation.getAccount();
final Contact contact = realJid == null ? null : account.getRoster().getContact(realJid);
if (contact != null) { if (contact != null) {
activity.switchToContactDetails(contact, fingerprint); activity.switchToContactDetails(contact, fingerprint);
} }

View File

@ -102,7 +102,11 @@ public class AccountUtils {
public static void showHideMenuItems(final Menu menu) { public static void showHideMenuItems(final Menu menu) {
final MenuItem manageAccounts = menu.findItem(R.id.action_accounts); final MenuItem manageAccounts = menu.findItem(R.id.action_accounts);
final MenuItem manageAccount = menu.findItem(R.id.action_account); final MenuItem manageAccount = menu.findItem(R.id.action_account);
manageAccount.setVisible(MANAGE_ACCOUNT_ACTIVITY == null); if (manageAccount != null) {
manageAccounts.setVisible(MANAGE_ACCOUNT_ACTIVITY != null); manageAccount.setVisible(MANAGE_ACCOUNT_ACTIVITY == null);
}
if (manageAccounts != null) {
manageAccounts.setVisible(MANAGE_ACCOUNT_ACTIVITY != null);
}
} }
} }

View File

@ -93,7 +93,7 @@ public class Compatibility {
public static void removeUnusedPreferences(SettingsFragment settingsFragment) { public static void removeUnusedPreferences(SettingsFragment settingsFragment) {
List<PreferenceCategory> categories = Arrays.asList( List<PreferenceCategory> categories = Arrays.asList(
(PreferenceCategory) settingsFragment.findPreference("notification_category"), (PreferenceCategory) settingsFragment.findPreference("notification_category"),
(PreferenceCategory) settingsFragment.findPreference("other_expert_category")); (PreferenceCategory) settingsFragment.findPreference("advanced"));
for (String key : (runsTwentySix() ? UNUSED_SETTINGS_POST_TWENTYSIX : UNUESD_SETTINGS_PRE_TWENTYSIX)) { for (String key : (runsTwentySix() ? UNUSED_SETTINGS_POST_TWENTYSIX : UNUESD_SETTINGS_PRE_TWENTYSIX)) {
Preference preference = settingsFragment.findPreference(key); Preference preference = settingsFragment.findPreference(key);
if (preference != null) { if (preference != null) {

View File

@ -1,6 +1,8 @@
package eu.siacs.conversations.xml; package eu.siacs.conversations.xml;
public final class Namespace { public final class Namespace {
public static final String DISCO_ITEMS = "http://jabber.org/protocol/disco#items";
public static final String DISCO_INFO = "http://jabber.org/protocol/disco#info";
public static final String BLOCKING = "urn:xmpp:blocking"; public static final String BLOCKING = "urn:xmpp:blocking";
public static final String ROSTER = "jabber:iq:roster"; public static final String ROSTER = "jabber:iq:roster";
public static final String REGISTER = "jabber:iq:register"; public static final String REGISTER = "jabber:iq:register";

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2018, Daniel Gultsch All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without modification,
~ are permitted provided that the following conditions are met:
~
~ 1. Redistributions of source code must retain the above copyright notice, this
~ list of conditions and the following disclaimer.
~
~ 2. Redistributions in binary form must reproduce the above copyright notice,
~ this list of conditions and the following disclaimer in the documentation and/or
~ other materials provided with the distribution.
~
~ 3. Neither the name of the copyright holder nor the names of its contributors
~ may be used to endorse or promote products derived from this software without
~ specific prior written permission.
~
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/grey800"/>
<item>
<bitmap
android:alpha="@dimen/background_image_opacity"
android:gravity="center"
android:src="@drawable/ic_no_results_background_white"/>
</item>
</layer-list>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2018, Daniel Gultsch All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without modification,
~ are permitted provided that the following conditions are met:
~
~ 1. Redistributions of source code must retain the above copyright notice, this
~ list of conditions and the following disclaimer.
~
~ 2. Redistributions in binary form must reproduce the above copyright notice,
~ this list of conditions and the following disclaimer in the documentation and/or
~ other materials provided with the distribution.
~
~ 3. Neither the name of the copyright holder nor the names of its contributors
~ may be used to endorse or promote products derived from this software without
~ specific prior written permission.
~
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/grey50"/>
<item>
<bitmap
android:alpha="@dimen/background_image_opacity"
android:gravity="center"
android:src="@drawable/ic_no_results_background_black"/>
</item>
</layer-list>

View File

@ -34,7 +34,6 @@
android:background="?attr/color_background_primary" android:background="?attr/color_background_primary"
android:orientation="vertical" android:orientation="vertical"
android:scrollbars="vertical" android:scrollbars="vertical"
android:visibility="gone"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" /> app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>

View File

@ -1,11 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/action_search" android:id="@+id/action_search"
app:actionLayout="@layout/actionview_search"
android:icon="?attr/icon_search" android:icon="?attr/icon_search"
app:showAsAction="collapseActionView|always" android:title="@string/search"
android:title="@string/search"/> app:actionLayout="@layout/actionview_search"
app:showAsAction="collapseActionView|always" />
<item
android:id="@+id/action_accounts"
android:orderInCategory="90"
android:title="@string/action_accounts"
app:showAsAction="never"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu> </menu>

View File

@ -62,7 +62,7 @@
<string-array name="picture_compression_entries"> <string-array name="picture_compression_entries">
<item>@string/never</item> <item>@string/never</item>
<item>@string/automatically</item> <item>@string/large_images_only</item>
<item>@string/always</item> <item>@string/always</item>
</string-array> </string-array>
@ -124,4 +124,14 @@
<item>@string/video_720p</item> <item>@string/video_720p</item>
<item>@string/video_original</item> <item>@string/video_original</item>
</string-array> </string-array>
<string-array name="channel_discovery_entries">
<item>@string/jabber_network</item>
<item>@string/local_server</item>
</string-array>
<string-array name="channel_discover_values">
<item>JABBER_NETWORK</item>
<item>LOCAL_SERVER</item>
</string-array>
</resources> </resources>

View File

@ -22,6 +22,7 @@
<attr name="activity_background_search" format="reference"/> <attr name="activity_background_search" format="reference"/>
<attr name="activity_background_no_results" format="reference"/> <attr name="activity_background_no_results" format="reference"/>
<attr name="activity_primary_background_no_results" format="reference"/>
<attr name="list_item_background" format="reference"/> <attr name="list_item_background" format="reference"/>

View File

@ -16,7 +16,6 @@
<integer name="auto_accept_filesize">524288</integer> <integer name="auto_accept_filesize">524288</integer>
<string name="picture_compression">auto</string> <string name="picture_compression">auto</string>
<string name="theme">light</string> <string name="theme">light</string>
<bool name="send_button_status">true</bool>
<string name="quick_action">recent</string> <string name="quick_action">recent</string>
<bool name="show_dynamic_tags">true</bool> <bool name="show_dynamic_tags">true</bool>
<bool name="btbv">true</bool> <bool name="btbv">true</bool>
@ -31,7 +30,6 @@
<bool name="dnd_on_silent_mode">true</bool> <bool name="dnd_on_silent_mode">true</bool>
<bool name="treat_vibrate_as_silent">true</bool> <bool name="treat_vibrate_as_silent">true</bool>
<bool name="autojoin">true</bool> <bool name="autojoin">true</bool>
<bool name="indicate_received">true</bool>
<bool name="enable_foreground_service">true</bool> <bool name="enable_foreground_service">true</bool>
<bool name="never_send">false</bool> <bool name="never_send">false</bool>
<bool name="validate_hostname">false</bool> <bool name="validate_hostname">false</bool>
@ -42,4 +40,5 @@
<bool name="use_share_location_plugin">false</bool> <bool name="use_share_location_plugin">false</bool>
<bool name="start_searching">false</bool> <bool name="start_searching">false</bool>
<string name="video_compression">360</string> <string name="video_compression">360</string>
<string name="default_channel_discovery">JABBER_NETWORK</string>
</resources> </resources>

View File

@ -119,7 +119,7 @@
<string name="pref_sound">Ringtone</string> <string name="pref_sound">Ringtone</string>
<string name="pref_sound_summary">Play sound when a new message arrives</string> <string name="pref_sound_summary">Play sound when a new message arrives</string>
<string name="pref_notification_grace_period">Grace Period</string> <string name="pref_notification_grace_period">Grace Period</string>
<string name="pref_notification_grace_period_summary">The length of time Conversations keeps quiet after seeing activity on another device</string> <string name="pref_notification_grace_period_summary">The length of time notifications are silenced after detecting activity on one of your other devices.</string>
<string name="pref_advanced_options">Advanced</string> <string name="pref_advanced_options">Advanced</string>
<string name="pref_never_send_crash">Never send crash reports</string> <string name="pref_never_send_crash">Never send crash reports</string>
<string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Conversations</string> <string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Conversations</string>
@ -281,10 +281,6 @@
<string name="title_pref_quiet_hours_end_time">End time</string> <string name="title_pref_quiet_hours_end_time">End time</string>
<string name="title_pref_enable_quiet_hours">Enable quiet hours</string> <string name="title_pref_enable_quiet_hours">Enable quiet hours</string>
<string name="pref_quiet_hours_summary">Notifications will be silenced during quiet hours</string> <string name="pref_quiet_hours_summary">Notifications will be silenced during quiet hours</string>
<string name="pref_use_send_button_to_indicate_status">Send button indicates status</string>
<string name="pref_use_indicate_received">Request message receipts</string>
<string name="pref_use_indicate_received_summary">Received messages will be marked with a green tick if supported</string>
<string name="pref_use_send_button_to_indicate_status_summary">Colorize send button to indicate contact status</string>
<string name="pref_expert_options_other">Other</string> <string name="pref_expert_options_other">Other</string>
<string name="pref_autojoin">Synchronize with bookmarks</string> <string name="pref_autojoin">Synchronize with bookmarks</string>
<string name="pref_autojoin_summary">Join and leave group chats according to auto-join flag in your bookmarks.</string> <string name="pref_autojoin_summary">Join and leave group chats according to auto-join flag in your bookmarks.</string>
@ -512,9 +508,9 @@
<string name="notify_never">Notifications disabled</string> <string name="notify_never">Notifications disabled</string>
<string name="notify_paused">Notifications paused</string> <string name="notify_paused">Notifications paused</string>
<string name="pref_picture_compression">Image Compression</string> <string name="pref_picture_compression">Image Compression</string>
<string name="pref_picture_compression_summary">Resize and compress images</string> <string name="pref_picture_compression_summary">Hint: Use Choose file instead of Choose picture to send individual images uncompressed regardless of this setting.</string>
<string name="always">Always</string> <string name="always">Always</string>
<string name="automatically">Automatically</string> <string name="large_images_only">Large images only</string>
<string name="battery_optimizations_enabled">Battery optimizations enabled</string> <string name="battery_optimizations_enabled">Battery optimizations enabled</string>
<string name="battery_optimizations_enabled_explained">Your device is doing some heavy battery optimizations on Conversations that might lead to delayed notifications or even message loss.\nIt is recommended to disable those.</string> <string name="battery_optimizations_enabled_explained">Your device is doing some heavy battery optimizations on Conversations that might lead to delayed notifications or even message loss.\nIt is recommended to disable those.</string>
<string name="battery_optimizations_enabled_dialog">Your device is doing some heavy battery optimizations on Conversations that might lead to delayed notifications or even message loss.\n\nYou will now be asked to disable those.</string> <string name="battery_optimizations_enabled_dialog">Your device is doing some heavy battery optimizations on Conversations that might lead to delayed notifications or even message loss.\n\nYou will now be asked to disable those.</string>
@ -876,4 +872,12 @@
<string name="please_enter_password">Please enter the password for this account</string> <string name="please_enter_password">Please enter the password for this account</string>
<string name="unable_to_perform_this_action">Unable to perform this action</string> <string name="unable_to_perform_this_action">Unable to perform this action</string>
<string name="open_join_dialog">Join public channel…</string> <string name="open_join_dialog">Join public channel…</string>
<string name="sharing_application_not_grant_permission">The sharing application did not grant permission to access this file.</string>
<string name="group_chats_and_channels"><![CDATA[Group Chats & Channels]]></string>
<string name="jabber_network">jabber.network</string>
<string name="local_server">Local server</string>
<string name="pref_channel_discovery_summary">Most users should choose jabber.network for better suggestions from the entirety of the public XMPP ecosystem.</string>
<string name="pref_channel_discovery">Channel discovery method</string>
<string name="backup">Backup</string>
<string name="category_about">About</string>
</resources> </resources>

View File

@ -18,6 +18,7 @@
<item name="activity_background_search">@drawable/search_background_light</item> <item name="activity_background_search">@drawable/search_background_light</item>
<item name="activity_background_no_results">@drawable/no_results_background_light</item> <item name="activity_background_no_results">@drawable/no_results_background_light</item>
<item name="activity_primary_background_no_results">@drawable/no_results_primary_background_light</item>
<item name="list_item_background">@drawable/list_item_background_light</item> <item name="list_item_background">@drawable/list_item_background_light</item>
<item name="EmojiColor">@color/black</item> <item name="EmojiColor">@color/black</item>
@ -127,6 +128,7 @@
<item name="color_background_overlay">@color/grey700</item> <item name="color_background_overlay">@color/grey700</item>
<item name="activity_background_search">@drawable/search_background_dark</item> <item name="activity_background_search">@drawable/search_background_dark</item>
<item name="activity_background_no_results">@drawable/no_results_background_dark</item> <item name="activity_background_no_results">@drawable/no_results_background_dark</item>
<item name="activity_primary_background_no_results">@drawable/no_results_primary_background_dark</item>
<item name="list_item_background">@drawable/list_item_background_dark</item> <item name="list_item_background">@drawable/list_item_background_dark</item>
<item name="color_warning">@color/red_a100</item> <item name="color_warning">@color/red_a100</item>

View File

@ -16,6 +16,22 @@
</PreferenceScreen> </PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/pref_privacy"> <PreferenceCategory android:title="@string/pref_privacy">
<CheckBoxPreference
android:defaultValue="@bool/confirm_messages"
android:key="confirm_messages"
android:summary="@string/pref_confirm_messages_summary"
android:title="@string/pref_confirm_messages" />
<CheckBoxPreference
android:defaultValue="@bool/chat_states"
android:key="chat_states"
android:summary="@string/pref_chat_states_summary"
android:title="@string/pref_chat_states" />
<CheckBoxPreference
android:defaultValue="@bool/last_activity"
android:key="last_activity"
android:summary="@string/pref_broadcast_last_activity_summary"
android:title="@string/pref_broadcast_last_activity" />
<ListPreference <ListPreference
android:defaultValue="@string/omemo_setting_default" android:defaultValue="@string/omemo_setting_default"
android:entries="@array/omemo_setting_entries" android:entries="@array/omemo_setting_entries"
@ -23,39 +39,10 @@
android:key="omemo" android:key="omemo"
android:summary="@string/pref_omemo_setting_summary_default_on" android:summary="@string/pref_omemo_setting_summary_default_on"
android:title="@string/pref_omemo_setting" /> android:title="@string/pref_omemo_setting" />
<CheckBoxPreference
android:defaultValue="@bool/confirm_messages"
android:key="confirm_messages"
android:summary="@string/pref_confirm_messages_summary"
android:title="@string/pref_confirm_messages" />
<CheckBoxPreference
android:defaultValue="@bool/chat_states"
android:key="chat_states"
android:summary="@string/pref_chat_states_summary"
android:title="@string/pref_chat_states" />
<CheckBoxPreference
android:defaultValue="@bool/last_activity"
android:key="last_activity"
android:summary="@string/pref_broadcast_last_activity_summary"
android:title="@string/pref_broadcast_last_activity" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/pref_notification_settings" android:key="notification_category"
android:key="notification_category"> android:title="@string/pref_notification_settings">
<PreferenceScreen
android:key="more_notification_settings"
android:summary="@string/pref_more_notification_settings_summary"
android:title="@string/pref_more_notification_settings">
<intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
<extra
android:name="android.provider.extra.APP_PACKAGE"
android:value="@string/applicationId" />
<extra
android:name="android.provider.extra.CHANNEL_ID"
android:value="messages" />
</intent>
</PreferenceScreen>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="@bool/notifications_from_strangers" android:defaultValue="@bool/notifications_from_strangers"
android:key="notifications_from_strangers" android:key="notifications_from_strangers"
@ -76,24 +63,17 @@
android:key="led" android:key="led"
android:summary="@string/pref_led_summary" android:summary="@string/pref_led_summary"
android:title="@string/pref_led" /> android:title="@string/pref_led" />
<RingtonePreference <ListPreference
android:defaultValue="@string/notification_ringtone" android:defaultValue="@integer/grace_period"
android:key="notification_ringtone" android:entries="@array/grace_periods"
android:ringtoneType="notification" android:entryValues="@array/grace_periods_values"
android:summary="@string/pref_sound_summary" android:key="grace_period_length"
android:title="@string/pref_sound" /> android:summary="@string/pref_notification_grace_period_summary"
android:title="@string/pref_notification_grace_period" />
<PreferenceScreen <PreferenceScreen
android:key="quiet_hours" android:key="quiet_hours"
android:summary="@string/pref_quiet_hours_summary" android:summary="@string/pref_quiet_hours_summary"
android:title="@string/title_pref_quiet_hours"> android:title="@string/title_pref_quiet_hours">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
android:targetPackage="@string/applicationId">
<extra
android:name="page"
android:value="quiet_hours" />
</intent>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="@bool/enable_quiet_hours" android:defaultValue="@bool/enable_quiet_hours"
android:key="enable_quiet_hours" android:key="enable_quiet_hours"
@ -111,25 +91,43 @@
android:negativeButtonText="@string/cancel" android:negativeButtonText="@string/cancel"
android:positiveButtonText="@string/set" android:positiveButtonText="@string/set"
android:title="@string/title_pref_quiet_hours_end_time" /> android:title="@string/title_pref_quiet_hours_end_time" />
<intent
android:action="android.intent.action.VIEW"
android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
android:targetPackage="@string/applicationId">
<extra
android:name="page"
android:value="quiet_hours" />
</intent>
</PreferenceScreen> </PreferenceScreen>
<ListPreference <PreferenceScreen
android:defaultValue="@integer/grace_period" android:key="more_notification_settings"
android:entries="@array/grace_periods" android:summary="@string/pref_more_notification_settings_summary"
android:entryValues="@array/grace_periods_values" android:title="@string/pref_more_notification_settings">
android:key="grace_period_length" <intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
android:summary="@string/pref_notification_grace_period_summary" <extra
android:title="@string/pref_notification_grace_period" /> android:name="android.provider.extra.APP_PACKAGE"
android:value="@string/applicationId" />
<extra
android:name="android.provider.extra.CHANNEL_ID"
android:value="messages" />
</intent>
</PreferenceScreen>
<RingtonePreference
android:defaultValue="@string/notification_ringtone"
android:key="notification_ringtone"
android:ringtoneType="notification"
android:summary="@string/pref_sound_summary"
android:title="@string/pref_sound" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="attachments" android:key="attachments"
android:title="@string/pref_attachments"> android:title="@string/pref_attachments">
<ListPreference <CheckBoxPreference
android:defaultValue="@integer/auto_accept_filesize" android:defaultValue="@bool/use_share_location_plugin"
android:entries="@array/filesizes" android:key="use_share_location_plugin"
android:entryValues="@array/filesizes_values" android:summary="@string/pref_use_share_location_plugin_summary"
android:key="auto_accept_file_size" android:title="@string/pref_use_share_location_plugin" />
android:summary="@string/pref_accept_files_summary"
android:title="@string/pref_accept_files" />
<ListPreference <ListPreference
android:defaultValue="@string/picture_compression" android:defaultValue="@string/picture_compression"
android:entries="@array/picture_compression_entries" android:entries="@array/picture_compression_entries"
@ -144,13 +142,25 @@
android:key="video_compression" android:key="video_compression"
android:summary="@string/pref_video_compression_summary" android:summary="@string/pref_video_compression_summary"
android:title="@string/pref_video_compression" /> android:title="@string/pref_video_compression" />
<CheckBoxPreference <ListPreference
android:defaultValue="@bool/use_share_location_plugin" android:defaultValue="@integer/auto_accept_filesize"
android:key="use_share_location_plugin" android:entries="@array/filesizes"
android:summary="@string/pref_use_share_location_plugin_summary" android:entryValues="@array/filesizes_values"
android:title="@string/pref_use_share_location_plugin" /> android:key="auto_accept_file_size"
android:summary="@string/pref_accept_files_summary"
android:title="@string/pref_accept_files" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/pref_ui_options"> <PreferenceCategory android:title="@string/pref_ui_options">
<CheckBoxPreference
android:defaultValue="@bool/use_green_background"
android:key="use_green_background"
android:summary="@string/pref_use_green_background_summary"
android:title="@string/pref_use_green_background" />
<CheckBoxPreference
android:defaultValue="@bool/show_dynamic_tags"
android:key="show_dynamic_tags"
android:summary="@string/pref_show_dynamic_tags_summary"
android:title="@string/pref_show_dynamic_tags" />
<ListPreference <ListPreference
android:defaultValue="@string/theme" android:defaultValue="@string/theme"
android:entries="@array/themes" android:entries="@array/themes"
@ -158,18 +168,6 @@
android:key="theme" android:key="theme"
android:summary="@string/pref_theme_options_summary" android:summary="@string/pref_theme_options_summary"
android:title="@string/pref_theme_options" /> android:title="@string/pref_theme_options" />
<ListPreference
android:defaultValue="@string/default_font_size"
android:entries="@array/font_size_entries"
android:entryValues="@array/font_size_entry_values"
android:key="font_size"
android:summary="@string/pref_font_size_summary"
android:title="@string/pref_font_size" />
<CheckBoxPreference
android:defaultValue="@bool/send_button_status"
android:key="send_button_status"
android:summary="@string/pref_use_send_button_to_indicate_status_summary"
android:title="@string/pref_use_send_button_to_indicate_status" />
<ListPreference <ListPreference
android:defaultValue="@string/quick_action" android:defaultValue="@string/quick_action"
android:dialogTitle="@string/choose_quick_action" android:dialogTitle="@string/choose_quick_action"
@ -178,27 +176,41 @@
android:key="quick_action" android:key="quick_action"
android:summary="@string/pref_quick_action_summary" android:summary="@string/pref_quick_action_summary"
android:title="@string/pref_quick_action" /> android:title="@string/pref_quick_action" />
<CheckBoxPreference <ListPreference
android:defaultValue="@bool/show_dynamic_tags" android:defaultValue="@string/default_font_size"
android:key="show_dynamic_tags" android:entries="@array/font_size_entries"
android:summary="@string/pref_show_dynamic_tags_summary" android:entryValues="@array/font_size_entry_values"
android:title="@string/pref_show_dynamic_tags" /> android:key="font_size"
android:summary="@string/pref_font_size_summary"
android:title="@string/pref_font_size" />
</PreferenceCategory>
<PreferenceCategory
android:key="backup_category"
android:title="@string/backup">
<Preference
android:key="create_backup"
android:summary="@string/pref_create_backup_summary"
android:title="@string/pref_create_backup" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="advanced" android:key="advanced"
android:title="@string/pref_advanced_options"> android:title="@string/pref_advanced_options">
<CheckBoxPreference
android:defaultValue="@bool/never_send"
android:key="never_send"
android:summary="@string/pref_never_send_crash_summary"
android:title="@string/pref_never_send_crash" />
<CheckBoxPreference
android:defaultValue="@bool/enable_foreground_service"
android:key="enable_foreground_service"
android:summary="@string/pref_keep_foreground_service_summary"
android:title="@string/pref_keep_foreground_service" />
<PreferenceScreen <PreferenceScreen
android:key="expert" android:key="expert"
android:summary="@string/pref_expert_options_summary" android:summary="@string/pref_expert_options_summary"
android:title="@string/pref_expert_options"> android:title="@string/pref_expert_options">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
android:targetPackage="@string/applicationId">
<extra
android:name="page"
android:value="expert" />
</intent>
<PreferenceCategory <PreferenceCategory
android:key="security_options" android:key="security_options"
android:title="@string/pref_security_settings"> android:title="@string/pref_security_settings">
@ -207,11 +219,6 @@
android:key="btbv" android:key="btbv"
android:summary="@string/pref_blind_trust_before_verification_summary" android:summary="@string/pref_blind_trust_before_verification_summary"
android:title="@string/pref_blind_trust_before_verification" /> android:title="@string/pref_blind_trust_before_verification" />
<ListPreference
android:defaultValue="@integer/automatic_message_deletion"
android:key="automatic_message_deletion"
android:summary="@string/pref_automatically_delete_messages_description"
android:title="@string/pref_automatically_delete_messages" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="@bool/dont_trust_system_cas" android:defaultValue="@bool/dont_trust_system_cas"
android:key="dont_trust_system_cas" android:key="dont_trust_system_cas"
@ -222,15 +229,20 @@
android:key="validate_hostname" android:key="validate_hostname"
android:summary="@string/pref_validate_hostname_summary" android:summary="@string/pref_validate_hostname_summary"
android:title="@string/pref_validate_hostname" /> android:title="@string/pref_validate_hostname" />
<Preference
android:key="remove_trusted_certificates"
android:summary="@string/pref_remove_trusted_certificates_summary"
android:title="@string/pref_remove_trusted_certificates_title" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="@bool/allow_message_correction" android:defaultValue="@bool/allow_message_correction"
android:key="allow_message_correction" android:key="allow_message_correction"
android:summary="@string/pref_allow_message_correction_summary" android:summary="@string/pref_allow_message_correction_summary"
android:title="@string/pref_allow_message_correction" /> android:title="@string/pref_allow_message_correction" />
<ListPreference
android:defaultValue="@integer/automatic_message_deletion"
android:key="automatic_message_deletion"
android:summary="@string/pref_automatically_delete_messages_description"
android:title="@string/pref_automatically_delete_messages" />
<Preference
android:key="remove_trusted_certificates"
android:summary="@string/pref_remove_trusted_certificates_summary"
android:title="@string/pref_remove_trusted_certificates_title" />
<Preference <Preference
android:key="clean_cache" android:key="clean_cache"
android:summary="@string/pref_clean_cache_summary" android:summary="@string/pref_clean_cache_summary"
@ -307,35 +319,32 @@
android:title="@string/pref_treat_vibrate_as_silent" /> android:title="@string/pref_treat_vibrate_as_silent" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:key="other_expert_category" android:key="group_chats"
android:title="@string/pref_expert_options_other"> android:title="@string/group_chats_and_channels">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="@bool/autojoin" android:defaultValue="@bool/autojoin"
android:key="autojoin" android:key="autojoin"
android:summary="@string/pref_autojoin_summary" android:summary="@string/pref_autojoin_summary"
android:title="@string/pref_autojoin" /> android:title="@string/pref_autojoin" />
<CheckBoxPreference <ListPreference
android:defaultValue="@bool/indicate_received" android:defaultValue="@string/default_channel_discovery"
android:key="indicate_received" android:entries="@array/channel_discovery_entries"
android:summary="@string/pref_use_indicate_received_summary" android:entryValues="@array/channel_discover_values"
android:title="@string/pref_use_indicate_received" /> android:key="channel_discovery_method"
<CheckBoxPreference android:summary="@string/pref_channel_discovery_summary"
android:defaultValue="@bool/enable_foreground_service" android:title="@string/pref_channel_discovery" />
android:key="enable_foreground_service"
android:summary="@string/pref_keep_foreground_service_summary"
android:title="@string/pref_keep_foreground_service" />
<Preference
android:key="create_backup"
android:summary="@string/pref_create_backup_summary"
android:title="@string/pref_create_backup" />
</PreferenceCategory> </PreferenceCategory>
<intent
android:action="android.intent.action.VIEW"
android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
android:targetPackage="@string/applicationId">
<extra
android:name="page"
android:value="expert" />
</intent>
</PreferenceScreen> </PreferenceScreen>
<CheckBoxPreference
android:defaultValue="@bool/never_send"
android:key="never_send"
android:summary="@string/pref_never_send_crash_summary"
android:title="@string/pref_never_send_crash" />
</PreferenceCategory> </PreferenceCategory>
<eu.siacs.conversations.ui.AboutPreference/> <PreferenceCategory android:title="@string/category_about">
<eu.siacs.conversations.ui.AboutPreference />
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>