diff --git a/app/src/main/kotlin/io/element/android/x/di/AppModule.kt b/app/src/main/kotlin/io/element/android/x/di/AppModule.kt index e9b9ff84e6..a121e0a6fb 100644 --- a/app/src/main/kotlin/io/element/android/x/di/AppModule.kt +++ b/app/src/main/kotlin/io/element/android/x/di/AppModule.kt @@ -23,6 +23,7 @@ import androidx.preference.PreferenceManager import com.squareup.anvil.annotations.ContributesTo import dagger.Module import dagger.Provides +import io.element.android.appconfig.ApplicationConfig import io.element.android.features.messages.impl.timeline.components.customreaction.DefaultEmojibaseProvider import io.element.android.features.messages.impl.timeline.components.customreaction.EmojibaseProvider import io.element.android.libraries.core.coroutine.CoroutineDispatchers @@ -79,10 +80,9 @@ object AppModule { fun providesBuildMeta(@ApplicationContext context: Context, buildType: BuildType) = BuildMeta( isDebuggable = BuildConfig.DEBUG, buildType = buildType, - applicationName = context.getString(R.string.app_name), - productionApplicationName = "Element", - // Use the same name for desktop and mobile for now - desktopApplicationName = context.getString(R.string.app_name), + applicationName = ApplicationConfig.APPLICATION_NAME.takeIf { it.isNotEmpty() } ?: context.getString(R.string.app_name), + productionApplicationName = ApplicationConfig.PRODUCTION_APPLICATION_NAME, + desktopApplicationName = ApplicationConfig.DESKTOP_APPLICATION_NAME, applicationId = BuildConfig.APPLICATION_ID, // TODO EAx Config.LOW_PRIVACY_LOG_ENABLE, lowPrivacyLoggingEnabled = false, diff --git a/appconfig/src/main/kotlin/io/element/android/appconfig/ApplicationConfig.kt b/appconfig/src/main/kotlin/io/element/android/appconfig/ApplicationConfig.kt new file mode 100644 index 0000000000..21af158ad6 --- /dev/null +++ b/appconfig/src/main/kotlin/io/element/android/appconfig/ApplicationConfig.kt @@ -0,0 +1,43 @@ +/* + * 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.appconfig + +object ApplicationConfig { + /** + * Application name used in the UI for string. If empty, the value is taken from the resources `R.string.app_name`. + * Note that this value is not used for the launcher icon. + * For Element, the value is empty, and so read from `R.string.app_name`, which depends on the build variant: + * - "Element X" for release builds; + * - "Element X dbg" for debug builds; + * - "Element X nightly" for nightly builds. + */ + const val APPLICATION_NAME: String = "" + + /** + * Used in the strings to reference the Element client. + * Cannot be empty. + * For Element, the value is "Element". + */ + const val PRODUCTION_APPLICATION_NAME: String = "Element" + + /** + * Used in the strings to reference the Element Desktop client, for instance Element Web. + * Cannot be empty. + * For Element, the value is "Element". We use the same name for desktop and mobile for now. + */ + const val DESKTOP_APPLICATION_NAME: String = "Element" +}