unfinished mode
This commit is contained in:
parent
0ad37725e0
commit
6527c44c88
|
@ -47,16 +47,18 @@ import javax.inject.Singleton
|
|||
open class AppModule {
|
||||
|
||||
@Provides
|
||||
fun providesPlugins(config: Config,
|
||||
fun providesPlugins(config: Config, buildHelper: BuildHelper,
|
||||
@PluginsModule.AllConfigs allConfigs: Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>,
|
||||
@PluginsModule.PumpDriver pumpDrivers: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
@PluginsModule.NotNSClient notNsClient: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
@PluginsModule.APS aps: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>)
|
||||
@PluginsModule.APS aps: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>,
|
||||
@PluginsModule.Unfinished unfinished: Lazy<Map<@JvmSuppressWildcards Int, @JvmSuppressWildcards PluginBase>>)
|
||||
: List<@JvmSuppressWildcards PluginBase> {
|
||||
val plugins = allConfigs.toMutableMap()
|
||||
if (config.PUMPDRIVERS) plugins += pumpDrivers.get()
|
||||
if (config.APS) plugins += aps.get()
|
||||
if (!config.NSCLIENT) plugins += notNsClient.get()
|
||||
if (buildHelper.isUnfinishedMode()) plugins += unfinished.get()
|
||||
return plugins.toList().sortedBy { it.first }.map { it.second }
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
|
|||
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
|
||||
import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin
|
||||
import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin
|
||||
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
|
||||
import info.nightscout.androidaps.plugins.general.wear.WearPlugin
|
||||
import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin
|
||||
import info.nightscout.androidaps.plugins.insulin.InsulinLyumjevPlugin
|
||||
|
@ -292,6 +293,12 @@ abstract class PluginsModule {
|
|||
@IntKey(360)
|
||||
abstract fun bindNSClientPlugin(plugin: NSClientPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@Unfinished
|
||||
@IntoMap
|
||||
@IntKey(368)
|
||||
abstract fun bindTidepoolPlugin(plugin: TidepoolPlugin): PluginBase
|
||||
|
||||
@Binds
|
||||
@AllConfigs
|
||||
@IntoMap
|
||||
|
@ -382,12 +389,6 @@ abstract class PluginsModule {
|
|||
@IntKey(475)
|
||||
abstract fun bindRandomBgPlugin(plugin: RandomBgPlugin): PluginBase
|
||||
|
||||
// @Binds
|
||||
// @NotNSClient
|
||||
// @IntoMap
|
||||
// @IntKey(480)
|
||||
// abstract fun bindOpenHumansPlugin(plugin: OpenHumansUploader): PluginBase
|
||||
|
||||
@Binds
|
||||
@NotNSClient
|
||||
@IntoMap
|
||||
|
@ -418,4 +419,6 @@ abstract class PluginsModule {
|
|||
@Qualifier
|
||||
annotation class APS
|
||||
|
||||
@Qualifier
|
||||
annotation class Unfinished
|
||||
}
|
|
@ -13,11 +13,14 @@ class BuildHelperImpl constructor(
|
|||
|
||||
private var devBranch = false
|
||||
private var engineeringMode = false
|
||||
private var unfinishedMode = false
|
||||
|
||||
init {
|
||||
val engineeringModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "engineering_mode")
|
||||
val unfinishedModeSemaphore = File(fileListProvider.ensureExtraDirExists(), "unfinished_mode")
|
||||
|
||||
engineeringMode = engineeringModeSemaphore.exists() && engineeringModeSemaphore.isFile
|
||||
unfinishedMode = unfinishedModeSemaphore.exists() && unfinishedModeSemaphore.isFile
|
||||
devBranch = BuildConfig.VERSION.contains("-") || BuildConfig.VERSION.matches(Regex(".*[a-zA-Z]+.*"))
|
||||
}
|
||||
|
||||
|
@ -26,5 +29,7 @@ class BuildHelperImpl constructor(
|
|||
|
||||
override fun isEngineeringMode(): Boolean = engineeringMode
|
||||
|
||||
override fun isUnfinishedMode(): Boolean = unfinishedMode
|
||||
|
||||
override fun isDev(): Boolean = devBranch
|
||||
}
|
|
@ -4,5 +4,6 @@ interface BuildHelper {
|
|||
|
||||
fun isEngineeringModeOrRelease(): Boolean
|
||||
fun isEngineeringMode(): Boolean
|
||||
fun isUnfinishedMode(): Boolean
|
||||
fun isDev(): Boolean
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue