Browse Source

Add ApplicationConfig object to help tweaking the application / brand name used across the application.

pull/2686/head
ganfra 1 month ago committed by Benoit Marty
parent
commit
447a10cb06
  1. 8
      app/src/main/kotlin/io/element/android/x/di/AppModule.kt
  2. 43
      appconfig/src/main/kotlin/io/element/android/appconfig/ApplicationConfig.kt

8
app/src/main/kotlin/io/element/android/x/di/AppModule.kt

@ -23,6 +23,7 @@ import androidx.preference.PreferenceManager @@ -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 { @@ -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,

43
appconfig/src/main/kotlin/io/element/android/appconfig/ApplicationConfig.kt

@ -0,0 +1,43 @@ @@ -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"
}
Loading…
Cancel
Save