Browse Source

remove useless bundle entries etc.

- add strings for breakout room toasts
- remove useless boilerplate code
- dismiss call actions dialog when chlicked raise/lower hand

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 years ago
parent
commit
3abb9db9dc

+ 7 - 6
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

@@ -1935,17 +1935,18 @@ public class CallActivity extends CallBaseActivity {
                         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();
+                        if (isBreakoutRoom) {
+                            Toast.makeText(context, context.getResources().getString(R.string.switch_to_main_room),
+                                           Toast.LENGTH_LONG).show();
+                        } else {
+                            Toast.makeText(context, context.getResources().getString(R.string.switch_to_breakout_room),
+                                           Toast.LENGTH_LONG).show();
+                        }
 
                         finish();
                     } else if (shutDownView) {

+ 0 - 1
app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt

@@ -356,7 +356,6 @@ class MainActivity : BaseActivity(), ActionBarProvider {
         handleActionFromContact(intent)
 
         if (intent.getBooleanExtra(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL, false)) {
-
             logRouterBackStack(router!!)
             remapChatController(
                 router!!,

+ 29 - 16
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -316,10 +316,10 @@ class ChatController(args: Bundle) :
         setHasOptionsMenu(true)
         NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
 
-        this.conversationUser = args.getParcelable(KEY_USER_ENTITY)
-        this.roomId = args.getString(KEY_ROOM_ID, "")
-        this.roomToken = args.getString(KEY_ROOM_TOKEN, "")
-        this.sharedText = args.getString(BundleKeys.KEY_SHARED_TEXT, "")
+        conversationUser = args.getParcelable(KEY_USER_ENTITY)
+        roomId = args.getString(KEY_ROOM_ID, "")
+        roomToken = args.getString(KEY_ROOM_TOKEN, "")
+        sharedText = args.getString(BundleKeys.KEY_SHARED_TEXT, "")
 
         Log.d(TAG, "   roomToken = $roomToken")
         if (roomToken.isNullOrEmpty()) {
@@ -327,11 +327,11 @@ class ChatController(args: Bundle) :
         }
 
         if (args.containsKey(KEY_ACTIVE_CONVERSATION)) {
-            this.currentConversation = Parcels.unwrap<Conversation>(args.getParcelable(KEY_ACTIVE_CONVERSATION))
-            this.participantPermissions = ParticipantPermissions(conversationUser!!, currentConversation!!)
+            currentConversation = Parcels.unwrap<Conversation>(args.getParcelable(KEY_ACTIVE_CONVERSATION))
+            participantPermissions = ParticipantPermissions(conversationUser!!, currentConversation!!)
         }
 
-        this.roomPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "")
+        roomPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "")
 
         credentials = if (conversationUser?.userId == "?") {
             null
@@ -340,14 +340,14 @@ class ChatController(args: Bundle) :
         }
 
         if (args.containsKey(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
-            this.startCallFromNotification = args.getBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)
+            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)
+            startCallFromRoomSwitch = args.getBoolean(BundleKeys.KEY_SWITCH_TO_ROOM_AND_START_CALL)
         }
 
-        this.voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
+        voiceOnly = args.getBoolean(BundleKeys.KEY_CALL_VOICE_ONLY, false)
     }
 
     private fun getRoomInfo() {
@@ -935,13 +935,26 @@ class ChatController(args: Bundle) :
             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)
+            activity?.runOnUiThread {
+                if (currentConversation?.objectType == BREAKOUT_ROOM_TYPE) {
+                    Toast.makeText(
+                        context,
+                        context.resources.getString(R.string.switch_to_main_room),
+                        Toast.LENGTH_LONG
+                    ).show()
+                } else {
+                    Toast.makeText(
+                        context,
+                        context.resources.getString(R.string.switch_to_breakout_room),
+                        Toast.LENGTH_LONG
+                    ).show()
+                }
+            }
+
+            val bundle = Bundle()
+            bundle.putParcelable(KEY_USER_ENTITY, conversationUser)
+            bundle.putString(KEY_ROOM_TOKEN, token)
 
             ConductorRemapping.remapChatController(
                 router,

+ 2 - 0
app/src/main/java/com/nextcloud/talk/ui/dialog/MoreCallActionsDialog.kt

@@ -130,12 +130,14 @@ class MoreCallActionsDialog(private val callActivity: CallActivity) : BottomShee
                     binding.raiseHandIcon.setImageDrawable(
                         ContextCompat.getDrawable(context, R.drawable.ic_baseline_do_not_touch_24)
                     )
+                    dismiss()
                 }
                 is RaiseHandViewModel.LoweredHandState -> {
                     binding.raiseHandText.text = context.getText(R.string.raise_hand)
                     binding.raiseHandIcon.setImageDrawable(
                         ContextCompat.getDrawable(context, R.drawable.ic_hand_back_left)
                     )
+                    dismiss()
                 }
                 else -> {}
             }

+ 4 - 0
app/src/main/res/values/strings.xml

@@ -633,6 +633,10 @@
     <string name="nc_expire_message_one_hour">1 hour</string>
     <string name="nc_expire_messages_explanation">Chat messages can be expired after a certain time. Note: Files shared in chat will not be deleted for the owner, but will no longer be shared in the conversation.</string>
 
+    <!-- Breakout rooms -->
+    <string name="switch_to_main_room">Switch to main room</string>
+    <string name="switch_to_breakout_room">Switch to breakout room</string>
+
     <string name="nc_not_allowed_to_activate_audio">You are not allowed to activate audio!</string>
     <string name="nc_not_allowed_to_activate_video">You are not allowed to activate video!</string>
     <string name="scroll_to_bottom">Scroll to bottom</string>