Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ dependencies {
// features
implementation(project(":features:cells"))
implementation(project(":features:sketch"))
implementation(projects.features.sync)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add this to the kover section 👀

i.e.
kover(project((projects.features.sync))

implementation(project(":features:meetings"))
implementation(projects.core.di)
implementation(projects.core.media)
implementation(projects.core.notification)
implementation(project(":core:ui-common"))

// kover
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ import kotlinx.coroutines.runBlocking
import javax.inject.Qualifier
import javax.inject.Singleton

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class KaliumCoreLogic

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class CurrentSessionFlowService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import androidx.core.app.NotificationManagerCompat
import androidx.core.app.Person
import com.wire.android.R
import com.wire.android.feature.notification.R as NR
import com.wire.android.appLogger
import com.wire.android.di.KaliumCoreLogic
import com.wire.android.di.NoSession
Expand Down Expand Up @@ -218,7 +219,7 @@
return notificationBuilder
.setPriority(NotificationCompat.PRIORITY_LOW)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(NR.drawable.notification_icon_small)

Check warning on line 222 in app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt#L222

Added line #L222 was not covered by tests
.setContentTitle(data.conversationName)
.setContentText(context.getString(R.string.notification_outgoing_call_tap_to_return))
.setSubText(data.userName)
Expand Down Expand Up @@ -248,7 +249,7 @@
val notification = NotificationCompat.Builder(context, channelId)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(NR.drawable.notification_icon_small)

Check warning on line 252 in app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt#L252

Added line #L252 was not covered by tests
.setContentTitle(title)
.setContentText(content)
.setSubText(data.userName)
Expand Down Expand Up @@ -296,7 +297,7 @@
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(NR.drawable.notification_icon_small)

Check warning on line 300 in app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt#L300

Added line #L300 was not covered by tests
.setAutoCancel(true)
.setOngoing(true)
.setUsesChronometer(true)
Expand Down Expand Up @@ -324,7 +325,7 @@
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(NR.drawable.notification_icon_small)

Check warning on line 328 in app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt#L328

Added line #L328 was not covered by tests
.setAutoCancel(true)
.setOngoing(true)
.setContentIntent(openAppPendingIntent(context))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
private fun getSummaryNotification(userId: QualifiedID, userName: String): Notification {
val channelId = NotificationConstants.getMessagesChannelId(userId)
return NotificationCompat.Builder(context, channelId)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 174 in app/src/main/kotlin/com/wire/android/notification/MessageNotificationManager.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/notification/MessageNotificationManager.kt#L174

Added line #L174 was not covered by tests
.setGroup(NotificationConstants.getMessagesGroupKey(userId))
.setStyle(NotificationCompat.InboxStyle().setSummaryText(userName))
.setGroupSummary(true)
Expand Down Expand Up @@ -530,7 +530,7 @@
priority = NotificationCompat.PRIORITY_MAX
setCategory(NotificationCompat.CATEGORY_MESSAGE)

setSmallIcon(R.drawable.notification_icon_small)
setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 533 in app/src/main/kotlin/com/wire/android/notification/MessageNotificationManager.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/notification/MessageNotificationManager.kt#L533

Added line #L533 was not covered by tests
setGroup(NotificationConstants.getMessagesGroupKey(userId))
setAutoCancel(true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

return NotificationCompat.Builder(this, PLAYING_AUDIO_CHANNEL_ID)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 151 in app/src/main/kotlin/com/wire/android/services/PlayingAudioMessageService.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/services/PlayingAudioMessageService.kt#L151

Added line #L151 was not covered by tests
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.wire.android.feature.SwitchAccountParam
import com.wire.android.feature.SwitchAccountResult
import com.wire.android.services.ServicesManager
import com.wire.android.sync.MonitorSyncWorkUseCase
import com.wire.android.ui.authentication.devices.model.displayName
import com.wire.android.ui.common.ActionsViewModel
import com.wire.android.ui.common.dialogs.CustomServerDetailsDialogState
Expand Down Expand Up @@ -130,6 +131,7 @@
private val workManager: Lazy<WorkManager>,
private val isProfileQRCodeEnabledFactory: IsProfileQRCodeEnabledUseCaseProvider.Factory,
private val observeSelfUserFactory: ObserveSelfUserUseCaseProvider.Factory,
private val monitorSyncWorkUseCase: MonitorSyncWorkUseCase,
) : ActionsViewModel<WireActivityViewAction>() {

var globalAppState: GlobalAppState by mutableStateOf(GlobalAppState())
Expand Down Expand Up @@ -163,6 +165,7 @@
observeSelectedAccent()
observeLogoutState()
resetNewRegistrationAnalyticsState()
viewModelScope.launch(dispatchers.io()) { monitorSyncWorkUseCase() }
}

private suspend fun shouldEnrollToE2ei(): Boolean = observeCurrentValidUserId.first()?.let {
Expand Down Expand Up @@ -491,9 +494,9 @@

is CheckConversationInviteCodeUseCase.Result.Failure ->
globalAppState =
globalAppState.copy(
conversationJoinedDialog = JoinConversationViaCodeState.Error(result)
)
globalAppState.copy(
conversationJoinedDialog = JoinConversationViaCodeState.Error(result)

Check warning on line 498 in app/src/main/kotlin/com/wire/android/ui/WireActivityViewModel.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/WireActivityViewModel.kt#L497-L498

Added lines #L497 - L498 were not covered by tests
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

package com.wire.android.workmanager

import com.wire.android.R
import com.wire.android.feature.notification.R
import com.wire.kalium.logic.sync.ForegroundNotificationDetailsProvider

object WireForegroundNotificationDetailsProvider : ForegroundNotificationDetailsProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.wire.android.feature.StartPersistentWebsocketIfNecessaryUseCase
import com.wire.android.notification.NotificationChannelsManager
import com.wire.android.notification.WireNotificationManager
import com.wire.android.sync.InitialSyncWorker
import com.wire.android.workmanager.worker.DeleteConversationLocallyWorker
import com.wire.android.workmanager.worker.NotificationFetchWorker
import com.wire.android.workmanager.worker.PersistentWebsocketCheckWorker
Expand Down Expand Up @@ -66,6 +67,9 @@
AssetUploadObserverWorker::class.java.canonicalName ->
AssetUploadObserverWorker(appContext, workerParameters, coreLogic, notificationChannelsManager)

InitialSyncWorker::class.java.canonicalName ->
InitialSyncWorker(appContext, workerParameters, coreLogic, notificationChannelsManager)

Check warning on line 71 in app/src/main/kotlin/com/wire/android/workmanager/WireWorkerFactory.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/workmanager/WireWorkerFactory.kt#L71

Added line #L71 was not covered by tests

else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
)

val notification = NotificationCompat.Builder(applicationContext, NotificationConstants.OTHER_CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 82 in app/src/main/kotlin/com/wire/android/workmanager/worker/AssetUploadObserverWorker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/workmanager/worker/AssetUploadObserverWorker.kt#L82

Added line #L82 was not covered by tests
.setAutoCancel(true)
.setSilent(true)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
)

val notification = NotificationCompat.Builder(applicationContext, NotificationConstants.OTHER_CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 97 in app/src/main/kotlin/com/wire/android/workmanager/worker/DeleteConversationLocallyWorker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/workmanager/worker/DeleteConversationLocallyWorker.kt#L97

Added line #L97 was not covered by tests
.setAutoCancel(true)
.setSilent(true)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
)

val notification = NotificationCompat.Builder(applicationContext, NotificationConstants.MESSAGE_SYNC_CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 64 in app/src/main/kotlin/com/wire/android/workmanager/worker/NotificationFetchWorker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/workmanager/worker/NotificationFetchWorker.kt#L64

Added line #L64 was not covered by tests
.setAutoCancel(true)
.setSilent(true)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
val title = "${applicationContext.getString(R.string.app_name)} " +
applicationContext.getString(R.string.settings_service_is_running)
val notification = NotificationCompat.Builder(applicationContext, NotificationConstants.OTHER_CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon_small)
.setSmallIcon(com.wire.android.feature.notification.R.drawable.notification_icon_small)

Check warning on line 71 in app/src/main/kotlin/com/wire/android/workmanager/worker/PersistentWebsocketCheckWorker.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/workmanager/worker/PersistentWebsocketCheckWorker.kt#L71

Added line #L71 was not covered by tests
.setAutoCancel(true)
.setSilent(true)
.setCategory(NotificationCompat.CATEGORY_SERVICE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import com.wire.android.framework.TestClient
import com.wire.android.framework.TestUser
import com.wire.android.framework.TestUser.SELF_USER
import com.wire.android.services.ServicesManager
import com.wire.android.sync.MonitorSyncWorkUseCase
import com.wire.android.ui.common.dialogs.CustomServerDetailsDialogState
import com.wire.android.ui.common.dialogs.CustomServerNoNetworkDialogState
import com.wire.android.ui.common.topappbar.CommonTopAppBarViewModelTest
Expand Down Expand Up @@ -770,6 +771,7 @@ class WireActivityViewModelTest {

// Default empty values
mockUri()
coEvery { monitorSyncWorkUseCase() } returns Unit
coEvery { currentSessionFlow() } returns flowOf()
coEvery { getServerConfigUseCase(any()) } returns GetServerConfigResult.Success(newServerConfig(1).links)
coEvery { deepLinkProcessor(any(), any()) } returns DeepLinkResult.Unknown
Expand Down Expand Up @@ -860,6 +862,9 @@ class WireActivityViewModelTest {
@MockK
lateinit var observeSelfUserFactory: ObserveSelfUserUseCaseProvider.Factory

@MockK
lateinit var monitorSyncWorkUseCase: MonitorSyncWorkUseCase

private val viewModel by lazy {
WireActivityViewModel(
coreLogic = { coreLogic },
Expand All @@ -881,7 +886,8 @@ class WireActivityViewModelTest {
observeIfE2EIRequiredDuringLoginUseCaseProviderFactory = observeIfE2EIRequiredDuringLoginUseCaseProviderFactory,
workManager = { workManager },
isProfileQRCodeEnabledFactory = isProfileQRCodeEnabledFactory,
observeSelfUserFactory = observeSelfUserFactory
observeSelfUserFactory = observeSelfUserFactory,
monitorSyncWorkUseCase = monitorSyncWorkUseCase,
)
}

Expand Down
5 changes: 0 additions & 5 deletions buildSrc/src/main/kotlin/scripts/infrastructure.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
}

tasks.named<Wrapper>("wrapper") {
gradleVersion = findVersion("gradle").requiredVersion
distributionType = Wrapper.DistributionType.ALL
}

tasks.register("runUnitTests") {
description = "Runs all Unit Tests."
dependsOn(":app:test${Default.BUILD_VARIANT}UnitTest")
Expand Down
1 change: 1 addition & 0 deletions core/di/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
11 changes: 11 additions & 0 deletions core/di/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id(libs.plugins.wire.android.library.get().pluginId)
id(libs.plugins.wire.kover.get().pluginId)
alias(libs.plugins.compose.compiler)
}

dependencies {
implementation(libs.androidx.core)
implementation(libs.hilt.android)
implementation(libs.compose.material3)
}
Empty file added core/di/consumer-rules.pro
Empty file.
4 changes: 4 additions & 0 deletions core/di/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.3.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.2)" variant="all" version="8.3.2">

</issues>
Empty file added core/di/proguard-rules.pro
Empty file.
24 changes: 24 additions & 0 deletions core/di/src/main/kotlin/com/wire/android/di/KaliumCoreLogic.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Wire
* Copyright (C) 2025 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.android.di

import javax.inject.Qualifier

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class KaliumCoreLogic
1 change: 1 addition & 0 deletions core/media/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
11 changes: 11 additions & 0 deletions core/media/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id(libs.plugins.wire.android.library.get().pluginId)
id(libs.plugins.wire.kover.get().pluginId)
alias(libs.plugins.compose.compiler)
}

dependencies {
implementation(libs.androidx.core)
implementation(libs.hilt.android)
implementation(libs.compose.material3)
}
Empty file added core/media/consumer-rules.pro
Empty file.
4 changes: 4 additions & 0 deletions core/media/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.3.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.2)" variant="all" version="8.3.2">

</issues>
Empty file added core/media/proguard-rules.pro
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2024 Wire Swiss GmbH
* Copyright (C) 2025 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,16 +17,17 @@
*/
package com.wire.android.media

import android.Manifest
import android.annotation.SuppressLint
import android.content.Context
import android.content.Context.VIBRATOR_SERVICE
import android.content.pm.PackageManager
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.MediaPlayer
import android.os.Build
import android.os.VibrationEffect
import android.os.Vibrator
import android.os.VibratorManager
import com.wire.android.appLogger
import javax.inject.Inject
import javax.inject.Singleton

Expand All @@ -45,7 +46,7 @@ class PingRinger @Inject constructor(private val context: Context) {
vibratorManager?.defaultVibrator
} else {
@Suppress("DEPRECATION")
context.getSystemService(VIBRATOR_SERVICE) as Vibrator?
context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator?
}
}

Expand Down Expand Up @@ -78,23 +79,24 @@ class PingRinger @Inject constructor(private val context: Context) {
@Suppress("NestedBlockDepth")
private fun vibrateIfNeeded(isReceivingPing: Boolean) {
if (isReceivingPing) {
val hasVibratePermission = context.checkSelfPermission(Manifest.permission.VIBRATE) == PackageManager.PERMISSION_GRANTED
if (!hasVibratePermission) {
return
}
vibrator?.let {
if (!it.hasVibrator()) {
appLogger.i("Device does not support vibration")
return
}
val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
val ringerMode = audioManager?.ringerMode
if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
appLogger.i("Starting vibration")
@SuppressLint("MissingPermission")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
it.vibrate(VibrationEffect.createWaveform(VIBRATE_PATTERN, DO_NOT_REPEAT))
} else {
@Suppress("DEPRECATION")
it.vibrate(VIBRATE_PATTERN, DO_NOT_REPEAT)
}
} else {
appLogger.i("Skipping vibration")
}
}
}
Expand Down
1 change: 1 addition & 0 deletions core/notification/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
14 changes: 14 additions & 0 deletions core/notification/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id(libs.plugins.wire.android.library.get().pluginId)
id(libs.plugins.wire.kover.get().pluginId)
alias(libs.plugins.compose.compiler)
}

dependencies {
implementation(projects.core.media)
implementation("com.wire.kalium:kalium-common")
implementation("com.wire.kalium:kalium-data")
implementation(libs.androidx.core)
implementation(libs.hilt.android)
implementation(libs.compose.material3)
}
Empty file.
4 changes: 4 additions & 0 deletions core/notification/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.3.2" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.2)" variant="all" version="8.3.2">

</issues>
Empty file.
Loading