Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into deprecated_pager
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/authentication/login/LoginScreen.kt
#	app/src/main/kotlin/com/wire/android/ui/authentication/welcome/WelcomeScreen.kt
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/details/GroupConversationDetailsScreen.kt
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/messagedetails/MessageDetailsScreen.kt
#	app/src/main/kotlin/com/wire/android/ui/home/conversations/search/SearchPeopleRouter.kt
#	app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaScreen.kt
#	app/src/main/kotlin/com/wire/android/ui/userprofile/other/OtherUserProfileScreen.kt
  • Loading branch information
ohassine committed Aug 3, 2023
2 parents 5cbdc6f + 64a9ff5 commit ceadb61
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ data class AudioState(
val DEFAULT = AudioState(AudioMediaPlayingState.Stopped, 0, TotalTimeInMs.NotKnown)
}

// before the user decides to play audio message, we are not able to determine total time ourself using
// MediaPlayer API, we are relying on the info retrieved from the other client, until then
fun sanitizeTotalTime(otherClientTotalTime: Int): AudioState {
if (totalTimeInMs is TotalTimeInMs.NotKnown) {
if (otherClientTotalTime != 0) {
return copy(totalTimeInMs = TotalTimeInMs.Known(otherClientTotalTime))
}
// if the back-end returned the total time, we use that, in case it didn't we use what we get from
// the [ConversationAudioMessagePlayer.kt] which will emit the time once the users play the audio.
fun sanitizeTotalTime(otherClientTotalTime: Int): TotalTimeInMs {
if (otherClientTotalTime != 0) {
return TotalTimeInMs.Known(otherClientTotalTime)
}

return this
return totalTimeInMs
}

sealed class TotalTimeInMs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.wire.android.media.audiomessage

import android.content.Context
import android.media.MediaPlayer
import android.media.MediaPlayer.SEEK_CLOSEST_SYNC
import android.net.Uri
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.feature.asset.GetMessageAssetUseCase
Expand Down Expand Up @@ -110,7 +111,9 @@ class ConversationAudioMessagePlayer
audioMessageStateHistory = audioMessageStateHistory.toMutableMap().apply {
put(
audioMessageStateUpdate.messageId,
currentState.copy(totalTimeInMs = AudioState.TotalTimeInMs.Known(audioMessageStateUpdate.totalTimeInMs))
currentState.copy(
totalTimeInMs = AudioState.TotalTimeInMs.Known(audioMessageStateUpdate.totalTimeInMs)
)
)
}
}
Expand Down Expand Up @@ -241,7 +244,7 @@ class ConversationAudioMessagePlayer
val isAudioMessageCurrentlyPlaying = currentAudioMessageId == messageId

if (isAudioMessageCurrentlyPlaying) {
audioMediaPlayer.seekTo(position)
audioMediaPlayer.seekTo(position.toLong(), SEEK_CLOSEST_SYNC)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,14 @@ private fun MessageContent(
val audioMessageState: AudioState = audioMessagesState[message.header.messageId]
?: AudioState.DEFAULT

val adjustedMessageState: AudioState = remember(audioMessagesState) {
val totalTimeInMs = remember(audioMessageState.totalTimeInMs) {
audioMessageState.sanitizeTotalTime(messageContent.audioMessageDurationInMs.toInt())
}

AudioMessage(
audioMediaPlayingState = adjustedMessageState.audioMediaPlayingState,
totalTimeInMs = adjustedMessageState.totalTimeInMs,
currentPositionInMs = adjustedMessageState.currentPositionInMs,
audioMediaPlayingState = audioMessageState.audioMediaPlayingState,
totalTimeInMs = totalTimeInMs,
currentPositionInMs = audioMessageState.currentPositionInMs,
onPlayButtonClick = { onAudioClick(message.header.messageId) },
onSliderPositionChange = { position ->
onChangeAudioPosition(message.header.messageId, position.toInt())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ fun GroupConversationDetailsScreen(
participant.isSelf -> navigator.navigate(NavigationCommand(SelfUserProfileScreenDestination))
participant.isService && participant.botService != null ->
navigator.navigate(NavigationCommand(ServiceDetailsScreenDestination(participant.botService, viewModel.conversationId)))

else -> navigator.navigate(NavigationCommand(OtherUserProfileScreenDestination(participant.id, viewModel.conversationId)))
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import org.commonmark.node.Link
import org.commonmark.node.Node
import org.commonmark.node.OrderedList
import org.commonmark.node.Paragraph
import org.commonmark.node.SoftLineBreak
import org.commonmark.node.StrongEmphasis
import org.commonmark.node.Text
import org.commonmark.node.ThematicBreak
Expand Down Expand Up @@ -158,9 +159,8 @@ fun inlineChildren(
annotatedString.pop()
}

is HardLineBreak -> {
is HardLineBreak, is SoftLineBreak -> {
annotatedString.append("\n")
annotatedString.pop()
}

is Link -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ fun Resources.annotatedText(
else -> {
pushStyle(style = toSpanStyle(normalStyle, useErrorColorIfApplies(isErrorString, errorColor, normalColor)))
append(piece)
pop()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion kalium
Submodule kalium updated 77 files
+87 βˆ’84 .github/workflows/gradle-android-tests.yml
+4 βˆ’2 .github/workflows/gradle-ios-tests.yml
+4 βˆ’6 .github/workflows/gradle-jvm-tests.yml
+2 βˆ’2 detekt/baseline.xml
+5 βˆ’0 logic/src/androidInstrumentedTest/kotlin/com/wire/kalium/logic/feature/call/CallManagerTest.kt
+4 βˆ’0 logic/src/appleMain/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt
+2 βˆ’0 logic/src/appleMain/kotlin/com/wire/kalium/logic/feature/call/GlobalCallManager.kt
+13 βˆ’3 logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/CallManagerImpl.kt
+4 βˆ’1 logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/GlobalCallManager.kt
+3 βˆ’41 logic/src/commonJvmAndroid/kotlin/com/wire/kalium/logic/feature/call/scenario/OnClientsRequest.kt
+1 βˆ’3 logic/src/commonMain/kotlin/com/wire/kalium/logic/CoreFailure.kt
+1 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/connection/ConnectionRepository.kt
+14 βˆ’0 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/conversation/ConversationRepository.kt
+15 βˆ’4 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt
+1 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/asset/GetAvatarAssetUseCase.kt
+1 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/asset/GetMessageAssetUseCase.kt
+1 βˆ’0 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/call/CallManager.kt
+4 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/call/CallsScope.kt
+2 βˆ’0 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/call/GlobalCallManager.kt
+74 βˆ’0 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/call/usecase/ConversationClientsInCallUpdater.kt
+3 βˆ’1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/call/usecase/EndCallOnConversationChangeUseCase.kt
+1 βˆ’2 .../commonMain/kotlin/com/wire/kalium/logic/sync/receiver/conversation/ConversationMessageTimerEventHandler.kt
+5 βˆ’5 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/connection/ConnectionRepositoryTest.kt
+31 βˆ’0 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/conversation/ConversationRepositoryTest.kt
+4 βˆ’5 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/AnswerCallUseCaseTest.kt
+103 βˆ’0 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/ConversationClientsInCallUpdaterTest.kt
+10 βˆ’1 .../src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/EndCallOnConversationChangeUseCaseTest.kt
+4 βˆ’5 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/EndCallUseCaseTest.kt
+2 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/FlipToBackCameraUseCaseTest.kt
+2 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/FlipToFrontCameraUseCaseTest.kt
+3 βˆ’3 ...ommonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/GetAllCallsWithSortedParticipantsUseCaseTest.kt
+0 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/GetIncomingCallsUseCaseTest.kt
+0 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/IsCallRunningUseCaseTest.kt
+4 βˆ’3 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/MuteCallUseCaseTest.kt
+1 βˆ’7 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/ObserveOngoingCallsUseCaseTest.kt
+3 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/RejectCallUseCaseTest.kt
+2 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/StartCallUseCaseTest.kt
+4 βˆ’3 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/UnMuteCallUseCaseTest.kt
+4 βˆ’2 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/call/usecase/UpdateVideoStateUseCaseTest.kt
+16 βˆ’1 ...monTest/kotlin/com/wire/kalium/logic/sync/receiver/conversation/ConversationMessageTimerEventHandlerTest.kt
+11 βˆ’0 monkeys/README.md
+24 βˆ’66 monkeys/build.gradle.kts
+171 βˆ’0 monkeys/example.json
+388 βˆ’0 monkeys/schema.json
+0 βˆ’43 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/DefaultConversationCreation.kt
+0 βˆ’180 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/DefaultSetup.kt
+0 βˆ’30 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/Monkey.kt
+0 βˆ’32 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/SimpleTestSequence.kt
+0 βˆ’71 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/TestSequence.kt
+0 βˆ’67 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/command/BananaPerGroupCommand.kt
+0 βˆ’24 monkeys/src/commonMain/kotlin/com/wire/kalium/monkeys/importer/TestDataImporter.kt
+0 βˆ’25 monkeys/src/darwinMain/kotlin/com/wire/kalium/monkeys/homeDirectory.kt
+0 βˆ’21 monkeys/src/darwinMain/kotlin/main.kt
+57 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/ActionScheduler.kt
+23 βˆ’23 monkeys/src/main/kotlin/com/wire/kalium/monkeys/MonkeyApplication.kt
+14 βˆ’3 monkeys/src/main/kotlin/com/wire/kalium/monkeys/MonkeyLogger.kt
+41 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/Action.kt
+28 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/AddUserToConversationAction.kt
+28 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/CreateConversationAction.kt
+28 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/DestroyConversationAction.kt
+28 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/LeaveConversationAction.kt
+7 βˆ’4 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/LoginAction.kt
+8 βˆ’7 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/ReconnectAction.kt
+8 βˆ’4 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/SendMessageAction.kt
+28 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/actions/SendRequestAction.kt
+205 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/conversation/Monkey.kt
+52 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/conversation/MonkeyConversation.kt
+1 βˆ’1 monkeys/src/main/kotlin/com/wire/kalium/monkeys/fileLogger.kt
+2 βˆ’2 monkeys/src/main/kotlin/com/wire/kalium/monkeys/homeDirectory.kt
+38 βˆ’13 monkeys/src/main/kotlin/com/wire/kalium/monkeys/importer/TestData.kt
+12 βˆ’11 monkeys/src/main/kotlin/com/wire/kalium/monkeys/importer/TestDataImporter.kt
+1 βˆ’1 monkeys/src/main/kotlin/com/wire/kalium/monkeys/importer/UserData.kt
+0 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/main.kt
+56 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/pool/ConversationPool.kt
+97 βˆ’0 monkeys/src/main/kotlin/com/wire/kalium/monkeys/pool/MonkeyPool.kt
+0 βˆ’75 monkeys/users.json
+6 βˆ’7 ...k/src/commonMain/kotlin/com/wire/kalium/network/api/base/authenticated/conversation/ConversationResponse.kt

0 comments on commit ceadb61

Please sign in to comment.