diff --git a/jarvis-app/src/main/java/com/jarvis/app/contentprovider/JarvisContentProvider.kt b/jarvis-app/src/main/java/com/jarvis/app/contentprovider/JarvisContentProvider.kt index 484b2a6..5c277f6 100644 --- a/jarvis-app/src/main/java/com/jarvis/app/contentprovider/JarvisContentProvider.kt +++ b/jarvis-app/src/main/java/com/jarvis/app/contentprovider/JarvisContentProvider.kt @@ -6,13 +6,13 @@ import android.util.Log import com.jarvis.app.BuildConfig import com.jarvis.app.contentprovider.util.ReadOnlyContentProvider import com.jarvis.app.di.JarvisContentProviderEntryPoint -import com.jarvis.app.domain.fields.JarvisContentProviderController +import com.jarvis.app.domain.fields.JarvisContentProviderViewModel import java.lang.RuntimeException class JarvisContentProvider : ReadOnlyContentProvider() { - private val controller: JarvisContentProviderController by lazy { - JarvisContentProviderEntryPoint.getController(context!!) + private val viewModel: JarvisContentProviderViewModel by lazy { + JarvisContentProviderEntryPoint.getViewModel(requireContext()) } override fun onCreate(): Boolean = true @@ -39,7 +39,7 @@ class JarvisContentProvider : ReadOnlyContentProvider() { private fun onConfigLocationReceived(uri: Uri): Int { log("- Config file URI received: $uri") - if (controller.isJarvisLocked) { + if (viewModel.isJarvisLocked) { log("- Jarvis is locked. Skipping.") return JARVIS_PULL_CONFIG_RESULT_LOCKED } @@ -56,7 +56,7 @@ class JarvisContentProvider : ReadOnlyContentProvider() { ?: throw RuntimeException("Failed to open config input stream.") stream.use { - controller.onConfigPush(it) + viewModel.onConfigPush(it) } return JARVIS_PULL_CONFIG_RESULT_SUCCESS @@ -87,9 +87,9 @@ class JarvisContentProvider : ReadOnlyContentProvider() { uri.pathSegments[PATH_VALUE_INDEX] == PATH_VALUE private fun readFieldValue(uri: Uri): String? { - if (!controller.isJarvisActive) return null + if (!viewModel.isJarvisActive) return null val fieldName = uri.pathSegments[PATH_CONFIG_VALUE_INDEX] - return controller.getFieldValue(fieldName) + return viewModel.getFieldValue(fieldName) } private fun log(message: String) { diff --git a/jarvis-app/src/main/java/com/jarvis/app/di/JarvisContentProviderEntryPoint.kt b/jarvis-app/src/main/java/com/jarvis/app/di/JarvisContentProviderEntryPoint.kt index 5dd17b2..968834c 100644 --- a/jarvis-app/src/main/java/com/jarvis/app/di/JarvisContentProviderEntryPoint.kt +++ b/jarvis-app/src/main/java/com/jarvis/app/di/JarvisContentProviderEntryPoint.kt @@ -1,7 +1,7 @@ package com.jarvis.app.di import android.content.Context -import com.jarvis.app.domain.fields.JarvisContentProviderController +import com.jarvis.app.domain.fields.JarvisContentProviderViewModel import dagger.hilt.EntryPoint import dagger.hilt.InstallIn import dagger.hilt.android.EntryPointAccessors @@ -14,10 +14,10 @@ import dagger.hilt.components.SingletonComponent @InstallIn(SingletonComponent::class) interface JarvisContentProviderEntryPoint { - fun jarvisContentProviderController(): JarvisContentProviderController + fun jarvisContentProviderController(): JarvisContentProviderViewModel companion object { - fun getController(context: Context): JarvisContentProviderController = + fun getViewModel(context: Context): JarvisContentProviderViewModel = EntryPointAccessors.fromApplication( context.applicationContext, JarvisContentProviderEntryPoint::class.java diff --git a/jarvis-app/src/main/java/com/jarvis/app/domain/fields/JarvisContentProviderController.kt b/jarvis-app/src/main/java/com/jarvis/app/domain/fields/JarvisContentProviderViewModel.kt similarity index 95% rename from jarvis-app/src/main/java/com/jarvis/app/domain/fields/JarvisContentProviderController.kt rename to jarvis-app/src/main/java/com/jarvis/app/domain/fields/JarvisContentProviderViewModel.kt index 07e5c89..1971dad 100644 --- a/jarvis-app/src/main/java/com/jarvis/app/domain/fields/JarvisContentProviderController.kt +++ b/jarvis-app/src/main/java/com/jarvis/app/domain/fields/JarvisContentProviderViewModel.kt @@ -7,7 +7,7 @@ import com.jarvis.client.data.StringListField import java.io.InputStream import javax.inject.Inject -class JarvisContentProviderController @Inject constructor( +class JarvisContentProviderViewModel @Inject constructor( private val settingsInteractor: SettingsInteractor, private val getSingleField: GetSingleFieldUseCase, private val refreshConfig: RefreshConfigUseCase diff --git a/jarvis-app/src/main/java/com/jarvis/app/view/main/recyclerview/ConfigItemListAdapter.kt b/jarvis-app/src/main/java/com/jarvis/app/view/main/recyclerview/ConfigItemListAdapter.kt index fcc38ba..a86d404 100644 --- a/jarvis-app/src/main/java/com/jarvis/app/view/main/recyclerview/ConfigItemListAdapter.kt +++ b/jarvis-app/src/main/java/com/jarvis/app/view/main/recyclerview/ConfigItemListAdapter.kt @@ -47,14 +47,10 @@ private val differCallback = object : DiffUtil.ItemCallback, newItem: FieldItemViewModel<*> - ): Boolean { - return oldItem.name == newItem.name - } + ): Boolean = oldItem.name == newItem.name override fun areContentsTheSame( oldItem: FieldItemViewModel<*>, newItem: FieldItemViewModel<*> - ): Boolean { - return oldItem == newItem - } + ): Boolean = oldItem == newItem } diff --git a/jarvis-app/src/main/java/com/jarvis/app/view/util/Ext.kt b/jarvis-app/src/main/java/com/jarvis/app/view/util/Ext.kt index e5c3903..3a04885 100644 --- a/jarvis-app/src/main/java/com/jarvis/app/view/util/Ext.kt +++ b/jarvis-app/src/main/java/com/jarvis/app/view/util/Ext.kt @@ -1,13 +1,13 @@ package com.jarvis.app.view.util -fun String.toSafeLong(default: Long = 0): Long = +fun String.toSafeLong(default: Long): Long = try { this.toLong() } catch (error: Throwable) { default } -fun String.toSafeDouble(default: Double = 0.0): Double = +fun String.toSafeDouble(default: Double): Double = try { this.toDouble() } catch (error: Throwable) { diff --git a/jarvis-client/build.gradle b/jarvis-client/build.gradle index 5d3bcc2..eb4da3a 100644 --- a/jarvis-client/build.gradle +++ b/jarvis-client/build.gradle @@ -26,6 +26,4 @@ android { dependencies { implementation "androidx.appcompat:appcompat:1.4.1" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" - - testImplementation "junit:junit:4.13.2" } diff --git a/jarvis-client/src/main/java/com/jarvis/client/JarvisClient.kt b/jarvis-client/src/main/java/com/jarvis/client/JarvisClient.kt index 006e9fa..fdb4c32 100644 --- a/jarvis-client/src/main/java/com/jarvis/client/JarvisClient.kt +++ b/jarvis-client/src/main/java/com/jarvis/client/JarvisClient.kt @@ -3,32 +3,38 @@ package com.jarvis.client import android.content.Context import com.jarvis.client.data.ClientJsonMapper import com.jarvis.client.data.JarvisConfig +import com.jarvis.client.data.jarvisConfig /** - * The Jarvis interface, obtained via [JarvisClient.newInstance]. + * The Jarvis interface, created via [JarvisClient.newInstance]. * - * @see [com.jarvis.client.data.jarvisConfig] to create a Jarvis config. - * Pass your Jarvis config to [JarvisClient.pushConfigToJarvisApp]. - * Read data from the Jarvis App via the `get*()` functions. + * 1. @see [jarvisConfig] to create a Jarvis config. + * 2. Pass your Jarvis config to [JarvisClient.pushConfigToJarvisApp]. + * 3. Read data from the Jarvis App via the `get*()` functions. * - * If the Jarvis App is installed then all `get*()` functions read data from there. + * If the Jarvis App is installed then all `get*()` functions return data from the config there. * If the Jarvis App is not installed then the default values are returned. */ interface JarvisClient { /** * Enable/disable Jarvis's internal logging. + * Useful for debugging purposes. */ var loggingEnabled: Boolean /** - * Pushes your app's Jarvis configuration to the Jarvis app. + * Pushes your app's Jarvis config to the Jarvis App. + * Note that the Jarvis App must be in an *unlocked* state to accept new configs. + * + * @return [JarvisPushConfigResult] indicating the push operation result. */ fun pushConfigToJarvisApp(config: JarvisConfig): JarvisPushConfigResult /** * Gets a named String value from the Jarvis App. * + * @return The named String, or the default value if the Jarvis App is not installed * @param name The name of the string * @param defaultValue The default value */ @@ -37,14 +43,16 @@ interface JarvisClient { /** * Gets a named String value from the Jarvis App. * + * @return The named String, or the default value if the Jarvis App is not installed * @param name The name of the string - * @param lazyDefaultValue The lazily obtained default value + * @param lazyDefaultValue The lazily created default value */ fun getString(name: String, lazyDefaultValue: () -> String): String /** * Gets a named Boolean value from the Jarvis App. * + * @return The named Boolean, or the default value if the Jarvis App is not installed * @param name The name of the boolean * @param defaultValue The default value */ @@ -53,14 +61,16 @@ interface JarvisClient { /** * Gets a named Boolean value from the Jarvis App. * + * @return The named Boolean, or the default value if the Jarvis App is not installed * @param name The name of the boolean - * @param lazyDefaultValue The lazily obtained default value + * @param lazyDefaultValue The lazily created default value */ fun getBoolean(name: String, lazyDefaultValue: () -> Boolean): Boolean /** * Gets a named Long value from the Jarvis App. * + * @return The named Long, or the default value if the Jarvis App is not installed * @param name The name of the long * @param defaultValue The default value */ @@ -69,14 +79,16 @@ interface JarvisClient { /** * Gets a named Long value from the Jarvis App. * + * @return The named Long, or the default value if the Jarvis App is not installed * @param name The name of the long - * @param lazyDefaultValue The lazily obtained default value + * @param lazyDefaultValue The lazily created default value */ fun getLong(name: String, lazyDefaultValue: () -> Long): Long /** * Gets a named Double value from the Jarvis App. * + * @return The named Double, or the default value if the Jarvis App is not installed * @param name The name of the double * @param defaultValue The default value */ @@ -85,14 +97,16 @@ interface JarvisClient { /** * Gets a named Double value from the Jarvis App. * + * @return The named Double, or the default value if the Jarvis App is not installed * @param name The name of the double - * @param lazyDefaultValue The lazily obtained default value + * @param lazyDefaultValue The lazily created default value */ fun getDouble(name: String, lazyDefaultValue: () -> Double): Double /** * Gets the index selection from a String list from the Jarvis App. * + * @return The named String List selection index, or the default value if the Jarvis App is not installed * @param name The name of the string list * @param defaultValue The default selection index */ @@ -101,8 +115,9 @@ interface JarvisClient { /** * Gets the index selection from a String list from the Jarvis App. * + * @return The named String List selection index, or the default value if the Jarvis App is not installed * @param name The name of the String list - * @param lazyDefaultValue The lazily obtained default value + * @param lazyDefaultValue The lazily created default value */ fun getStringListSelection(name: String, lazyDefaultValue: () -> Int): Int diff --git a/jarvis-client/src/main/java/com/jarvis/client/JarvisClientImpl.kt b/jarvis-client/src/main/java/com/jarvis/client/JarvisClientImpl.kt index 3c9b971..70ced1c 100644 --- a/jarvis-client/src/main/java/com/jarvis/client/JarvisClientImpl.kt +++ b/jarvis-client/src/main/java/com/jarvis/client/JarvisClientImpl.kt @@ -207,11 +207,11 @@ internal class JarvisClientImpl( it.delete() } - val destinationOutputStream = FileOutputStream(destinationFile) + val fileOutputStream = FileOutputStream(destinationFile) val configInputStream = jsonMapper.mapToJsonString(config).byteInputStream() configInputStream.use { inputStream -> - destinationOutputStream.use { outputStream -> + fileOutputStream.use { outputStream -> var read: Int val buff = ByteArray(2048) diff --git a/jarvis-client/src/main/java/com/jarvis/client/JarvisPushConfigResult.kt b/jarvis-client/src/main/java/com/jarvis/client/JarvisPushConfigResult.kt index 381730c..329257d 100644 --- a/jarvis-client/src/main/java/com/jarvis/client/JarvisPushConfigResult.kt +++ b/jarvis-client/src/main/java/com/jarvis/client/JarvisPushConfigResult.kt @@ -1,7 +1,21 @@ package com.jarvis.client +/** + * Result of [JarvisClient.pushConfigToJarvisApp]. + */ enum class JarvisPushConfigResult { + /** + * The config push succeeded. + */ SUCCESS, + + /** + * The config push failed. + */ FAILURE, + + /** + * The Jarvis app is locked and cannot accept new config. + */ LOCKED } diff --git a/jarvis-client/src/main/java/com/jarvis/client/data/Builders.kt b/jarvis-client/src/main/java/com/jarvis/client/data/Builders.kt index a04388d..51d1cfc 100644 --- a/jarvis-client/src/main/java/com/jarvis/client/data/Builders.kt +++ b/jarvis-client/src/main/java/com/jarvis/client/data/Builders.kt @@ -2,41 +2,84 @@ package com.jarvis.client.data +import com.jarvis.client.JarvisClient import java.lang.IllegalStateException -@DslMarker -annotation class JarvisDsl - +/** + * Creates a [JarvisConfigBuilder] and calls the function block on it. + * Once the function block returns [JarvisConfigBuilder.build] is called. + */ fun jarvisConfig(block: JarvisConfigBuilder.() -> Unit): JarvisConfig = JarvisConfigBuilder().apply(block).build() +/** + * Builder pattern to create a [JarvisConfig]. + * Use this class to add different config field types. + */ @JarvisDsl class JarvisConfigBuilder { + /** + * Optionally locks Jarvis after a config is pushed. + * + * Jarvis must be *unlocked* to accept a new config being pushed. + * If this value is true then Jarvis will automatically lock after receiving a new config. + * If this value is false then Jarvis will remain unlocked after receiving a new config. + */ var withLockAfterPush = true private val fields = mutableListOf>() + /** + * Adds a String field to the config. + * + * Creates a [StringFieldBuilder] and calls the function block on it. + */ fun withStringField(block: StringFieldBuilder.() -> Unit) { addField(StringFieldBuilder().apply(block).build() as JarvisField) } + /** + * Adds a Long field to the config. + * + * Creates a [LongFieldBuilder] and calls the function block on it. + */ fun withLongField(block: LongFieldBuilder.() -> Unit) { addField(LongFieldBuilder().apply(block).build() as JarvisField) } + /** + * Adds a Double field to the config. + * + * Creates a [DoubleFieldBuilder] and calls the function block on it. + */ fun withDoubleField(block: DoubleFieldBuilder.() -> Unit) { addField(DoubleFieldBuilder().apply(block).build() as JarvisField) } + /** + * Adds a Boolean field to the config. + * + * Creates a [BooleanFieldBuilder] and calls the function block on it. + */ fun withBooleanField(block: BooleanFieldBuilder.() -> Unit) { addField(BooleanFieldBuilder().apply(block).build() as JarvisField) } + /** + * Adds a String List field to the config. + * + * Creates a [StringListFieldBuilder] and calls the function block on it. + */ fun withStringListField(block: StringListFieldBuilder.() -> Unit) { addField(StringListFieldBuilder().apply(block).build() as JarvisField) } + /** + * Returns the Jarvis config according to the fields that have been set. + * + * @return [JarvisConfig] to (be passed to [JarvisClient.pushConfigToJarvisApp]). + */ fun build(): JarvisConfig = JarvisConfig(withLockAfterPush, fields.toList()) @@ -57,9 +100,24 @@ abstract class BaseFieldBuilder { @JarvisDsl class StringFieldBuilder : BaseFieldBuilder() { + /** + * The user-friendly hint displayed in the EditText. + */ var hint: String? = null + + /** + * Validation: the minimum required length of the String. + */ var minLength: Long = 0 + + /** + * Validation: the maximum required length of the String. + */ var maxLength: Long = 999 + + /** + * Validation: the regex to be applied to the String. + */ var regex: String? = null fun build(): JarvisField = @@ -80,9 +138,24 @@ class StringFieldBuilder : BaseFieldBuilder() { @JarvisDsl class LongFieldBuilder : BaseFieldBuilder() { + /** + * The user-friendly hint displayed in the EditText. + */ var hint: String? = null + + /** + * Validation: the minimum Long vale. + */ var min: Long? = null + + /** + * Validation: the maximum Long vale. + */ var max: Long? = null + + /** + * TODO + */ var asRange: Boolean = false fun build(): LongField = @@ -103,9 +176,24 @@ class LongFieldBuilder : BaseFieldBuilder() { @JarvisDsl class DoubleFieldBuilder : BaseFieldBuilder() { + /** + * The user-friendly hint displayed in the EditText. + */ var hint: String? = null + + /** + * Validation: the minimum Double vale. + */ var min: Double? = null + + /** + * Validation: the maximum Double vale. + */ var max: Double? = null + + /** + * TODO + */ var asRange: Boolean = false fun build(): DoubleField = @@ -140,6 +228,9 @@ class BooleanFieldBuilder : BaseFieldBuilder() { @JarvisDsl class StringListFieldBuilder : BaseFieldBuilder>() { + /** + * The default selection index within the String List. + */ var defaultSelection = 0 fun build(): StringListField = diff --git a/jarvis-client/src/main/java/com/jarvis/client/data/JarvisDsl.kt b/jarvis-client/src/main/java/com/jarvis/client/data/JarvisDsl.kt new file mode 100644 index 0000000..6cf2edb --- /dev/null +++ b/jarvis-client/src/main/java/com/jarvis/client/data/JarvisDsl.kt @@ -0,0 +1,4 @@ +package com.jarvis.client.data + +@DslMarker +annotation class JarvisDsl diff --git a/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepository.kt b/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepository.kt index b9490da..dcfe1bc 100644 --- a/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepository.kt +++ b/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepository.kt @@ -23,7 +23,7 @@ class DebugConfigRepository( /** * Retrieves the value from the Jarvis App (if installed). - * Falls back to [FirebaseRemoteConfig] service for the default value. + * Falls back to [FirebaseRemoteConfig] for the default value. */ override fun someStringValue(): String = jarvis.getString(SOME_STRING_NAME, firebaseRemoteConfig::someStringValue) diff --git a/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepositoryModule.kt b/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepositoryModule.kt index 7e0aa65..ea28c38 100644 --- a/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepositoryModule.kt +++ b/jarvis-demo-advanced/src/debug/java/com/jarvis/demo/advanced/repository/DebugConfigRepositoryModule.kt @@ -6,6 +6,7 @@ import org.koin.dsl.module /** * Only seen by the `debug` build variant. + * * This app uses Koin for its simplicity. Replace with your preferred DI framework. */ val configRepositoryModule = module { @@ -15,8 +16,9 @@ val configRepositoryModule = module { } /** - * Inject the single interface to the rest of the app. - * See [com.jarvis.demo.advanced.MainActivity.configRepository]. + * Inject the single repository interface to the rest of the app. + * + * @See [com.jarvis.demo.advanced.MainActivity.configRepo]. */ single { DebugConfigRepository(get(), get()) diff --git a/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/MainActivity.kt b/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/MainActivity.kt index 3752a1f..bee65d5 100644 --- a/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/MainActivity.kt +++ b/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/MainActivity.kt @@ -8,7 +8,7 @@ import com.jarvis.demo.advanced.repository.ConfigRepository import org.koin.android.ext.android.inject /** - * Switch the build variant between `debug` and `release` in the IDE. + * Switch the build variant between `debug` and `release` build variants in the IDE. * The implementation of [ConfigRepository] will change at runtime. * * For the `debug` build variant, experiment with having the Jarvis app installed/uninstalled. @@ -19,17 +19,16 @@ class MainActivity : AppCompatActivity() { /** * This single interface could be injected anywhere in your app. */ - private val configRepository: ConfigRepository by inject() + private val configRepo: ConfigRepository by inject() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - findViewById(R.id.repository_class_name).text = - configRepository.javaClass.simpleName + findViewById(R.id.repository_class_name).text = configRepo.javaClass.simpleName findViewById(R.id.get_value_button).setOnClickListener { - findViewById(R.id.value_at_runtime).text = configRepository.someStringValue() + findViewById(R.id.value_at_runtime).text = configRepo.someStringValue() } } } diff --git a/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/ConfigRepository.kt b/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/ConfigRepository.kt index 8fe4f6c..76706a8 100644 --- a/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/ConfigRepository.kt +++ b/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/ConfigRepository.kt @@ -2,6 +2,7 @@ package com.jarvis.demo.advanced.repository /** * This single interface is exposed to the rest of the app. + * * The implementation will depend on the build variant: * `debug` (with Jarvis): [com.jarvis.demo.advanced.repository.DebugConfigRepository] * `release` (no Jarvis): [com.jarvis.demo.advanced.repository.ReleaseConfigRepository] diff --git a/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/FirebaseRemoteConfig.kt b/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/FirebaseRemoteConfig.kt index b6947e8..4091f39 100644 --- a/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/FirebaseRemoteConfig.kt +++ b/jarvis-demo-advanced/src/main/java/com/jarvis/demo/advanced/repository/FirebaseRemoteConfig.kt @@ -2,7 +2,7 @@ package com.jarvis.demo.advanced.repository /** * Seen by both `debug` and `release` build variants. - * Represents your preferred (real) remote configuration service. + * Represents your preferred (real) remote config service. * Replace this with real Firebase Remote Config, LaunchDarkly, Leanplum, etc. */ class FirebaseRemoteConfig { @@ -10,5 +10,5 @@ class FirebaseRemoteConfig { /** * Mock the call to the "real" Firebase Remote Config to get the value. */ - fun someStringValue(): String = "Real value" + fun someStringValue(): String = "Firebase value" } diff --git a/jarvis-demo-simple/src/main/java/com/slambang/jarvis/demo/simple/MainActivity.kt b/jarvis-demo-simple/src/main/java/com/slambang/jarvis/demo/simple/MainActivity.kt index d77a60e..e265511 100644 --- a/jarvis-demo-simple/src/main/java/com/slambang/jarvis/demo/simple/MainActivity.kt +++ b/jarvis-demo-simple/src/main/java/com/slambang/jarvis/demo/simple/MainActivity.kt @@ -8,8 +8,8 @@ import com.jarvis.client.JarvisClient import com.jarvis.client.data.jarvisConfig /** - * Absolute minimal code setup, obtaining an instance of [JarvisClient] to read a string. - * See the FileProvider that is declared in the manifest. + * Absolute minimal code setup using [JarvisClient] to read a string from the config. + * Also see the FileProvider that is declared in the manifest. */ class MainActivity : AppCompatActivity() { @@ -20,9 +20,7 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) /** - * Push your app's config. - * This can be done wherever you like, but the config must be pushed before your - * app tries to read any config values. + * Push your app's Jarvis config to the Jarvis App. */ with (jarvis) { loggingEnabled = true @@ -36,9 +34,9 @@ class MainActivity : AppCompatActivity() { } companion object { - const val SOME_STRING_NAME = "Some string (simple demo)" + private const val SOME_STRING_NAME = "Some string (simple demo)" - val JARVIS_CONFIG = jarvisConfig { + private val JARVIS_CONFIG = jarvisConfig { withLockAfterPush = false