-
Notifications
You must be signed in to change notification settings - Fork 579
Fix Part of #4938: Create Admin Onboarding Intro(2/12) #5839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adhiamboperes
wants to merge
100
commits into
develop
Choose a base branch
from
create-admin-intro
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
100 commits
Select commit
Hold shift + click to select a range
f3e8961
New layout for auth
adhiamboperes 471e1a6
Merge remote-tracking branch 'upstream/develop' into redesign-pin-input
adhiamboperes 14296af
Add compose livedata dependency
adhiamboperes cb7936f
Create color and string resources
adhiamboperes b10ae81
Create xml layouts
adhiamboperes 5a366f1
Create ProfileLoginActivity
adhiamboperes 83f3762
Create ProfileLoginFragment
adhiamboperes c384747
Refactor login intent to new ProfileLoginActivity
adhiamboperes a691304
Add todos to track cleanup
adhiamboperes eec9434
Cleanup unused items
adhiamboperes 99e1a19
Add admin reset pin flow
adhiamboperes a93542a
Add route to non-admin reset pin flow
adhiamboperes 1ea182a
Add non-admin pin reset flow
adhiamboperes 69973d1
wip commit
adhiamboperes b393870
Merge branch 'develop' of github.com:oppia/oppia-android into redesig…
adhiamboperes f00119d
Create AdminIntroActivity
adhiamboperes 8d6139a
Create AdminIntroFragment
adhiamboperes 2796aa4
Correct ktlint errors
adhiamboperes 3cff4d1
Add navigation to the screen
adhiamboperes 9145b20
Create the screen components
adhiamboperes 44d77bf
Add navigation to the next screen
adhiamboperes 9ef0501
Add activity tests
adhiamboperes 734c9ab
Add fragment tests
adhiamboperes d894646
Break down large composables
adhiamboperes a0ca9de
Add tests for login flow
adhiamboperes 0524005
Move dialogs to own files
adhiamboperes 3c7e3ff
Add tests for dialog flows: wip for non-admin
adhiamboperes a83c10b
Add todo to ensure an admin profile is created when all profile data …
adhiamboperes 09bfe8c
Fix lint issues
adhiamboperes a4e9208
Fix static analysis checks failures
adhiamboperes e0a697e
Fix ProfileChooserFragmentTest failures
adhiamboperes 6680a9c
Finish dialog tests
adhiamboperes 7523db0
Merge branch 'develop' of github.com:oppia/oppia-android into redesig…
adhiamboperes 828e042
Format dagger modules
adhiamboperes c1f6619
Fix missing dagger module
adhiamboperes 139723f
Merge remote-tracking branch 'upstream/redesign-pin-input' into creat…
adhiamboperes 1f58671
Ensure navigation is correct
adhiamboperes bfb32f3
Cleanup navigation and add tests for all changes
adhiamboperes d75fdb5
Fix UI and failing tests
adhiamboperes 432f3d7
fix trim spannable bug
adhiamboperes 4e4315f
Merge branch 'develop' of github.com:oppia/oppia-android into develop
adhiamboperes bff3c08
Merge branch 'develop' into redesign-pin-input
adhiamboperes fc3c28c
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes 7d781b4
Merge branch 'develop' into redesign-pin-input
adhiamboperes 98372c9
Generate a new maven_install due to conflicts in the old one.
adhiamboperes d6cc784
regenerate maven_install.json
adhiamboperes 8dbe1ec
address reviewer comment.
adhiamboperes 92efbaf
Revert unrelated changed
adhiamboperes 99eeafb
fix tests
adhiamboperes 7971ea4
Merge branch 'develop' into redesign-pin-input
adhiamboperes 39efe71
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes 54304b3
Merge branch 'develop' into redesign-pin-input
adhiamboperes f14fdbf
fix conflicts
adhiamboperes f6c3ce4
Repin dependencies
adhiamboperes d3be083
Merge branch 'redesign-pin-input' of github.com:oppia/oppia-android i…
adhiamboperes 9d00c2f
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes 299376c
Fix ktlint issue
adhiamboperes db6e2aa
Fix file formatting
adhiamboperes ef109b7
Merge branch 'develop' into redesign-pin-input
adhiamboperes 4b42e64
Exempt files from coverage.
adhiamboperes da39e88
Address reviewer comments
adhiamboperes d9cd074
Fix coverage failures
adhiamboperes f51dda6
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes fd1740c
Minor cleanup
adhiamboperes c452f8d
Fix Kdoc validity check
adhiamboperes fd9e76f
Fix navigation bug
adhiamboperes d69d67f
Fix wavy background
adhiamboperes 19320b9
Fix lint checks
adhiamboperes a0e3293
Merge branch 'develop' into redesign-pin-input
adhiamboperes e672fe2
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes b745269
Merge branch 'develop' into redesign-pin-input
adhiamboperes b5ef741
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes 696089e
Merge branch 'develop' of github.com:oppia/oppia-android into redesig…
adhiamboperes cf03541
Merge branch 'develop' into redesign-pin-input
adhiamboperes 7a2928a
Use use {} block for scenario
adhiamboperes cc2b32f
Remove test tags
adhiamboperes 8b2e18b
Merge branch 'develop' of github.com:oppia/oppia-android into redesig…
adhiamboperes 82e0ba2
Merge branch 'redesign-pin-input' of github.com:oppia/oppia-android i…
adhiamboperes 3ff1286
Add lint exemption
adhiamboperes 4589f9e
Merge branch 'develop' of github.com:oppia/oppia-android into redesig…
adhiamboperes 50f62cd
Add comments explaining test tag usage
adhiamboperes f8670b9
fix kdoc formatting
adhiamboperes 99ef626
add comment
adhiamboperes 252a05b
resolve merge conflicts from develop
adhiamboperes 1373660
Remove duplicate tests
adhiamboperes 1a03d92
Merge remote-tracking branch 'upstream/develop' into redesign-pin-input
adhiamboperes 8963a2a
Merge branch 'redesign-pin-input' into create-admin-intro
adhiamboperes e9601f1
Fix indentation issue
adhiamboperes a306113
General cleanup.
adhiamboperes eb930d3
Refactor some intents.
adhiamboperes 761a0b3
Ensure the newly created admin name is picked up by the profile chooser.
adhiamboperes 9c172ce
Refactor complete onboarding logic and update tests
adhiamboperes 3841366
Update AdminIntroFragmentTest tests
adhiamboperes e0659f0
Update CreateProfileFragmentTest tests
adhiamboperes 3e20653
fix failing tests
adhiamboperes ad84072
address reviewer comments
adhiamboperes ed7e0e6
Update admin profile creation and profile choose launch
adhiamboperes 184a956
Fix failing admin intro test and lint errors
adhiamboperes 054ad99
Fix failing OnboardingProfileTypeFragmentTest tests
adhiamboperes e639c2d
Merge branch 'develop' into create-admin-intro
adhiamboperes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -275,13 +275,27 @@ class ClassroomListFragmentPresenter @Inject constructor( | |||||
| val profile = result.value | ||||||
| val profileType = profile.profileType | ||||||
|
|
||||||
| if (enableOnboardingFlowV2.value && !profile.completedProfileOnboarding) { | ||||||
| // These asynchronous API calls do not block or wait for their results. They execute in | ||||||
| // the background and have minimal chances of interfering with the synchronous | ||||||
| // `handleBackPress` call below. | ||||||
| profileManagementController.markProfileOnboardingEnded(profileId) | ||||||
| if (profileType == ProfileType.SOLE_LEARNER || profileType == ProfileType.SUPERVISOR) { | ||||||
| appStartupStateController.markOnboardingFlowCompleted(profileId) | ||||||
| if (enableOnboardingFlowV2.value) { | ||||||
| when { | ||||||
| profileType == ProfileType.SUPERVISOR && profile.numberOfLogins == 1 -> { | ||||||
| // Supervisors end profile onboarding on the profiles list screen, but they do | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Small nit. |
||||||
| // complete app onboarding here. | ||||||
| appStartupStateController.markOnboardingFlowCompleted(profileId) | ||||||
| } | ||||||
| profileType == ProfileType.SOLE_LEARNER && !profile.completedProfileOnboarding -> { | ||||||
| // Sole learners both end profile onboarding and complete app onboarding here. | ||||||
| // These asynchronous API calls do not block or wait for their results. They execute | ||||||
| // in the background and have minimal chances of interfering with the synchronous | ||||||
| // `handleBackPress` call below. | ||||||
| profileManagementController.markProfileOnboardingEnded(profileId) | ||||||
| appStartupStateController.markOnboardingFlowCompleted(profileId) | ||||||
| } | ||||||
| profileType == ProfileType.ADDITIONAL_LEARNER && | ||||||
| !profile.completedProfileOnboarding -> { | ||||||
| // Additional learners only end profile onboarding, since they will never be the first | ||||||
| // profile in the app. | ||||||
| profileManagementController.markProfileOnboardingEnded(profileId) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
This file contains hidden or 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
This file contains hidden or 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
63 changes: 63 additions & 0 deletions
63
app/src/main/java/org/oppia/android/app/onboarding/AdminIntroActivity.kt
This file contains hidden or 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,63 @@ | ||
| package org.oppia.android.app.onboarding | ||
|
|
||
| import android.content.Context | ||
| import android.content.Intent | ||
| import android.os.Bundle | ||
| import org.oppia.android.app.activity.ActivityComponentImpl | ||
| import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity | ||
| import org.oppia.android.app.model.AdminIntroActivityParams | ||
| import org.oppia.android.app.model.ProfileId | ||
| import org.oppia.android.app.model.ProfileType | ||
| import org.oppia.android.app.model.ScreenName.ADMIN_INTRO_ACTIVITY | ||
| import org.oppia.android.util.extensions.getProtoExtra | ||
| import org.oppia.android.util.extensions.putProtoExtra | ||
| import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName | ||
| import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId | ||
| import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId | ||
| import javax.inject.Inject | ||
|
|
||
| /** Argument key for [AdminIntroActivity] intent parameters. */ | ||
| const val ADMIN_INTRO_PARAMS_KEY = "AdminIntroActivityParams.params" | ||
|
|
||
| /** Activity for displaying the admin onboarding screen. */ | ||
| class AdminIntroActivity : InjectableAutoLocalizedAppCompatActivity() { | ||
|
|
||
| @Inject | ||
| lateinit var adminIntroActivityPresenter: AdminIntroActivityPresenter | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
|
|
||
| (activityComponent as ActivityComponentImpl).inject(this) | ||
|
|
||
| val profileId = intent.extractCurrentUserProfileId() | ||
| val adminIntroActivityParams = intent.getProtoExtra( | ||
| ADMIN_INTRO_PARAMS_KEY, AdminIntroActivityParams.getDefaultInstance() | ||
| ) | ||
| val profileType = adminIntroActivityParams.profileType | ||
| val profileNickname = adminIntroActivityParams.profileNickname | ||
|
|
||
| adminIntroActivityPresenter.handleOnCreate(profileId, profileType, profileNickname) | ||
| } | ||
|
|
||
| companion object { | ||
| /** Returns a new [Intent] to open an [AdminIntroActivity] with the specified params. */ | ||
| fun createAdminIntroActivityIntent( | ||
| context: Context, | ||
| profileId: ProfileId, | ||
| profileType: ProfileType, | ||
| profileNickname: String | ||
| ): Intent { | ||
| val introActivityParams = AdminIntroActivityParams.newBuilder() | ||
| .setProfileType(profileType) | ||
| .setProfileNickname(profileNickname) | ||
| .build() | ||
|
|
||
| return Intent(context, AdminIntroActivity::class.java).apply { | ||
| decorateWithScreenName(ADMIN_INTRO_ACTIVITY) | ||
| putProtoExtra(ADMIN_INTRO_PARAMS_KEY, introActivityParams) | ||
| decorateWithUserProfileId(profileId) | ||
| } | ||
| } | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/org/oppia/android/app/onboarding/AdminIntroActivityPresenter.kt
This file contains hidden or 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,59 @@ | ||
| package org.oppia.android.app.onboarding | ||
|
|
||
| import android.os.Bundle | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import org.oppia.android.app.activity.ActivityScope | ||
| import org.oppia.android.app.model.AdminIntroFragmentArguments | ||
| import org.oppia.android.app.model.ProfileId | ||
| import org.oppia.android.app.model.ProfileType | ||
| import org.oppia.android.app.ui.R | ||
| import org.oppia.android.util.extensions.putProto | ||
| import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId | ||
| import javax.inject.Inject | ||
|
|
||
| /** Argument key for [AdminIntroFragment] arguments. */ | ||
| const val ADMIN_INTRO_FRAGMENT_ARGS = "AdminIntroFragment.args" | ||
|
|
||
| private const val TAG_ADMIN_INTRO_FRAGMENT = "TAG_ADMIN_INTRO_FRAGMENT" | ||
|
|
||
| /** The presenter for [AdminIntroActivity]. */ | ||
| @ActivityScope | ||
| class AdminIntroActivityPresenter @Inject constructor( | ||
| private val activity: AppCompatActivity | ||
| ) { | ||
|
|
||
| /** Creates the view for [AdminIntroActivity]. */ | ||
| fun handleOnCreate(profileId: ProfileId, profileType: ProfileType, profileNickname: String) { | ||
| activity.setContentView(R.layout.admin_intro_activity) | ||
|
|
||
| if (getAdminIntroFragment() == null) { | ||
| val adminIntroFragment = AdminIntroFragment() | ||
|
|
||
| val args = Bundle().apply { | ||
| val fragmentArgs = | ||
| AdminIntroFragmentArguments.newBuilder() | ||
| .setProfileType(profileType) | ||
| .setProfileNickname(profileNickname) | ||
| .build() | ||
| putProto(ADMIN_INTRO_FRAGMENT_ARGS, fragmentArgs) | ||
| decorateWithUserProfileId(profileId) | ||
| } | ||
|
|
||
| adminIntroFragment.arguments = args | ||
|
|
||
| activity.supportFragmentManager.beginTransaction() | ||
| .add( | ||
| R.id.admin_intro_fragment_placeholder, | ||
| adminIntroFragment, | ||
| TAG_ADMIN_INTRO_FRAGMENT | ||
| ) | ||
| .commitNow() | ||
| } | ||
| } | ||
|
|
||
| private fun getAdminIntroFragment(): AdminIntroFragment? { | ||
| return activity.supportFragmentManager.findFragmentByTag( | ||
| TAG_ADMIN_INTRO_FRAGMENT | ||
| ) as? AdminIntroFragment | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
app/src/main/java/org/oppia/android/app/onboarding/AdminIntroFragment.kt
This file contains hidden or 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,50 @@ | ||
| package org.oppia.android.app.onboarding | ||
|
|
||
| import android.content.Context | ||
| import android.os.Bundle | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import org.oppia.android.app.fragment.FragmentComponentImpl | ||
| import org.oppia.android.app.fragment.InjectableFragment | ||
| import org.oppia.android.app.model.AdminIntroFragmentArguments | ||
| import org.oppia.android.util.extensions.getProto | ||
| import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId | ||
| import javax.inject.Inject | ||
|
|
||
| /** Fragment that contains the admin intro screen. */ | ||
| class AdminIntroFragment : InjectableFragment() { | ||
|
|
||
| @Inject | ||
| lateinit var adminIntroFragmentPresenter: AdminIntroFragmentPresenter | ||
|
|
||
| override fun onAttach(context: Context) { | ||
| super.onAttach(context) | ||
| (fragmentComponent as FragmentComponentImpl).inject(this) | ||
| } | ||
|
|
||
| override fun onCreateView( | ||
| inflater: LayoutInflater, | ||
| container: ViewGroup?, | ||
| savedInstanceState: Bundle? | ||
| ): View? { | ||
| val profileId = checkNotNull(arguments?.extractCurrentUserProfileId()) { | ||
| "Expected profileId to be included in the arguments for AdminIntroFragment." | ||
| } | ||
|
|
||
| val adminIntroFragmentArguments = arguments?.getProto( | ||
| ADMIN_INTRO_FRAGMENT_ARGS, AdminIntroFragmentArguments.getDefaultInstance() | ||
| ) | ||
|
|
||
| val profileType = checkNotNull(adminIntroFragmentArguments?.profileType) { | ||
| "Expected AdminIntroFragment to have a profileType argument." | ||
| } | ||
|
|
||
| val profileNickName = checkNotNull(adminIntroFragmentArguments?.profileNickname) { | ||
| "Expected AdminIntroFragment to have a profileNickName argument." | ||
| } | ||
|
|
||
| return adminIntroFragmentPresenter | ||
| .handleCreateView(inflater, container, profileId, profileType, profileNickName) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.