Skip to content
Merged
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
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
PURPLE := \033[0;35m
NC := \033[0m # No Color (reset)

# Staging apk
STAGING_APK_PATH := $(wildcard app/build/outputs/apk/staging/debug/com.*.apk)

# Get user id for sample work profile
WORK_PROFILE := $(shell adb shell pm list users | grep "Managed Profile")
WORK_PROFILE_ID := $(shell echo "$(WORK_PROFILE)" | awk -F'[:{}]' '{print $$2}')

assemble/staging-debug:
@echo "🔧️$(PURPLE)Assembling staging debug build...$(NC)"
./gradlew assembleStagingDebug

install/staging-debug:
@echo "🚀$(PURPLE)Installing staging debug build on connected device...$(NC)"
adb install -r $(STAGING_APK_PATH)

emm/install/staging-debug:
@echo "🚀$(PURPLE)Installing staging debug build on connected device on work-profile...$(NC)"
adb install --user $(WORK_PROFILE_ID) -r $(STAGING_APK_PATH)
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ dependencies {
implementation(libs.aboutLibraries.compose.m3)
implementation(libs.compose.qr.code)
implementation(libs.audio.amplituda)
implementation(libs.enterprise.feedback)

// screenshot testing
screenshotTestImplementation(libs.compose.ui.tooling)
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@
android:resource="@xml/provider_paths" />
</provider>

<meta-data
android:name="android.content.APP_RESTRICTIONS"
android:resource="@xml/app_restrictions" />

<receiver
android:name=".notification.broadcastreceivers.NotificationReplyReceiver"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.config

import com.wire.android.BuildConfig
import com.wire.android.emm.ManagedServerConfig
import com.wire.kalium.logic.configuration.server.ServerConfig
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class ServerConfigProvider @Inject constructor() {

fun getDefaultServerConfig(managedServerConfig: ManagedServerConfig? = null): ServerConfig.Links {
return if (managedServerConfig != null) {
with(managedServerConfig) {
ServerConfig.Links(
api = endpoints.backendURL,
accounts = endpoints.accountsURL,
webSocket = endpoints.backendWSURL,
teams = endpoints.teamsURL,
blackList = endpoints.blackListURL,
website = endpoints.websiteURL,
title = title,
isOnPremises = true, // EMM configuration always treated as on-premises
apiProxy = null
)
}
} else {
ServerConfig.Links(
api = BuildConfig.DEFAULT_BACKEND_URL_BASE_API,
accounts = BuildConfig.DEFAULT_BACKEND_URL_ACCOUNTS,
webSocket = BuildConfig.DEFAULT_BACKEND_URL_BASE_WEBSOCKET,
teams = BuildConfig.DEFAULT_BACKEND_URL_TEAM_MANAGEMENT,
blackList = BuildConfig.DEFAULT_BACKEND_URL_BLACKLIST,
website = BuildConfig.DEFAULT_BACKEND_URL_WEBSITE,
title = BuildConfig.DEFAULT_BACKEND_TITLE,
isOnPremises = false,
apiProxy = null
)
}
}
}

private val staticServerConfigProvider = ServerConfigProvider()

fun getDefaultServerConfig(managedServerConfig: ManagedServerConfig? = null): ServerConfig.Links {
return staticServerConfigProvider.getDefaultServerConfig(managedServerConfig)
}

val DefaultServerConfig get() = getDefaultServerConfig()
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* 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 android.content.Context
import com.wire.android.BuildConfig
import com.wire.android.config.ServerConfigProvider
import com.wire.android.emm.ManagedConfigurationsManager
import com.wire.android.emm.ManagedConfigurationsManagerImpl
import com.wire.android.util.EMPTY
import com.wire.android.util.dispatchers.DispatcherProvider
import com.wire.kalium.logic.configuration.server.ServerConfig
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Named
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class ManagedConfigurationsModule {

@Provides
@Singleton
fun provideServerConfigProvider(): ServerConfigProvider = ServerConfigProvider()

@Provides
@Singleton
fun provideManagedConfigurationsRepository(
@ApplicationContext context: Context,
dispatcherProvider: DispatcherProvider,
serverConfigProvider: ServerConfigProvider
): ManagedConfigurationsManager {
return ManagedConfigurationsManagerImpl(context, dispatcherProvider, serverConfigProvider)
}

@Provides
fun provideCurrentServerConfig(
managedConfigurationsManager: ManagedConfigurationsManager
): ServerConfig.Links {
return if (BuildConfig.EMM_SUPPORT_ENABLED) {
// Returns the current resolved server configuration links, which could be either managed or default
managedConfigurationsManager.currentServerConfig
} else {
// If EMM support is disabled, always return the static default server configuration links
provideServerConfigProvider().getDefaultServerConfig(null)
}
}

@Provides
@Named("ssoCodeConfig")
fun provideCurrentSSOCodeConfig(
managedConfigurationsManager: ManagedConfigurationsManager
): String {
return if (BuildConfig.EMM_SUPPORT_ENABLED) {
// Returns the current resolved SSO code from managed configurations, or empty if none
managedConfigurationsManager.currentSSOCodeConfig
} else {
// If EMM support is disabled, always return empty SSO code
String.EMPTY
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,11 @@
* 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.config
package com.wire.android.emm

import com.wire.android.BuildConfig
import com.wire.kalium.logic.configuration.server.ServerConfig
enum class ManagedConfigurationsKeys {
DEFAULT_SERVER_URLS,
SSO_CODE;

val DefaultServerConfig = ServerConfig.Links(
api = BuildConfig.DEFAULT_BACKEND_URL_BASE_API,
accounts = BuildConfig.DEFAULT_BACKEND_URL_ACCOUNTS,
webSocket = BuildConfig.DEFAULT_BACKEND_URL_BASE_WEBSOCKET,
teams = BuildConfig.DEFAULT_BACKEND_URL_TEAM_MANAGEMENT,
blackList = BuildConfig.DEFAULT_BACKEND_URL_BLACKLIST,
website = BuildConfig.DEFAULT_BACKEND_URL_WEBSITE,
title = BuildConfig.DEFAULT_BACKEND_TITLE,
isOnPremises = false,
apiProxy = null
)

fun ServerConfig.Links?.orDefault() = this ?: DefaultServerConfig
fun asKey() = name.lowercase()
}

Check warning on line 25 in app/src/main/kotlin/com/wire/android/emm/ManagedConfigurationsKeys.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/emm/ManagedConfigurationsKeys.kt#L25

Added line #L25 was not covered by tests
Loading
Loading