Skip to content

Commit

Permalink
Add Kenya study-specific alpha build flavor.
Browse files Browse the repository at this point in the history
This new build flavor automatically enables the study-specific learner
study feature flag.
  • Loading branch information
BenHenning committed Jul 3, 2022
1 parent 01d5dfb commit eef2f4c
Show file tree
Hide file tree
Showing 8 changed files with 312 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package org.oppia.android.app.application.alphakenya

import dagger.Component
import org.oppia.android.app.application.ApplicationComponent
import org.oppia.android.app.application.ApplicationModule
import org.oppia.android.app.application.ApplicationStartupListenerModule
import org.oppia.android.app.devoptions.DeveloperOptionsModule
import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule
import org.oppia.android.app.shim.IntentFactoryShimModule
import org.oppia.android.app.shim.ViewBindingShimModule
import org.oppia.android.app.topic.PracticeTabModule
import org.oppia.android.app.translation.ActivityRecreatorProdModule
import org.oppia.android.data.backends.gae.NetworkConfigProdModule
import org.oppia.android.data.backends.gae.NetworkModule
import org.oppia.android.domain.classify.InteractionsModule
import org.oppia.android.domain.classify.rules.algebraicexpressioninput.AlgebraicExpressionInputModule
import org.oppia.android.domain.classify.rules.continueinteraction.ContinueModule
import org.oppia.android.domain.classify.rules.dragAndDropSortInput.DragDropSortInputModule
import org.oppia.android.domain.classify.rules.fractioninput.FractionInputModule
import org.oppia.android.domain.classify.rules.imageClickInput.ImageClickInputModule
import org.oppia.android.domain.classify.rules.itemselectioninput.ItemSelectionInputModule
import org.oppia.android.domain.classify.rules.mathequationinput.MathEquationInputModule
import org.oppia.android.domain.classify.rules.multiplechoiceinput.MultipleChoiceInputModule
import org.oppia.android.domain.classify.rules.numberwithunits.NumberWithUnitsRuleModule
import org.oppia.android.domain.classify.rules.numericexpressioninput.NumericExpressionInputModule
import org.oppia.android.domain.classify.rules.numericinput.NumericInputRuleModule
import org.oppia.android.domain.classify.rules.ratioinput.RatioInputModule
import org.oppia.android.domain.classify.rules.textinput.TextInputRuleModule
import org.oppia.android.domain.exploration.lightweightcheckpointing.ExplorationStorageModule
import org.oppia.android.domain.hintsandsolution.HintsAndSolutionConfigModule
import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule
import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule
import org.oppia.android.domain.oppialogger.LogStorageModule
import org.oppia.android.domain.oppialogger.LoggingIdentifierModule
import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule
import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule
import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerModule
import org.oppia.android.domain.platformparameter.PlatformParameterAlphaKenyaModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.topic.PrimeTopicAssetsControllerModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.util.accessibility.AccessibilityProdModule
import org.oppia.android.util.caching.AssetModule
import org.oppia.android.util.caching.CachingModule
import org.oppia.android.util.gcsresource.GcsResourceModule
import org.oppia.android.util.locale.LocaleProdModule
import org.oppia.android.util.logging.LoggerModule
import org.oppia.android.util.logging.SyncStatusModule
import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule
import org.oppia.android.util.logging.firebase.LogReportingModule
import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule
import org.oppia.android.util.networking.NetworkConnectionUtilProdModule
import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule
import org.oppia.android.util.parser.image.GlideImageLoaderModule
import org.oppia.android.util.parser.image.ImageParsingModule
import org.oppia.android.util.system.OppiaClockModule
import org.oppia.android.util.threading.DispatcherModule
import javax.inject.Singleton

/**
* Root Dagger component for the alpha version of the application specific to a user study in Kenya.
*
* All application-scoped modules should be included in this component.
*/
@Singleton
@Component(
modules = [
ApplicationModule::class, DispatcherModule::class, LoggerModule::class, OppiaClockModule::class,
ContinueModule::class, FractionInputModule::class, ItemSelectionInputModule::class,
MultipleChoiceInputModule::class, NumberWithUnitsRuleModule::class,
NumericInputRuleModule::class, TextInputRuleModule::class, DragDropSortInputModule::class,
InteractionsModule::class, GcsResourceModule::class, GlideImageLoaderModule::class,
ImageParsingModule::class, HtmlParserEntityTypeModule::class, CachingModule::class,
QuestionModule::class, AccessibilityProdModule::class, ImageClickInputModule::class,
LogStorageModule::class, IntentFactoryShimModule::class, ViewBindingShimModule::class,
PrimeTopicAssetsControllerModule::class, ExpirationMetaDataRetrieverModule::class,
RatioInputModule::class, UncaughtExceptionLoggerModule::class,
ApplicationStartupListenerModule::class, LogUploadWorkerModule::class,
WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class,
FirebaseLogUploaderModule::class, NetworkModule::class, PracticeTabModule::class,
PlatformParameterAlphaKenyaModule::class, PlatformParameterSingletonModule::class,
ExplorationStorageModule::class, DeveloperOptionsModule::class,
PlatformParameterSyncUpWorkerModule::class, NetworkConfigProdModule::class, AssetModule::class,
LocaleProdModule::class, ActivityRecreatorProdModule::class,
NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class,
MathEquationInputModule::class, SplitScreenInteractionModule::class,
LoggingIdentifierModule::class, ApplicationLifecycleModule::class,
NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class,
SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class,
HintsAndSolutionProdModule::class, AlphaKenyaBuildFlavorModule::class
]
)
interface AlphaKenyaApplicationComponent : ApplicationComponent {
/**
* The [ApplicationComponent.Builder] for this component. Dagger will generate an implementation
* of this builder for use.
*/
@Component.Builder
interface Builder : ApplicationComponent.Builder {
override fun build(): AlphaKenyaApplicationComponent
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.oppia.android.app.application.alphakenya

import dagger.Module
import dagger.Provides
import org.oppia.android.app.model.BuildFlavor

/**
* Module for providing the compile-time [BuildFlavor] of the Kenya-specific alpha build of the app.
*/
@Module
class AlphaKenyaBuildFlavorModule {
@Provides
fun provideAlphaKenyaBuildFlavor(): BuildFlavor = BuildFlavor.ALPHA
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.oppia.android.app.application.alphakenya

import org.oppia.android.app.application.AbstractOppiaApplication

// TODO(#4419): Remove this application class & broader Kenya-specific alpha package.
/** The root [AbstractOppiaApplication] for the Kenya-specific alpha build of the Oppia app. */
class AlphaKenyaOppiaApplication : AbstractOppiaApplication(
DaggerAlphaKenyaApplicationComponent::builder
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
This package contains the root application definitions for a Kenya user study specific alpha build
of the app.
"""

load("@dagger//:workspace_defs.bzl", "dagger_rules")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")

kt_android_library(
name = "alpha_kenya_application",
srcs = [
"AlphaKenyaApplicationComponent.kt",
"AlphaKenyaBuildFlavorModule.kt",
"AlphaKenyaOppiaApplication.kt",
],
visibility = ["//:oppia_binary_visibility"],
deps = [
":dagger",
"//app",
"//app/src/main/java/org/oppia/android/app/application:abstract_application",
"//app/src/main/java/org/oppia/android/app/application:application_component",
"//app/src/main/java/org/oppia/android/app/application:common_application_modules",
"//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module",
"//utility/src/main/java/org/oppia/android/util/networking:prod_module",
],
)

dagger_rules()
17 changes: 16 additions & 1 deletion build_flavors.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Macros & definitions corresponding to Oppia binary build flavors.
"""

load("//:oppia_android_application.bzl", "declare_deployable_application", "oppia_android_application")
load("//:version.bzl", "MAJOR_VERSION", "MINOR_VERSION", "OPPIA_ALPHA_KITKAT_VERSION_CODE", "OPPIA_ALPHA_VERSION_CODE", "OPPIA_BETA_VERSION_CODE", "OPPIA_DEV_KITKAT_VERSION_CODE", "OPPIA_DEV_VERSION_CODE", "OPPIA_GA_VERSION_CODE")
load("//:version.bzl", "MAJOR_VERSION", "MINOR_VERSION", "OPPIA_ALPHA_KENYA_VERSION_CODE", "OPPIA_ALPHA_KITKAT_VERSION_CODE", "OPPIA_ALPHA_VERSION_CODE", "OPPIA_BETA_VERSION_CODE", "OPPIA_DEV_KITKAT_VERSION_CODE", "OPPIA_DEV_VERSION_CODE", "OPPIA_GA_VERSION_CODE")

# Defines the list of flavors available to build the Oppia app in. Note to developers: this list
# should be ordered by the development pipeline (i.e. features go through dev first, then other
Expand All @@ -13,6 +13,7 @@ AVAILABLE_FLAVORS = [
"dev_kitkat",
"alpha",
"alpha_kitkat",
"alpha_kenya",
"beta",
"ga",
]
Expand Down Expand Up @@ -40,6 +41,7 @@ _PRODUCTION_PROGUARD_SPECS = [
]

# Note to developers: keys of this dict should follow the order of AVAILABLE_FLAVORS.
# TODO(#4419): Remove the Kenya-specific alpha flavor.
_FLAVOR_METADATA = {
"dev": {
"manifest": "//app:src/main/AndroidManifest.xml",
Expand Down Expand Up @@ -95,6 +97,19 @@ _FLAVOR_METADATA = {
"version_code": OPPIA_ALPHA_KITKAT_VERSION_CODE,
"application_class": ".app.application.alpha.AlphaOppiaApplication",
},
"alpha_kenya": {
"manifest": "//app:src/main/AndroidManifest.xml",
"min_sdk_version": 21,
"target_sdk_version": 30,
"multidex": "native",
"proguard_specs": _PRODUCTION_PROGUARD_SPECS,
"production_release": True,
"deps": [
"//app/src/main/java/org/oppia/android/app/application/alphakenya:alpha_kenya_application",
],
"version_code": OPPIA_ALPHA_KENYA_VERSION_CODE,
"application_class": ".app.application.alphakenya.AlphaKenyaOppiaApplication",
},
"beta": {
"manifest": "//app:src/main/AndroidManifest.xml",
"min_sdk_version": 21,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
package org.oppia.android.domain.platformparameter

import dagger.Module
import dagger.Provides
import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING
import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.CacheLatexRendering
import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS
import org.oppia.android.util.platformparameter.LearnerStudyAnalytics
import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES
import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL
import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES
import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL
import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES
import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL
import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes
import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes
import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes
import org.oppia.android.util.platformparameter.PlatformParameterSingleton
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS
import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg
import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours

// TODO(#4419): Remove this module.
/**
* Dagger module that provides bindings for platform parameters for the Kenya-specific alpha build
* of the app.
*/
@Module
class PlatformParameterAlphaKenyaModule {
@Provides
@SplashScreenWelcomeMsg
fun provideSplashScreenWelcomeMsgParam(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
return platformParameterSingleton.getBooleanPlatformParameter(SPLASH_SCREEN_WELCOME_MSG)
?: PlatformParameterValue.createDefaultParameter(SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE)
}

@Provides
@SyncUpWorkerTimePeriodHours
fun provideSyncUpWorkerTimePeriod(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Int> {
return platformParameterSingleton.getIntegerPlatformParameter(
SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS
) ?: PlatformParameterValue.createDefaultParameter(
SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@LearnerStudyAnalytics
fun provideLearnerStudyAnalytics(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
// Turn on the learner study platform parameter by default.
return platformParameterSingleton.getBooleanPlatformParameter(LEARNER_STUDY_ANALYTICS)
?: PlatformParameterValue.createDefaultParameter(true)
}

@Provides
@CacheLatexRendering
fun provideCacheLatexRendering(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
return platformParameterSingleton.getBooleanPlatformParameter(CACHE_LATEX_RENDERING)
?: PlatformParameterValue.createDefaultParameter(CACHE_LATEX_RENDERING_DEFAULT_VALUE)
}

@Provides
@EnablePerformanceMetricsCollection
fun provideEnablePerformanceMetricCollection(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
return platformParameterSingleton.getBooleanPlatformParameter(
ENABLE_PERFORMANCE_METRICS_COLLECTION
) ?: PlatformParameterValue.createDefaultParameter(
ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
)
}

@Provides
@PerformanceMetricsCollectionUploadTimeIntervalInMinutes
fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Int> {
return platformParameterSingleton.getIntegerPlatformParameter(
PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES
) ?: PlatformParameterValue.createDefaultParameter(
PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL
)
}

@Provides
@PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes
fun providePerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Int> {
return platformParameterSingleton.getIntegerPlatformParameter(
PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES
) ?: PlatformParameterValue.createDefaultParameter(
PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL
)
}

@Provides
@PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes
fun providePerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Int> {
return platformParameterSingleton.getIntegerPlatformParameter(
PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES
) ?: PlatformParameterValue.createDefaultParameter(
PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL
)
}
}
4 changes: 4 additions & 0 deletions scripts/assets/test_file_exemptions.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ exempted_file_path: "app/src/main/java/org/oppia/android/app/application/Applica
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/ApplicationStartupListenerModule.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alpha/AlphaOppiaApplication.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alpha/AlphaApplicationComponent.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaBuildFlavorModule.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaOppiaApplication.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/beta/BetaOppiaApplication.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt"
exempted_file_path: "app/src/main/java/org/oppia/android/app/application/dev/DeveloperOppiaApplication.kt"
Expand Down Expand Up @@ -634,6 +637,7 @@ exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/a
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/UncaughtExceptionLoggerModule.kt"
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerFactory.kt"
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/loguploader/LogUploadWorkerModule.kt"
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt"
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt"
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonModule.kt"
exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerFactory.kt"
Expand Down
2 changes: 2 additions & 0 deletions version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ their device qualifies for more than one choice.
MAJOR_VERSION = 0
MINOR_VERSION = 7

# TODO(#4419): Remove the Kenya-specific alpha version code.
# TODO(#4348): Offset these version codes by '+1' for the next release.
OPPIA_DEV_KITKAT_VERSION_CODE = 22
OPPIA_DEV_VERSION_CODE = 23
OPPIA_ALPHA_KITKAT_VERSION_CODE = 24
OPPIA_ALPHA_VERSION_CODE = 25
OPPIA_ALPHA_KENYA_VERSION_CODE = 28
OPPIA_BETA_VERSION_CODE = 26
OPPIA_GA_VERSION_CODE = 27

0 comments on commit eef2f4c

Please sign in to comment.