Added setting to use basic chat rooms for 1 to 1 instead

This commit is contained in:
Sylvain Berfini 2018-03-26 11:02:36 +02:00
parent 837879dffe
commit 14724c3cc3
5 changed files with 12 additions and 4 deletions

View file

@ -43,6 +43,7 @@ enable_basic_to_client_group_chat_room_migration=0
[app]
activation_code_length=4
prefer_basic_chat_room=0
[in-app-purchase]
server_url=https://subscribe.linphone.org:444/inapp.php

View file

@ -1529,4 +1529,8 @@ public class LinphonePreferences {
public boolean isFriendsStorageEnabled() {
return getConfig().getBool("misc", "store_friends", true);
}
public boolean useBasicChatRoomFor1To1() {
return getConfig().getBool("app", "prefer_basic_chat_room", false);
}
}

View file

@ -38,6 +38,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.contacts.ContactAddress;
import org.linphone.contacts.ContactsManager;
import org.linphone.contacts.SearchContactsListAdapter;
@ -340,7 +341,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
ChatRoom chatRoom = lc.findOneToOneChatRoom(lc.getDefaultProxyConfig().getContact(), participant);
if (chatRoom == null) {
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null && lpc.getConferenceFactoryUri() != null) {
if (lpc != null && lpc.getConferenceFactoryUri() != null && !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);
mChatRoom.addParticipant(participant);
@ -372,7 +373,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
ContactAddress ca = mSearchAdapter.getContacts().get(i);
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc == null || lpc.getConferenceFactoryUri() == null) {
if (lpc == null || lpc.getConferenceFactoryUri() == null || LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
ChatRoom chatRoom = lc.getChatRoom(ca.getAddress());
LinphoneActivity.instance().goToChat(chatRoom.getPeerAddress().asStringUriOnly());
} else {

View file

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.LinphoneUtils;
import org.linphone.R;
import org.linphone.activities.LinphoneActivity;
@ -79,7 +80,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
} else {
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null && lpc.getConferenceFactoryUri() != null) {
if (lpc != null && lpc.getConferenceFactoryUri() != null && !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);

View file

@ -31,6 +31,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.contacts.ContactsManager;
import org.linphone.contacts.LinphoneContact;
import org.linphone.LinphoneUtils;
@ -201,7 +202,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
LinphoneActivity.instance().goToChat(room.getPeerAddress().asStringUriOnly());
} else {
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null && lpc.getConferenceFactoryUri() != null) {
if (lpc != null && lpc.getConferenceFactoryUri() != null && !LinphonePreferences.instance().useBasicChatRoomFor1To1()) {
mWaitLayout.setVisibility(View.VISIBLE);
mChatRoom = lc.createClientGroupChatRoom(getString(R.string.dummy_group_chat_subject));
mChatRoom.addListener(mChatRoomCreationListener);