mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
WIP. Breakout to room from call and chat.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c67ce4253f
commit
ebfd15e001
@ -180,11 +180,14 @@ import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_PARTICIPANT_PERMISS
|
|||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN;
|
||||||
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL;
|
||||||
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY;
|
import static com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY;
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication.class)
|
@AutoInjector(NextcloudTalkApplication.class)
|
||||||
public class CallActivity extends CallBaseActivity {
|
public class CallActivity extends CallBaseActivity {
|
||||||
|
|
||||||
|
public static boolean active = false;
|
||||||
|
|
||||||
public static final String VIDEO_STREAM_TYPE_SCREEN = "screen";
|
public static final String VIDEO_STREAM_TYPE_SCREEN = "screen";
|
||||||
public static final String VIDEO_STREAM_TYPE_VIDEO = "video";
|
public static final String VIDEO_STREAM_TYPE_VIDEO = "video";
|
||||||
|
|
||||||
@ -304,10 +307,14 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
|
|
||||||
private CallParticipantList callParticipantList;
|
private CallParticipantList callParticipantList;
|
||||||
|
|
||||||
|
private String switchToRoomToken = "";
|
||||||
|
|
||||||
private SignalingMessageReceiver.LocalParticipantMessageListener localParticipantMessageListener =
|
private SignalingMessageReceiver.LocalParticipantMessageListener localParticipantMessageListener =
|
||||||
new SignalingMessageReceiver.LocalParticipantMessageListener() {
|
new SignalingMessageReceiver.LocalParticipantMessageListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSwitchTo(String token) {
|
public void onSwitchTo(String token) {
|
||||||
|
switchToRoomToken = token;
|
||||||
|
hangup(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -456,6 +463,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
active = true;
|
||||||
initFeaturesVisibility();
|
initFeaturesVisibility();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -465,6 +473,12 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
active = false;
|
||||||
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.S)
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
private void requestBluetoothPermission() {
|
private void requestBluetoothPermission() {
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (ContextCompat.checkSelfPermission(
|
||||||
@ -1870,7 +1884,29 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@io.reactivex.annotations.NonNull GenericOverall genericOverall) {
|
public void onNext(@io.reactivex.annotations.NonNull GenericOverall genericOverall) {
|
||||||
if (shutDownView) {
|
if (!switchToRoomToken.isEmpty()) {
|
||||||
|
Intent intent = new Intent(context, MainActivity.class);
|
||||||
|
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putBoolean(KEY_SWITCH_TO_ROOM_AND_START_CALL, true);
|
||||||
|
bundle.putString(KEY_ROOM_TOKEN, switchToRoomToken);
|
||||||
|
|
||||||
|
// bundle.putString(KEY_ROOM_ID, roomId);
|
||||||
|
bundle.putParcelable(KEY_USER_ENTITY, conversationUser);
|
||||||
|
// conversationName = extras.getString(KEY_CONVERSATION_NAME, "");
|
||||||
|
bundle.putBoolean(KEY_CALL_VOICE_ONLY, isVoiceOnlyCall);
|
||||||
|
bundle.putBoolean(KEY_CALL_WITHOUT_NOTIFICATION, true);
|
||||||
|
bundle.putBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO, canPublishAudioStream);
|
||||||
|
bundle.putBoolean(KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO, canPublishVideoStream);
|
||||||
|
intent.putExtras(bundle);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
Toast.makeText(context, "going to breakout room...", Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
finish();
|
||||||
|
} else if (shutDownView) {
|
||||||
finish();
|
finish();
|
||||||
} else if (currentCallStatus == CallStatus.RECONNECTING
|
} else if (currentCallStatus == CallStatus.RECONNECTING
|
||||||
|| currentCallStatus == CallStatus.PUBLISHER_FAILED) {
|
|| currentCallStatus == CallStatus.PUBLISHER_FAILED) {
|
||||||
|
@ -354,6 +354,21 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||||||
|
|
||||||
private fun handleIntent(intent: Intent) {
|
private fun handleIntent(intent: Intent) {
|
||||||
handleActionFromContact(intent)
|
handleActionFromContact(intent)
|
||||||
|
|
||||||
|
if (intent.getBooleanExtra(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL, false)) {
|
||||||
|
|
||||||
|
logRouterBackStack(router!!)
|
||||||
|
remapChatController(
|
||||||
|
router!!,
|
||||||
|
intent.getParcelableExtra<User>(KEY_USER_ENTITY)!!.id!!,
|
||||||
|
intent.getStringExtra(KEY_ROOM_TOKEN)!!,
|
||||||
|
intent.extras!!,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
logRouterBackStack(router!!)
|
||||||
|
}
|
||||||
|
|
||||||
if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
|
if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
|
||||||
if (intent.getBooleanExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, false)) {
|
if (intent.getBooleanExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, false)) {
|
||||||
if (!router!!.hasRootController()) {
|
if (!router!!.hasRootController()) {
|
||||||
|
@ -266,6 +266,7 @@ class ChatController(args: Bundle) :
|
|||||||
private var lookingIntoFuture = false
|
private var lookingIntoFuture = false
|
||||||
var newMessagesCount = 0
|
var newMessagesCount = 0
|
||||||
var startCallFromNotification: Boolean? = null
|
var startCallFromNotification: Boolean? = null
|
||||||
|
var startCallFromRoomSwitch: Boolean = false
|
||||||
val roomId: String
|
val roomId: String
|
||||||
val voiceOnly: Boolean
|
val voiceOnly: Boolean
|
||||||
var isFirstMessagesProcessing = true
|
var isFirstMessagesProcessing = true
|
||||||
@ -302,6 +303,9 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
private val localParticipantMessageListener = object : SignalingMessageReceiver.LocalParticipantMessageListener {
|
private val localParticipantMessageListener = object : SignalingMessageReceiver.LocalParticipantMessageListener {
|
||||||
override fun onSwitchTo(token: String?) {
|
override fun onSwitchTo(token: String?) {
|
||||||
|
if (token != null) {
|
||||||
|
switchToRoom(token)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,6 +342,10 @@ class ChatController(args: Bundle) :
|
|||||||
this.startCallFromNotification = args.getBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)
|
this.startCallFromNotification = args.getBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.containsKey(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL)) {
|
||||||
|
this.startCallFromRoomSwitch = args.getBoolean(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL)
|
||||||
|
}
|
||||||
|
|
||||||
this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
|
this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,6 +928,30 @@ class ChatController(args: Bundle) :
|
|||||||
super.onViewBound(view)
|
super.onViewBound(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun switchToRoom(token: String) {
|
||||||
|
if (CallActivity.active) {
|
||||||
|
Log.d(TAG, "CallActivity is running. Ignore to switch chat in ChatController...")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val conversationIntent = Intent(activity, CallActivity::class.java)
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
|
||||||
|
bundle.putString(KEY_ROOM_TOKEN, token)
|
||||||
|
|
||||||
|
if (conversationUser != null) {
|
||||||
|
conversationIntent.putExtras(bundle)
|
||||||
|
|
||||||
|
ConductorRemapping.remapChatController(
|
||||||
|
router,
|
||||||
|
conversationUser.id!!,
|
||||||
|
token,
|
||||||
|
bundle,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun showSendButtonMenu() {
|
private fun showSendButtonMenu() {
|
||||||
val popupMenu = PopupMenu(
|
val popupMenu = PopupMenu(
|
||||||
ContextThemeWrapper(view?.context, R.style.ChatSendButtonMenu),
|
ContextThemeWrapper(view?.context, R.style.ChatSendButtonMenu),
|
||||||
@ -1972,6 +2004,10 @@ class ChatController(args: Bundle) :
|
|||||||
startCallFromNotification = false
|
startCallFromNotification = false
|
||||||
startACall(voiceOnly, false)
|
startACall(voiceOnly, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (startCallFromRoomSwitch) {
|
||||||
|
startACall(voiceOnly, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onError(e: Throwable) {
|
||||||
@ -2398,12 +2434,14 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateReadStatusOfAllMessages(xChatLastCommonRead: Int?) {
|
private fun updateReadStatusOfAllMessages(xChatLastCommonRead: Int?) {
|
||||||
|
if (adapter != null) {
|
||||||
for (message in adapter!!.items) {
|
for (message in adapter!!.items) {
|
||||||
xChatLastCommonRead?.let {
|
xChatLastCommonRead?.let {
|
||||||
updateReadStatusOfMessage(message, it)
|
updateReadStatusOfMessage(message, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateReadStatusOfMessage(
|
private fun updateReadStatusOfMessage(
|
||||||
message: MessagesListAdapter<IMessage>.Wrapper<Any>,
|
message: MessagesListAdapter<IMessage>.Wrapper<Any>,
|
||||||
|
@ -80,4 +80,5 @@ object BundleKeys {
|
|||||||
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO"
|
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_AUDIO"
|
||||||
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO"
|
const val KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO = "KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO"
|
||||||
const val KEY_IS_MODERATOR = "KEY_IS_MODERATOR"
|
const val KEY_IS_MODERATOR = "KEY_IS_MODERATOR"
|
||||||
|
const val KEY_SWITCH_TO_ROOM_AND_START_CALL = "KEY_SWITCH_TO_ROOM_AND_START_CALL"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user