Create a Kotlin Config object in vector-config module, for easy configuration.

This commit is contained in:
Benoit Marty 2022-06-09 08:57:33 +02:00 committed by Benoit Marty
parent 5846ad5768
commit 3560ac95d1
2 changed files with 39 additions and 10 deletions

View File

@ -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
}

View File

@ -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
}