mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
replacing DEBUG build config flag with injectable property
This commit is contained in:
parent
b6d052e58d
commit
cc4aae0f4a
@ -41,6 +41,7 @@ import com.vanniktech.emoji.EmojiManager
|
||||
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import im.vector.app.features.call.webrtc.WebRtcCallManager
|
||||
import im.vector.app.features.configuration.VectorConfiguration
|
||||
@ -99,6 +100,7 @@ class VectorApplication :
|
||||
@Inject lateinit var flipperProxy: FlipperProxy
|
||||
@Inject lateinit var matrix: Matrix
|
||||
@Inject lateinit var fcmHelper: FcmHelper
|
||||
@Inject lateinit var buildMeta: BuildMeta
|
||||
|
||||
// font thread handler
|
||||
private var fontThreadHandler: Handler? = null
|
||||
@ -127,12 +129,12 @@ class VectorApplication :
|
||||
.filterIsInstance(JitsiMeetDefaultLogHandler::class.java)
|
||||
.forEach { Timber.uproot(it) }
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (buildMeta.isDebug) {
|
||||
Timber.plant(Timber.DebugTree())
|
||||
}
|
||||
Timber.plant(vectorFileLogger)
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (buildMeta.isDebug) {
|
||||
Stetho.initializeWithDefaults(this)
|
||||
}
|
||||
logInfo()
|
||||
@ -148,7 +150,7 @@ class VectorApplication :
|
||||
R.array.com_google_android_gms_fonts_certs
|
||||
)
|
||||
FontsContractCompat.requestFont(this, fontRequest, emojiCompatFontProvider, getFontThreadHandler())
|
||||
VectorLocale.init(this)
|
||||
VectorLocale.init(this, buildMeta)
|
||||
ThemeUtils.init(this)
|
||||
vectorConfiguration.applyToApplicationContext()
|
||||
|
||||
|
@ -24,6 +24,7 @@ import im.vector.app.BuildConfig
|
||||
import im.vector.app.config.Analytics
|
||||
import im.vector.app.config.Config
|
||||
import im.vector.app.config.KeySharingStrategy
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.features.analytics.AnalyticsConfig
|
||||
import im.vector.app.features.call.webrtc.VoipConfig
|
||||
import im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy
|
||||
@ -36,8 +37,8 @@ import im.vector.app.features.raw.wellknown.CryptoConfig
|
||||
object ConfigurationModule {
|
||||
|
||||
@Provides
|
||||
fun providesAnalyticsConfig(): AnalyticsConfig {
|
||||
val config: Analytics = when (BuildConfig.DEBUG) {
|
||||
fun providesAnalyticsConfig(buildMeta: BuildMeta): AnalyticsConfig {
|
||||
val config: Analytics = when (buildMeta.isDebug) {
|
||||
true -> Config.DEBUG_ANALYTICS_CONFIG
|
||||
false -> Config.RELEASE_ANALYTICS_CONFIG
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import android.content.SharedPreferences
|
||||
import android.content.res.Resources
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil
|
||||
import android.os.Build
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
@ -236,7 +237,11 @@ object VectorStaticModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun providesBuildMeta() = BuildMeta()
|
||||
fun providesBuildMeta() = BuildMeta(
|
||||
isDebug = BuildConfig.DEBUG,
|
||||
sdkInt = Build.VERSION.SDK_INT,
|
||||
applicationId = BuildConfig.APPLICATION_ID,
|
||||
)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
|
@ -53,7 +53,6 @@ import com.google.android.material.appbar.MaterialToolbar
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import dagger.hilt.android.EntryPointAccessors
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.di.ActivityEntryPoint
|
||||
@ -67,6 +66,7 @@ import im.vector.app.core.extensions.restart
|
||||
import im.vector.app.core.extensions.setTextOrHide
|
||||
import im.vector.app.core.extensions.singletonEntryPoint
|
||||
import im.vector.app.core.extensions.toMvRxBundle
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.AndroidSystemSettingsProvider
|
||||
import im.vector.app.core.utils.ToolbarConfig
|
||||
import im.vector.app.core.utils.toast
|
||||
@ -155,11 +155,9 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
||||
protected lateinit var bugReporter: BugReporter
|
||||
private lateinit var pinLocker: PinLocker
|
||||
|
||||
@Inject
|
||||
lateinit var rageShake: RageShake
|
||||
|
||||
@Inject
|
||||
lateinit var fontScalePreferences: FontScalePreferences
|
||||
@Inject lateinit var rageShake: RageShake
|
||||
@Inject lateinit var buildMeta: BuildMeta
|
||||
@Inject lateinit var fontScalePreferences: FontScalePreferences
|
||||
|
||||
lateinit var navigator: Navigator
|
||||
private set
|
||||
@ -409,7 +407,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
||||
}
|
||||
DebugReceiver
|
||||
.getIntentFilter(this)
|
||||
.takeIf { BuildConfig.DEBUG }
|
||||
.takeIf { buildMeta.isDebug }
|
||||
?.let {
|
||||
debugReceiver = DebugReceiver()
|
||||
registerReceiver(debugReceiver, it)
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package im.vector.app.core.resources
|
||||
|
||||
import android.os.Build
|
||||
|
||||
data class BuildMeta(
|
||||
val sdkInt: Int = Build.VERSION.SDK_INT
|
||||
val isDebug: Boolean,
|
||||
val sdkInt: Int,
|
||||
val applicationId: String,
|
||||
)
|
||||
|
@ -19,10 +19,15 @@ package im.vector.app.features.analytics.impl
|
||||
import android.content.Context
|
||||
import com.posthog.android.PostHog
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.features.analytics.AnalyticsConfig
|
||||
import javax.inject.Inject
|
||||
|
||||
class PostHogFactory @Inject constructor(private val context: Context, private val analyticsConfig: AnalyticsConfig) {
|
||||
class PostHogFactory @Inject constructor(
|
||||
private val context: Context,
|
||||
private val analyticsConfig: AnalyticsConfig,
|
||||
private val buildMeta: BuildMeta,
|
||||
) {
|
||||
|
||||
fun createPosthog(): PostHog {
|
||||
return PostHog.Builder(context, analyticsConfig.postHogApiKey, analyticsConfig.postHogHost)
|
||||
@ -43,7 +48,7 @@ class PostHogFactory @Inject constructor(private val context: Context, private v
|
||||
}
|
||||
|
||||
private fun getLogLevel(): PostHog.LogLevel {
|
||||
return if (BuildConfig.DEBUG) {
|
||||
return if (buildMeta.isDebug) {
|
||||
PostHog.LogLevel.DEBUG
|
||||
} else {
|
||||
PostHog.LogLevel.INFO
|
||||
|
@ -23,11 +23,11 @@ import android.view.ViewGroup
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.observeK
|
||||
import im.vector.app.core.extensions.replaceChildFragment
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.startSharePlainTextIntent
|
||||
import im.vector.app.databinding.FragmentHomeDrawerBinding
|
||||
import im.vector.app.features.analytics.plan.MobileScreen
|
||||
@ -43,7 +43,8 @@ import javax.inject.Inject
|
||||
class HomeDrawerFragment @Inject constructor(
|
||||
private val session: Session,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val avatarRenderer: AvatarRenderer
|
||||
private val avatarRenderer: AvatarRenderer,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : VectorBaseFragment<FragmentHomeDrawerBinding>() {
|
||||
|
||||
private lateinit var sharedActionViewModel: HomeSharedActionViewModel
|
||||
@ -112,7 +113,7 @@ class HomeDrawerFragment @Inject constructor(
|
||||
}
|
||||
|
||||
// Debug menu
|
||||
views.homeDrawerHeaderDebugView.isVisible = BuildConfig.DEBUG && vectorPreferences.developerMode()
|
||||
views.homeDrawerHeaderDebugView.isVisible = buildMeta.isDebug && vectorPreferences.developerMode()
|
||||
views.homeDrawerHeaderDebugView.debouncedClicks {
|
||||
sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer)
|
||||
navigator.openDebug(requireActivity())
|
||||
|
@ -26,6 +26,7 @@ import androidx.core.content.pm.ShortcutManagerCompat
|
||||
import androidx.core.graphics.drawable.IconCompat
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.core.glide.GlideApp
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.DimensionConverter
|
||||
import im.vector.app.features.MainActivity
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
@ -35,13 +36,15 @@ import javax.inject.Inject
|
||||
private val useAdaptiveIcon = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
private const val adaptiveIconSizeDp = 108
|
||||
private const val adaptiveIconOuterSidesDp = 18
|
||||
private const val directShareCategory = BuildConfig.APPLICATION_ID + ".SHORTCUT_SHARE"
|
||||
|
||||
class ShortcutCreator @Inject constructor(
|
||||
private val context: Context,
|
||||
private val avatarRenderer: AvatarRenderer,
|
||||
private val dimensionConverter: DimensionConverter
|
||||
private val dimensionConverter: DimensionConverter,
|
||||
buildMeta: BuildMeta,
|
||||
) {
|
||||
|
||||
private val directShareCategory = buildMeta.applicationId + ".SHORTCUT_SHARE"
|
||||
private val adaptiveIconSize = dimensionConverter.dpToPx(adaptiveIconSizeDp)
|
||||
private val adaptiveIconOuterSides = dimensionConverter.dpToPx(adaptiveIconOuterSidesDp)
|
||||
private val iconSize by lazy {
|
||||
|
@ -33,6 +33,7 @@ import im.vector.app.core.di.MavericksAssistedViewModelFactory
|
||||
import im.vector.app.core.di.hiltMavericksViewModelFactory
|
||||
import im.vector.app.core.mvrx.runCatchingToAsync
|
||||
import im.vector.app.core.platform.VectorViewModel
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.core.utils.BehaviorDataSource
|
||||
import im.vector.app.features.analytics.AnalyticsTracker
|
||||
@ -139,6 +140,7 @@ class TimelineViewModel @AssistedInject constructor(
|
||||
private val stopLiveLocationShareUseCase: StopLiveLocationShareUseCase,
|
||||
private val redactLiveLocationShareEventUseCase: RedactLiveLocationShareEventUseCase,
|
||||
private val cryptoConfig: CryptoConfig,
|
||||
buildMeta: BuildMeta,
|
||||
timelineFactory: TimelineFactory,
|
||||
spaceStateHandler: SpaceStateHandler,
|
||||
) : VectorViewModel<RoomDetailViewState, RoomDetailAction, RoomDetailViewEvents>(initialState),
|
||||
@ -152,7 +154,7 @@ class TimelineViewModel @AssistedInject constructor(
|
||||
val timeline = timelineFactory.createTimeline(viewModelScope, room, eventId, initialState.rootThreadEventId)
|
||||
|
||||
// Same lifecycle than the ViewModel (survive to screen rotation)
|
||||
val previewUrlRetriever = PreviewUrlRetriever(session, viewModelScope)
|
||||
val previewUrlRetriever = PreviewUrlRetriever(session, viewModelScope, buildMeta)
|
||||
|
||||
// Slot to keep a pending action during permission request
|
||||
var pendingAction: RoomDetailAction? = null
|
||||
|
@ -21,6 +21,7 @@ import android.media.AudioAttributes
|
||||
import android.media.MediaPlayer
|
||||
import androidx.core.content.FileProvider
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.features.home.room.detail.timeline.helper.AudioMessagePlaybackTracker
|
||||
import im.vector.app.features.voice.VoiceFailure
|
||||
import im.vector.app.features.voice.VoiceRecorder
|
||||
@ -43,6 +44,7 @@ import javax.inject.Inject
|
||||
class AudioMessageHelper @Inject constructor(
|
||||
private val context: Context,
|
||||
private val playbackTracker: AudioMessagePlaybackTracker,
|
||||
private val buildMeta: BuildMeta,
|
||||
voiceRecorderProvider: VoiceRecorderProvider
|
||||
) {
|
||||
private var mediaPlayer: MediaPlayer? = null
|
||||
@ -88,7 +90,7 @@ class AudioMessageHelper @Inject constructor(
|
||||
|
||||
try {
|
||||
voiceMessageFile?.let {
|
||||
val outputFileUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileProvider", it, "Voice message.${it.extension}")
|
||||
val outputFileUri = FileProvider.getUriForFile(context, buildMeta.applicationId + ".fileProvider", it, "Voice message.${it.extension}")
|
||||
return outputFileUri
|
||||
.toMultiPickerAudioType(context)
|
||||
?.apply {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package im.vector.app.features.home.room.detail.timeline.url
|
||||
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@ -27,7 +27,8 @@ import org.matrix.android.sdk.api.session.room.timeline.getLatestEventId
|
||||
|
||||
class PreviewUrlRetriever(
|
||||
session: Session,
|
||||
private val coroutineScope: CoroutineScope
|
||||
private val coroutineScope: CoroutineScope,
|
||||
private val buildMeta: BuildMeta,
|
||||
) {
|
||||
private val mediaService = session.mediaService()
|
||||
|
||||
@ -77,7 +78,7 @@ class PreviewUrlRetriever(
|
||||
mediaService.getPreviewUrl(
|
||||
url = urlToRetrieve,
|
||||
timestamp = null,
|
||||
cacheStrategy = if (BuildConfig.DEBUG) CacheStrategy.NoCache else CacheStrategy.TtlCache(CACHE_VALIDITY, false)
|
||||
cacheStrategy = if (buildMeta.isDebug) CacheStrategy.NoCache else CacheStrategy.TtlCache(CACHE_VALIDITY, false)
|
||||
)
|
||||
}.fold(
|
||||
{
|
||||
|
@ -27,9 +27,9 @@ import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.hideKeyboard
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.ensureProtocol
|
||||
import im.vector.app.core.utils.openUrlInChromeCustomTab
|
||||
import im.vector.app.databinding.FragmentLoginServerUrlFormBinding
|
||||
@ -43,7 +43,9 @@ import javax.inject.Inject
|
||||
/**
|
||||
* In this screen, the user is prompted to enter a homeserver url.
|
||||
*/
|
||||
class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment<FragmentLoginServerUrlFormBinding>() {
|
||||
class LoginServerUrlFormFragment @Inject constructor(
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractLoginFragment<FragmentLoginServerUrlFormBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginServerUrlFormBinding {
|
||||
return FragmentLoginServerUrlFormBinding.inflate(inflater, container, false)
|
||||
@ -99,7 +101,7 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment<F
|
||||
views.loginServerUrlFormNotice.text = getString(R.string.login_server_url_form_common_notice)
|
||||
}
|
||||
}
|
||||
val completions = state.knownCustomHomeServersUrls + if (BuildConfig.DEBUG) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
val completions = state.knownCustomHomeServersUrls + if (buildMeta.isDebug) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
views.loginServerUrlFormHomeServerUrl.setAdapter(
|
||||
ArrayAdapter(
|
||||
requireContext(),
|
||||
|
@ -25,6 +25,7 @@ import androidx.core.view.isVisible
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.databinding.FragmentLoginSplashBinding
|
||||
import im.vector.app.features.analytics.plan.MobileScreen
|
||||
import im.vector.app.features.settings.VectorPreferences
|
||||
@ -36,7 +37,8 @@ import javax.inject.Inject
|
||||
* In this screen, the user is viewing an introduction to what he can do with this application.
|
||||
*/
|
||||
class LoginSplashFragment @Inject constructor(
|
||||
private val vectorPreferences: VectorPreferences
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractLoginFragment<FragmentLoginSplashBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSplashBinding {
|
||||
@ -57,7 +59,7 @@ class LoginSplashFragment @Inject constructor(
|
||||
private fun setupViews() {
|
||||
views.loginSplashSubmit.debouncedClicks { getStarted() }
|
||||
|
||||
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
|
||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||
views.loginSplashVersion.isVisible = true
|
||||
@SuppressLint("SetTextI18n")
|
||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
||||
|
@ -26,9 +26,9 @@ import android.widget.ArrayAdapter
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.hideKeyboard
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.ensureProtocol
|
||||
import im.vector.app.databinding.FragmentLoginServerUrlForm2Binding
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
@ -43,7 +43,9 @@ import javax.net.ssl.HttpsURLConnection
|
||||
/**
|
||||
* In this screen, the user is prompted to enter a homeserver url.
|
||||
*/
|
||||
class LoginServerUrlFormFragment2 @Inject constructor() : AbstractLoginFragment2<FragmentLoginServerUrlForm2Binding>() {
|
||||
class LoginServerUrlFormFragment2 @Inject constructor(
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractLoginFragment2<FragmentLoginServerUrlForm2Binding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginServerUrlForm2Binding {
|
||||
return FragmentLoginServerUrlForm2Binding.inflate(inflater, container, false)
|
||||
@ -80,7 +82,7 @@ class LoginServerUrlFormFragment2 @Inject constructor() : AbstractLoginFragment2
|
||||
}
|
||||
|
||||
private fun setupUi(state: LoginViewState2) {
|
||||
val completions = state.knownCustomHomeServersUrls + if (BuildConfig.DEBUG) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
val completions = state.knownCustomHomeServersUrls + if (buildMeta.isDebug) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
views.loginServerUrlFormHomeServerUrl.setAdapter(
|
||||
ArrayAdapter(
|
||||
requireContext(),
|
||||
|
@ -23,6 +23,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.databinding.FragmentLoginSplash2Binding
|
||||
import im.vector.app.features.settings.VectorPreferences
|
||||
import javax.inject.Inject
|
||||
@ -32,7 +33,8 @@ import javax.inject.Inject
|
||||
* This is the new splash screen.
|
||||
*/
|
||||
class LoginSplashSignUpSignInSelectionFragment2 @Inject constructor(
|
||||
private val vectorPreferences: VectorPreferences
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractLoginFragment2<FragmentLoginSplash2Binding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginSplash2Binding {
|
||||
@ -49,7 +51,7 @@ class LoginSplashSignUpSignInSelectionFragment2 @Inject constructor(
|
||||
views.loginSignupSigninSignUp.setOnClickListener { signUp() }
|
||||
views.loginSignupSigninSignIn.setOnClickListener { signIn() }
|
||||
|
||||
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
|
||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||
views.loginSplashVersion.isVisible = true
|
||||
@SuppressLint("SetTextI18n")
|
||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
||||
|
@ -49,6 +49,7 @@ import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.createIgnoredUri
|
||||
import im.vector.app.core.platform.PendingIntentCompat
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.resources.StringProvider
|
||||
import im.vector.app.core.services.CallAndroidService
|
||||
import im.vector.app.core.time.Clock
|
||||
@ -79,6 +80,7 @@ class NotificationUtils @Inject constructor(
|
||||
private val stringProvider: StringProvider,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val clock: Clock,
|
||||
private val buildMeta: BuildMeta,
|
||||
) {
|
||||
|
||||
companion object {
|
||||
|
@ -30,6 +30,7 @@ import com.google.android.material.textfield.TextInputLayout
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.hideKeyboard
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.ensureProtocol
|
||||
import im.vector.app.core.utils.openUrlInChromeCustomTab
|
||||
import im.vector.app.databinding.FragmentLoginServerUrlFormBinding
|
||||
@ -47,7 +48,9 @@ import javax.inject.Inject
|
||||
/**
|
||||
* In this screen, the user is prompted to enter a homeserver url.
|
||||
*/
|
||||
class FtueAuthServerUrlFormFragment @Inject constructor() : AbstractFtueAuthFragment<FragmentLoginServerUrlFormBinding>() {
|
||||
class FtueAuthServerUrlFormFragment @Inject constructor(
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractFtueAuthFragment<FragmentLoginServerUrlFormBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginServerUrlFormBinding {
|
||||
return FragmentLoginServerUrlFormBinding.inflate(inflater, container, false)
|
||||
@ -103,7 +106,7 @@ class FtueAuthServerUrlFormFragment @Inject constructor() : AbstractFtueAuthFrag
|
||||
views.loginServerUrlFormNotice.text = getString(R.string.login_server_url_form_common_notice)
|
||||
}
|
||||
}
|
||||
val completions = state.knownCustomHomeServersUrls + if (BuildConfig.DEBUG) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
val completions = state.knownCustomHomeServersUrls + if (buildMeta.isDebug) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
views.loginServerUrlFormHomeServerUrl.setAdapter(
|
||||
ArrayAdapter(
|
||||
requireContext(),
|
||||
|
@ -31,6 +31,7 @@ import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.incrementByOneAndWrap
|
||||
import im.vector.app.core.extensions.setCurrentItem
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.databinding.FragmentFtueSplashCarouselBinding
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
@ -48,7 +49,8 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val vectorFeatures: VectorFeatures,
|
||||
private val carouselController: SplashCarouselController,
|
||||
private val carouselStateFactory: SplashCarouselStateFactory
|
||||
private val carouselStateFactory: SplashCarouselStateFactory,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractFtueAuthFragment<FragmentFtueSplashCarouselBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueSplashCarouselBinding {
|
||||
@ -76,7 +78,7 @@ class FtueAuthSplashCarouselFragment @Inject constructor(
|
||||
debouncedClicks { alreadyHaveAnAccount() }
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
|
||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||
views.loginSplashVersion.isVisible = true
|
||||
@SuppressLint("SetTextI18n")
|
||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}#${BuildConfig.BUILD_NUMBER}\n" +
|
||||
|
@ -24,6 +24,7 @@ import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.databinding.FragmentFtueAuthSplashBinding
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
@ -36,7 +37,8 @@ import javax.inject.Inject
|
||||
*/
|
||||
class FtueAuthSplashFragment @Inject constructor(
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val vectorFeatures: VectorFeatures
|
||||
private val vectorFeatures: VectorFeatures,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : AbstractFtueAuthFragment<FragmentFtueAuthSplashBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueAuthSplashBinding {
|
||||
@ -59,7 +61,7 @@ class FtueAuthSplashFragment @Inject constructor(
|
||||
debouncedClicks { alreadyHaveAnAccount() }
|
||||
}
|
||||
|
||||
if (BuildConfig.DEBUG || vectorPreferences.developerMode()) {
|
||||
if (buildMeta.isDebug || vectorPreferences.developerMode()) {
|
||||
views.loginSplashVersion.isVisible = true
|
||||
@SuppressLint("SetTextI18n")
|
||||
views.loginSplashVersion.text = "Version : ${BuildConfig.VERSION_NAME}\n" +
|
||||
|
@ -22,6 +22,7 @@ import androidx.core.content.edit
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.DefaultSharedPreferences
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import timber.log.Timber
|
||||
@ -53,12 +54,14 @@ object VectorLocale {
|
||||
private set
|
||||
|
||||
private lateinit var context: Context
|
||||
private lateinit var buildMeta: BuildMeta
|
||||
|
||||
/**
|
||||
* Init this object.
|
||||
*/
|
||||
fun init(context: Context) {
|
||||
fun init(context: Context, buildMeta: BuildMeta) {
|
||||
this.context = context
|
||||
this.buildMeta = buildMeta
|
||||
val preferences = DefaultSharedPreferences.getInstance(context)
|
||||
|
||||
if (preferences.contains(APPLICATION_LOCALE_LANGUAGE_KEY)) {
|
||||
@ -174,7 +177,7 @@ object VectorLocale {
|
||||
.setScript(script)
|
||||
.build()
|
||||
} catch (exception: IllformedLocaleException) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (buildMeta.isDebug) {
|
||||
throw exception
|
||||
}
|
||||
// Ignore this locale in production
|
||||
|
@ -26,6 +26,7 @@ import com.squareup.seismic.ShakeDetector
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.DefaultSharedPreferences
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.time.Clock
|
||||
import im.vector.app.features.disclaimer.SHARED_PREF_KEY
|
||||
import im.vector.app.features.home.ShortcutsHandler
|
||||
@ -38,6 +39,7 @@ import javax.inject.Inject
|
||||
class VectorPreferences @Inject constructor(
|
||||
private val context: Context,
|
||||
private val clock: Clock,
|
||||
private val buildMeta: BuildMeta,
|
||||
) {
|
||||
|
||||
companion object {
|
||||
@ -364,7 +366,7 @@ class VectorPreferences @Inject constructor(
|
||||
}
|
||||
|
||||
fun failFast(): Boolean {
|
||||
return BuildConfig.DEBUG || (developerMode() && defaultPrefs.getBoolean(SETTINGS_DEVELOPER_MODE_FAIL_FAST_PREFERENCE_KEY, false))
|
||||
return buildMeta.isDebug || (developerMode() && defaultPrefs.getBoolean(SETTINGS_DEVELOPER_MODE_FAIL_FAST_PREFERENCE_KEY, false))
|
||||
}
|
||||
|
||||
fun didAskUserToEnableSessionPush(): Boolean {
|
||||
|
@ -22,6 +22,7 @@ import im.vector.app.BuildConfig
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.orEmpty
|
||||
import im.vector.app.core.preference.VectorPreference
|
||||
import im.vector.app.core.resources.BuildMeta
|
||||
import im.vector.app.core.utils.FirstThrottler
|
||||
import im.vector.app.core.utils.copyToClipboard
|
||||
import im.vector.app.core.utils.openAppSettingsPage
|
||||
@ -32,7 +33,8 @@ import org.matrix.android.sdk.api.Matrix
|
||||
import javax.inject.Inject
|
||||
|
||||
class VectorSettingsHelpAboutFragment @Inject constructor(
|
||||
private val versionProvider: VersionProvider
|
||||
private val versionProvider: VersionProvider,
|
||||
private val buildMeta: BuildMeta,
|
||||
) : VectorSettingsBaseFragment() {
|
||||
|
||||
override var titleRes = R.string.preference_root_help_about
|
||||
@ -66,7 +68,7 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
|
||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_VERSION_PREFERENCE_KEY)!!.let {
|
||||
it.summary = buildString {
|
||||
append(versionProvider.getVersion(longFormat = false, useBuildNumber = true))
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (buildMeta.isDebug) {
|
||||
append(" ")
|
||||
append(BuildConfig.GIT_BRANCH_NAME)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user