Merge pull request #935 from vector-im/feature/bma/noWarnings
Code quality: warnings are errors and enable more Detekt rules.
This commit is contained in:
commit
f09996cb30
82 changed files with 170 additions and 229 deletions
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
|
|
@ -42,7 +42,7 @@ jobs:
|
||||||
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
|
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
|
||||||
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
|
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
|
||||||
ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID: ${{ secrets.MAPTILER_DARK_MAP_ID }}
|
ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID: ${{ secrets.MAPTILER_DARK_MAP_ID }}
|
||||||
run: ./gradlew assembleDebug $CI_GRADLE_ARG_PROPERTIES
|
run: ./gradlew assembleDebug -PallWarningsAsErrors=true $CI_GRADLE_ARG_PROPERTIES
|
||||||
- name: Upload debug APKs
|
- name: Upload debug APKs
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
@ -72,8 +72,8 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Compile release sources
|
- name: Compile release sources
|
||||||
run: ./gradlew compileReleaseSources $CI_GRADLE_ARG_PROPERTIES
|
run: ./gradlew compileReleaseSources -PallWarningsAsErrors=true $CI_GRADLE_ARG_PROPERTIES
|
||||||
- name: Compile nightly sources
|
- name: Compile nightly sources
|
||||||
run: ./gradlew compileNightlySources $CI_GRADLE_ARG_PROPERTIES
|
run: ./gradlew compileNightlySources -PallWarningsAsErrors=true $CI_GRADLE_ARG_PROPERTIES
|
||||||
- name: Compile samples minimal
|
- name: Compile samples minimal
|
||||||
run: ./gradlew :samples:minimal:assemble $CI_GRADLE_ARG_PROPERTIES
|
run: ./gradlew :samples:minimal:assemble $CI_GRADLE_ARG_PROPERTIES
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,6 @@ import io.element.android.features.login.api.oidc.OidcAction
|
||||||
import io.element.android.features.login.api.oidc.OidcIntentResolver
|
import io.element.android.features.login.api.oidc.OidcIntentResolver
|
||||||
import io.element.android.libraries.deeplink.DeeplinkData
|
import io.element.android.libraries.deeplink.DeeplinkData
|
||||||
import io.element.android.libraries.deeplink.DeeplinkParser
|
import io.element.android.libraries.deeplink.DeeplinkParser
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
|
||||||
import io.element.android.libraries.matrix.api.core.SessionId
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import io.element.android.features.networkmonitor.api.ui.ConnectivityIndicatorView
|
import io.element.android.features.networkmonitor.api.ui.ConnectivityIndicatorView
|
||||||
import io.element.android.libraries.designsystem.atomic.atoms.PlaceholderAtom
|
import io.element.android.libraries.designsystem.atomic.atoms.PlaceholderAtom
|
||||||
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,14 @@ allprojects {
|
||||||
apply {
|
apply {
|
||||||
plugin("org.owasp.dependencycheck")
|
plugin("org.owasp.dependencycheck")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||||
|
// Warnings are potential errors, so stop ignoring them
|
||||||
|
// This is disabled by default, but the CI will enforce this.
|
||||||
|
// You can override by passing `-PallWarningsAsErrors=true` in the command line
|
||||||
|
// Or add a line with "allWarningsAsErrors=true" in your ~/.gradle/gradle.properties file
|
||||||
|
kotlinOptions.allWarningsAsErrors = project.properties["allWarningsAsErrors"] == "true"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To run a sonar analysis:
|
// To run a sonar analysis:
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.semantics.Role
|
import androidx.compose.ui.semantics.Role
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import io.element.android.features.createroom.impl.configureroom.RoomPrivacyItem
|
import io.element.android.features.createroom.impl.configureroom.RoomPrivacyItem
|
||||||
import io.element.android.features.createroom.impl.configureroom.roomPrivacyItems
|
import io.element.android.features.createroom.impl.configureroom.roomPrivacyItems
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ import io.element.android.features.createroom.impl.userlist.FakeUserListPresente
|
||||||
import io.element.android.features.createroom.impl.userlist.UserListDataStore
|
import io.element.android.features.createroom.impl.userlist.UserListDataStore
|
||||||
import io.element.android.features.createroom.impl.userlist.aUserListState
|
import io.element.android.features.createroom.impl.userlist.aUserListState
|
||||||
import io.element.android.libraries.architecture.Async
|
import io.element.android.libraries.architecture.Async
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
|
||||||
import io.element.android.libraries.core.meta.BuildType
|
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
import io.element.android.libraries.matrix.api.core.UserId
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import io.element.android.services.analytics.api.AnalyticsService
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.SupervisorJob
|
import kotlinx.coroutines.SupervisorJob
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.test.TestScope
|
|
||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ fun Modifier.centerBottomEdge(scope: BoxScope): Modifier = with(scope) {
|
||||||
Modifier.align { size, space, _ ->
|
Modifier.align { size, space, _ ->
|
||||||
IntOffset(
|
IntOffset(
|
||||||
x = (space.width - size.width) / 2,
|
x = (space.width - size.width) / 2,
|
||||||
y = (space.height / 2) - size.height,
|
y = space.height / 2 - size.height,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ data class LoginPasswordState(
|
||||||
) {
|
) {
|
||||||
val submitEnabled: Boolean
|
val submitEnabled: Boolean
|
||||||
get() = loginAction !is Async.Failure &&
|
get() = loginAction !is Async.Failure &&
|
||||||
((formState.login.isNotEmpty() && formState.password.isNotEmpty()))
|
formState.login.isNotEmpty() &&
|
||||||
|
formState.password.isNotEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,11 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontStyle
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import io.element.android.features.messages.impl.actionlist.ActionListEvents
|
import io.element.android.features.messages.impl.actionlist.ActionListEvents
|
||||||
import io.element.android.features.messages.impl.actionlist.ActionListView
|
import io.element.android.features.messages.impl.actionlist.ActionListView
|
||||||
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
|
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import io.element.android.features.messages.impl.timeline.model.event.TimelineIt
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.canBeCopied
|
import io.element.android.features.messages.impl.timeline.model.event.canBeCopied
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
import io.element.android.libraries.core.meta.BuildMeta
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.LocalEventSendState
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ fun ForwardMessagesView(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun onRoomRemoved(roomSummaryDetails: RoomSummaryDetails) {
|
fun onRoomRemoved(roomSummaryDetails: RoomSummaryDetails) {
|
||||||
// TODO toggle selection when multi-selection is enabled
|
// TODO toggle selection when multi-selection is enabled
|
||||||
state.eventSink(ForwardMessagesEvents.RemoveSelectedRoom)
|
state.eventSink(ForwardMessagesEvents.RemoveSelectedRoom)
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ import io.element.android.features.messages.impl.media.local.LocalMediaView
|
||||||
import io.element.android.features.messages.impl.media.local.MediaInfo
|
import io.element.android.features.messages.impl.media.local.MediaInfo
|
||||||
import io.element.android.features.messages.impl.media.local.rememberLocalMediaViewState
|
import io.element.android.features.messages.impl.media.local.rememberLocalMediaViewState
|
||||||
import io.element.android.libraries.architecture.Async
|
import io.element.android.libraries.architecture.Async
|
||||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
|
||||||
import io.element.android.libraries.designsystem.components.button.BackButton
|
import io.element.android.libraries.designsystem.components.button.BackButton
|
||||||
import io.element.android.libraries.designsystem.components.dialogs.RetryDialog
|
import io.element.android.libraries.designsystem.components.dialogs.RetryDialog
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val backPaginationEventLimit = 20
|
private const val BACK_PAGINATION_EVENT_LIMIT = 20
|
||||||
private const val backPaginationPageSize = 50
|
private const val BACK_PAGINATION_PAGE_SIZE = 50
|
||||||
|
|
||||||
class TimelinePresenter @Inject constructor(
|
class TimelinePresenter @Inject constructor(
|
||||||
private val timelineItemsFactory: TimelineItemsFactory,
|
private val timelineItemsFactory: TimelineItemsFactory,
|
||||||
|
|
@ -164,6 +164,6 @@ class TimelinePresenter @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun CoroutineScope.paginateBackwards() = launch {
|
private fun CoroutineScope.paginateBackwards() = launch {
|
||||||
timeline.paginateBackwards(backPaginationEventLimit, backPaginationPageSize)
|
timeline.paginateBackwards(BACK_PAGINATION_EVENT_LIMIT, BACK_PAGINATION_PAGE_SIZE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ fun TimelineView(
|
||||||
|
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun inReplyToClicked(eventId: EventId) {
|
fun inReplyToClicked(eventId: EventId) {
|
||||||
// TODO implement this logic once we have support to 'jump to event X' in sliding sync
|
// TODO implement this logic once we have support to 'jump to event X' in sliding sync
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import com.vanniktech.emoji.Emoji
|
import com.vanniktech.emoji.Emoji
|
||||||
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
|
|
@ -62,7 +61,7 @@ fun EmojiPicker(
|
||||||
val emojiProvider = remember { GoogleEmojiProvider() }
|
val emojiProvider = remember { GoogleEmojiProvider() }
|
||||||
val categories = remember { emojiProvider.categories }
|
val categories = remember { emojiProvider.categories }
|
||||||
val pagerState = rememberPagerState()
|
val pagerState = rememberPagerState()
|
||||||
Column (modifier) {
|
Column(modifier) {
|
||||||
TabRow(
|
TabRow(
|
||||||
selectedTabIndex = pagerState.currentPage,
|
selectedTabIndex = pagerState.currentPage,
|
||||||
) {
|
) {
|
||||||
|
|
@ -109,7 +108,8 @@ fun EmojiPicker(
|
||||||
Text(
|
Text(
|
||||||
text = item.unicode,
|
text = item.unicode,
|
||||||
style = ElementTheme.typography.fontHeadingSmRegular,
|
style = ElementTheme.typography.fontHeadingSmRegular,
|
||||||
) }
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import androidx.compose.ui.graphics.Shape
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import io.element.android.features.messages.impl.timeline.model.TimelineItemGroupPosition
|
import io.element.android.features.messages.impl.timeline.model.TimelineItemGroupPosition
|
||||||
import io.element.android.features.messages.impl.timeline.model.bubble.BubbleState
|
import io.element.android.features.messages.impl.timeline.model.bubble.BubbleState
|
||||||
import io.element.android.features.messages.impl.timeline.model.bubble.BubbleStateProvider
|
import io.element.android.features.messages.impl.timeline.model.bubble.BubbleStateProvider
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||||
import io.element.android.libraries.theme.ElementTheme
|
|
||||||
import io.element.android.libraries.designsystem.theme.components.Surface
|
import io.element.android.libraries.designsystem.theme.components.Surface
|
||||||
|
|
||||||
private val CORNER_RADIUS = 8.dp
|
private val CORNER_RADIUS = 8.dp
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ fun TimelineItem.Event.toExtraPadding(): ExtraPadding {
|
||||||
fun ExtraPadding.getStr(fontSize: TextUnit): String {
|
fun ExtraPadding.getStr(fontSize: TextUnit): String {
|
||||||
if (nbChars == 0) return ""
|
if (nbChars == 0) return ""
|
||||||
val timestampFontSize = ElementTheme.typography.fontBodyXsRegular.fontSize // 11.sp
|
val timestampFontSize = ElementTheme.typography.fontBodyXsRegular.fontSize // 11.sp
|
||||||
val nbOfSpaces = ((timestampFontSize.value / fontSize.value) * nbChars).toInt() + 1
|
val nbOfSpaces = (timestampFontSize.value / fontSize.value * nbChars).toInt() + 1
|
||||||
// A space and some unbreakable spaces
|
// A space and some unbreakable spaces
|
||||||
return " " + "\u00A0".repeat(nbOfSpaces)
|
return " " + "\u00A0".repeat(nbOfSpaces)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemEncryptedView(
|
fun TimelineItemEncryptedView(
|
||||||
content: TimelineItemEncryptedContent,
|
@Suppress("UNUSED_PARAMETER") content: TimelineItemEncryptedContent,
|
||||||
extraPadding: ExtraPadding,
|
extraPadding: ExtraPadding,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemRedactedView(
|
fun TimelineItemRedactedView(
|
||||||
content: TimelineItemRedactedContent,
|
@Suppress("UNUSED_PARAMETER") content: TimelineItemRedactedContent,
|
||||||
extraPadding: ExtraPadding,
|
extraPadding: ExtraPadding,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemUnknownView(
|
fun TimelineItemUnknownView(
|
||||||
content: TimelineItemUnknownContent,
|
@Suppress("UNUSED_PARAMETER") content: TimelineItemUnknownContent,
|
||||||
extraPadding: ExtraPadding,
|
extraPadding: ExtraPadding,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package io.element.android.features.messages.impl.timeline.components.event
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.PlayArrow
|
import androidx.compose.material.icons.filled.PlayArrow
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ import org.jsoup.nodes.Element
|
||||||
import org.jsoup.nodes.Node
|
import org.jsoup.nodes.Node
|
||||||
import org.jsoup.nodes.TextNode
|
import org.jsoup.nodes.TextNode
|
||||||
|
|
||||||
private const val chipId = "chip"
|
private const val CHIP_ID = "chip"
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HtmlDocument(
|
fun HtmlDocument(
|
||||||
|
|
@ -351,7 +351,7 @@ private fun HtmlMxReply(
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.padding(bottom = 4.dp)
|
.padding(bottom = 4.dp)
|
||||||
.offset(x = -(8.dp)),
|
.offset(x = (-8).dp),
|
||||||
color = MaterialTheme.colorScheme.background,
|
color = MaterialTheme.colorScheme.background,
|
||||||
shape = shape,
|
shape = shape,
|
||||||
) {
|
) {
|
||||||
|
|
@ -544,13 +544,13 @@ private fun AnnotatedString.Builder.appendLink(link: Element) {
|
||||||
pop()
|
pop()
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomEmailInviteLink -> {
|
is PermalinkData.RoomEmailInviteLink -> {
|
||||||
appendInlineContent(chipId, link.ownText())
|
appendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
is PermalinkData.RoomLink -> {
|
is PermalinkData.RoomLink -> {
|
||||||
appendInlineContent(chipId, link.ownText())
|
appendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
is PermalinkData.UserLink -> {
|
is PermalinkData.UserLink -> {
|
||||||
appendInlineContent(chipId, link.ownText())
|
appendInlineContent(CHIP_ID, link.ownText())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
@ -165,6 +164,7 @@ internal fun RetrySendMessageMenuPreviewDark(@PreviewParameter(RetrySendMenuStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun ContentToPreview(state: RetrySendMenuState) {
|
private fun ContentToPreview(state: RetrySendMenuState) {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.features.messages.impl.R
|
import io.element.android.features.messages.impl.R
|
||||||
import io.element.android.libraries.designsystem.preview.DayNightPreviews
|
import io.element.android.libraries.designsystem.preview.DayNightPreviews
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class TimelineItemContentFailedToParseMessageFactory @Inject constructor() {
|
class TimelineItemContentFailedToParseMessageFactory @Inject constructor() {
|
||||||
|
|
||||||
fun create(failedToParseMessageLike: FailedToParseMessageLikeContent): TimelineItemEventContent {
|
fun create(@Suppress("UNUSED_PARAMETER") failedToParseMessageLike: FailedToParseMessageLikeContent): TimelineItemEventContent {
|
||||||
return TimelineItemUnknownContent
|
return TimelineItemUnknownContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class TimelineItemContentFailedToParseStateFactory @Inject constructor() {
|
class TimelineItemContentFailedToParseStateFactory @Inject constructor() {
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
fun create(failedToParseState: FailedToParseStateContent): TimelineItemEventContent {
|
fun create(failedToParseState: FailedToParseStateContent): TimelineItemEventContent {
|
||||||
return TimelineItemUnknownContent
|
return TimelineItemUnknownContent
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class TimelineItemContentRedactedFactory @Inject constructor() {
|
class TimelineItemContentRedactedFactory @Inject constructor() {
|
||||||
|
|
||||||
fun create(content: RedactedContent): TimelineItemEventContent {
|
fun create(@Suppress("UNUSED_PARAMETER") content: RedactedContent): TimelineItemEventContent {
|
||||||
return TimelineItemRedactedContent
|
return TimelineItemRedactedContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class TimelineItemContentStickerFactory @Inject constructor() {
|
class TimelineItemContentStickerFactory @Inject constructor() {
|
||||||
|
|
||||||
fun create(content: StickerContent): TimelineItemEventContent {
|
fun create(@Suppress("UNUSED_PARAMETER") content: StickerContent): TimelineItemEventContent {
|
||||||
return TimelineItemUnknownContent
|
return TimelineItemUnknownContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import android.net.Uri
|
||||||
import app.cash.molecule.RecompositionMode
|
import app.cash.molecule.RecompositionMode
|
||||||
import app.cash.molecule.moleculeFlow
|
import app.cash.molecule.moleculeFlow
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import com.google.common.collect.Iterables.skip
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.features.analytics.test.FakeAnalyticsService
|
import io.element.android.features.analytics.test.FakeAnalyticsService
|
||||||
import io.element.android.features.messages.fixtures.aMessageEvent
|
import io.element.android.features.messages.fixtures.aMessageEvent
|
||||||
|
|
@ -46,8 +45,6 @@ import io.element.android.features.messages.utils.messagesummary.FakeMessageSumm
|
||||||
import io.element.android.features.networkmonitor.test.FakeNetworkMonitor
|
import io.element.android.features.networkmonitor.test.FakeNetworkMonitor
|
||||||
import io.element.android.libraries.androidutils.clipboard.FakeClipboardHelper
|
import io.element.android.libraries.androidutils.clipboard.FakeClipboardHelper
|
||||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
|
||||||
import io.element.android.libraries.core.meta.BuildType
|
|
||||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
import io.element.android.libraries.core.mimetype.MimeTypes
|
||||||
import io.element.android.libraries.designsystem.utils.SnackbarDispatcher
|
import io.element.android.libraries.designsystem.utils.SnackbarDispatcher
|
||||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
||||||
|
|
@ -102,7 +99,6 @@ class MessagesPresenterTest {
|
||||||
val initialState = awaitItem()
|
val initialState = awaitItem()
|
||||||
initialState.eventSink.invoke(MessagesEvents.ToggleReaction("👍", AN_EVENT_ID))
|
initialState.eventSink.invoke(MessagesEvents.ToggleReaction("👍", AN_EVENT_ID))
|
||||||
assertThat(room.myReactions.count()).isEqualTo(1)
|
assertThat(room.myReactions.count()).isEqualTo(1)
|
||||||
|
|
||||||
// No crashes when sending a reaction failed
|
// No crashes when sending a reaction failed
|
||||||
room.givenToggleReactionResult(Result.failure(IllegalStateException("Failed to send reaction")))
|
room.givenToggleReactionResult(Result.failure(IllegalStateException("Failed to send reaction")))
|
||||||
initialState.eventSink.invoke(MessagesEvents.ToggleReaction("👍", AN_EVENT_ID))
|
initialState.eventSink.invoke(MessagesEvents.ToggleReaction("👍", AN_EVENT_ID))
|
||||||
|
|
@ -245,7 +241,6 @@ class MessagesPresenterTest {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
initialState.eventSink.invoke(MessagesEvents.HandleAction(TimelineItemAction.Reply, mediaMessage))
|
initialState.eventSink.invoke(MessagesEvents.HandleAction(TimelineItemAction.Reply, mediaMessage))
|
||||||
|
|
||||||
val finalState = awaitItem()
|
val finalState = awaitItem()
|
||||||
assertThat(finalState.composerState.mode).isInstanceOf(MessageComposerMode.Reply::class.java)
|
assertThat(finalState.composerState.mode).isInstanceOf(MessageComposerMode.Reply::class.java)
|
||||||
val replyMode = finalState.composerState.mode as MessageComposerMode.Reply
|
val replyMode = finalState.composerState.mode as MessageComposerMode.Reply
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import io.element.android.features.messages.impl.timeline.model.event.TimelineIt
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemTextContent
|
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemTextContent
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemImageContent
|
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemImageContent
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemStateEventContent
|
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemStateEventContent
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.LocalEventSendState
|
|
||||||
import io.element.android.libraries.matrix.test.A_MESSAGE
|
import io.element.android.libraries.matrix.test.A_MESSAGE
|
||||||
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class AttachmentsPreviewPresenterTest {
|
||||||
val loadingState = awaitItem()
|
val loadingState = awaitItem()
|
||||||
assertThat(loadingState.sendActionState).isEqualTo(SendActionState.Sending.Processing)
|
assertThat(loadingState.sendActionState).isEqualTo(SendActionState.Sending.Processing)
|
||||||
val failureState = awaitItem()
|
val failureState = awaitItem()
|
||||||
assertThat(failureState.sendActionState).isEqualTo((SendActionState.Failure(failure)))
|
assertThat(failureState.sendActionState).isEqualTo(SendActionState.Failure(failure))
|
||||||
assertThat(room.sendMediaCount).isEqualTo(0)
|
assertThat(room.sendMediaCount).isEqualTo(0)
|
||||||
failureState.eventSink(AttachmentsPreviewEvents.ClearSendState)
|
failureState.eventSink(AttachmentsPreviewEvents.ClearSendState)
|
||||||
val clearedState = awaitItem()
|
val clearedState = awaitItem()
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import io.element.android.features.messages.impl.attachments.Attachment
|
||||||
import io.element.android.features.messages.impl.media.local.LocalMedia
|
import io.element.android.features.messages.impl.media.local.LocalMedia
|
||||||
import io.element.android.features.messages.impl.media.local.MediaInfo
|
import io.element.android.features.messages.impl.media.local.MediaInfo
|
||||||
import io.element.android.features.messages.impl.media.local.anImageInfo
|
import io.element.android.features.messages.impl.media.local.anImageInfo
|
||||||
import io.element.android.libraries.core.mimetype.MimeTypes
|
|
||||||
|
|
||||||
fun aLocalMedia(
|
fun aLocalMedia(
|
||||||
uri: Uri,
|
uri: Uri,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,17 @@ package io.element.android.features.preferences.impl.about
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
private const val CopyrightUrl = "https://element.io/copyright"
|
private const val COPYRIGHT_URL = "https://element.io/copyright"
|
||||||
private const val UsePolicyUrl = "https://element.io/acceptable-use-policy-terms"
|
private const val USE_POLICY_URL = "https://element.io/acceptable-use-policy-terms"
|
||||||
private const val PrivacyUrl = "https://element.io/privacy"
|
private const val PRIVACY_URL = "https://element.io/privacy"
|
||||||
|
|
||||||
sealed class ElementLegal(
|
sealed class ElementLegal(
|
||||||
@StringRes val titleRes: Int,
|
@StringRes val titleRes: Int,
|
||||||
val url: String,
|
val url: String,
|
||||||
) {
|
) {
|
||||||
object Copyright : ElementLegal(CommonStrings.common_copyright, CopyrightUrl)
|
object Copyright : ElementLegal(CommonStrings.common_copyright, COPYRIGHT_URL)
|
||||||
object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, UsePolicyUrl)
|
object AcceptableUsePolicy : ElementLegal(CommonStrings.common_acceptable_use_policy, USE_POLICY_URL)
|
||||||
object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PrivacyUrl)
|
object PrivacyPolicy : ElementLegal(CommonStrings.common_privacy_policy, PRIVACY_URL)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAllLegals(): List<ElementLegal> {
|
fun getAllLegals(): List<ElementLegal> {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package io.element.android.features.rageshake.api.detection
|
package io.element.android.features.rageshake.api.detection
|
||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.Stable
|
|
||||||
import io.element.android.features.rageshake.api.preferences.RageshakePreferencesState
|
import io.element.android.features.rageshake.api.preferences.RageshakePreferencesState
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class VectorFileLogger(
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val SIZE_20MB = 20 * 1024 * 1024
|
private const val SIZE_20MB = 20 * 1024 * 1024
|
||||||
private const val SIZE_50MB = 50 * 1024 * 1024
|
// private const val SIZE_50MB = 50 * 1024 * 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class DefaultBugReporter @Inject constructor(
|
||||||
// filenames
|
// filenames
|
||||||
private const val LOG_CAT_ERROR_FILENAME = "logcatError.log"
|
private const val LOG_CAT_ERROR_FILENAME = "logcatError.log"
|
||||||
private const val LOG_CAT_FILENAME = "logcat.log"
|
private const val LOG_CAT_FILENAME = "logcat.log"
|
||||||
private const val KEY_REQUESTS_FILENAME = "keyRequests.log"
|
// private const val KEY_REQUESTS_FILENAME = "keyRequests.log"
|
||||||
|
|
||||||
private const val BUFFER_SIZE = 1024 * 1024 * 50
|
private const val BUFFER_SIZE = 1024 * 1024 * 50
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +103,7 @@ class DefaultBugReporter @Inject constructor(
|
||||||
.adapter<JsonDict>(Types.newParameterizedType(Map::class.java, String::class.java, Any::class.java))
|
.adapter<JsonDict>(Types.newParameterizedType(Map::class.java, String::class.java, Any::class.java))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private val LOGCAT_CMD_ERROR = arrayOf(
|
private val logcatCommandError = arrayOf(
|
||||||
"logcat", // /< Run 'logcat' command
|
"logcat", // /< Run 'logcat' command
|
||||||
"-d", // /< Dump the log rather than continue outputting it
|
"-d", // /< Dump the log rather than continue outputting it
|
||||||
"-v", // formatting
|
"-v", // formatting
|
||||||
|
|
@ -114,7 +114,7 @@ class DefaultBugReporter @Inject constructor(
|
||||||
"*:S" // /< Everything else silent, so don't pick it..
|
"*:S" // /< Everything else silent, so don't pick it..
|
||||||
)
|
)
|
||||||
|
|
||||||
private val LOGCAT_CMD_DEBUG = arrayOf("logcat", "-d", "-v", "threadtime", "*:*")
|
private val logcatCommandDebug = arrayOf("logcat", "-d", "-v", "threadtime", "*:*")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a bug report.
|
* Send a bug report.
|
||||||
|
|
@ -500,7 +500,7 @@ class DefaultBugReporter @Inject constructor(
|
||||||
val logcatProc: Process
|
val logcatProc: Process
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logcatProc = Runtime.getRuntime().exec(if (isErrorLogCat) LOGCAT_CMD_ERROR else LOGCAT_CMD_DEBUG)
|
logcatProc = Runtime.getRuntime().exec(if (isErrorLogCat) logcatCommandError else logcatCommandDebug)
|
||||||
} catch (e1: IOException) {
|
} catch (e1: IOException) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.widthIn
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ class RoomInviteMembersPresenter @Inject constructor(
|
||||||
value = if (value.contains(user)) {
|
value = if (value.contains(user)) {
|
||||||
value.filterNot { it == user }
|
value.filterNot { it == user }
|
||||||
} else {
|
} else {
|
||||||
(value + user)
|
value + user
|
||||||
}.toImmutableList()
|
}.toImmutableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package io.element.android.features.roomdetails.impl.members
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.State
|
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
|
@ -31,7 +30,6 @@ import io.element.android.libraries.architecture.Presenter
|
||||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||||
import io.element.android.libraries.designsystem.theme.components.SearchBarResultState
|
import io.element.android.libraries.designsystem.theme.components.SearchBarResultState
|
||||||
import io.element.android.libraries.matrix.api.room.MatrixRoom
|
import io.element.android.libraries.matrix.api.room.MatrixRoom
|
||||||
import io.element.android.libraries.matrix.api.room.MatrixRoomMembersState
|
|
||||||
import io.element.android.libraries.matrix.api.room.RoomMembershipState
|
import io.element.android.libraries.matrix.api.room.RoomMembershipState
|
||||||
import io.element.android.libraries.matrix.api.room.powerlevels.canInvite
|
import io.element.android.libraries.matrix.api.room.powerlevels.canInvite
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
|
|
@ -101,6 +99,5 @@ class RoomMemberListPresenter @Inject constructor(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class RoomMemberListPresenterTests {
|
||||||
loadedState.eventSink(RoomMemberListEvents.OnSearchActiveChanged(true))
|
loadedState.eventSink(RoomMemberListEvents.OnSearchActiveChanged(true))
|
||||||
|
|
||||||
val searchActiveState = awaitItem()
|
val searchActiveState = awaitItem()
|
||||||
Truth.assertThat((searchActiveState.isSearchActive)).isTrue()
|
Truth.assertThat(searchActiveState.isSearchActive).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ class RoomMemberListPresenterTests {
|
||||||
val searchActiveState = awaitItem()
|
val searchActiveState = awaitItem()
|
||||||
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("something"))
|
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("something"))
|
||||||
val searchQueryUpdatedState = awaitItem()
|
val searchQueryUpdatedState = awaitItem()
|
||||||
Truth.assertThat((searchQueryUpdatedState.searchQuery)).isEqualTo("something")
|
Truth.assertThat(searchQueryUpdatedState.searchQuery).isEqualTo("something")
|
||||||
val searchSearchResultDelivered = awaitItem()
|
val searchSearchResultDelivered = awaitItem()
|
||||||
Truth.assertThat(searchSearchResultDelivered.searchResults).isInstanceOf(SearchBarResultState.NoResults::class.java)
|
Truth.assertThat(searchSearchResultDelivered.searchResults).isInstanceOf(SearchBarResultState.NoResults::class.java)
|
||||||
}
|
}
|
||||||
|
|
@ -106,9 +106,9 @@ class RoomMemberListPresenterTests {
|
||||||
val searchActiveState = awaitItem()
|
val searchActiveState = awaitItem()
|
||||||
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("Alice"))
|
loadedState.eventSink(RoomMemberListEvents.UpdateSearchQuery("Alice"))
|
||||||
val searchQueryUpdatedState = awaitItem()
|
val searchQueryUpdatedState = awaitItem()
|
||||||
Truth.assertThat((searchQueryUpdatedState.searchQuery)).isEqualTo("Alice")
|
Truth.assertThat(searchQueryUpdatedState.searchQuery).isEqualTo("Alice")
|
||||||
val searchSearchResultDelivered = awaitItem()
|
val searchSearchResultDelivered = awaitItem()
|
||||||
Truth.assertThat((searchSearchResultDelivered.searchResults)).isInstanceOf(SearchBarResultState.Results::class.java)
|
Truth.assertThat(searchSearchResultDelivered.searchResults).isInstanceOf(SearchBarResultState.Results::class.java)
|
||||||
Truth.assertThat((searchSearchResultDelivered.searchResults as SearchBarResultState.Results).results.joined.first().displayName)
|
Truth.assertThat((searchSearchResultDelivered.searchResults as SearchBarResultState.Results).results.joined.first().displayName)
|
||||||
.isEqualTo("Alice")
|
.isEqualTo("Alice")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.libraries.designsystem.VectorIcons
|
import io.element.android.libraries.designsystem.VectorIcons
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private const val extendedRangeSize = 40
|
private const val EXTENDED_RANGE_SIZE = 40
|
||||||
|
|
||||||
class RoomListPresenter @Inject constructor(
|
class RoomListPresenter @Inject constructor(
|
||||||
private val client: MatrixClient,
|
private val client: MatrixClient,
|
||||||
|
|
@ -130,7 +130,7 @@ class RoomListPresenter @Inject constructor(
|
||||||
|
|
||||||
private fun updateVisibleRange(range: IntRange) {
|
private fun updateVisibleRange(range: IntRange) {
|
||||||
if (range.isEmpty()) return
|
if (range.isEmpty()) return
|
||||||
val midExtendedRangeSize = extendedRangeSize / 2
|
val midExtendedRangeSize = EXTENDED_RANGE_SIZE / 2
|
||||||
val extendedRangeStart = (range.first - midExtendedRangeSize).coerceAtLeast(0)
|
val extendedRangeStart = (range.first - midExtendedRangeSize).coerceAtLeast(0)
|
||||||
// Safe to give bigger size than room list
|
// Safe to give bigger size than room list
|
||||||
val extendedRangeEnd = range.last + midExtendedRangeSize
|
val extendedRangeEnd = range.last + midExtendedRangeSize
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ private fun RowScope.NameAndTimestampRow(room: RoomListRoomSummary) {
|
||||||
@Composable
|
@Composable
|
||||||
private fun RowScope.LastMessageAndIndicatorRow(room: RoomListRoomSummary) {
|
private fun RowScope.LastMessageAndIndicatorRow(room: RoomListRoomSummary) {
|
||||||
// Last Message
|
// Last Message
|
||||||
val attributedLastMessage = (room.lastMessage as? AnnotatedString)
|
val attributedLastMessage = room.lastMessage as? AnnotatedString
|
||||||
?: AnnotatedString(room.lastMessage.orEmpty().toString())
|
?: AnnotatedString(room.lastMessage.orEmpty().toString())
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -186,10 +186,10 @@ class PercentRectangleSizeShape(private val percent: Float) : Shape {
|
||||||
val halfPercent = percent / 2f
|
val halfPercent = percent / 2f
|
||||||
val path = Path().apply {
|
val path = Path().apply {
|
||||||
val rect = Rect(
|
val rect = Rect(
|
||||||
0f,
|
left = 0f,
|
||||||
size.height * halfPercent,
|
top = size.height * halfPercent,
|
||||||
size.width,
|
right = size.width,
|
||||||
size.height - (size.height * halfPercent)
|
bottom = size.height * (1 - halfPercent)
|
||||||
)
|
)
|
||||||
addRect(rect)
|
addRect(rect)
|
||||||
close()
|
close()
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ fun Context.isAnimationEnabled(): Boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
|
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
|
||||||
fun supportNotificationChannels() = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
fun supportNotificationChannels() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the application label of the provided package. If not found, the package is returned.
|
* Return the application label of the provided package. If not found, the package is returned.
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ fun Modifier.shapeShadow(
|
||||||
val paint = Paint()
|
val paint = Paint()
|
||||||
val frameworkPaint = paint.asFrameworkPaint()
|
val frameworkPaint = paint.asFrameworkPaint()
|
||||||
if (blurRadius != 0.dp) {
|
if (blurRadius != 0.dp) {
|
||||||
frameworkPaint.maskFilter = (BlurMaskFilter(blurRadius.toPx(), BlurMaskFilter.Blur.NORMAL))
|
frameworkPaint.maskFilter = BlurMaskFilter(blurRadius.toPx(), BlurMaskFilter.Blur.NORMAL)
|
||||||
}
|
}
|
||||||
frameworkPaint.color = color.toArgb()
|
frameworkPaint.color = color.toArgb()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.libraries.designsystem.preview
|
||||||
|
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.SheetState
|
||||||
|
import androidx.compose.material3.SheetValue
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
val sheetStateForPreview = SheetState(
|
||||||
|
skipPartiallyExpanded = true,
|
||||||
|
initialValue = SheetValue.Expanded,
|
||||||
|
)
|
||||||
|
|
@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.BottomSheetDefaults
|
import androidx.compose.material3.BottomSheetDefaults
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.SheetState
|
import androidx.compose.material3.SheetState
|
||||||
import androidx.compose.material3.SheetValue
|
|
||||||
import androidx.compose.material3.contentColorFor
|
import androidx.compose.material3.contentColorFor
|
||||||
import androidx.compose.material3.rememberModalBottomSheetState
|
import androidx.compose.material3.rememberModalBottomSheetState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -38,6 +37,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||||
|
import io.element.android.libraries.designsystem.preview.sheetStateForPreview
|
||||||
import io.element.android.libraries.theme.ElementTheme
|
import io.element.android.libraries.theme.ElementTheme
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
@ -100,10 +100,7 @@ private fun ContentToPreview() {
|
||||||
) {
|
) {
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
onDismissRequest = {},
|
onDismissRequest = {},
|
||||||
sheetState = SheetState(
|
sheetState = sheetStateForPreview,
|
||||||
skipPartiallyExpanded = true,
|
|
||||||
initialValue = SheetValue.Expanded,
|
|
||||||
),
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Sheet Content",
|
text = "Sheet Content",
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,6 @@ sealed class AuthenticationException(message: String) : Exception(message) {
|
||||||
class SlidingSyncNotAvailable(message: String) : AuthenticationException(message)
|
class SlidingSyncNotAvailable(message: String) : AuthenticationException(message)
|
||||||
class SessionMissing(message: String) : AuthenticationException(message)
|
class SessionMissing(message: String) : AuthenticationException(message)
|
||||||
class Generic(message: String) : AuthenticationException(message)
|
class Generic(message: String) : AuthenticationException(message)
|
||||||
class OidcError(type: String, message: String) : AuthenticationException(message)
|
// TODO Oidc
|
||||||
|
// class OidcError(type: String, message: String) : AuthenticationException(message)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ object PermalinkBuilder {
|
||||||
|
|
||||||
private const val ROOM_PATH = "room/"
|
private const val ROOM_PATH = "room/"
|
||||||
private const val USER_PATH = "user/"
|
private const val USER_PATH = "user/"
|
||||||
private const val GROUP_PATH = "group/"
|
|
||||||
|
|
||||||
private val permalinkBaseUrl get() = (MatrixConfiguration.clientPermalinkBaseUrl ?: MatrixConfiguration.matrixToPermalinkBaseUrl).also {
|
private val permalinkBaseUrl get() = (MatrixConfiguration.clientPermalinkBaseUrl ?: MatrixConfiguration.matrixToPermalinkBaseUrl).also {
|
||||||
var baseUrl = it
|
var baseUrl = it
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
package io.element.android.libraries.matrix.impl.auth
|
package io.element.android.libraries.matrix.impl.auth
|
||||||
|
|
||||||
import io.element.android.libraries.matrix.api.auth.OidcConfig
|
|
||||||
// TODO Oidc
|
// TODO Oidc
|
||||||
|
// import io.element.android.libraries.matrix.api.auth.OidcConfig
|
||||||
// import org.matrix.rustcomponents.sdk.OidcClientMetadata
|
// import org.matrix.rustcomponents.sdk.OidcClientMetadata
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package io.element.android.libraries.matrix.impl.media
|
package io.element.android.libraries.matrix.impl.media
|
||||||
|
|
||||||
import io.element.android.libraries.matrix.api.media.ImageInfo
|
import io.element.android.libraries.matrix.api.media.ImageInfo
|
||||||
import org.matrix.rustcomponents.sdk.MediaSource
|
|
||||||
import org.matrix.rustcomponents.sdk.ImageInfo as RustImageInfo
|
import org.matrix.rustcomponents.sdk.ImageInfo as RustImageInfo
|
||||||
|
|
||||||
fun RustImageInfo.map(): ImageInfo = ImageInfo(
|
fun RustImageInfo.map(): ImageInfo = ImageInfo(
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class EventMessageMapper {
|
||||||
fun map(message: Message): MessageContent = message.use {
|
fun map(message: Message): MessageContent = message.use {
|
||||||
val type = it.msgtype().use(this::mapMessageType)
|
val type = it.msgtype().use(this::mapMessageType)
|
||||||
val inReplyToId = it.inReplyTo()?.eventId?.let(::EventId)
|
val inReplyToId = it.inReplyTo()?.eventId?.let(::EventId)
|
||||||
val inReplyToEvent: InReplyTo? = (it.inReplyTo()?.event)?.use { details ->
|
val inReplyToEvent: InReplyTo? = it.inReplyTo()?.event?.use { details ->
|
||||||
when (details) {
|
when (details) {
|
||||||
is RepliedToEventDetails.Ready -> {
|
is RepliedToEventDetails.Ready -> {
|
||||||
val senderProfile = details.senderProfile as? ProfileDetails.Ready
|
val senderProfile = details.senderProfile as? ProfileDetails.Ready
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import io.element.android.libraries.matrix.api.timeline.item.virtual.VirtualTime
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.getAndUpdate
|
import kotlinx.coroutines.flow.getAndUpdate
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
class TimelineEncryptedHistoryPostProcessor(
|
class TimelineEncryptedHistoryPostProcessor(
|
||||||
private val lastLoginTimestamp: Date?,
|
private val lastLoginTimestamp: Date?,
|
||||||
|
|
@ -70,5 +69,4 @@ class TimelineEncryptedHistoryPostProcessor(
|
||||||
val timestamp = (item as? MatrixTimelineItem.Event)?.event?.timestamp ?: return false
|
val timestamp = (item as? MatrixTimelineItem.Event)?.event?.timestamp ?: return false
|
||||||
return timestamp <= lastLoginTimestamp!!.time
|
return timestamp <= lastLoginTimestamp!!.time
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import io.element.android.libraries.matrix.api.core.SpaceId
|
||||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||||
import io.element.android.libraries.matrix.api.core.TransactionId
|
import io.element.android.libraries.matrix.api.core.TransactionId
|
||||||
import io.element.android.libraries.matrix.api.core.UserId
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
const val A_USER_NAME = "alice"
|
const val A_USER_NAME = "alice"
|
||||||
const val A_PASSWORD = "password"
|
const val A_PASSWORD = "password"
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ fun SelectedUsersList(
|
||||||
val maxVisibleUsers = rowWidth / userWidthWithSpacing
|
val maxVisibleUsers = rowWidth / userWidthWithSpacing
|
||||||
|
|
||||||
// Round down the number of visible users to end with a state where one is half visible
|
// Round down the number of visible users to end with a state where one is half visible
|
||||||
val targetFraction = (userWidth / 2) / userWidthWithSpacing
|
val targetFraction = userWidth / 2 / userWidthWithSpacing
|
||||||
val targetUsers = floor(maxVisibleUsers - targetFraction) + targetFraction
|
val targetUsers = floor(maxVisibleUsers - targetFraction) + targetFraction
|
||||||
|
|
||||||
// Work out how much extra spacing we need to reduce the number of users that much, then split it evenly amongst the visible users
|
// Work out how much extra spacing we need to reduce the number of users that much, then split it evenly amongst the visible users
|
||||||
|
|
@ -153,7 +153,7 @@ private fun ContentToPreview() {
|
||||||
SelectedUsersList(
|
SelectedUsersList(
|
||||||
selectedUsers = aMatrixUserList().take(6).toImmutableList(),
|
selectedUsers = aMatrixUserList().take(6).toImmutableList(),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width((200 + (i * 20)).dp)
|
.width((200 + i * 20).dp)
|
||||||
.border(1.dp, Color.Red)
|
.border(1.dp, Color.Red)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,6 @@ class MediaSender @Inject constructor(
|
||||||
progressCallback = progressCallback
|
progressCallback = progressCallback
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else -> Result.failure(IllegalStateException("Unexpected MediaUploadInfo format: $uploadInfo"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.element.android.libraries.mediaupload
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import com.vanniktech.blurhash.BlurHash
|
|
||||||
import io.element.android.libraries.androidutils.bitmap.calculateInSampleSize
|
import io.element.android.libraries.androidutils.bitmap.calculateInSampleSize
|
||||||
import io.element.android.libraries.androidutils.bitmap.resizeToMax
|
import io.element.android.libraries.androidutils.bitmap.resizeToMax
|
||||||
import io.element.android.libraries.androidutils.bitmap.rotateToMetadataOrientation
|
import io.element.android.libraries.androidutils.bitmap.rotateToMetadataOrientation
|
||||||
|
|
@ -92,7 +91,7 @@ class ImageCompressor @Inject constructor(
|
||||||
) {
|
) {
|
||||||
val (width, height) = when (resizeMode) {
|
val (width, height) = when (resizeMode) {
|
||||||
is ResizeMode.Approximate -> resizeMode.desiredWidth to resizeMode.desiredHeight
|
is ResizeMode.Approximate -> resizeMode.desiredWidth to resizeMode.desiredHeight
|
||||||
is ResizeMode.Strict -> (resizeMode.maxWidth / 2) to (resizeMode.maxHeight / 2)
|
is ResizeMode.Strict -> resizeMode.maxWidth / 2 to resizeMode.maxHeight / 2
|
||||||
is ResizeMode.None -> return
|
is ResizeMode.None -> return
|
||||||
}
|
}
|
||||||
// Read bounds only
|
// Read bounds only
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ class ThumbnailFactory @Inject constructor(
|
||||||
cancellationSignal
|
cancellationSignal
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
ThumbnailUtils.createImageThumbnail(
|
ThumbnailUtils.createImageThumbnail(
|
||||||
file.path,
|
file.path,
|
||||||
MediaStore.Images.Thumbnails.MINI_KIND,
|
MediaStore.Images.Thumbnails.MINI_KIND,
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,6 @@ dependencies {
|
||||||
implementation(projects.services.appnavstate.api)
|
implementation(projects.services.appnavstate.api)
|
||||||
implementation(projects.services.toolbox.api)
|
implementation(projects.services.toolbox.api)
|
||||||
|
|
||||||
// TODO Temporary use the deprecated LocalBroadcastManager, to be changed later.
|
|
||||||
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.1.0")
|
|
||||||
|
|
||||||
testImplementation(libs.test.junit)
|
testImplementation(libs.test.junit)
|
||||||
testImplementation(libs.test.mockk)
|
testImplementation(libs.test.mockk)
|
||||||
testImplementation(libs.test.truth)
|
testImplementation(libs.test.truth)
|
||||||
|
|
|
||||||
|
|
@ -103,33 +103,6 @@ class PushersManager @Inject constructor(
|
||||||
return "{\"cs\":\"$secretForUser\"}"
|
return "{\"cs\":\"$secretForUser\"}"
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun registerEmailForPush(email: String) {
|
|
||||||
TODO()
|
|
||||||
/*
|
|
||||||
val currentSession = activeSessionHolder.getActiveSession()
|
|
||||||
val appName = appNameProvider.getAppName()
|
|
||||||
currentSession.pushersService().addEmailPusher(
|
|
||||||
email = email,
|
|
||||||
lang = localeProvider.current().language,
|
|
||||||
emailBranding = appName,
|
|
||||||
appDisplayName = appName,
|
|
||||||
deviceDisplayName = currentSession.sessionParams.deviceId ?: "MOBILE"
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getPusherForCurrentSession() {}/*: Pusher? {
|
|
||||||
val session = activeSessionHolder.getSafeActiveSession() ?: return null
|
|
||||||
val deviceId = session.sessionParams.deviceId
|
|
||||||
return session.pushersService().getPushers().firstOrNull { it.deviceId == deviceId }
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
suspend fun unregisterEmailPusher(email: String) {
|
|
||||||
// val currentSession = activeSessionHolder.getSafeActiveSession() ?: return
|
|
||||||
// currentSession.pushersService().removeEmailPusher(email)
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun unregisterPusher(matrixClient: MatrixClient, pushKey: String, gateway: String) {
|
override suspend fun unregisterPusher(matrixClient: MatrixClient, pushKey: String, gateway: String) {
|
||||||
matrixClient.pushersService().unsetHttpPusher()
|
matrixClient.pushersService().unsetHttpPusher()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import io.element.android.libraries.matrix.api.core.SessionId
|
||||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
import io.element.android.libraries.matrix.api.core.ThreadId
|
||||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||||
import io.element.android.libraries.push.api.notifications.NotificationDrawerManager
|
import io.element.android.libraries.push.api.notifications.NotificationDrawerManager
|
||||||
import io.element.android.libraries.push.api.store.PushDataStore
|
|
||||||
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
|
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
|
||||||
import io.element.android.services.appnavstate.api.AppNavigationStateService
|
import io.element.android.services.appnavstate.api.AppNavigationStateService
|
||||||
import io.element.android.services.appnavstate.api.NavigationState
|
import io.element.android.services.appnavstate.api.NavigationState
|
||||||
|
|
@ -49,7 +48,6 @@ import javax.inject.Inject
|
||||||
*/
|
*/
|
||||||
@SingleIn(AppScope::class)
|
@SingleIn(AppScope::class)
|
||||||
class DefaultNotificationDrawerManager @Inject constructor(
|
class DefaultNotificationDrawerManager @Inject constructor(
|
||||||
private val pushDataStore: PushDataStore,
|
|
||||||
private val notifiableEventProcessor: NotifiableEventProcessor,
|
private val notifiableEventProcessor: NotifiableEventProcessor,
|
||||||
private val notificationRenderer: NotificationRenderer,
|
private val notificationRenderer: NotificationRenderer,
|
||||||
private val notificationEventPersistence: NotificationEventPersistence,
|
private val notificationEventPersistence: NotificationEventPersistence,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class FilteredEventDetector @Inject constructor(
|
||||||
* Returns true if the given event should be ignored.
|
* Returns true if the given event should be ignored.
|
||||||
* Used to skip notifications if a non expected message is received.
|
* Used to skip notifications if a non expected message is received.
|
||||||
*/
|
*/
|
||||||
fun shouldBeIgnored(notifiableEvent: NotifiableEvent): Boolean {
|
fun shouldBeIgnored(@Suppress("UNUSED_PARAMETER") notifiableEvent: NotifiableEvent): Boolean {
|
||||||
/* TODO EAx
|
/* TODO EAx
|
||||||
val session = activeSessionDataSource.currentValue?.orNull() ?: return false
|
val session = activeSessionDataSource.currentValue?.orNull() ?: return false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
package io.element.android.libraries.push.impl.notifications
|
package io.element.android.libraries.push.impl.notifications
|
||||||
|
|
||||||
import io.element.android.libraries.core.log.logger.LoggerTag
|
import io.element.android.libraries.core.log.logger.LoggerTag
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
import io.element.android.libraries.matrix.api.MatrixClientProvider
|
||||||
import io.element.android.libraries.matrix.api.core.EventId
|
import io.element.android.libraries.matrix.api.core.EventId
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
import io.element.android.libraries.matrix.api.core.SessionId
|
import io.element.android.libraries.matrix.api.core.SessionId
|
||||||
|
|
@ -34,7 +34,6 @@ import io.element.android.libraries.matrix.api.timeline.item.event.NoticeMessage
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.TextMessageType
|
import io.element.android.libraries.matrix.api.timeline.item.event.TextMessageType
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.UnknownMessageType
|
import io.element.android.libraries.matrix.api.timeline.item.event.UnknownMessageType
|
||||||
import io.element.android.libraries.matrix.api.timeline.item.event.VideoMessageType
|
import io.element.android.libraries.matrix.api.timeline.item.event.VideoMessageType
|
||||||
import io.element.android.libraries.matrix.api.MatrixClientProvider
|
|
||||||
import io.element.android.libraries.push.impl.R
|
import io.element.android.libraries.push.impl.R
|
||||||
import io.element.android.libraries.push.impl.log.pushLoggerTag
|
import io.element.android.libraries.push.impl.log.pushLoggerTag
|
||||||
import io.element.android.libraries.push.impl.notifications.model.FallbackNotifiableEvent
|
import io.element.android.libraries.push.impl.notifications.model.FallbackNotifiableEvent
|
||||||
|
|
@ -57,9 +56,6 @@ private val loggerTag = LoggerTag("NotifiableEventResolver", pushLoggerTag)
|
||||||
*/
|
*/
|
||||||
class NotifiableEventResolver @Inject constructor(
|
class NotifiableEventResolver @Inject constructor(
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
// private val noticeEventFormatter: NoticeEventFormatter,
|
|
||||||
// private val displayableEventFormatter: DisplayableEventFormatter,
|
|
||||||
private val buildMeta: BuildMeta,
|
|
||||||
private val clock: SystemClock,
|
private val clock: SystemClock,
|
||||||
private val matrixClientProvider: MatrixClientProvider,
|
private val matrixClientProvider: MatrixClientProvider,
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,12 @@ package io.element.android.libraries.push.impl.notifications
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.core.app.RemoteInput
|
|
||||||
import io.element.android.libraries.architecture.bindings
|
import io.element.android.libraries.architecture.bindings
|
||||||
import io.element.android.libraries.core.log.logger.LoggerTag
|
import io.element.android.libraries.core.log.logger.LoggerTag
|
||||||
import io.element.android.libraries.matrix.api.core.EventId
|
import io.element.android.libraries.matrix.api.core.EventId
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
import io.element.android.libraries.matrix.api.core.SessionId
|
import io.element.android.libraries.matrix.api.core.SessionId
|
||||||
import io.element.android.libraries.matrix.api.core.ThreadId
|
|
||||||
import io.element.android.libraries.push.impl.log.notificationLoggerTag
|
import io.element.android.libraries.push.impl.log.notificationLoggerTag
|
||||||
import io.element.android.services.toolbox.api.systemclock.SystemClock
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
@ -39,10 +36,6 @@ private val loggerTag = LoggerTag("NotificationBroadcastReceiver", notificationL
|
||||||
class NotificationBroadcastReceiver : BroadcastReceiver() {
|
class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
@Inject lateinit var defaultNotificationDrawerManager: DefaultNotificationDrawerManager
|
@Inject lateinit var defaultNotificationDrawerManager: DefaultNotificationDrawerManager
|
||||||
|
|
||||||
//@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
|
||||||
//@Inject lateinit var analyticsTracker: AnalyticsTracker
|
|
||||||
@Inject lateinit var clock: SystemClock
|
|
||||||
@Inject lateinit var actionIds: NotificationActionIds
|
@Inject lateinit var actionIds: NotificationActionIds
|
||||||
|
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
|
@ -81,6 +74,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
private fun handleJoinRoom(sessionId: SessionId, roomId: RoomId) {
|
private fun handleJoinRoom(sessionId: SessionId, roomId: RoomId) {
|
||||||
/*
|
/*
|
||||||
activeSessionHolder.getSafeActiveSession()?.let { session ->
|
activeSessionHolder.getSafeActiveSession()?.let { session ->
|
||||||
|
|
@ -94,10 +88,10 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
private fun handleRejectRoom(sessionId: SessionId, roomId: RoomId) {
|
private fun handleRejectRoom(sessionId: SessionId, roomId: RoomId) {
|
||||||
/*
|
/*
|
||||||
activeSessionHolder.getSafeActiveSession()?.let { session ->
|
activeSessionHolder.getSafeActiveSession()?.let { session ->
|
||||||
|
|
@ -109,6 +103,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
private fun handleMarkAsRead(sessionId: SessionId, roomId: RoomId) {
|
private fun handleMarkAsRead(sessionId: SessionId, roomId: RoomId) {
|
||||||
/*
|
/*
|
||||||
activeSessionHolder.getActiveSession().let { session ->
|
activeSessionHolder.getActiveSession().let { session ->
|
||||||
|
|
@ -123,7 +118,9 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
private fun handleSmartReply(intent: Intent, context: Context) {
|
private fun handleSmartReply(intent: Intent, context: Context) {
|
||||||
|
/*
|
||||||
val message = getReplyMessage(intent)
|
val message = getReplyMessage(intent)
|
||||||
val sessionId = intent.getStringExtra(KEY_SESSION_ID)?.let(::SessionId)
|
val sessionId = intent.getStringExtra(KEY_SESSION_ID)?.let(::SessionId)
|
||||||
val roomId = intent.getStringExtra(KEY_ROOM_ID)?.let(::RoomId)
|
val roomId = intent.getStringExtra(KEY_ROOM_ID)?.let(::RoomId)
|
||||||
|
|
@ -134,13 +131,11 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
// Can this happen? should we update notification?
|
// Can this happen? should we update notification?
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
activeSessionHolder.getActiveSession().let { session ->
|
activeSessionHolder.getActiveSession().let { session ->
|
||||||
session.getRoom(roomId)?.let { room ->
|
session.getRoom(roomId)?.let { room ->
|
||||||
sendMatrixEvent(message, threadId, session, room, context)
|
sendMatrixEvent(message, threadId, session, room, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,6 +229,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
private fun getReplyMessage(intent: Intent?): String? {
|
private fun getReplyMessage(intent: Intent?): String? {
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
val remoteInput = RemoteInput.getResultsFromIntent(intent)
|
val remoteInput = RemoteInput.getResultsFromIntent(intent)
|
||||||
|
|
@ -243,6 +239,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val KEY_SESSION_ID = "sessionID"
|
const val KEY_SESSION_ID = "sessionID"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class OutdatedEventDetector @Inject constructor(
|
||||||
* Used to clean up notifications if a displayed message has been read on an
|
* Used to clean up notifications if a displayed message has been read on an
|
||||||
* other device.
|
* other device.
|
||||||
*/
|
*/
|
||||||
fun isMessageOutdated(notifiableEvent: NotifiableEvent): Boolean {
|
fun isMessageOutdated(@Suppress("UNUSED_PARAMETER") notifiableEvent: NotifiableEvent): Boolean {
|
||||||
/* TODO EAx
|
/* TODO EAx
|
||||||
val session = activeSessionDataSource.currentValue?.orNull() ?: return false
|
val session = activeSessionDataSource.currentValue?.orNull() ?: return false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class RoomGroupMessageCreator @Inject constructor(
|
||||||
|
|
||||||
val lastMessageTimestamp = events.last().timestamp
|
val lastMessageTimestamp = events.last().timestamp
|
||||||
val smartReplyErrors = events.filter { it.isSmartReplyError() }
|
val smartReplyErrors = events.filter { it.isSmartReplyError() }
|
||||||
val messageCount = (events.size - smartReplyErrors.size)
|
val messageCount = events.size - smartReplyErrors.size
|
||||||
val meta = RoomNotification.Message.Meta(
|
val meta = RoomNotification.Message.Meta(
|
||||||
summaryLine = createRoomMessagesGroupSummaryLine(events, roomName, roomIsDirect = !roomIsGroup),
|
summaryLine = createRoomMessagesGroupSummaryLine(events, roomName, roomIsDirect = !roomIsGroup),
|
||||||
messageCount = messageCount,
|
messageCount = messageCount,
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,10 @@ package io.element.android.libraries.push.impl.notifications
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
|
||||||
|
|
||||||
class TestNotificationReceiver : BroadcastReceiver() {
|
class TestNotificationReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
// Internal broadcast to any one interested
|
// TODO The test notification has been clicked, notify the ui
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ class NotificationChannels @Inject constructor(
|
||||||
private const val CALL_NOTIFICATION_CHANNEL_ID = "CALL_NOTIFICATION_CHANNEL_ID_V2"
|
private const val CALL_NOTIFICATION_CHANNEL_ID = "CALL_NOTIFICATION_CHANNEL_ID_V2"
|
||||||
|
|
||||||
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
|
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.O)
|
||||||
private fun supportNotificationChannels() = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
private fun supportNotificationChannels() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||||
|
|
||||||
fun openSystemSettingsForSilentCategory(activity: Activity) {
|
fun openSystemSettingsForSilentCategory(activity: Activity) {
|
||||||
activity.startNotificationChannelSettingsIntent(SILENT_NOTIFICATION_CHANNEL_ID)
|
activity.startNotificationChannelSettingsIntent(SILENT_NOTIFICATION_CHANNEL_ID)
|
||||||
|
|
|
||||||
|
|
@ -16,22 +16,17 @@
|
||||||
|
|
||||||
package io.element.android.libraries.push.impl.push
|
package io.element.android.libraries.push.impl.push
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
|
||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.libraries.core.log.logger.LoggerTag
|
import io.element.android.libraries.core.log.logger.LoggerTag
|
||||||
import io.element.android.libraries.core.meta.BuildMeta
|
import io.element.android.libraries.core.meta.BuildMeta
|
||||||
import io.element.android.libraries.di.AppScope
|
import io.element.android.libraries.di.AppScope
|
||||||
import io.element.android.libraries.di.ApplicationContext
|
|
||||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||||
import io.element.android.libraries.push.impl.PushersManager
|
import io.element.android.libraries.push.impl.PushersManager
|
||||||
import io.element.android.libraries.push.impl.log.pushLoggerTag
|
import io.element.android.libraries.push.impl.log.pushLoggerTag
|
||||||
import io.element.android.libraries.push.impl.notifications.NotifiableEventResolver
|
|
||||||
import io.element.android.libraries.push.impl.notifications.NotificationActionIds
|
|
||||||
import io.element.android.libraries.push.impl.notifications.DefaultNotificationDrawerManager
|
import io.element.android.libraries.push.impl.notifications.DefaultNotificationDrawerManager
|
||||||
|
import io.element.android.libraries.push.impl.notifications.NotifiableEventResolver
|
||||||
import io.element.android.libraries.push.impl.store.DefaultPushDataStore
|
import io.element.android.libraries.push.impl.store.DefaultPushDataStore
|
||||||
import io.element.android.libraries.pushproviders.api.PushData
|
import io.element.android.libraries.pushproviders.api.PushData
|
||||||
import io.element.android.libraries.pushproviders.api.PushHandler
|
import io.element.android.libraries.pushproviders.api.PushHandler
|
||||||
|
|
@ -53,8 +48,7 @@ class DefaultPushHandler @Inject constructor(
|
||||||
private val defaultPushDataStore: DefaultPushDataStore,
|
private val defaultPushDataStore: DefaultPushDataStore,
|
||||||
private val userPushStoreFactory: UserPushStoreFactory,
|
private val userPushStoreFactory: UserPushStoreFactory,
|
||||||
private val pushClientSecret: PushClientSecret,
|
private val pushClientSecret: PushClientSecret,
|
||||||
private val actionIds: NotificationActionIds,
|
// private val actionIds: NotificationActionIds,
|
||||||
@ApplicationContext private val context: Context,
|
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
private val matrixAuthenticationService: MatrixAuthenticationService,
|
private val matrixAuthenticationService: MatrixAuthenticationService,
|
||||||
) : PushHandler {
|
) : PushHandler {
|
||||||
|
|
@ -82,8 +76,8 @@ class DefaultPushHandler @Inject constructor(
|
||||||
|
|
||||||
// Diagnostic Push
|
// Diagnostic Push
|
||||||
if (pushData.eventId == PushersManager.TEST_EVENT_ID) {
|
if (pushData.eventId == PushersManager.TEST_EVENT_ID) {
|
||||||
val intent = Intent(actionIds.push)
|
// val intent = Intent(actionIds.push)
|
||||||
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
|
// TODO The test push has been received, notify the ui
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2023 New Vector Ltd
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.element.android.libraries.pushproviders.firebase
|
|
||||||
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
class EnsureFcmTokenIsRetrievedUseCase @Inject constructor(
|
|
||||||
// private val unifiedPushHelper: UnifiedPushHelper,
|
|
||||||
// private val fcmHelper: FcmHelper,
|
|
||||||
// private val activeSessionHolder: ActiveSessionHolder,
|
|
||||||
) {
|
|
||||||
|
|
||||||
// fun execute(pushersManager: PushersManager, registerPusher: Boolean) {
|
|
||||||
// if (unifiedPushHelper.isEmbeddedDistributor()) {
|
|
||||||
// fcmHelper.ensureFcmTokenIsRetrieved(pushersManager, shouldAddHttpPusher(registerPusher))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private fun shouldAddHttpPusher(registerPusher: Boolean) = if (registerPusher) {
|
|
||||||
/*
|
|
||||||
TODO EAx
|
|
||||||
val currentSession = activeSessionHolder.getActiveSession()
|
|
||||||
val currentPushers = currentSession.pushersService().getPushers()
|
|
||||||
currentPushers.none { it.deviceId == currentSession.sessionParams.deviceId }
|
|
||||||
*/
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -26,7 +26,7 @@ class UnregisterUnifiedPushUseCase @Inject constructor(
|
||||||
@ApplicationContext private val context: Context,
|
@ApplicationContext private val context: Context,
|
||||||
//private val pushDataStore: PushDataStore,
|
//private val pushDataStore: PushDataStore,
|
||||||
private val unifiedPushStore: UnifiedPushStore,
|
private val unifiedPushStore: UnifiedPushStore,
|
||||||
private val unifiedPushGatewayResolver: UnifiedPushGatewayResolver,
|
// private val unifiedPushGatewayResolver: UnifiedPushGatewayResolver,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
suspend fun execute(clientSecret: String /*pushersManager: PushersManager?*/) {
|
suspend fun execute(clientSecret: String /*pushersManager: PushersManager?*/) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package io.element.android.services.analyticsproviders.posthog
|
package io.element.android.services.analyticsproviders.posthog
|
||||||
|
|
||||||
import com.posthog.android.Options
|
|
||||||
import com.posthog.android.PostHog
|
import com.posthog.android.PostHog
|
||||||
import com.posthog.android.Properties
|
import com.posthog.android.Properties
|
||||||
import com.squareup.anvil.annotations.ContributesMultibinding
|
import com.squareup.anvil.annotations.ContributesMultibinding
|
||||||
|
|
@ -29,8 +28,8 @@ import io.element.android.services.analyticsproviders.posthog.log.analyticsTag
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
private val REUSE_EXISTING_ID: String? = null
|
// private val REUSE_EXISTING_ID: String? = null
|
||||||
private val IGNORED_OPTIONS: Options? = null
|
// private val IGNORED_OPTIONS: Options? = null
|
||||||
|
|
||||||
@ContributesMultibinding(AppScope::class)
|
@ContributesMultibinding(AppScope::class)
|
||||||
class PosthogAnalyticsProvider @Inject constructor(
|
class PosthogAnalyticsProvider @Inject constructor(
|
||||||
|
|
@ -101,9 +100,11 @@ class PosthogAnalyticsProvider @Inject constructor(
|
||||||
* We avoid sending nulls as part of the UserProperties as this will reset the values across all devices.
|
* We avoid sending nulls as part of the UserProperties as this will reset the values across all devices.
|
||||||
* The UserProperties event has nullable properties to allow for clients to opt in.
|
* The UserProperties event has nullable properties to allow for clients to opt in.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
private fun Map<String, Any?>.toPostHogUserProperties(): Properties {
|
private fun Map<String, Any?>.toPostHogUserProperties(): Properties {
|
||||||
return Properties().apply {
|
return Properties().apply {
|
||||||
putAll(this@toPostHogUserProperties.filter { it.value != null })
|
putAll(this@toPostHogUserProperties.filter { it.value != null })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package io.element.android.tests.uitests
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import com.airbnb.android.showkase.models.Showkase
|
|
||||||
import com.airbnb.android.showkase.ui.ShowkaseBrowserActivity
|
import com.airbnb.android.showkase.ui.ShowkaseBrowserActivity
|
||||||
|
|
||||||
fun openShowkase(activity: Activity) {
|
fun openShowkase(activity: Activity) {
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,22 @@ style:
|
||||||
FunctionOnlyReturningConstant:
|
FunctionOnlyReturningConstant:
|
||||||
active: false
|
active: false
|
||||||
UnusedPrivateMember:
|
UnusedPrivateMember:
|
||||||
# TODO Enable it
|
active: true
|
||||||
active: false
|
|
||||||
UnusedParameter:
|
UnusedParameter:
|
||||||
# TODO Enable it
|
active: true
|
||||||
active: false
|
UnnecessaryInnerClass:
|
||||||
|
active: true
|
||||||
|
UnnecessaryLet:
|
||||||
|
active: true
|
||||||
|
UnnecessaryParentheses:
|
||||||
|
active: true
|
||||||
|
allowForUnclearPrecedence: false
|
||||||
|
UntilInsteadOfRangeTo:
|
||||||
|
active: true
|
||||||
|
UnusedImports:
|
||||||
|
active: true
|
||||||
UnusedPrivateProperty:
|
UnusedPrivateProperty:
|
||||||
# TODO Enable it
|
active: true
|
||||||
active: false
|
|
||||||
ThrowsCount:
|
ThrowsCount:
|
||||||
active: false
|
active: false
|
||||||
LoopWithTooManyJumpStatements:
|
LoopWithTooManyJumpStatements:
|
||||||
|
|
@ -72,11 +80,9 @@ complexity:
|
||||||
|
|
||||||
naming:
|
naming:
|
||||||
VariableNaming:
|
VariableNaming:
|
||||||
# TODO Enable it
|
active: true
|
||||||
active: false
|
|
||||||
TopLevelPropertyNaming:
|
TopLevelPropertyNaming:
|
||||||
# TODO Enable it
|
active: true
|
||||||
active: false
|
|
||||||
FunctionNaming:
|
FunctionNaming:
|
||||||
active: true
|
active: true
|
||||||
ignoreAnnotated: ['Composable']
|
ignoreAnnotated: ['Composable']
|
||||||
|
|
@ -150,8 +156,3 @@ Compose:
|
||||||
active: true
|
active: true
|
||||||
UnstableCollections:
|
UnstableCollections:
|
||||||
active: true
|
active: true
|
||||||
ViewModelForwarding:
|
|
||||||
## TODO Set to true later
|
|
||||||
active: false
|
|
||||||
ViewModelInjection:
|
|
||||||
active: true
|
|
||||||
|
|
|
||||||
30
tools/quality/check.sh
Executable file
30
tools/quality/check.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2023 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# List of tasks to run before creating a PR, to limit the risk of getting rejected by the CI.
|
||||||
|
# Can be used as a git hook if you want.
|
||||||
|
|
||||||
|
# exit when any command fails
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# First run the quickest script
|
||||||
|
./tools/check/check_code_quality.sh
|
||||||
|
|
||||||
|
# Build, test and check the project, with warning as errors
|
||||||
|
# It also check that the minimal app is compiling.
|
||||||
|
./gradlew check -PallWarningsAsErrors=true
|
||||||
|
|
@ -16,6 +16,9 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# exit when any command fails
|
||||||
|
set -e
|
||||||
|
|
||||||
printf "\n================================================================================\n"
|
printf "\n================================================================================\n"
|
||||||
printf "| Welcome to the release script! |\n"
|
printf "| Welcome to the release script! |\n"
|
||||||
printf "================================================================================\n"
|
printf "================================================================================\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue