optionally search local muc rooms instead of jabber.network
This commit is contained in:
parent
adfbe59e57
commit
07786d4576
90
src/main/java/eu/siacs/conversations/entities/Room.java
Normal file
90
src/main/java/eu/siacs/conversations/entities/Room.java
Normal 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();
|
||||
}
|
||||
}
|
|
@ -565,4 +565,18 @@ public class IqGenerator extends AbstractGenerator {
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
package eu.siacs.conversations.http.services;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import eu.siacs.conversations.services.AvatarService;
|
||||
import eu.siacs.conversations.utils.LanguageUtils;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import eu.siacs.conversations.entities.Room;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
import rocks.xmpp.addr.Jid;
|
||||
|
||||
public interface MuclumbusService {
|
||||
|
||||
|
@ -31,55 +26,6 @@ public interface MuclumbusService {
|
|||
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 {
|
||||
|
||||
public final Set<String> keywords;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.siacs.conversations.parser;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
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.Contact;
|
||||
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.xml.Namespace;
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
import eu.siacs.conversations.xmpp.InvalidJid;
|
||||
import eu.siacs.conversations.xmpp.OnIqPacketReceived;
|
||||
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
||||
import eu.siacs.conversations.xmpp.forms.Data;
|
||||
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import eu.siacs.conversations.entities.ListItem;
|
|||
import eu.siacs.conversations.entities.Message;
|
||||
import eu.siacs.conversations.entities.MucOptions;
|
||||
import eu.siacs.conversations.entities.RawBlockable;
|
||||
import eu.siacs.conversations.entities.Room;
|
||||
import eu.siacs.conversations.http.services.MuclumbusService;
|
||||
import eu.siacs.conversations.utils.UIHelper;
|
||||
import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded;
|
||||
|
@ -81,14 +82,14 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
|||
return get((ListItem) avatarable, size, cachedOnly);
|
||||
} else if (avatarable instanceof MucOptions.User) {
|
||||
return get((MucOptions.User) avatarable, size, cachedOnly);
|
||||
} else if (avatarable instanceof MuclumbusService.Room) {
|
||||
return get((MuclumbusService.Room) avatarable, size, cachedOnly);
|
||||
} else if (avatarable instanceof Room) {
|
||||
return get((Room) avatarable, size, cachedOnly);
|
||||
}
|
||||
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();
|
||||
Conversation conversation = room != null ? mXmppConnectionService.findFirstMuc(room) : null;
|
||||
if (conversation != null) {
|
||||
|
|
|
@ -7,14 +7,27 @@ import com.google.common.cache.Cache;
|
|||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
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.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.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
|
@ -22,6 +35,7 @@ import retrofit2.Callback;
|
|||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import rocks.xmpp.addr.Jid;
|
||||
|
||||
public class ChannelDiscoveryService {
|
||||
|
||||
|
@ -30,7 +44,7 @@ public class ChannelDiscoveryService {
|
|||
|
||||
private MuclumbusService muclumbusService;
|
||||
|
||||
private final Cache<String, List<MuclumbusService.Room>> cache;
|
||||
private final Cache<String, List<Room>> cache;
|
||||
|
||||
ChannelDiscoveryService(XmppConnectionService service) {
|
||||
this.service = service;
|
||||
|
@ -56,21 +70,28 @@ public class ChannelDiscoveryService {
|
|||
this.muclumbusService = retrofit.create(MuclumbusService.class);
|
||||
}
|
||||
|
||||
void discover(String query, OnChannelSearchResultsFound onChannelSearchResultsFound) {
|
||||
final boolean all = query == null || query.trim().isEmpty();
|
||||
List<MuclumbusService.Room> result = cache.getIfPresent(all ? "" : query);
|
||||
void cleanCache() {
|
||||
cache.invalidateAll();
|
||||
}
|
||||
|
||||
void discover(@NonNull final String query, Method method, OnChannelSearchResultsFound onChannelSearchResultsFound) {
|
||||
List<Room> result = cache.getIfPresent(key(method, query));
|
||||
if (result != null) {
|
||||
onChannelSearchResultsFound.onChannelSearchResultsFound(result);
|
||||
return;
|
||||
}
|
||||
if (all) {
|
||||
discoverChannels(onChannelSearchResultsFound);
|
||||
if (method == Method.LOCAL_SERVER) {
|
||||
discoverChannelsLocalServers(query, onChannelSearchResultsFound);
|
||||
} 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);
|
||||
try {
|
||||
call.enqueue(new Callback<MuclumbusService.Rooms>() {
|
||||
|
@ -82,7 +103,7 @@ public class ChannelDiscoveryService {
|
|||
logError(response);
|
||||
return;
|
||||
}
|
||||
cache.put("", body.items);
|
||||
cache.put(key(Method.JABBER_NETWORK, ""), 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);
|
||||
Call<MuclumbusService.SearchResult> searchResultCall = muclumbusService.search(searchRequest);
|
||||
|
||||
|
@ -110,7 +131,7 @@ public class ChannelDiscoveryService {
|
|||
logError(response);
|
||||
return;
|
||||
}
|
||||
cache.put(query, body.result.items);
|
||||
cache.put(key(Method.JABBER_NETWORK, query), 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) {
|
||||
final ResponseBody errorBody = response.errorBody();
|
||||
Log.d(Config.LOGTAG, "code from muclumbus=" + response.code());
|
||||
|
@ -129,13 +246,18 @@ public class ChannelDiscoveryService {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
Log.d(Config.LOGTAG,"error body="+errorBody.string());
|
||||
Log.d(Config.LOGTAG, "error body=" + errorBody.string());
|
||||
} catch (IOException e) {
|
||||
//ignored
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnChannelSearchResultsFound {
|
||||
void onChannelSearchResultsFound(List<MuclumbusService.Room> results);
|
||||
void onChannelSearchResultsFound(List<Room> results);
|
||||
}
|
||||
|
||||
public enum Method {
|
||||
JABBER_NETWORK,
|
||||
LOCAL_SERVER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import android.provider.ContactsContract;
|
|||
import android.security.KeyChain;
|
||||
import android.support.annotation.BoolRes;
|
||||
import android.support.annotation.IntegerRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.RemoteInput;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
|
@ -42,6 +43,8 @@ import android.util.Log;
|
|||
import android.util.LruCache;
|
||||
import android.util.Pair;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import org.conscrypt.Conscrypt;
|
||||
import org.openintents.openpgp.IOpenPgpService2;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
|
@ -857,8 +860,8 @@ public class XmppConnectionService extends Service {
|
|||
mChannelDiscoveryService.initializeMuclumbusService();
|
||||
}
|
||||
|
||||
public void discoverChannels(String query, ChannelDiscoveryService.OnChannelSearchResultsFound onChannelSearchResultsFound) {
|
||||
mChannelDiscoveryService.discover(query, onChannelSearchResultsFound);
|
||||
public void discoverChannels(String query, ChannelDiscoveryService.Method method, ChannelDiscoveryService.OnChannelSearchResultsFound onChannelSearchResultsFound) {
|
||||
mChannelDiscoveryService.discover(Strings.nullToEmpty(query).trim(), method, onChannelSearchResultsFound);
|
||||
}
|
||||
|
||||
public boolean isDataSaverDisabled() {
|
||||
|
@ -2244,6 +2247,7 @@ public class XmppConnectionService extends Service {
|
|||
getNotificationService().updateErrorNotification();
|
||||
toggleForegroundService();
|
||||
syncEnabledAccountSetting();
|
||||
mChannelDiscoveryService.cleanCache();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -3086,9 +3090,7 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
|
||||
public void fetchConferenceConfiguration(final Conversation conversation, final OnConferenceConfigurationFetched callback) {
|
||||
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
|
||||
request.setTo(conversation.getJid().asBareJid());
|
||||
request.query("http://jabber.org/protocol/disco#info");
|
||||
IqPacket request = mIqGenerator.queryDiscoInfo(conversation.getJid().asBareJid());
|
||||
sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
|
@ -4437,7 +4439,7 @@ public class XmppConnectionService extends Service {
|
|||
request.setTo(jid);
|
||||
final String node = presence.getNode();
|
||||
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) {
|
||||
query.setAttribute("node", node + "#" + ver);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.content.SharedPreferences;
|
|||
import android.databinding.DataBindingUtil;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Html;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -27,7 +28,7 @@ import eu.siacs.conversations.databinding.ActivityChannelDiscoveryBinding;
|
|||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Bookmark;
|
||||
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.ui.adapter.ChannelSearchResultAdapter;
|
||||
import eu.siacs.conversations.ui.util.PendingItem;
|
||||
|
@ -46,6 +47,8 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
private MenuItem mMenuSearchView;
|
||||
private EditText mSearchEditText;
|
||||
|
||||
private ChannelDiscoveryService.Method method = ChannelDiscoveryService.Method.LOCAL_SERVER;
|
||||
|
||||
private boolean optedIn = false;
|
||||
|
||||
@Override
|
||||
|
@ -55,14 +58,15 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
|
||||
@Override
|
||||
void onBackendConnected() {
|
||||
if (optedIn) {
|
||||
String query;
|
||||
if (optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) {
|
||||
final String query;
|
||||
if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) {
|
||||
query = mSearchEditText.getText().toString();
|
||||
} else {
|
||||
query = mInitialSearchValue.peek();
|
||||
}
|
||||
xmppConnectionService.discoverChannels(query, this);
|
||||
toggleLoadingScreen();
|
||||
xmppConnectionService.discoverChannels(query, this.method, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,29 +78,39 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
configureActionBar(getSupportActionBar(), true);
|
||||
binding.list.setAdapter(this.adapter);
|
||||
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");
|
||||
if (search != null) {
|
||||
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
|
||||
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);
|
||||
final View mSearchView = mMenuSearchView.getActionView();
|
||||
mSearchEditText = mSearchView.findViewById(R.id.search_field);
|
||||
mSearchEditText.setHint(R.string.search_channels);
|
||||
String initialSearchValue = mInitialSearchValue.pop();
|
||||
final String initialSearchValue = mInitialSearchValue.pop();
|
||||
if (initialSearchValue != null) {
|
||||
mMenuSearchView.expandActionView();
|
||||
mSearchEditText.append(initialSearchValue);
|
||||
mSearchEditText.requestFocus();
|
||||
if (optedIn && xmppConnectionService != null) {
|
||||
xmppConnectionService.discoverChannels(initialSearchValue, this);
|
||||
if ((optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) && xmppConnectionService != null) {
|
||||
xmppConnectionService.discoverChannels(initialSearchValue, this.method, this);
|
||||
}
|
||||
}
|
||||
mSearchEditText.setOnEditorActionListener(this);
|
||||
|
@ -120,8 +134,8 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||
mSearchEditText.setText("");
|
||||
toggleLoadingScreen();
|
||||
if (optedIn) {
|
||||
xmppConnectionService.discoverChannels(null, this);
|
||||
if (optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) {
|
||||
xmppConnectionService.discoverChannels(null, this.method, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -135,7 +149,8 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (!optedIn) {
|
||||
this.method = getMethod(this);
|
||||
if (!optedIn && method == ChannelDiscoveryService.Method.JABBER_NETWORK) {
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.channel_discovery_opt_in_title);
|
||||
builder.setMessage(Html.fromHtml(getString(R.string.channel_discover_opt_in_message)));
|
||||
|
@ -160,21 +175,21 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
SharedPreferences preferences = getPreferences();
|
||||
preferences.edit().putBoolean(CHANNEL_DISCOVERY_OPT_IN, true).apply();
|
||||
optedIn = true;
|
||||
xmppConnectionService.discoverChannels(null, this);
|
||||
xmppConnectionService.discoverChannels(null, this.method, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||
if (optedIn) {
|
||||
if (optedIn || method == ChannelDiscoveryService.Method.LOCAL_SERVER) {
|
||||
toggleLoadingScreen();
|
||||
SoftKeyboardUtils.hideSoftKeyboard(this);
|
||||
xmppConnectionService.discoverChannels(v.getText().toString(), this);
|
||||
xmppConnectionService.discoverChannels(v.getText().toString(), this.method, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelSearchResultsFound(final List<MuclumbusService.Room> results) {
|
||||
public void onChannelSearchResultsFound(final List<Room> results) {
|
||||
runOnUiThread(() -> {
|
||||
adapter.submitList(results);
|
||||
binding.progressBar.setVisibility(View.GONE);
|
||||
|
@ -188,7 +203,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onChannelSearchResult(final MuclumbusService.Room result) {
|
||||
public void onChannelSearchResult(final Room result) {
|
||||
List<String> accounts = AccountUtils.getEnabledAccounts(xmppConnectionService);
|
||||
if (accounts.size() == 1) {
|
||||
joinChannelSearchResult(accounts.get(0), result);
|
||||
|
@ -206,7 +221,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
|
||||
@Override
|
||||
public boolean onContextItemSelected(MenuItem item) {
|
||||
final MuclumbusService.Room room = adapter.getCurrent();
|
||||
final Room room = adapter.getCurrent();
|
||||
if (room != null) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.share_with:
|
||||
|
@ -224,7 +239,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
|||
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 boolean syncAutoJoin = getBooleanPreference("autojoin", R.bool.autojoin);
|
||||
final Account account = xmppConnectionService.findAccountByJid(jid);
|
||||
|
|
|
@ -16,26 +16,26 @@ import java.util.Locale;
|
|||
|
||||
import eu.siacs.conversations.R;
|
||||
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.util.AvatarWorkerTask;
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
};
|
||||
private OnChannelSearchResultSelected listener;
|
||||
private MuclumbusService.Room current;
|
||||
private Room current;
|
||||
|
||||
public ChannelSearchResultAdapter() {
|
||||
super(DIFF);
|
||||
|
@ -49,7 +49,7 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo
|
|||
|
||||
@Override
|
||||
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());
|
||||
final String description = searchResult.getDescription();
|
||||
final String language = searchResult.getLanguage();
|
||||
|
@ -78,7 +78,7 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo
|
|||
this.listener = listener;
|
||||
}
|
||||
|
||||
public MuclumbusService.Room getCurrent() {
|
||||
public Room getCurrent() {
|
||||
return this.current;
|
||||
}
|
||||
|
||||
|
@ -86,15 +86,14 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo
|
|||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
final Activity activity = XmppActivity.find(v);
|
||||
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);
|
||||
this.current = (MuclumbusService.Room) tag;
|
||||
this.current = (Room) tag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface OnChannelSearchResultSelected {
|
||||
void onChannelSearchResult(MuclumbusService.Room result);
|
||||
void onChannelSearchResult(Room result);
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
|
|
@ -102,7 +102,11 @@ public class AccountUtils {
|
|||
public static void showHideMenuItems(final Menu menu) {
|
||||
final MenuItem manageAccounts = menu.findItem(R.id.action_accounts);
|
||||
final MenuItem manageAccount = menu.findItem(R.id.action_account);
|
||||
if (manageAccount != null) {
|
||||
manageAccount.setVisible(MANAGE_ACCOUNT_ACTIVITY == null);
|
||||
}
|
||||
if (manageAccounts != null) {
|
||||
manageAccounts.setVisible(MANAGE_ACCOUNT_ACTIVITY != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package eu.siacs.conversations.xml;
|
||||
|
||||
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 ROSTER = "jabber:iq:roster";
|
||||
public static final String REGISTER = "jabber:iq:register";
|
||||
|
|
|
@ -4,8 +4,18 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/action_search"
|
||||
app:actionLayout="@layout/actionview_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>
|
||||
|
|
|
@ -124,4 +124,14 @@
|
|||
<item>@string/video_720p</item>
|
||||
<item>@string/video_original</item>
|
||||
</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>
|
||||
|
|
|
@ -43,4 +43,5 @@
|
|||
<bool name="use_share_location_plugin">false</bool>
|
||||
<bool name="start_searching">false</bool>
|
||||
<string name="video_compression">360</string>
|
||||
<string name="default_channel_discovery">JABBER_NETWORK</string>
|
||||
</resources>
|
||||
|
|
|
@ -879,4 +879,9 @@
|
|||
<string name="unable_to_perform_this_action">Unable to perform this action</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>
|
||||
</resources>
|
||||
|
|
|
@ -16,6 +16,22 @@
|
|||
</PreferenceScreen>
|
||||
</PreferenceCategory>
|
||||
<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
|
||||
android:defaultValue="@string/omemo_setting_default"
|
||||
android:entries="@array/omemo_setting_entries"
|
||||
|
@ -23,39 +39,10 @@
|
|||
android:key="omemo"
|
||||
android:summary="@string/pref_omemo_setting_summary_default_on"
|
||||
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
|
||||
android:title="@string/pref_notification_settings"
|
||||
android:key="notification_category">
|
||||
<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>
|
||||
android:key="notification_category"
|
||||
android:title="@string/pref_notification_settings">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/notifications_from_strangers"
|
||||
android:key="notifications_from_strangers"
|
||||
|
@ -76,24 +63,17 @@
|
|||
android:key="led"
|
||||
android:summary="@string/pref_led_summary"
|
||||
android:title="@string/pref_led" />
|
||||
<RingtonePreference
|
||||
android:defaultValue="@string/notification_ringtone"
|
||||
android:key="notification_ringtone"
|
||||
android:ringtoneType="notification"
|
||||
android:summary="@string/pref_sound_summary"
|
||||
android:title="@string/pref_sound" />
|
||||
<ListPreference
|
||||
android:defaultValue="@integer/grace_period"
|
||||
android:entries="@array/grace_periods"
|
||||
android:entryValues="@array/grace_periods_values"
|
||||
android:key="grace_period_length"
|
||||
android:summary="@string/pref_notification_grace_period_summary"
|
||||
android:title="@string/pref_notification_grace_period" />
|
||||
<PreferenceScreen
|
||||
android:key="quiet_hours"
|
||||
android:summary="@string/pref_quiet_hours_summary"
|
||||
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
|
||||
android:defaultValue="@bool/enable_quiet_hours"
|
||||
android:key="enable_quiet_hours"
|
||||
|
@ -111,25 +91,43 @@
|
|||
android:negativeButtonText="@string/cancel"
|
||||
android:positiveButtonText="@string/set"
|
||||
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>
|
||||
<ListPreference
|
||||
android:defaultValue="@integer/grace_period"
|
||||
android:entries="@array/grace_periods"
|
||||
android:entryValues="@array/grace_periods_values"
|
||||
android:key="grace_period_length"
|
||||
android:summary="@string/pref_notification_grace_period_summary"
|
||||
android:title="@string/pref_notification_grace_period" />
|
||||
<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>
|
||||
<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
|
||||
android:key="attachments"
|
||||
android:title="@string/pref_attachments">
|
||||
<ListPreference
|
||||
android:defaultValue="@integer/auto_accept_filesize"
|
||||
android:entries="@array/filesizes"
|
||||
android:entryValues="@array/filesizes_values"
|
||||
android:key="auto_accept_file_size"
|
||||
android:summary="@string/pref_accept_files_summary"
|
||||
android:title="@string/pref_accept_files" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/use_share_location_plugin"
|
||||
android:key="use_share_location_plugin"
|
||||
android:summary="@string/pref_use_share_location_plugin_summary"
|
||||
android:title="@string/pref_use_share_location_plugin" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/picture_compression"
|
||||
android:entries="@array/picture_compression_entries"
|
||||
|
@ -144,13 +142,30 @@
|
|||
android:key="video_compression"
|
||||
android:summary="@string/pref_video_compression_summary"
|
||||
android:title="@string/pref_video_compression" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/use_share_location_plugin"
|
||||
android:key="use_share_location_plugin"
|
||||
android:summary="@string/pref_use_share_location_plugin_summary"
|
||||
android:title="@string/pref_use_share_location_plugin" />
|
||||
<ListPreference
|
||||
android:defaultValue="@integer/auto_accept_filesize"
|
||||
android:entries="@array/filesizes"
|
||||
android:entryValues="@array/filesizes_values"
|
||||
android:key="auto_accept_file_size"
|
||||
android:summary="@string/pref_accept_files_summary"
|
||||
android:title="@string/pref_accept_files" />
|
||||
</PreferenceCategory>
|
||||
<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/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" />
|
||||
<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
|
||||
android:defaultValue="@string/theme"
|
||||
android:entries="@array/themes"
|
||||
|
@ -158,23 +173,6 @@
|
|||
android:key="theme"
|
||||
android:summary="@string/pref_theme_options_summary"
|
||||
android:title="@string/pref_theme_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" />
|
||||
<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
|
||||
android:defaultValue="@string/quick_action"
|
||||
android:dialogTitle="@string/choose_quick_action"
|
||||
|
@ -183,27 +181,27 @@
|
|||
android:key="quick_action"
|
||||
android:summary="@string/pref_quick_action_summary"
|
||||
android:title="@string/pref_quick_action" />
|
||||
<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
|
||||
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" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="advanced"
|
||||
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" />
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="expert"
|
||||
android:summary="@string/pref_expert_options_summary"
|
||||
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
|
||||
android:key="security_options"
|
||||
android:title="@string/pref_security_settings">
|
||||
|
@ -212,11 +210,6 @@
|
|||
android:key="btbv"
|
||||
android:summary="@string/pref_blind_trust_before_verification_summary"
|
||||
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
|
||||
android:defaultValue="@bool/dont_trust_system_cas"
|
||||
android:key="dont_trust_system_cas"
|
||||
|
@ -227,15 +220,20 @@
|
|||
android:key="validate_hostname"
|
||||
android:summary="@string/pref_validate_hostname_summary"
|
||||
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
|
||||
android:defaultValue="@bool/allow_message_correction"
|
||||
android:key="allow_message_correction"
|
||||
android:summary="@string/pref_allow_message_correction_summary"
|
||||
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
|
||||
android:key="clean_cache"
|
||||
android:summary="@string/pref_clean_cache_summary"
|
||||
|
@ -312,13 +310,24 @@
|
|||
android:title="@string/pref_treat_vibrate_as_silent" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="other_expert_category"
|
||||
android:title="@string/pref_expert_options_other">
|
||||
android:key="group_chats"
|
||||
android:title="@string/group_chats_and_channels">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/autojoin"
|
||||
android:key="autojoin"
|
||||
android:summary="@string/pref_autojoin_summary"
|
||||
android:title="@string/pref_autojoin" />
|
||||
<ListPreference
|
||||
android:defaultValue="@string/default_channel_discovery"
|
||||
android:entries="@array/channel_discovery_entries"
|
||||
android:entryValues="@array/channel_discover_values"
|
||||
android:key="channel_discovery_method"
|
||||
android:summary="@string/pref_channel_discovery_summary"
|
||||
android:title="@string/pref_channel_discovery" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:key="other_expert_category"
|
||||
android:title="@string/pref_expert_options_other">
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="@bool/indicate_received"
|
||||
android:key="indicate_received"
|
||||
|
@ -334,13 +343,15 @@
|
|||
android:summary="@string/pref_create_backup_summary"
|
||||
android:title="@string/pref_create_backup" />
|
||||
</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>
|
||||
|
||||
<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>
|
||||
<eu.siacs.conversations.ui.AboutPreference/>
|
||||
<eu.siacs.conversations.ui.AboutPreference />
|
||||
</PreferenceScreen>
|
||||
|
|
Loading…
Reference in a new issue