Commit 64f70d4d authored by Adrien Béraud's avatar Adrien Béraud Committed by Sébastien Blin
Browse files

ConversationPath: factor logic

Change-Id: Ic910a890558efaa1d93e608ad9e08e50152dcd6c
parent cdcbbbb0
...@@ -126,8 +126,6 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen ...@@ -126,8 +126,6 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
public static final int REQ_ADD_CONTACT = 42; public static final int REQ_ADD_CONTACT = 42;
public static final String KEY_CONTACT_RING_ID = BuildConfig.APPLICATION_ID + ".CONTACT_RING_ID";
public static final String KEY_ACCOUNT_ID = BuildConfig.APPLICATION_ID + ".ACCOUNT_ID";
public static final String KEY_PREFERENCE_PENDING_MESSAGE = "pendingMessage"; public static final String KEY_PREFERENCE_PENDING_MESSAGE = "pendingMessage";
public static final String KEY_PREFERENCE_CONVERSATION_COLOR = "color"; public static final String KEY_PREFERENCE_CONVERSATION_COLOR = "color";
public static final String KEY_PREFERENCE_CONVERSATION_LAST_READ = "lastRead"; public static final String KEY_PREFERENCE_CONVERSATION_LAST_READ = "lastRead";
......
...@@ -145,8 +145,7 @@ public class ShareWithFragment extends Fragment { ...@@ -145,8 +145,7 @@ public class ShareWithFragment extends Fragment {
if (type != null && type.startsWith("text/")) { if (type != null && type.startsWith("text/")) {
intent.putExtra(Intent.EXTRA_TEXT, previewText.getText().toString()); intent.putExtra(Intent.EXTRA_TEXT, previewText.getText().toString());
} }
intent.putExtra(ConversationFragment.KEY_ACCOUNT_ID, smartListViewModel.getAccountId()); intent.putExtras(ConversationPath.toBundle(smartListViewModel.getAccountId(), smartListViewModel.getUri()));
intent.putExtra(ConversationFragment.KEY_CONTACT_RING_ID, smartListViewModel.getUri().getUri());
intent.setClass(requireActivity(), ConversationActivity.class); intent.setClass(requireActivity(), ConversationActivity.class);
startActivity(intent); startActivity(intent);
} }
......
...@@ -426,7 +426,7 @@ public class SmartListFragment extends BaseSupportFragment<SmartListPresenter> i ...@@ -426,7 +426,7 @@ public class SmartListFragment extends BaseSupportFragment<SmartListPresenter> i
public void onActivityResult(int requestCode, int resultCode, Intent data) { public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == HomeActivity.REQUEST_CODE_QR_CONVERSATION && data != null && resultCode == Activity.RESULT_OK) { if (requestCode == HomeActivity.REQUEST_CODE_QR_CONVERSATION && data != null && resultCode == Activity.RESULT_OK) {
String contactId = data.getStringExtra(ConversationFragment.KEY_CONTACT_RING_ID); String contactId = data.getStringExtra(ConversationPath.KEY_CONVERSATION_URI);
if (contactId != null) { if (contactId != null) {
presenter.startConversation(net.jami.model.Uri.fromString(contactId)); presenter.startConversation(net.jami.model.Uri.fromString(contactId));
} }
......
...@@ -22,7 +22,6 @@ import android.content.Intent; ...@@ -22,7 +22,6 @@ import android.content.Intent;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.WindowManager; import android.view.WindowManager;
...@@ -34,8 +33,11 @@ import androidx.fragment.app.FragmentTransaction; ...@@ -34,8 +33,11 @@ import androidx.fragment.app.FragmentTransaction;
import cx.ring.R; import cx.ring.R;
import cx.ring.application.JamiApplication; import cx.ring.application.JamiApplication;
import net.jami.call.CallView; import net.jami.call.CallView;
import cx.ring.fragments.ConversationFragment;
import cx.ring.utils.ConversationPath;
import net.jami.services.NotificationService; import net.jami.services.NotificationService;
import net.jami.utils.Log; import net.jami.utils.Log;
...@@ -59,7 +61,7 @@ public class TVCallActivity extends FragmentActivity { ...@@ -59,7 +61,7 @@ public class TVCallActivity extends FragmentActivity {
setTurnScreenOn(true); setTurnScreenOn(true);
setShowWhenLocked(true); setShowWhenLocked(true);
} else { } else {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED| getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
} }
setContentView(R.layout.tv_activity_call); setContentView(R.layout.tv_activity_call);
...@@ -69,19 +71,18 @@ public class TVCallActivity extends FragmentActivity { ...@@ -69,19 +71,18 @@ public class TVCallActivity extends FragmentActivity {
JamiApplication.getInstance().getInjectionComponent().inject(this); JamiApplication.getInstance().getInjectionComponent().inject(this);
JamiApplication.getInstance().startDaemon(); JamiApplication.getInstance().startDaemon();
boolean audioOnly = false; ConversationPath path = ConversationPath.fromIntent(intent);
String accountId = getIntent().getStringExtra(ConversationFragment.KEY_ACCOUNT_ID);
String ringId = getIntent().getStringExtra(ConversationFragment.KEY_CONTACT_RING_ID);
FragmentManager fragmentManager = getSupportFragmentManager(); FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if (!TextUtils.isEmpty(ringId)) { if (path != null) {
Log.d(TAG, "onCreate: outgoing call"); Log.d(TAG, "onCreate: outgoing call " + path);
callFragment = TVCallFragment.newInstance(TVCallFragment.ACTION_PLACE_CALL, callFragment = TVCallFragment.newInstance(intent.getAction(),
accountId, path.getAccountId(),
ringId, path.getConversationId(),
audioOnly); intent.getExtras().getString(Intent.EXTRA_PHONE_NUMBER, path.getConversationId()),
false);
fragmentTransaction.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit(); fragmentTransaction.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit();
} else { } else {
Log.d(TAG, "onCreate: incoming call"); Log.d(TAG, "onCreate: incoming call");
...@@ -89,14 +90,13 @@ public class TVCallActivity extends FragmentActivity { ...@@ -89,14 +90,13 @@ public class TVCallActivity extends FragmentActivity {
String confId = getIntent().getStringExtra(NotificationService.KEY_CALL_ID); String confId = getIntent().getStringExtra(NotificationService.KEY_CALL_ID);
Log.d(TAG, "onCreate: conf " + confId); Log.d(TAG, "onCreate: conf " + confId);
callFragment = TVCallFragment.newInstance(TVCallFragment.ACTION_GET_CALL, confId); callFragment = TVCallFragment.newInstance(Intent.ACTION_VIEW, confId);
fragmentTransaction.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit(); fragmentTransaction.replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit();
} }
} }
@Override @Override
public void onUserLeaveHint () { public void onUserLeaveHint() {
Fragment fragment = getSupportFragmentManager().findFragmentByTag(CALL_FRAGMENT_TAG); Fragment fragment = getSupportFragmentManager().findFragmentByTag(CALL_FRAGMENT_TAG);
if (fragment instanceof CallView) { if (fragment instanceof CallView) {
CallView callFragment = (CallView) fragment; CallView callFragment = (CallView) fragment;
......
...@@ -100,13 +100,8 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement ...@@ -100,13 +100,8 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement
public static final String TAG = TVCallFragment.class.getSimpleName(); public static final String TAG = TVCallFragment.class.getSimpleName();
public static final String ACTION_PLACE_CALL = "PLACE_CALL";
public static final String ACTION_GET_CALL = "GET_CALL";
public static final String KEY_ACTION = "action"; public static final String KEY_ACTION = "action";
public static final String KEY_ACCOUNT_ID = "accountId";
public static final String KEY_CONF_ID = "confId"; public static final String KEY_CONF_ID = "confId";
public static final String KEY_CONTACT_RING_ID = "CONTACT_RING_ID";
public static final String KEY_AUDIO_ONLY = "AUDIO_ONLY"; public static final String KEY_AUDIO_ONLY = "AUDIO_ONLY";
private static final int REQUEST_CODE_ADD_PARTICIPANT = 6; private static final int REQUEST_CODE_ADD_PARTICIPANT = 6;
...@@ -137,15 +132,15 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement ...@@ -137,15 +132,15 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement
@Inject @Inject
DeviceRuntimeService mDeviceRuntimeService; DeviceRuntimeService mDeviceRuntimeService;
public static TVCallFragment newInstance(@NonNull String action, @Nullable String accountID, @Nullable String contactRingId, boolean audioOnly) { public static TVCallFragment newInstance(@NonNull String action, @NonNull String accountId, @NonNull String conversationId, @NonNull String contactUri, boolean audioOnly) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(KEY_ACTION, action); bundle.putString(KEY_ACTION, action);
bundle.putString(KEY_ACCOUNT_ID, accountID); bundle.putAll(ConversationPath.toBundle(accountId, conversationId));
bundle.putSerializable(KEY_CONTACT_RING_ID, contactRingId); bundle.putString(Intent.EXTRA_PHONE_NUMBER, contactUri);
bundle.putBoolean(KEY_AUDIO_ONLY, audioOnly); bundle.putBoolean(KEY_AUDIO_ONLY, audioOnly);
TVCallFragment countDownFragment = new TVCallFragment(); TVCallFragment fragment = new TVCallFragment();
countDownFragment.setArguments(bundle); fragment.setArguments(bundle);
return countDownFragment; return fragment;
} }
public static TVCallFragment newInstance(@NonNull String action, @Nullable String confId) { public static TVCallFragment newInstance(@NonNull String action, @Nullable String confId) {
...@@ -168,9 +163,9 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement ...@@ -168,9 +163,9 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement
super.initPresenter(presenter); super.initPresenter(presenter);
String action = getArguments().getString(KEY_ACTION); String action = getArguments().getString(KEY_ACTION);
if (action != null) { if (action != null) {
if (action.equals(ACTION_PLACE_CALL)) { if (action.equals(Intent.ACTION_CALL)) {
prepareCall(false); prepareCall(false);
} else if (action.equals(ACTION_GET_CALL)) { } else if (action.equals(Intent.ACTION_VIEW)) {
presenter.initIncomingCall(getArguments().getString(KEY_CONF_ID), true); presenter.initIncomingCall(getArguments().getString(KEY_CONF_ID), true);
} }
} }
...@@ -451,15 +446,13 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement ...@@ -451,15 +446,13 @@ public class TVCallFragment extends BaseSupportFragment<CallPresenter> implement
PopupMenu popup = new PopupMenu(context, view); PopupMenu popup = new PopupMenu(context, view);
popup.inflate(R.menu.conference_participant_actions); popup.inflate(R.menu.conference_participant_actions);
popup.setOnMenuItemClickListener(item -> { popup.setOnMenuItemClickListener(item -> {
switch (item.getItemId()) { int itemId = item.getItemId();
case R.id.conv_contact_details: if (itemId == R.id.conv_contact_details) {
presenter.openParticipantContact(call); presenter.openParticipantContact(call);
break; } else if (itemId == R.id.conv_contact_hangup) {
case R.id.conv_contact_hangup: presenter.hangupParticipant(call);
presenter.hangupParticipant(call); } else {
break; return false;
default:
return false;
} }
return true; return true;
}); });
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
package cx.ring.tv.contact; package cx.ring.tv.contact;
...@@ -46,6 +45,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; ...@@ -46,6 +45,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import cx.ring.R; import cx.ring.R;
import cx.ring.application.JamiApplication; import cx.ring.application.JamiApplication;
import cx.ring.client.CallActivity;
import cx.ring.client.HomeActivity;
import cx.ring.fragments.CallFragment;
import cx.ring.fragments.ConversationFragment; import cx.ring.fragments.ConversationFragment;
import net.jami.model.Uri; import net.jami.model.Uri;
import net.jami.services.NotificationService; import net.jami.services.NotificationService;
...@@ -195,20 +197,17 @@ public class TVContactFragment extends BaseDetailFragment<TVContactPresenter> im ...@@ -195,20 +197,17 @@ public class TVContactFragment extends BaseDetailFragment<TVContactPresenter> im
} }
@Override @Override
public void callContact(String accountID, Uri uri) { public void callContact(String accountId, Uri conversationUri, Uri uri) {
Context context = requireContext(); startActivity(new Intent(Intent.ACTION_CALL)
Intent intent = new Intent(context, TVCallActivity.class); .setClass(requireContext(), TVCallActivity.class)
intent.putExtra(ConversationFragment.KEY_ACCOUNT_ID, accountID); .putExtras(ConversationPath.toBundle(accountId, conversationUri))
intent.putExtra(ConversationFragment.KEY_CONTACT_RING_ID, uri.getRawUriString()); .putExtra(Intent.EXTRA_PHONE_NUMBER, uri.getUri()));
context.startActivity(intent, null);
} }
@Override @Override
public void goToCallActivity(String id) { public void goToCallActivity(String id) {
Context context = requireContext(); startActivity(new Intent(requireContext(), TVCallActivity.class)
Intent intent = new Intent(context, TVCallActivity.class); .putExtra(NotificationService.KEY_CALL_ID, id));
intent.putExtra(NotificationService.KEY_CALL_ID, id);
context.startActivity(intent, null);
} }
@Override @Override
......
...@@ -77,14 +77,19 @@ public class TVContactPresenter extends RootPresenter<TVContactView> { ...@@ -77,14 +77,19 @@ public class TVContactPresenter extends RootPresenter<TVContactView> {
public void contactClicked() { public void contactClicked() {
Account account = mAccountService.getAccount(mAccountId); Account account = mAccountService.getAccount(mAccountId);
if (account != null) { if (account != null) {
Conference conf = account.getByUri(mUri).getCurrentCall(); Conversation conversation = account.getByUri(mUri);
Conference conf = conversation.getCurrentCall();
if (conf != null if (conf != null
&& !conf.getParticipants().isEmpty() && !conf.getParticipants().isEmpty()
&& conf.getParticipants().get(0).getCallStatus() != Call.CallStatus.INACTIVE && conf.getParticipants().get(0).getCallStatus() != Call.CallStatus.INACTIVE
&& conf.getParticipants().get(0).getCallStatus() != Call.CallStatus.FAILURE) { && conf.getParticipants().get(0).getCallStatus() != Call.CallStatus.FAILURE) {
getView().goToCallActivity(conf.getId()); getView().goToCallActivity(conf.getId());
} else { } else {
getView().callContact(mAccountId, mUri); if (conversation.isSwarm()) {
getView().callContact(mAccountId, mUri, conversation.getContact().getUri());
} else {
getView().callContact(mAccountId, mUri, mUri);
}
} }
} }
} }
......
...@@ -27,7 +27,7 @@ import net.jami.smartlist.SmartListViewModel; ...@@ -27,7 +27,7 @@ import net.jami.smartlist.SmartListViewModel;
public interface TVContactView extends BaseView { public interface TVContactView extends BaseView {
void showContact(SmartListViewModel model); void showContact(SmartListViewModel model);
void callContact(String accountID, Uri uri); void callContact(String accountID, Uri conversationUri, Uri uri);
void goToCallActivity(String id); void goToCallActivity(String id);
......
...@@ -365,7 +365,7 @@ public class TvConversationAdapter extends RecyclerView.Adapter<TvConversationVi ...@@ -365,7 +365,7 @@ public class TvConversationAdapter extends RecyclerView.Adapter<TvConversationVi
private void configureForFileInfoTextMessage(@NonNull final TvConversationViewHolder viewHolder, private void configureForFileInfoTextMessage(@NonNull final TvConversationViewHolder viewHolder,
@NonNull final Interaction interaction, int position) { @NonNull final Interaction interaction, int position) {
DataTransfer file = (DataTransfer) interaction; DataTransfer file = (DataTransfer) interaction;
File path = presenter.getDeviceRuntimeService().getConversationPath(file.getConversationId(), file.getStoragePath()); File path = presenter.getDeviceRuntimeService().getConversationPath(interaction.getConversationId() == null ? interaction.getConversation().getParticipant() : interaction.getConversationId(), file.getStoragePath());
file.setSize(path.length()); file.setSize(path.length());
String timeString = timestampToDetailString(viewHolder.itemView.getContext(), file.getTimestamp()); String timeString = timestampToDetailString(viewHolder.itemView.getContext(), file.getTimestamp());
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
package cx.ring.tv.main; package cx.ring.tv.main;
...@@ -362,9 +361,7 @@ public class MainFragment extends BaseBrowseFragment<MainPresenter> implements M ...@@ -362,9 +361,7 @@ public class MainFragment extends BaseBrowseFragment<MainPresenter> implements M
@Override @Override
public void callContact(String accountID, String number) { public void callContact(String accountID, String number) {
Intent intent = new Intent(getActivity(), TVCallActivity.class); Intent intent = new Intent(Intent.ACTION_CALL, ConversationPath.toUri(accountID, number), getActivity(), TVCallActivity.class);
intent.putExtra(ConversationFragment.KEY_ACCOUNT_ID, accountID);
intent.putExtra(ConversationFragment.KEY_CONTACT_RING_ID, number);
startActivity(intent, null); startActivity(intent, null);
} }
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
package cx.ring.tv.search; package cx.ring.tv.search;
...@@ -36,7 +35,6 @@ import android.view.View; ...@@ -36,7 +35,6 @@ import android.view.View;
import cx.ring.R; import cx.ring.R;
import cx.ring.application.JamiApplication; import cx.ring.application.JamiApplication;
import cx.ring.client.CallActivity; import cx.ring.client.CallActivity;
import cx.ring.fragments.ConversationFragment;
import net.jami.model.Contact; import net.jami.model.Contact;
import net.jami.smartlist.SmartListViewModel; import net.jami.smartlist.SmartListViewModel;
import cx.ring.tv.call.TVCallActivity; import cx.ring.tv.call.TVCallActivity;
...@@ -138,7 +136,6 @@ public class ContactSearchFragment extends BaseSearchFragment<ContactSearchPrese ...@@ -138,7 +136,6 @@ public class ContactSearchFragment extends BaseSearchFragment<ContactSearchPrese
@Override @Override
public void startCall(String accountID, String number) { public void startCall(String accountID, String number) {
Intent intent = new Intent(CallActivity.ACTION_CALL, ConversationPath.toUri(accountID, number), getActivity(), TVCallActivity.class); Intent intent = new Intent(CallActivity.ACTION_CALL, ConversationPath.toUri(accountID, number), getActivity(), TVCallActivity.class);
intent.putExtra(ConversationFragment.KEY_ACCOUNT_ID, accountID);
intent.putExtra(Intent.EXTRA_PHONE_NUMBER, number); intent.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
startActivity(intent); startActivity(intent);
getActivity().finish(); getActivity().finish();
......
/*
* Copyright (C) 2004-2021 Savoir-faire Linux Inc.
*
* Authors: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cx.ring.utils; package cx.ring.utils;
import android.content.Intent; import android.content.Intent;
...@@ -8,17 +26,21 @@ import android.text.TextUtils; ...@@ -8,17 +26,21 @@ import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import cx.ring.fragments.ConversationFragment;
import net.jami.model.Conversation; import net.jami.model.Conversation;
import net.jami.model.Interaction; import net.jami.model.Interaction;
import net.jami.utils.StringUtils; import net.jami.utils.StringUtils;
import net.jami.utils.Tuple; import net.jami.utils.Tuple;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import cx.ring.BuildConfig;
public class ConversationPath { public class ConversationPath {
public static final String KEY_CONVERSATION_URI = BuildConfig.APPLICATION_ID + ".conversationUri";
public static final String KEY_ACCOUNT_ID = BuildConfig.APPLICATION_ID + ".accountId";
private final String accountId; private final String accountId;
private final String conversationId; private final String conversationId;
public ConversationPath(String account, String contact) { public ConversationPath(String account, String contact) {
...@@ -84,14 +106,14 @@ public class ConversationPath { ...@@ -84,14 +106,14 @@ public class ConversationPath {
return toBundle(accountId, conversationId); return toBundle(accountId, conversationId);
} }
public void toBundle(Bundle bundle) { public void toBundle(Bundle bundle) {
bundle.putString(ConversationFragment.KEY_CONTACT_RING_ID, conversationId); bundle.putString(KEY_CONVERSATION_URI, conversationId);
bundle.putString(ConversationFragment.KEY_ACCOUNT_ID, accountId); bundle.putString(KEY_ACCOUNT_ID, accountId);
} }
public static Bundle toBundle(String accountId, String uri) { public static Bundle toBundle(String accountId, String uri) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(ConversationFragment.KEY_CONTACT_RING_ID, uri); bundle.putString(KEY_CONVERSATION_URI, uri);
bundle.putString(ConversationFragment.KEY_ACCOUNT_ID, accountId); bundle.putString(KEY_ACCOUNT_ID, accountId);
return bundle; return bundle;
} }
public static Bundle toBundle(String accountId, net.jami.model.Uri uri) { public static Bundle toBundle(String accountId, net.jami.model.Uri uri) {
...@@ -135,8 +157,8 @@ public class ConversationPath { ...@@ -135,8 +157,8 @@ public class ConversationPath {
public static ConversationPath fromBundle(@Nullable Bundle bundle) { public static ConversationPath fromBundle(@Nullable Bundle bundle) {
if (bundle != null) { if (bundle != null) {
String accountId = bundle.getString(ConversationFragment.KEY_ACCOUNT_ID); String accountId = bundle.getString(KEY_ACCOUNT_ID);
String contactId = bundle.getString(ConversationFragment.KEY_CONTACT_RING_ID); String contactId = bundle.getString(KEY_CONVERSATION_URI);
if (accountId != null && contactId != null) { if (accountId != null && contactId != null) {
return new ConversationPath(accountId, contactId); return new ConversationPath(accountId, contactId);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment