Skip to content

Commit

Permalink
Merge branch 'feat/audio_messages_play_in_background' into feat/audio…
Browse files Browse the repository at this point in the history
…_messages_play_in_background_part_2
  • Loading branch information
borichellow committed Jan 15, 2025
2 parents 3f8343f + 4148493 commit 0a2252e
Show file tree
Hide file tree
Showing 66 changed files with 1,203 additions and 404 deletions.
8 changes: 4 additions & 4 deletions .github/actions/deploy-to-s3/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ runs:
aws-bucket: ${{ inputs.aws-bucket }}
destination-dir: "megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/PR-${{ github.event.pull_request.number }}/"
file-path: ${{ steps.path.outputs.apk_full_path }}
output-file-url: 'true'
public: true
output-file-url: 'false'
public: false
- name: Upload to S3 from branch
if: github.event.pull_request.number == ''
id: upload-from-branch
Expand All @@ -53,8 +53,8 @@ runs:
aws-bucket: ${{ inputs.aws-bucket }}
destination-dir: "megazord/android/reloaded/${{ inputs.build-flavour }}/${{ inputs.build-variant }}/"
file-path: ${{ steps.path.outputs.apk_full_path }}
output-file-url: 'true'
public: true
output-file-url: 'false'
public: false
- name: Show URL
if: github.event.pull_request.number != ''
shell: bash
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,12 @@ class UseCaseModule {
fun provideMigrateFromPersonalToTeamUseCase(
@KaliumCoreLogic coreLogic: CoreLogic,
@CurrentAccount currentAccount: UserId
) =
coreLogic.getSessionScope(currentAccount).migrateFromPersonalToTeam
) = coreLogic.getSessionScope(currentAccount).migrateFromPersonalToTeam

@ViewModelScoped
@Provides
fun provideGetTeamUrlUseCase(
@KaliumCoreLogic coreLogic: CoreLogic,
@CurrentAccount currentAccount: UserId
) = coreLogic.getSessionScope(currentAccount).getTeamUrlUseCase
}
4 changes: 4 additions & 0 deletions app/src/main/kotlin/com/wire/android/di/ViewModelScoped.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ interface ScopedArgs {
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class ViewModelScopedPreview

interface AssistedViewModelFactory<VM : ViewModel, R : ScopedArgs> {
fun create(args: R): VM
}
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,9 @@ class ConversationModule {
@Provides
fun provideObserveUserFoldersUseCase(conversationScope: ConversationScope) =
conversationScope.observeUserFolders

@ViewModelScoped
@Provides
fun provideMoveConversationToFolderUseCase(conversationScope: ConversationScope) =
conversationScope.moveConversationToFolder
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import com.wire.kalium.logic.feature.personaltoteamaccount.CanMigrateFromPersona
import com.wire.kalium.logic.feature.publicuser.GetAllContactsUseCase
import com.wire.kalium.logic.feature.publicuser.GetKnownUserUseCase
import com.wire.kalium.logic.feature.publicuser.RefreshUsersWithoutMetadataUseCase
import com.wire.kalium.logic.feature.server.GetTeamUrlUseCase
import com.wire.kalium.logic.feature.user.DeleteAccountUseCase
import com.wire.kalium.logic.feature.user.GetSelfUserUseCase
import com.wire.kalium.logic.feature.user.GetUserInfoUseCase
Expand Down Expand Up @@ -192,11 +191,6 @@ class UserModule {
fun provideGetSelfUseCase(userScope: UserScope): GetSelfUserUseCase =
userScope.getSelfUser

@ViewModelScoped
@Provides
fun provideGetTeamUrlUseCase(userScope: UserScope): GetTeamUrlUseCase =
userScope.getTeamUrl

@ViewModelScoped
@Provides
fun provideGetAvatarAssetUseCase(userScope: UserScope): GetAvatarAssetUseCase =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
hasNewActivitiesToShow = hasNewActivitiesToShow,
searchQuery = searchQuery,
isFavorite = conversationDetails.isFavorite,
folder = conversationDetails.folder,
playingAudio = getPlayingAudioInConversation(playingAudioMessage, conversationDetails)
)
}
Expand Down Expand Up @@ -110,6 +111,7 @@ fun ConversationDetailsWithEvents.toConversationItem(
hasNewActivitiesToShow = hasNewActivitiesToShow,
searchQuery = searchQuery,
isFavorite = conversationDetails.isFavorite,
folder = conversationDetails.folder,
playingAudio = getPlayingAudioInConversation(playingAudioMessage, conversationDetails)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package com.wire.android.navigation
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.hilt.navigation.compose.hiltViewModel
import com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi
import com.ramcosta.composedestinations.DestinationsNavHost
Expand All @@ -44,6 +45,7 @@ import com.wire.android.ui.home.newconversation.NewConversationViewModel
fun MainNavHost(
navigator: Navigator,
startDestination: Route,
modifier: Modifier = Modifier,
) {
val navHostEngine = rememberAnimatedNavHostEngine(
rootDefaultAnimations = DefaultRootNavGraphAnimations,
Expand All @@ -55,6 +57,7 @@ fun MainNavHost(
)

DestinationsNavHost(
modifier = modifier,
navGraph = WireMainNavGraph,
engine = navHostEngine,
startRoute = startDestination,
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ package com.wire.android.ui

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.biometric.BiometricManager
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.remember
import androidx.core.view.WindowCompat
import com.wire.android.appLogger
import com.wire.android.navigation.MainNavHost
import com.wire.android.navigation.rememberNavigator
Expand All @@ -39,7 +39,7 @@ import dagger.hilt.android.AndroidEntryPoint
class AppLockActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge()
setContent {
val snackbarHostState = remember { SnackbarHostState() }
CompositionLocalProvider(
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ import android.os.Bundle
import android.view.WindowManager
import android.widget.Toast
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.statusBars
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand All @@ -47,7 +50,6 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -163,7 +165,7 @@ class WireActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
splashScreen.setKeepOnScreenCondition { shouldKeepSplashOpen }

WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge()

lifecycleScope.launch {

Expand Down Expand Up @@ -232,18 +234,17 @@ class WireActivity : AppCompatActivity() {
WireTheme {
Column(
modifier = Modifier
.statusBarsPadding()
.semantics { testTagsAsResourceId = true }
) {
val navigator = rememberNavigator(this@WireActivity::finish)
WireTopAppBar(
themeOption = viewModel.globalAppState.themeOption,
commonTopAppBarState = commonTopAppBarViewModel.state,
)
CompositionLocalProvider(LocalNavigator provides navigator) {
MainNavHost(
navigator = navigator,
startDestination = startDestination
startDestination = startDestination,
modifier = Modifier.consumeWindowInsets(WindowInsets.statusBars)
)
}

Expand All @@ -260,11 +261,11 @@ class WireActivity : AppCompatActivity() {

@Composable
private fun WireTopAppBar(
themeOption: ThemeOption,
commonTopAppBarState: CommonTopAppBarState
commonTopAppBarState: CommonTopAppBarState,
modifier: Modifier = Modifier,
) {
CommonTopAppBar(
themeOption = themeOption,
modifier = modifier,
commonTopAppBarState = commonTopAppBarState,
onReturnToCallClick = { establishedCall ->
getOngoingCallIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.togetherWith
import androidx.compose.material3.SnackbarHostState
Expand All @@ -33,7 +34,6 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.core.view.WindowCompat
import com.wire.android.appLogger
import com.wire.android.navigation.style.TransitionAnimationType
import com.wire.android.ui.LocalActivity
Expand Down Expand Up @@ -87,7 +87,7 @@ class StartingCallActivity : CallActivity() {
setUpScreenshotPreventionFlag()
setUpCallingFlags()

WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge()

handleNewIntent(intent)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import android.graphics.drawable.Icon
import android.os.Bundle
import android.util.Rational
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.togetherWith
import androidx.compose.material3.SnackbarHostState
Expand All @@ -38,7 +39,6 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.core.view.WindowCompat
import com.wire.android.R
import com.wire.android.appLogger
import com.wire.android.navigation.style.TransitionAnimationType
Expand Down Expand Up @@ -90,7 +90,7 @@ class OngoingCallActivity : CallActivity() {
setUpScreenshotPreventionFlag()
setUpCallingFlags()

WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge()

handleNewIntent(intent)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ fun SelectableMenuBottomSheetItem(
.wrapContentHeight()
.wrapContentWidth()
.defaultMinSize(minHeight = dimensions().spacing48x)
.let { if (isSelectedItem(state)) it.background(MaterialTheme.wireColorScheme.secondaryButtonSelected) else it }
.background(
if (isSelectedItem(state)) {
MaterialTheme.wireColorScheme.secondaryButtonSelected
} else {
MaterialTheme.wireColorScheme.surface
}
)
.clickable(onItemClick)
.semantics { if (isSelectedItem(state)) selected = true }
.padding(vertical = dimensions().spacing12x, horizontal = dimensions().spacing16x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ import com.wire.android.R
import com.wire.android.model.ImageAsset.UserAvatarAsset
import com.wire.android.ui.common.dialogs.BlockUserDialogState
import com.wire.android.ui.common.dialogs.UnblockUserDialogState
import com.wire.android.ui.home.conversations.folder.ConversationFoldersNavArgs
import com.wire.android.ui.home.conversationslist.model.BlockingState
import com.wire.android.ui.home.conversationslist.model.DialogState
import com.wire.android.ui.home.conversationslist.model.GroupDialogState
import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.data.conversation.ConversationFolder
import com.wire.kalium.logic.data.conversation.MutedConversationStatus
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.user.UserId
Expand All @@ -38,7 +40,7 @@ fun ConversationSheetContent(
conversationSheetState: ConversationSheetState,
onMutingConversationStatusChange: () -> Unit,
changeFavoriteState: (GroupDialogState, addToFavorite: Boolean) -> Unit,
moveConversationToFolder: () -> Unit,
moveConversationToFolder: ((ConversationFoldersNavArgs) -> Unit)?,
updateConversationArchiveStatus: (DialogState) -> Unit,
clearConversationContent: (DialogState) -> Unit,
blockUser: (BlockUserDialogState) -> Unit,
Expand All @@ -56,8 +58,7 @@ fun ConversationSheetContent(
ConversationMainSheetContent(
conversationSheetContent = conversationSheetState.conversationSheetContent!!,
changeFavoriteState = changeFavoriteState,
// TODO(profile): enable when implemented
// moveConversationToFolder = moveConversationToFolder,
moveConversationToFolder = moveConversationToFolder,
updateConversationArchiveStatus = updateConversationArchiveStatus,
clearConversationContent = clearConversationContent,
blockUserClick = blockUser,
Expand Down Expand Up @@ -128,6 +129,7 @@ data class ConversationSheetContent(
val proteusVerificationStatus: Conversation.VerificationStatus,
val isUnderLegalHold: Boolean,
val isFavorite: Boolean?,
val folder: ConversationFolder?,
val isDeletingConversationLocallyRunning: Boolean
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ fun rememberConversationSheetState(
proteusVerificationStatus = Conversation.VerificationStatus.VERIFIED,
isUnderLegalHold = showLegalHoldIndicator,
isFavorite = isFavorite,
folder = folder,
isDeletingConversationLocallyRunning = isConversationDeletionLocallyRunning
)
}
Expand Down Expand Up @@ -108,6 +109,7 @@ fun rememberConversationSheetState(
proteusVerificationStatus = Conversation.VerificationStatus.VERIFIED,
isUnderLegalHold = showLegalHoldIndicator,
isFavorite = isFavorite,
folder = folder,
isDeletingConversationLocallyRunning = false
)
}
Expand All @@ -130,6 +132,7 @@ fun rememberConversationSheetState(
proteusVerificationStatus = Conversation.VerificationStatus.VERIFIED,
isUnderLegalHold = showLegalHoldIndicator,
isFavorite = null,
folder = null,
isDeletingConversationLocallyRunning = false
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import com.wire.android.ui.common.conversationColor
import com.wire.android.ui.common.dialogs.BlockUserDialogState
import com.wire.android.ui.common.dialogs.UnblockUserDialogState
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.home.conversations.folder.ConversationFoldersNavArgs
import com.wire.android.ui.home.conversationslist.common.GroupConversationAvatar
import com.wire.android.ui.home.conversationslist.model.BlockingState
import com.wire.android.ui.home.conversationslist.model.DialogState
Expand All @@ -59,8 +60,7 @@ import com.wire.kalium.logic.data.user.ConnectionState
internal fun ConversationMainSheetContent(
conversationSheetContent: ConversationSheetContent,
changeFavoriteState: (dialogState: GroupDialogState, addToFavorite: Boolean) -> Unit,
// TODO(profile): enable when implemented
// moveConversationToFolder: () -> Unit,
moveConversationToFolder: ((ConversationFoldersNavArgs) -> Unit)?,
updateConversationArchiveStatus: (DialogState) -> Unit,
clearConversationContent: (DialogState) -> Unit,
blockUserClick: (BlockUserDialogState) -> Unit,
Expand Down Expand Up @@ -142,19 +142,28 @@ internal fun ConversationMainSheetContent(
}
}
}
// TODO(profile): enable when implemented
// add {
// MenuBottomSheetItem(
// icon = {
// MenuItemIcon(
// id = R.drawable.ic_folder,
// contentDescription = stringResource(R.string.content_description_move_to_folder),
// )
// },
// title = stringResource(R.string.label_move_to_folder),
// onItemClick = moveConversationToFolder
// )
// }
if (moveConversationToFolder != null) {
add {
MenuBottomSheetItem(
leading = {
MenuItemIcon(
id = R.drawable.ic_folder,
contentDescription = null,
)
},
title = stringResource(R.string.label_move_to_folder),
onItemClick = {
moveConversationToFolder(
ConversationFoldersNavArgs(
conversationId = conversationSheetContent.conversationId,
conversationName = conversationSheetContent.title,
currentFolderId = conversationSheetContent.folder?.id
)
)
}
)
}
}
add {
MenuBottomSheetItem(
leading = {
Expand Down
Loading

0 comments on commit 0a2252e

Please sign in to comment.