-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Explanation Fixes #4410 This PR builds on #4414 by introducing a new alpha component that's specific to the team's ongoing research project in Kenya. This build serves three benefits: 1. It allows us to ensure end users can easily distinguish between alpha & study-specific alpha flavors of the app (since they will now have different build flavors). 2. It ensures we can explicitly version the binaries such that the study binary always takes precedence on Play Store. 3. It allows us to define study-specific parameters without needing manual changes during release (such as automatically enabling the learner study feature, which this PR is doing for the new build flavor). A few important things to note: - There are no new tests for the new components since they are mostly uninteresting to test (similar to other build flavor components). - The new components are temporary are will be reoved (#4419 is tracking this). - This PR is a recreation of #4420 since the new build flavor was being originally being introduced after the new beta & GA flavors (but this is no longer the case due to the beta release being delayed). - The new build flavor is not being added to CI build tests mainly because it's unlikely for this build to break versus the alpha build (as the two are so similar), and because of the temporary nature of this version of the app. - The new classes needed to be exempted for Gradle builds since Gradle was having difficulty with the fact that the new study-specific alpha component was a separate Dagger graph (our Gradle configuration, unlike Bazel, can't manage multiple Dagger graphs in the same build tree). This seems like a reasonable thing to do since the study-specific version of the app can't be built on Gradle, anyway. This ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only This PR has no user-facing side effects except the fact that the version name is different now for the study-specific version of the app (which doesn't seem particularly important to show a video/screenshot for). Commits: * Create dedicated alpha application component. This simplifies application component management significantly and allows individual build flavors to have their own unique module lists. * Fix broken test per earlier changes. * Add Kenya study-specific alpha build flavor. This new build flavor automatically enables the study-specific learner study feature flag. Cherry-pick of eef2f4c from the original #4420. * Update build_flavors.bzl Remove beta version declaration since that doesn't belong in this branch. * Post-CP fixes. * Fix Gradle builds. * Update TransformAndroidManifestTest.kt Correct typos.
- Loading branch information
1 parent
7562fdf
commit 17f2bcb
Showing
9 changed files
with
320 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
.../main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaBuildFlavorModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaOppiaApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/org/oppia/android/app/application/alphakenya/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
...main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) | ||
} | ||
} |
Oops, something went wrong.