Skip to content

Commit

Permalink
Merge branch 'develop' into chore/gh-acceptance-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored May 16, 2024
2 parents f47751e + 0cd5009 commit 58584de
Show file tree
Hide file tree
Showing 25 changed files with 495 additions and 380 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class GlobalDataStore @Inject constructor(@ApplicationContext private val contex

val APP_THEME_OPTION = stringPreferencesKey("app_theme_option")
val RECORD_AUDIO_EFFECTS_CHECKBOX = booleanPreferencesKey("record_audio_effects_checkbox")
val ANONYMOUS_USAGE_DATA_STATUS = booleanPreferencesKey("anonymous_usage_data_status")

private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = PREFERENCES_NAME)

Expand Down Expand Up @@ -104,6 +105,13 @@ class GlobalDataStore @Inject constructor(@ApplicationContext private val contex
context.dataStore.edit { it[RECORD_AUDIO_EFFECTS_CHECKBOX] = enabled }
}

fun isAnonymousUsageDataEnabled(): Flow<Boolean> =
getBooleanPreference(ANONYMOUS_USAGE_DATA_STATUS, true)

suspend fun setAnonymousUsageDataEnabled(enabled: Boolean) {
context.dataStore.edit { it[ANONYMOUS_USAGE_DATA_STATUS] = enabled }
}

fun isEncryptedProteusStorageEnabled(): Flow<Boolean> =
getBooleanPreference(
IS_ENCRYPTED_PROTEUS_STORAGE_ENABLED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,40 @@

package com.wire.android.ui.calling.controlbuttons

import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import com.wire.android.R
import com.wire.android.ui.common.button.WirePrimaryButton
import com.wire.android.ui.common.button.wirePrimaryButtonColors
import com.wire.android.ui.common.colorsScheme
import com.wire.android.ui.common.button.WireButtonState
import com.wire.android.ui.common.button.WirePrimaryIconButton
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.ui.PreviewMultipleThemes

@Composable
fun AcceptButton(
modifier: Modifier = Modifier.size(dimensions().outgoingCallHangUpButtonSize),
buttonClicked: () -> Unit
buttonClicked: () -> Unit,
modifier: Modifier = Modifier,
size: Dp = dimensions().bigCallingControlsSize,
iconSize: Dp = dimensions().bigCallingAcceptButtonIconSize,
) {
WirePrimaryButton(
WirePrimaryIconButton(
iconResource = R.drawable.ic_call_accept,
contentDescription = R.string.content_description_calling_accept_call,
state = WireButtonState.Positive,
shape = CircleShape,
minSize = DpSize(size, size),
minClickableSize = DpSize(size, size),
iconSize = iconSize,
onButtonClicked = buttonClicked,
modifier = modifier,
colors = wirePrimaryButtonColors().copy(enabled = colorsScheme().callingAnswerButtonColor),
onClick = buttonClicked,
leadingIcon = {
Icon(
painter = painterResource(id = R.drawable.ic_call_accept),
contentDescription = stringResource(id = R.string.content_description_calling_accept_call),
tint = colorsScheme().onCallingAnswerButtonColor
)
}
)
}

@PreviewMultipleThemes
@Composable
fun PreviewAcceptButton() = WireTheme {
AcceptButton(buttonClicked = { })
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,24 @@

package com.wire.android.ui.calling.controlbuttons

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.ripple
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import com.wire.android.R
import com.wire.android.appLogger
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.permission.PermissionDenialType
import com.wire.android.util.permission.rememberCallingCameraRequestFlow
import com.wire.android.util.ui.PreviewMultipleThemes

@Composable
fun CameraButton(
modifier: Modifier = Modifier.size(dimensions().defaultCallingControlsSize),
isCameraOn: Boolean = false,
onCameraButtonClicked: () -> Unit,
onPermissionPermanentlyDenied: (type: PermissionDenialType) -> Unit
onPermissionPermanentlyDenied: (type: PermissionDenialType) -> Unit,
size: Dp = dimensions().defaultCallingControlsSize,
modifier: Modifier = Modifier,
) {
val cameraPermissionCheck = CameraPermissionCheckFlow(
onPermissionGranted = onCameraButtonClicked,
Expand All @@ -55,34 +48,18 @@ fun CameraButton(

WireCallControlButton(
isSelected = isCameraOn,
modifier = modifier
) { iconColor ->
Icon(
modifier = Modifier
.wrapContentSize()
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(
bounded = false,
radius = dimensions().defaultCallingControlsSize / 2
),
role = Role.Button,
onClick = cameraPermissionCheck::launch,
),
painter = painterResource(
id = if (isCameraOn) {
R.drawable.ic_camera_on
} else {
R.drawable.ic_camera_off
}
),
contentDescription = stringResource(
id = if (isCameraOn) R.string.content_description_calling_turn_camera_off
else R.string.content_description_calling_turn_camera_on
),
tint = iconColor
)
}
iconResId = when (isCameraOn) {
true -> R.drawable.ic_camera_on
false -> R.drawable.ic_camera_off
},
contentDescription = when (isCameraOn) {
true -> R.string.content_description_calling_turn_camera_off
false -> R.string.content_description_calling_turn_camera_on
},
onClick = cameraPermissionCheck::launch,
size = size,
modifier = modifier,
)
}

@Composable
Expand All @@ -98,8 +75,14 @@ private fun CameraPermissionCheckFlow(
onPermissionPermanentlyDenied = onPermanentPermissionDecline
)

@Preview
@PreviewMultipleThemes
@Composable
fun PreviewComposableCameraButtonOn() = WireTheme {
CameraButton(isCameraOn = true, onCameraButtonClicked = { }, onPermissionPermanentlyDenied = { })
}

@PreviewMultipleThemes
@Composable
fun PreviewComposableCameraButton() {
CameraButton(onCameraButtonClicked = { }, onPermissionPermanentlyDenied = { })
fun PreviewComposableCameraButtonOff() = WireTheme {
CameraButton(isCameraOn = false, onCameraButtonClicked = { }, onPermissionPermanentlyDenied = { })
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,45 @@

package com.wire.android.ui.calling.controlbuttons

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.ripple
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import com.wire.android.R
import com.wire.android.ui.common.dimensions
import com.wire.android.ui.theme.WireTheme
import com.wire.android.util.ui.PreviewMultipleThemes

@Composable
fun CameraFlipButton(
isOnFrontCamera: Boolean = false,
onCameraFlipButtonClicked: () -> Unit
onCameraFlipButtonClicked: () -> Unit,
size: Dp = dimensions().defaultCallingControlsSize,
modifier: Modifier = Modifier,
) {
WireCallControlButton(
isSelected = !isOnFrontCamera
) { iconColor ->
Icon(
modifier = Modifier
.wrapContentSize()
.clickable(
interactionSource = remember { MutableInteractionSource() },
indication = ripple(bounded = false, radius = dimensions().defaultCallingControlsSize / 2),
role = Role.Button,
onClick = onCameraFlipButtonClicked
isSelected = !isOnFrontCamera,
iconResId = when (isOnFrontCamera) {
true -> R.drawable.ic_camera_flipped
false -> R.drawable.ic_camera_flip
},
contentDescription = when (isOnFrontCamera) {
true -> R.string.content_description_calling_flip_camera_on
false -> R.string.content_description_calling_flip_camera_off
},
onClick = onCameraFlipButtonClicked,
size = size,
modifier = modifier,
)
}

),
painter = painterResource(
id = if (isOnFrontCamera) {
R.drawable.ic_camera_flipped
} else {
R.drawable.ic_camera_flip
}
),
tint = iconColor,
contentDescription = stringResource(
id = if (isOnFrontCamera) R.string.content_description_calling_flip_camera_on
else R.string.content_description_calling_flip_camera_off
)
)
}
@PreviewMultipleThemes
@Composable
fun PreviewCameraFlipButtonOn() = WireTheme {
CameraFlipButton(isOnFrontCamera = true, onCameraFlipButtonClicked = { })
}

@Preview
@PreviewMultipleThemes
@Composable
fun PreviewCameraFlipButton() {
CameraFlipButton(onCameraFlipButtonClicked = { })
fun PreviewCameraFlipButtonOff() = WireTheme {
CameraFlipButton(isOnFrontCamera = false, onCameraFlipButtonClicked = { })
}

This file was deleted.

Loading

0 comments on commit 58584de

Please sign in to comment.