-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #703 from 100mslive/dev
Release :: v2.9.55
- Loading branch information
Showing
16 changed files
with
187 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
room-kit/src/main/java/live/hms/roomkit/ui/meeting/TranscriptionsPositionUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package live.hms.roomkit.ui.meeting | ||
|
||
import androidx.lifecycle.MutableLiveData | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.sync.Mutex | ||
import kotlinx.coroutines.sync.withLock | ||
|
||
class TranscriptionsPositionUseCase(private val scope : CoroutineScope) { | ||
val TAG = "TranscPositionUseCase" | ||
val transcriptionsPosition = MutableLiveData(MeetingViewModel.TranscriptionsPosition.BOTTOM) | ||
|
||
|
||
private var isScreenShare : Boolean = false | ||
private var isChatEnabled : Boolean = false | ||
private var lock = Mutex() | ||
fun chatStateChanged(enabled: Boolean) { | ||
scope.launch { | ||
lock.withLock { | ||
// Log.d(TAG, "Chatstate: $enabled") | ||
isChatEnabled = enabled | ||
transcriptionsPosition.postValue(recalculate()) | ||
} | ||
} | ||
} | ||
|
||
fun setScreenShare(enabled : Boolean) { | ||
scope.launch { | ||
lock.withLock { | ||
// Log.d(TAG, "Screenshare: $enabled") | ||
isScreenShare = enabled | ||
|
||
transcriptionsPosition.postValue(recalculate()) | ||
} | ||
} | ||
} | ||
|
||
private fun recalculate() : MeetingViewModel.TranscriptionsPosition { | ||
return if(!isChatEnabled) | ||
MeetingViewModel.TranscriptionsPosition.BOTTOM | ||
else if(isScreenShare) | ||
MeetingViewModel.TranscriptionsPosition.SCREENSHARE_TOP | ||
else | ||
MeetingViewModel.TranscriptionsPosition.TOP | ||
// Log.d(TAG, "recalculate $r") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
room-kit/src/main/java/live/hms/roomkit/ui/meeting/participants/LoadAfterJoin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package live.hms.roomkit.ui.meeting.participants | ||
|
||
import androidx.lifecycle.LifecycleOwner | ||
import live.hms.roomkit.ui.meeting.MeetingViewModel | ||
|
||
/** | ||
* Many fragments need to load data out of the MeetingViewModel or the ChatViewModel when the view | ||
* is created. However, if they do this just in onViewCreated, then if the app is destroyed by | ||
* going in the background, they won't wait until the app has joined the room to load this data. | ||
* Which means they will crash at some point. | ||
* Everything covered in this class has been tested by | ||
* 1. Turning on kill `background activities` | ||
* 2. Leave the app, so it's in the background and open it again. | ||
* | ||
* Fragments particularly must have empty constructors only. | ||
* This can be resolved by: | ||
* 1. For methods, make them lateinit and apply them after the fragment is created. | ||
* 2. For data, pass it in an argument. | ||
*/ | ||
class LoadAfterJoin(meetingViewModel: MeetingViewModel, viewLifecycleOwner: LifecycleOwner, afterJoin: () -> Unit ) { | ||
private var inited = false | ||
init { | ||
meetingViewModel.joined.observe(viewLifecycleOwner) { joined -> | ||
if(!inited && joined) { | ||
inited = true | ||
afterJoin() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.