From 3560ac95d1b55eda07e6b77b337368139134898f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 9 Jun 2022 08:57:33 +0200 Subject: [PATCH] Create a Kotlin Config object in vector-config module, for easy configuration. --- .../main/java/im/vector/app/config/Config.kt | 37 +++++++++++++++++++ .../im/vector/app/features/VectorFeatures.kt | 12 +----- 2 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 vector-config/src/main/java/im/vector/app/config/Config.kt diff --git a/vector-config/src/main/java/im/vector/app/config/Config.kt b/vector-config/src/main/java/im/vector/app/config/Config.kt new file mode 100644 index 0000000000..414fbcfd8e --- /dev/null +++ b/vector-config/src/main/java/im/vector/app/config/Config.kt @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 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 im.vector.app.config + +/** + * Set of flags to configure the application. + */ +object Config { + /** + * Flag to allow external UnifiedPush distributors to be chosen by the user. + * + * Set to true to allow any available external UnifiedPush distributor to be chosen by the user. + * - For Gplay variant it means that FCM will be used by default, but user can choose another UnifiedPush distributor; + * - For F-Droid variant, it means that background polling will be used by default, but user can choose another UnifiedPush distributor. + * + * Set to false to prevent usage of external UnifiedPush distributors. + * - For Gplay variant it means that only FCM will be used; + * - For F-Droid variant, it means that only background polling will be available to the user. + * + * *Note*: Changing the value from `true` to `false` when the app is already installed on users' phone may have unexpected behavior. + */ + const val ALLOW_EXTERNAL_UNIFIED_PUSH_DISTRIBUTORS = true +} diff --git a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt index 85b04dfbdc..6fe4beff95 100644 --- a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt +++ b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt @@ -17,6 +17,7 @@ package im.vector.app.features import im.vector.app.BuildConfig +import im.vector.app.config.Config interface VectorFeatures { @@ -45,15 +46,6 @@ class DefaultVectorFeatures : VectorFeatures { override fun isOnboardingPersonalizeEnabled() = false override fun isOnboardingCombinedRegisterEnabled() = false override fun isOnboardingCombinedLoginEnabled() = false - - /** - * Return false to prevent usage of external UnifiedPush distributors. - * - For Gplay variant it means that only FCM will be used; - * - For F-Droid variant, it means that only background polling will be available to the user. - * Return true to allow any available external UnifiedPush distributor to be chosen by the user. - * - For Gplay variant it means that FCM will be used by default, but user can choose another UnifiedPush distributor; - * - For F-Droid variant, it means that background polling will be used by default, but user can choose another UnifiedPush distributor. - */ - override fun allowExternalUnifiedPushDistributors(): Boolean = true + override fun allowExternalUnifiedPushDistributors(): Boolean = Config.ALLOW_EXTERNAL_UNIFIED_PUSH_DISTRIBUTORS override fun isScreenSharingEnabled(): Boolean = true }