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

swarm: update model, conversations, add creation wizard

Change-Id: I212e550d145a90a7d6dc63416849aadd1ac7573f
parent 195212d0
...@@ -171,6 +171,7 @@ STATIC_LIBS_ALL="-llog -lOpenSLES -landroid \ ...@@ -171,6 +171,7 @@ STATIC_LIBS_ALL="-llog -lOpenSLES -landroid \
-lpjlib-util-${PJ_TARGET} \ -lpjlib-util-${PJ_TARGET} \
-lpj-${PJ_TARGET} \ -lpj-${PJ_TARGET} \
-lupnp -lixml \ -lupnp -lixml \
-lgit2 \
-larchive \ -larchive \
-lsecp256k1 \ -lsecp256k1 \
-lgnutls -lhogweed -lnettle -lgmp \ -lgnutls -lhogweed -lnettle -lgmp \
......
...@@ -107,7 +107,7 @@ dependencies { ...@@ -107,7 +107,7 @@ dependencies {
implementation 'com.google.zxing:core:3.3.3' implementation 'com.google.zxing:core:3.3.3'
// RxBindings // RxBindings
implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0' //implementation 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
implementation 'com.rodolfonavalon:ShapeRippleLibrary:1.0.0' implementation 'com.rodolfonavalon:ShapeRippleLibrary:1.0.0'
......
...@@ -330,8 +330,8 @@ public class JamiAccountSummaryFragment extends BaseSupportFragment<JamiAccountS ...@@ -330,8 +330,8 @@ public class JamiAccountSummaryFragment extends BaseSupportFragment<JamiAccountS
boolean hasRegisteredName = !currentRegisteredName && username != null && !username.isEmpty(); boolean hasRegisteredName = !currentRegisteredName && username != null && !username.isEmpty();
mBinding.groupRegisteringName.setVisibility(currentRegisteredName ? View.VISIBLE : View.GONE); mBinding.groupRegisteringName.setVisibility(currentRegisteredName ? View.VISIBLE : View.GONE);
mBinding.btnShare.setOnClickListener(v -> shareAccount(hasRegisteredName? username : account.getUsername())); mBinding.btnShare.setOnClickListener(v -> shareAccount(hasRegisteredName? username : account.getUsername()));
mBinding.registerName.setVisibility(hasRegisteredName? View.GONE : View.VISIBLE); mBinding.registerName.setVisibility(hasRegisteredName ? View.GONE : View.VISIBLE);
mBinding.registeredName.setText(hasRegisteredName? username : getResources().getString(R.string.no_registered_name_for_account)); mBinding.registeredName.setText(hasRegisteredName ? username : getResources().getString(R.string.no_registered_name_for_account));
mBinding.btnQr.setOnClickListener(v -> QRCodeFragment.newInstance(QRCodeFragment.INDEX_CODE).show(getParentFragmentManager(), QRCodeFragment.TAG)); mBinding.btnQr.setOnClickListener(v -> QRCodeFragment.newInstance(QRCodeFragment.INDEX_CODE).show(getParentFragmentManager(), QRCodeFragment.TAG));
mBinding.username.setOnFocusChangeListener((v, hasFocus) -> { mBinding.username.setOnFocusChangeListener((v, hasFocus) -> {
Editable name = mBinding.username.getText(); Editable name = mBinding.username.getText();
......
...@@ -32,6 +32,7 @@ import android.graphics.drawable.Drawable; ...@@ -32,6 +32,7 @@ import android.graphics.drawable.Drawable;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.text.TextUtils;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.text.format.Formatter; import android.text.format.Formatter;
import android.util.Log; import android.util.Log;
...@@ -49,6 +50,7 @@ import android.view.animation.AnimationUtils; ...@@ -49,6 +50,7 @@ import android.view.animation.AnimationUtils;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
...@@ -112,13 +114,13 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -112,13 +114,13 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
private int expandedItemPosition = -1; private int expandedItemPosition = -1;
private int lastDeliveredPosition = -1; private int lastDeliveredPosition = -1;
private int lastDisplayedPosition = -1; private int lastDisplayedPosition = -1;
private Observable<Long> timestampUpdateTimer; private final Observable<Long> timestampUpdateTimer;
private int lastMsgPos = -1; private int lastMsgPos = -1;
private boolean isComposing = false; private boolean isComposing = false;
private boolean mShowReadIndicator = true; private boolean mShowReadIndicator = true;
private static int[] msgBGLayouts = new int[] { private static final int[] msgBGLayouts = new int[] {
R.drawable.textmsg_bg_out_first, R.drawable.textmsg_bg_out_first,
R.drawable.textmsg_bg_out_middle, R.drawable.textmsg_bg_out_middle,
R.drawable.textmsg_bg_out_last, R.drawable.textmsg_bg_out_last,
...@@ -164,12 +166,31 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -164,12 +166,31 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void add(Interaction e) { public boolean add(Interaction e) {
boolean update = !mInteractions.isEmpty(); if (!TextUtils.isEmpty(e.getMessageId())) {
mInteractions.add(e); if (mInteractions.isEmpty() || e.getParentIds().contains(mInteractions.get(mInteractions.size()-1).getMessageId())) {
notifyItemInserted(mInteractions.size() - 1); boolean update = !mInteractions.isEmpty();
if (update) mInteractions.add(e);
notifyItemChanged(mInteractions.size() - 2); notifyItemInserted(mInteractions.size()-1);
if (update)
notifyItemChanged(mInteractions.size()-2);
return true;
}
for (int i = 0, n = mInteractions.size(); i<n; i++) {
if (mInteractions.get(i).getParentIds().contains(e.getMessageId())) {
mInteractions.add(i, e);
notifyItemInserted(i);
return i == n-1;
}
}
} else {
boolean update = !mInteractions.isEmpty();
mInteractions.add(e);
notifyItemInserted(mInteractions.size() - 1);
if (update)
notifyItemChanged(mInteractions.size() - 2);
}
return true;
} }
public void update(Interaction e) { public void update(Interaction e) {
...@@ -253,16 +274,18 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -253,16 +274,18 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
} }
} }
return out; return out;
case INVALID:
return MessageType.INVALID.ordinal();
} }
} }
return MessageType.CALL_INFORMATION.ordinal(); return -1;
} }
@NonNull @NonNull
@Override @Override
public ConversationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public ConversationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
MessageType type = MessageType.values()[viewType]; MessageType type = MessageType.values()[viewType];
ViewGroup v = (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(type.layout, parent, false); ViewGroup v = type == MessageType.INVALID ? new FrameLayout(parent.getContext()) : (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(type.layout, parent, false);
return new ConversationViewHolder(v, type); return new ConversationViewHolder(v, type);
} }
...@@ -287,14 +310,20 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -287,14 +310,20 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
conversationViewHolder.itemView.startAnimation(animation); conversationViewHolder.itemView.startAnimation(animation);
} }
if (interaction.getType() == (InteractionType.TEXT)) { //Log.w(TAG, "onBindViewHolder " + interaction.getType() + " " + interaction);
configureForTextMessage(conversationViewHolder, interaction, position); if (interaction.getType() == InteractionType.INVALID) {
} else if (interaction.getType() == (InteractionType.CALL)) { conversationViewHolder.itemView.setVisibility(View.GONE);
configureForCallInfo(conversationViewHolder, interaction); } else {
} else if (interaction.getType() == (InteractionType.CONTACT)) { conversationViewHolder.itemView.setVisibility(View.VISIBLE);
configureForContactEvent(conversationViewHolder, interaction); if (interaction.getType() == InteractionType.TEXT) {
} else if (interaction.getType() == (InteractionType.DATA_TRANSFER)) { configureForTextMessage(conversationViewHolder, interaction, position);
configureForFileInfo(conversationViewHolder, interaction, position); } else if (interaction.getType() == InteractionType.CALL) {
configureForCallInfo(conversationViewHolder, interaction);
} else if (interaction.getType() == InteractionType.CONTACT) {
configureForContactEvent(conversationViewHolder, interaction);
} else if (interaction.getType() == InteractionType.DATA_TRANSFER) {
configureForFileInfo(conversationViewHolder, interaction, position);
}
} }
} }
...@@ -584,7 +613,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -584,7 +613,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
private void configureForFileInfo(@NonNull final ConversationViewHolder viewHolder, private void configureForFileInfo(@NonNull final ConversationViewHolder 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.getPeerId(), file.getStoragePath()); File path = presenter.getDeviceRuntimeService().getConversationPath(interaction.getConversationId() == null ? interaction.getConversation().getParticipant() : interaction.getConversationId(), file.getStoragePath());
if (file.isComplete()) if (file.isComplete())
file.setSize(path.length()); file.setSize(path.length());
...@@ -697,28 +726,8 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -697,28 +726,8 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
if (file.getStatus() == InteractionStatus.TRANSFER_AWAITING_HOST) { if (file.getStatus() == InteractionStatus.TRANSFER_AWAITING_HOST) {
viewHolder.mAnswerLayout.setVisibility(View.VISIBLE); viewHolder.mAnswerLayout.setVisibility(View.VISIBLE);
viewHolder.btnAccept.setOnClickListener(v -> { viewHolder.btnAccept.setOnClickListener(v -> presenter.acceptFile(file));
if (!presenter.getDeviceRuntimeService().hasWriteExternalStoragePermission()) { viewHolder.btnRefuse.setOnClickListener(v -> presenter.refuseFile(file));
conversationFragment.askWriteExternalStoragePermission();
return;
}
Context context = v.getContext();
File cacheDir = context.getCacheDir();
long spaceLeft = AndroidFileUtils.getSpaceLeft(cacheDir.toString());
if (spaceLeft == -1L || file.getTotalSize() > spaceLeft) {
presenter.noSpaceLeft();
return;
}
context.startService(new Intent(DRingService.ACTION_FILE_ACCEPT)
.setClass(context.getApplicationContext(), DRingService.class)
.putExtra(DRingService.KEY_TRANSFER_ID, file.getDaemonId()));
});
viewHolder.btnRefuse.setOnClickListener(v -> {
Context context = v.getContext();
context.startService(new Intent(DRingService.ACTION_FILE_CANCEL)
.setClass(context.getApplicationContext(), DRingService.class)
.putExtra(DRingService.KEY_TRANSFER_ID, file.getDaemonId()));
});
} else { } else {
viewHolder.mAnswerLayout.setVisibility(View.GONE); viewHolder.mAnswerLayout.setVisibility(View.GONE);
if (file.getStatus() == InteractionStatus.TRANSFER_ONGOING) { if (file.getStatus() == InteractionStatus.TRANSFER_ONGOING) {
...@@ -769,9 +778,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -769,9 +778,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
} }
// Log.w(TAG, "configureForTextMessage " + position + " " + interaction.getDaemonId() + " " + interaction.getStatus()); // Log.w(TAG, "configureForTextMessage " + position + " " + interaction.getDaemonId() + " " + interaction.getStatus());
convViewHolder.mCid = textMessage.getConversation().getParticipant();
String message = textMessage.getBody().trim(); String message = textMessage.getBody().trim();
View longPressView = convViewHolder.mMsgTxt; View longPressView = convViewHolder.mMsgTxt;
longPressView.getBackground().setTintList(null); longPressView.getBackground().setTintList(null);
...@@ -795,13 +802,13 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -795,13 +802,13 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
if (expandedItemPosition == position) { if (expandedItemPosition == position) {
expandedItemPosition = -1; expandedItemPosition = -1;
} }
conversationFragment.updatePosition(convViewHolder.getAdapterPosition()); conversationFragment.updatePosition(convViewHolder.getBindingAdapterPosition());
if (textMessage.isIncoming()) { if (textMessage.isIncoming()) {
longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.grey_500)); longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.grey_500));
} else { } else {
longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.blue_900)); longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.blue_900));
} }
mCurrentLongItem = new RecyclerViewContextMenuInfo(convViewHolder.getAdapterPosition(), v.getId()); mCurrentLongItem = new RecyclerViewContextMenuInfo(convViewHolder.getBindingAdapterPosition(), v.getId());
return false; return false;
}); });
...@@ -850,8 +857,10 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -850,8 +857,10 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
}); });
convViewHolder.mAvatar.startAnimation(animation); convViewHolder.mAvatar.startAnimation(animation);
} else { } else {
convViewHolder.mAvatar.setImageBitmap(null); if (convViewHolder.mAvatar != null) {
convViewHolder.mAvatar.setVisibility(View.INVISIBLE); convViewHolder.mAvatar.setImageBitmap(null);
convViewHolder.mAvatar.setVisibility(View.INVISIBLE);
}
} }
} }
} else { } else {
...@@ -938,16 +947,11 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -938,16 +947,11 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
*/ */
private void configureForCallInfo(@NonNull final ConversationViewHolder convViewHolder, private void configureForCallInfo(@NonNull final ConversationViewHolder convViewHolder,
@NonNull final Interaction interaction) { @NonNull final Interaction interaction) {
int pictureResID;
String historyTxt;
convViewHolder.mIcon.setScaleY(1); convViewHolder.mIcon.setScaleY(1);
Context context = convViewHolder.itemView.getContext(); Context context = convViewHolder.itemView.getContext();
View longPressView = convViewHolder.mCallInfoLayout; View longPressView = convViewHolder.mCallInfoLayout;
longPressView.getBackground().setTintList(null); longPressView.getBackground().setTintList(null);
longPressView.setOnCreateContextMenuListener((menu, v, menuInfo) -> { longPressView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
conversationFragment.onCreateContextMenu(menu, v, menuInfo); conversationFragment.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = conversationFragment.getActivity().getMenuInflater(); MenuInflater inflater = conversationFragment.getActivity().getMenuInflater();
...@@ -958,7 +962,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -958,7 +962,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
menu.removeItem(R.id.conv_action_copy_text); menu.removeItem(R.id.conv_action_copy_text);
}); });
longPressView.setOnLongClickListener((View v) -> { longPressView.setOnLongClickListener((View v) -> {
longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.grey_500)); longPressView.getBackground().setTint(conversationFragment.getResources().getColor(R.color.grey_500));
conversationFragment.updatePosition(convViewHolder.getAdapterPosition()); conversationFragment.updatePosition(convViewHolder.getAdapterPosition());
...@@ -966,9 +969,9 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -966,9 +969,9 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
return false; return false;
}); });
int pictureResID;
String historyTxt;
SipCall call = (SipCall) interaction; SipCall call = (SipCall) interaction;
if (call.isMissed()) { if (call.isMissed()) {
if (call.isIncoming()) { if (call.isIncoming()) {
pictureResID = R.drawable.baseline_call_missed_24; pictureResID = R.drawable.baseline_call_missed_24;
...@@ -989,7 +992,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -989,7 +992,6 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
context.getString(R.string.notif_outgoing_call); context.getString(R.string.notif_outgoing_call);
} }
convViewHolder.mCid = call.getConversation().getParticipant();
convViewHolder.mIcon.setImageResource(pictureResID); convViewHolder.mIcon.setImageResource(pictureResID);
convViewHolder.mHistTxt.setText(historyTxt); convViewHolder.mHistTxt.setText(historyTxt);
convViewHolder.mHistDetailTxt.setText(DateFormat.getDateTimeInstance() convViewHolder.mHistDetailTxt.setText(DateFormat.getDateTimeInstance()
...@@ -1199,11 +1201,12 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo ...@@ -1199,11 +1201,12 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
CALL_INFORMATION(R.layout.item_conv_call), CALL_INFORMATION(R.layout.item_conv_call),
INCOMING_TEXT_MESSAGE(R.layout.item_conv_msg_peer), INCOMING_TEXT_MESSAGE(R.layout.item_conv_msg_peer),
OUTGOING_TEXT_MESSAGE(R.layout.item_conv_msg_me), OUTGOING_TEXT_MESSAGE(R.layout.item_conv_msg_me),
COMPOSING_INDICATION(R.layout.item_conv_composing); COMPOSING_INDICATION(R.layout.item_conv_composing),
INVALID(-1);
private final int layout; @LayoutRes private final int layout;
MessageType(int l) { MessageType(@LayoutRes int l) {
layout = l; layout = l;
} }
......
...@@ -85,7 +85,7 @@ public class NumberAdapter extends BaseAdapter { ...@@ -85,7 +85,7 @@ public class NumberAdapter extends BaseAdapter {
Phone number = mNumbers.get(position); Phone number = mNumbers.get(position);
ImageView numberIcon = convertView.findViewById(R.id.number_icon); ImageView numberIcon = convertView.findViewById(R.id.number_icon);
numberIcon.setImageResource(number.getNumber().isRingId() ? numberIcon.setImageResource(number.getNumber().isHexId() ?
R.drawable.ic_jami_24 : R.drawable.baseline_dialer_sip_24); R.drawable.ic_jami_24 : R.drawable.baseline_dialer_sip_24);
if (longView) { if (longView) {
......
...@@ -26,6 +26,7 @@ import cx.ring.smartlist.SmartListViewModel; ...@@ -26,6 +26,7 @@ import cx.ring.smartlist.SmartListViewModel;
import cx.ring.viewholders.SmartListViewHolder; import cx.ring.viewholders.SmartListViewHolder;
import android.os.Parcelable; import android.os.Parcelable;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -90,6 +91,7 @@ public class SmartListAdapter extends RecyclerView.Adapter<SmartListViewHolder> ...@@ -90,6 +91,7 @@ public class SmartListAdapter extends RecyclerView.Adapter<SmartListViewHolder>
} }
public void update(List<SmartListViewModel> viewModels) { public void update(List<SmartListViewModel> viewModels) {
//Log.w("SmartListAdapter", "update " + (viewModels == null ? null : viewModels.size()));
final List<SmartListViewModel> old = mSmartListViewModels; final List<SmartListViewModel> old = mSmartListViewModels;
mSmartListViewModels = viewModels == null ? new ArrayList<>() : viewModels; mSmartListViewModels = viewModels == null ? new ArrayList<>() : viewModels;
if (old != null && viewModels != null) { if (old != null && viewModels != null) {
......
...@@ -27,8 +27,8 @@ import cx.ring.smartlist.SmartListViewModel; ...@@ -27,8 +27,8 @@ import cx.ring.smartlist.SmartListViewModel;
public class SmartListDiffUtil extends DiffUtil.Callback { public class SmartListDiffUtil extends DiffUtil.Callback {
private List<SmartListViewModel> mOldList; private final List<SmartListViewModel> mOldList;
private List<SmartListViewModel> mNewList; private final List<SmartListViewModel> mNewList;
public SmartListDiffUtil(List<SmartListViewModel> oldList, List<SmartListViewModel> newList) { public SmartListDiffUtil(List<SmartListViewModel> oldList, List<SmartListViewModel> newList) {
mOldList = oldList; mOldList = oldList;
...@@ -49,7 +49,17 @@ public class SmartListDiffUtil extends DiffUtil.Callback { ...@@ -49,7 +49,17 @@ public class SmartListDiffUtil extends DiffUtil.Callback {
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
SmartListViewModel oldItem = mOldList.get(oldItemPosition); SmartListViewModel oldItem = mOldList.get(oldItemPosition);
SmartListViewModel newItem = mNewList.get(newItemPosition); SmartListViewModel newItem = mNewList.get(newItemPosition);
return newItem.getHeaderTitle() == oldItem.getHeaderTitle() && newItem.getContact() == oldItem.getContact(); if (newItem.getHeaderTitle() != oldItem.getHeaderTitle())
return false;
if (newItem.getContact() != oldItem.getContact()) {
if (newItem.getContact().size() != oldItem.getContact().size())
return false;
for (int i = 0; i < newItem.getContact().size(); i++) {
if (newItem.getContact().get(i) != oldItem.getContact().get(i))
return false;
}
}
return true;
} }
@Override @Override
......
...@@ -52,6 +52,8 @@ import java.util.concurrent.ScheduledExecutorService; ...@@ -52,6 +52,8 @@ import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import androidx.annotation.RequiresApi;
import cx.ring.BuildConfig; import cx.ring.BuildConfig;
import cx.ring.R; import cx.ring.R;
import cx.ring.contacts.AvatarFactory; import cx.ring.contacts.AvatarFactory;
...@@ -238,7 +240,7 @@ public abstract class JamiApplication extends Application { ...@@ -238,7 +240,7 @@ public abstract class JamiApplication extends Application {
super.onCreate(); super.onCreate();
sInstance = this; sInstance = this;
RxJavaPlugins.setErrorHandler(e -> Log.e(TAG, "Unhandled RxJava error", e)); //RxJavaPlugins.setErrorHandler(e -> Log.e(TAG, "Unhandled RxJava error", e));
// building injection dependency tree // building injection dependency tree
mJamiInjectionComponent = DaggerJamiInjectionComponent.builder() mJamiInjectionComponent = DaggerJamiInjectionComponent.builder()
......
...@@ -42,8 +42,8 @@ import cx.ring.BuildConfig; ...@@ -42,8 +42,8 @@ import cx.ring.BuildConfig;
import cx.ring.R; import cx.ring.R;
import cx.ring.application.JamiApplication; import cx.ring.application.JamiApplication;
import cx.ring.fragments.CallFragment; import cx.ring.fragments.CallFragment;
import cx.ring.fragments.ConversationFragment;
import cx.ring.services.NotificationService; import cx.ring.services.NotificationService;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.KeyboardVisibilityManager; import cx.ring.utils.KeyboardVisibilityManager;
import cx.ring.utils.MediaButtonsHelper; import cx.ring.utils.MediaButtonsHelper;
...@@ -118,22 +118,16 @@ public class CallActivity extends AppCompatActivity { ...@@ -118,22 +118,16 @@ public class CallActivity extends AppCompatActivity {
private void handleNewIntent(Intent intent) { private void handleNewIntent(Intent intent) {
String action = intent.getAction(); String action = intent.getAction();
if (Intent.ACTION_CALL.equals(action) || ACTION_CALL.equals(action)) { if (Intent.ACTION_CALL.equals(action) || ACTION_CALL.equals(action)) {
boolean audioOnly = intent.getBooleanExtra(CallFragment.KEY_AUDIO_ONLY, true); boolean audioOnly = intent.getBooleanExtra(CallFragment.KEY_AUDIO_ONLY, true);
String accountId = intent.getStringExtra(ConversationFragment.KEY_ACCOUNT_ID); String contactId = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
String contactRingId = intent.getStringExtra(ConversationFragment.KEY_CONTACT_RING_ID);
// Reload a new view
CallFragment callFragment = CallFragment.newInstance(CallFragment.ACTION_PLACE_CALL, CallFragment callFragment = CallFragment.newInstance(CallFragment.ACTION_PLACE_CALL,
accountId, ConversationPath.fromIntent(intent),
contactRingId, contactId,
audioOnly); audioOnly);
getSupportFragmentManager().beginTransaction().replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit();
} else if (Intent.ACTION_VIEW.equals(action) || ACTION_CALL_ACCEPT.equals(action)) { } else if (Intent.ACTION_VIEW.equals(action) || ACTION_CALL_ACCEPT.equals(action)) {
String confId = intent.getStringExtra(NotificationService.KEY_CALL_ID); String confId = intent.getStringExtra(NotificationService.KEY_CALL_ID);
// Reload a new view
CallFragment callFragment = CallFragment.newInstance(Intent.ACTION_VIEW.equals(action) ? CallFragment.ACTION_GET_CALL : ACTION_CALL_ACCEPT, confId); CallFragment callFragment = CallFragment.newInstance(Intent.ACTION_VIEW.equals(action) ? CallFragment.ACTION_GET_CALL : ACTION_CALL_ACCEPT, confId);
getSupportFragmentManager().beginTransaction().replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.main_call_layout, callFragment, CALL_FRAGMENT_TAG).commit();
} }
......
...@@ -33,7 +33,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; ...@@ -33,7 +33,9 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;