Skip to content
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

Fix Part of #4938: Profile Configuration and Migration #5387

Merged
merged 368 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
368 commits
Select commit Hold shift + click to select a range
b458e19
Fix forward databinding error from upstream
adhiamboperes Jun 5, 2024
1a77d9c
Add forward navigation
adhiamboperes Jun 5, 2024
b542733
Remove modules from upstream
adhiamboperes Jun 5, 2024
a6ee4f5
Add navigation tests
adhiamboperes Jun 5, 2024
fac5719
Fix alignment on tablet landscape
adhiamboperes Jun 5, 2024
93a29ab
Remove PrimeTopicAssetsControllerModule
adhiamboperes Jun 5, 2024
c18a4b1
Move files to onboarding package
adhiamboperes Jun 5, 2024
c3f922a
Merge remote-tracking branch 'upstream/onboarding-learner-intro-scree…
adhiamboperes Jun 5, 2024
b165913
Refactor layouts based on upstream changes.
adhiamboperes Jun 5, 2024
1c64112
Remove unused imports
adhiamboperes Jun 5, 2024
403a8fa
Create style for language dropdown
adhiamboperes Jun 6, 2024
539e740
Refactor tablet layout styling
adhiamboperes Jun 6, 2024
d11d221
Refactor rename AudioLanguageFragmentPresenter to V1 suffix
adhiamboperes Jun 6, 2024
52fbf56
Add tests
adhiamboperes Jun 6, 2024
f14bbb1
Merge remote-tracking branch 'upstream/develop' into new-onboarding-s…
adhiamboperes Jun 11, 2024
ea056af
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes Jun 11, 2024
5237f63
Merge remote-tracking branch 'upstream/onboarding-profile-type-screen…
adhiamboperes Jun 11, 2024
3fdf74f
Fix merge conflict
adhiamboperes Jun 11, 2024
c2c244b
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes Jun 11, 2024
b802921
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 11, 2024
66b664c
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 11, 2024
a435c11
Create new style for error messages
adhiamboperes Jun 11, 2024
3f3b810
Add textwatcher test
adhiamboperes Jun 11, 2024
5b3ecba
Fix small issues
adhiamboperes Jun 11, 2024
5b43705
Fix small issues
adhiamboperes Jun 11, 2024
43274da
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 11, 2024
1d7f954
Fix merge conflicts
adhiamboperes Jun 11, 2024
a3e7168
Merge remote-tracking branch 'upstream/onboarding-learner-intro-scree…
adhiamboperes Jun 11, 2024
027c745
Merge branch 'onboarding-audio-language-screen' into onboarding-profi…
adhiamboperes Jun 13, 2024
ae9886f
Create sole learner profile with tests
adhiamboperes Jun 13, 2024
5257e30
Create profile onboarding event logs
adhiamboperes Jun 13, 2024
edd2151
Exit app for sole learner profile
adhiamboperes Jun 13, 2024
c1698ed
Add login pathway for sole learner
adhiamboperes Jun 13, 2024
441b2d0
fix import order
adhiamboperes Jun 13, 2024
bcc2cbf
Add tests for migrated login routes
adhiamboperes Jun 17, 2024
6c1a28f
Add tests for migrated login routes
adhiamboperes Jun 17, 2024
822e1fb
Log onboarding started event
adhiamboperes Jun 17, 2024
d71ed56
Update test initialization for onboarding v2 off
adhiamboperes Jun 17, 2024
1e9c136
Update test initialization for onboarding v2 off
adhiamboperes Jun 17, 2024
72624f5
Merge branch 'develop' into new-onboarding-screen
adhiamboperes Jun 17, 2024
13d9ac5
Merge branch 'new-onboarding-screen' into onboarding-profile-type-screen
adhiamboperes Jun 17, 2024
f0d0c57
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 17, 2024
199447d
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 17, 2024
a0fc7d6
Merge branch 'onboarding-learner-intro-screen' into onboarding-audio-…
adhiamboperes Jun 17, 2024
9c2e1d6
Merge branch 'onboarding-audio-language-screen' into onboarding-profi…
adhiamboperes Jun 17, 2024
485dc54
Replace Lifecycle.State check with activity.isFinishing
adhiamboperes Jun 18, 2024
33624d7
Flatten layout
adhiamboperes Jun 19, 2024
2b10f80
Resolve merge conflicts
adhiamboperes Jun 19, 2024
1ade253
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 19, 2024
49586cc
Adjust profile picture prompt
adhiamboperes Jun 19, 2024
2d5d438
Add assertions for image loaded
adhiamboperes Jun 19, 2024
41dea0b
Replace Lifecycle.State check with activity.isFinishing
adhiamboperes Jun 19, 2024
e6a1b24
Addressed reviewer comments
adhiamboperes Jun 19, 2024
85081cc
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 19, 2024
4e91b89
Merge branch 'onboarding-learner-intro-screen' into onboarding-audio-…
adhiamboperes Jun 19, 2024
66f8fac
Fix tests
adhiamboperes Jun 19, 2024
c10ba82
Fix failing tests
adhiamboperes Jun 19, 2024
c386024
Add missing test initialization
adhiamboperes Jun 19, 2024
0b74249
Merge branch 'onboarding-audio-language-screen' into onboarding-profi…
adhiamboperes Jun 19, 2024
db36244
Fix merge conflict
adhiamboperes Jun 19, 2024
35a839e
Add missing bazel dependency
adhiamboperes Jun 19, 2024
59c4665
Complete login migration route tests
adhiamboperes Jun 20, 2024
ab36c03
Fix tests/flows broken by changes
adhiamboperes Jun 20, 2024
c327be9
Add tests for end profile onboarding event log
adhiamboperes Jun 20, 2024
fccac67
Add tests for profile creation errors
adhiamboperes Jun 20, 2024
4cd3918
General cleanup
adhiamboperes Jun 21, 2024
2c33188
General cleanup
adhiamboperes Jun 21, 2024
026ff1d
Revert breaking change
adhiamboperes Jun 21, 2024
7304449
Add kdoc
adhiamboperes Jun 21, 2024
2cb0469
Fix static check failures
adhiamboperes Jun 21, 2024
c32d2e9
Fix failing event log events
adhiamboperes Jun 21, 2024
cb8b21e
Fix failing app deprecation tests
adhiamboperes Jun 22, 2024
c827a68
Refactor the app startup state
adhiamboperes Jun 23, 2024
5a570b2
Fix event logs
adhiamboperes Jun 23, 2024
381c883
Revert changes to app init
adhiamboperes Jun 24, 2024
bdcf5c1
Enforce v2 onboarding flow
adhiamboperes Jun 24, 2024
0a59cfc
Enforce conditional profile exit for sole learner
adhiamboperes Jun 24, 2024
5ee3a20
Revert unnecessary test file changes
adhiamboperes Jun 24, 2024
df789ea
Fix proto field case
adhiamboperes Jun 24, 2024
a1b0964
Fix SplashActivityTests
adhiamboperes Jun 24, 2024
1bb7508
Merge branch 'develop' into onboarding-profile-type-screen
adhiamboperes Jun 24, 2024
6e0401f
Update test_file_exemptions to the new format
adhiamboperes Jun 24, 2024
2f84098
Fix indent
adhiamboperes Jun 24, 2024
d979d1b
Merge branch 'onboarding-profile-type-screen' into create-profile-screen
adhiamboperes Jun 24, 2024
2d83378
Update test_file_exemptions
adhiamboperes Jun 24, 2024
3f5c8c2
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 24, 2024
e3565b5
Address reviewer comment
adhiamboperes Jun 24, 2024
3641559
Merge branch 'onboarding-learner-intro-screen' into onboarding-audio-…
adhiamboperes Jun 24, 2024
b19014c
Address reviewer comments
adhiamboperes Jun 24, 2024
2412618
Populate the language dropdown list
adhiamboperes Jun 25, 2024
8d8ab17
Merge branch 'onboarding-audio-language-screen' into onboarding-profi…
adhiamboperes Jun 25, 2024
61a7724
Fix test file exemption path
adhiamboperes Jun 25, 2024
5512216
Add missing bazel dep
adhiamboperes Jun 25, 2024
a0fe5c6
Add dropdown view id
adhiamboperes Jun 25, 2024
2bf2eda
Hook up app language options
adhiamboperes Jun 26, 2024
04acfa9
Merge branch 'develop' into onboarding-profile-type-screen
adhiamboperes Jun 30, 2024
223150b
Replace png images with svgs
adhiamboperes Jun 30, 2024
90428af
Add exemptions for new svgs
adhiamboperes Jun 30, 2024
e248fb1
Pull upstream and fix conflicts
adhiamboperes Jun 30, 2024
9fd9fbc
Change default avatar bg in v2
adhiamboperes Jun 30, 2024
2ec249d
Fix profile prompt background
adhiamboperes Jun 30, 2024
988ab47
Merge branch 'develop' into create-profile-screen
adhiamboperes Jun 30, 2024
af6ed95
Fix deprecated api
adhiamboperes Jun 30, 2024
53e7b9b
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 30, 2024
05d02c3
Fix kdoc
adhiamboperes Jun 30, 2024
ce9660d
Merge branch 'create-profile-screen' into onboarding-learner-intro-sc…
adhiamboperes Jun 30, 2024
ce46838
Merge remote-tracking branch 'upstream/onboarding-learner-intro-scree…
adhiamboperes Jun 30, 2024
86416a1
Fix test_file_exemption
adhiamboperes Jun 30, 2024
b3b7d6c
Merge branch 'develop' into onboarding-audio-language-screen
adhiamboperes Jul 1, 2024
29eb9d5
Replace ConstraintLayout with FrameLayout
adhiamboperes Jul 1, 2024
fbe6ac3
Add dropdown view id
adhiamboperes Jun 25, 2024
264f827
Hook up app language options
adhiamboperes Jun 26, 2024
320fc14
Create language dropdown list and the default selection
adhiamboperes Jul 2, 2024
d96d29e
Make otter graphic respond to rtl layouts
adhiamboperes Jul 2, 2024
9073e8c
Add mechanisms to check if a default profile exists: wip
adhiamboperes Jul 2, 2024
31fb8f5
Pass the created profileId and update profile details
adhiamboperes Jul 2, 2024
d65b9f8
Refactored IntroFragment arguments to proto, and decorated with the p…
adhiamboperes Jul 2, 2024
cf138ab
Prime AudioLanguageActivity to receive a profileId args
adhiamboperes Jul 2, 2024
b0e47c9
Fix merge conflicts
adhiamboperes Jul 3, 2024
866fff4
Refactor to the new central hasProtoExtra
adhiamboperes Jul 3, 2024
8d96257
Remove redundant non-null assertion
adhiamboperes Jul 3, 2024
470a476
Fix duplicating default profile creation
adhiamboperes Jul 5, 2024
89d5c67
Bind audiolanguage pre-selection to the dropdown
adhiamboperes Jul 5, 2024
c901f9d
Fix persist selection on config change
adhiamboperes Jul 5, 2024
b71d6bd
Setup audio language pre-selection logic
adhiamboperes Jul 5, 2024
682355d
Fix lint errors
adhiamboperes Jul 5, 2024
185d8d4
Cleanup language selection and profile creation
adhiamboperes Jul 9, 2024
a0884c8
Fix missing kdocs
adhiamboperes Jul 9, 2024
efe460e
Update profile error message view
adhiamboperes Jul 11, 2024
0be7286
Refactor IntroActivity intent creation
adhiamboperes Jul 11, 2024
8508ea5
Update intent tests to reflect new intent extras
adhiamboperes Jul 11, 2024
beb6f7c
Add tests for language switching
adhiamboperes Jul 11, 2024
e653a7b
Add helper for creating a default empty profile
adhiamboperes Jul 11, 2024
4d2c48d
Update updateNewProfileDetails() kdocs
adhiamboperes Jul 11, 2024
002cc38
Helper for creating the default empty profile in tests
adhiamboperes Jul 11, 2024
eff4cbb
Tests for the new profile update api
adhiamboperes Jul 11, 2024
d6423c2
Additional tests for the profile creation flow
adhiamboperes Jul 11, 2024
7730225
Add tests for language selection
adhiamboperes Jul 11, 2024
af11961
Fix missing kdoc
adhiamboperes Jul 11, 2024
4d81441
Fix self-review pass issues.
adhiamboperes Jul 12, 2024
d08df8b
Exempt OnboardingFragmentTest from locale checks
adhiamboperes Jul 12, 2024
0932981
Fix failing tests
adhiamboperes Jul 12, 2024
d76307b
Revert conflicting/already implemented UI layer code
adhiamboperes Jul 12, 2024
844c0e2
Temporary comments
adhiamboperes Jul 12, 2024
9ba0b9b
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Jul 12, 2024
36f3cf6
Fix leftover refactor issue
adhiamboperes Jul 12, 2024
de5783c
Complete the sole learner onboarding flow
adhiamboperes Jul 15, 2024
fc85e9d
Update admin profile profileType in v2
adhiamboperes Jul 15, 2024
7564eba
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Jul 15, 2024
56f668a
Destroy onboarding activities after onboarding completed.
adhiamboperes Jul 15, 2024
7a97741
Fix failing SplashActivityTests
adhiamboperes Jul 15, 2024
8efa8b9
Fix failing SplashActivityTests + finish migration pathways
adhiamboperes Jul 17, 2024
318334f
Onboard existing learner profiles
adhiamboperes Jul 17, 2024
0bf61cc
Toggle homescreen with multiple classrooms flag
adhiamboperes Jul 17, 2024
b00217a
General cleanup
adhiamboperes Jul 18, 2024
5f01efb
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Jul 18, 2024
cd25696
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Jul 18, 2024
eb64975
General cleanup
adhiamboperes Jul 18, 2024
e7ee78a
Fix failing test
adhiamboperes Jul 23, 2024
f4f652e
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Jul 25, 2024
08f67c6
Address part of reviewer comments
adhiamboperes Aug 1, 2024
e942263
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 1, 2024
9a8024b
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 1, 2024
e67f67b
Fix lint errors
adhiamboperes Aug 1, 2024
ac6b501
Merge branch 'onboarding-language-domain-config' of github.com:oppia/…
adhiamboperes Aug 1, 2024
ef1fd91
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 1, 2024
666ad36
Create test suite for TextInputLayoutBindingAdapters
adhiamboperes Aug 5, 2024
9ad283a
Address more reviewer comments.
adhiamboperes Aug 5, 2024
ee841fa
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Aug 5, 2024
4e6a2a6
Create test suite for TextInputLayoutBindingAdapters
adhiamboperes Aug 5, 2024
5389819
Address more reviewer comments.
adhiamboperes Aug 5, 2024
4b37f24
Fixed static check failures
adhiamboperes Aug 5, 2024
5503aee
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 6, 2024
da1787b
Fix empty strings assertion
adhiamboperes Aug 12, 2024
3e068bb
Addressed test comments
adhiamboperes Aug 12, 2024
990dc5a
Use proto for app language
adhiamboperes Aug 14, 2024
30cf1db
Refactor language binding logic
adhiamboperes Aug 19, 2024
9193b4a
Allow user to progress on continue clicked.
adhiamboperes Aug 21, 2024
bc140c5
Fix failing test
adhiamboperes Aug 21, 2024
6635c0d
Fix failing audio language tests
adhiamboperes Aug 21, 2024
d604e53
Fix failing profile creation tests
adhiamboperes Aug 21, 2024
622edb3
Temporarily remove failing adapter tests
adhiamboperes Aug 22, 2024
0133cd0
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 22, 2024
f838bab
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 23, 2024
dd03357
Update profile creation exceptions and tests
adhiamboperes Aug 23, 2024
da2fb5f
Properly set up binding adapter tests
adhiamboperes Aug 23, 2024
d982d06
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 23, 2024
0fc0078
Fix self review issues
adhiamboperes Aug 23, 2024
7589da6
Remove unused code
adhiamboperes Aug 23, 2024
ded1640
Fix nit
adhiamboperes Aug 23, 2024
b2084e6
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 23, 2024
e06d28f
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 23, 2024
6cf179f
Remove duplicate exemption
adhiamboperes Aug 23, 2024
1cc21bb
Remove leftover profile audiolanguage
adhiamboperes Aug 24, 2024
f89ed7a
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Aug 27, 2024
946c79b
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Aug 27, 2024
ca334d6
Integrate classrooms and onboarding
adhiamboperes Aug 27, 2024
831fa1c
Fix Admin profile creation and onboarding
adhiamboperes Aug 27, 2024
b94a0f8
Add missing argument proto
adhiamboperes Aug 27, 2024
b3d6ee3
Update broken tests
adhiamboperes Aug 27, 2024
daea15f
Fix profile migration bugs
adhiamboperes Aug 28, 2024
0397de7
Fix failing audio language tests
adhiamboperes Sep 4, 2024
9993552
Add test for arabic inTextInputLayoutBindingAdaptersTest
adhiamboperes Sep 9, 2024
dea8c06
Refactor formatting
adhiamboperes Sep 9, 2024
47af3d1
Address reviewer comment
adhiamboperes Sep 9, 2024
cc7147a
Cleanup language selection impl
adhiamboperes Sep 9, 2024
7c713c6
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Sep 9, 2024
063b97a
Address general comments
adhiamboperes Sep 9, 2024
73105a0
Nit
adhiamboperes Sep 10, 2024
fac0a95
Nit
adhiamboperes Sep 10, 2024
1a4d82d
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Sep 10, 2024
0ceb9fc
Fix failing tests
adhiamboperes Sep 10, 2024
28d2742
Fix failing tests
adhiamboperes Sep 10, 2024
6ae7968
Merge branch 'onboarding-profile-domain-config' of github.com:oppia/o…
adhiamboperes Sep 10, 2024
6a5634e
remove unused import
adhiamboperes Sep 10, 2024
7d2c1a7
Refactor event log management
adhiamboperes Sep 11, 2024
6d90cd2
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Sep 11, 2024
59df467
Refactor function
adhiamboperes Sep 11, 2024
45719dd
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Sep 12, 2024
41c6a68
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Sep 16, 2024
9961d00
Merge branch 'develop' into onboarding-language-domain-config
adhiamboperes Oct 1, 2024
4ff4680
Refactor language selection to use supported languages only
adhiamboperes Oct 1, 2024
9d60f13
Merge branch 'onboarding-language-domain-config' of github.com:oppia/…
adhiamboperes Oct 1, 2024
0047916
Merge branch 'onboarding-language-domain-config' into onboarding-prof…
adhiamboperes Oct 4, 2024
e6f821a
Refactor test to use existing eventlog util function
adhiamboperes Oct 8, 2024
21c85a9
Null check and readability improvements
adhiamboperes Oct 8, 2024
6fbea02
Refactor test setup
adhiamboperes Oct 9, 2024
b30dd7e
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Oct 15, 2024
fd3a10c
Fix failing tests
adhiamboperes Oct 15, 2024
a57310e
Fix failing profile chooser tests
adhiamboperes Oct 16, 2024
943aa87
Resolve merge conflicts
adhiamboperes Oct 22, 2024
8d5a78d
Refactor backpress callback
adhiamboperes Oct 22, 2024
b200e0f
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Nov 4, 2024
7a52213
Fix synchronisation issues caused by createEmptyComposeRule()
adhiamboperes Nov 6, 2024
241d58e
Revert formatting changes
adhiamboperes Nov 6, 2024
537b6b9
Refactor callback code
adhiamboperes Nov 6, 2024
4899492
Revert formatting only changes
adhiamboperes Nov 6, 2024
a133e6d
Add missing tests
adhiamboperes Nov 7, 2024
885a193
Pull latest changes
adhiamboperes Nov 7, 2024
8d294c7
Fix merge issues
adhiamboperes Nov 7, 2024
13ad7ee
Resolve merge conflicts
adhiamboperes Nov 18, 2024
f18fb54
Address reviewer comments
adhiamboperes Nov 19, 2024
e8251c1
Run test on CI without espresso annotation
adhiamboperes Nov 20, 2024
066ea9f
Fix failing tests and livedata bug
adhiamboperes Nov 26, 2024
5f5ea04
Add tests for profile type migration
adhiamboperes Nov 26, 2024
f3f4c6d
Merge branch 'develop' into onboarding-profile-domain-config
BenHenning Nov 26, 2024
fefbd84
Add tests for complete app onboarding
adhiamboperes Nov 26, 2024
0ba097d
Merge branch 'develop' of github.com:oppia/oppia-android into onboard…
adhiamboperes Nov 26, 2024
c83fc69
Added test coverage for onboarding events
adhiamboperes Nov 29, 2024
0d435e4
Merge branch 'onboarding-profile-domain-config' of github.com:oppia/o…
adhiamboperes Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity
import org.oppia.android.app.activity.route.ActivityRouter
import org.oppia.android.app.drawer.ExitProfileDialogFragment
import org.oppia.android.app.drawer.TAG_SWITCH_PROFILE_DIALOG
import org.oppia.android.app.home.ExitProfileListener
import org.oppia.android.app.home.RouteToRecentlyPlayedListener
import org.oppia.android.app.home.RouteToTopicListener
import org.oppia.android.app.home.RouteToTopicPlayStoryListener
import org.oppia.android.app.model.DestinationScreen
import org.oppia.android.app.model.ExitProfileDialogArguments
import org.oppia.android.app.model.HighlightItem
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ProfileType
import org.oppia.android.app.model.RecentlyPlayedActivityParams
import org.oppia.android.app.model.RecentlyPlayedActivityTitle
import org.oppia.android.app.model.ScreenName.CLASSROOM_LIST_ACTIVITY
import org.oppia.android.app.topic.TopicActivity.Companion.createTopicActivityIntent
import org.oppia.android.app.topic.TopicActivity.Companion.createTopicPlayStoryActivityIntent
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName
import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject
Expand All @@ -32,7 +36,8 @@ class ClassroomListActivity :
InjectableAutoLocalizedAppCompatActivity(),
RouteToTopicListener,
RouteToTopicPlayStoryListener,
RouteToRecentlyPlayedListener {
RouteToRecentlyPlayedListener,
ExitProfileListener {
@Inject
lateinit var classroomListActivityPresenter: ClassroomListActivityPresenter

Expand All @@ -44,6 +49,10 @@ class ClassroomListActivity :

private var internalProfileId: Int = -1

@Inject
@field:EnableOnboardingFlowV2
lateinit var enableOnboardingFlowV2: PlatformParameterValue<Boolean>

companion object {
/** Returns a new [Intent] to route to [ClassroomListActivity] for a specified [profileId]. */
fun createClassroomListActivity(context: Context, profileId: ProfileId?): Intent {
Expand All @@ -68,22 +77,6 @@ class ClassroomListActivity :
classroomListActivityPresenter.handleOnRestart()
}

override fun onBackPressed() {
val previousFragment =
supportFragmentManager.findFragmentByTag(TAG_SWITCH_PROFILE_DIALOG)
if (previousFragment != null) {
supportFragmentManager.beginTransaction().remove(previousFragment).commitNow()
}
val exitProfileDialogArguments =
ExitProfileDialogArguments
.newBuilder()
.setHighlightItem(HighlightItem.NONE)
.build()
val dialogFragment = ExitProfileDialogFragment
.newInstance(exitProfileDialogArguments = exitProfileDialogArguments)
dialogFragment.showNow(supportFragmentManager, TAG_SWITCH_PROFILE_DIALOG)
}

override fun routeToRecentlyPlayed(recentlyPlayedActivityTitle: RecentlyPlayedActivityTitle) {
val recentlyPlayedActivityParams =
RecentlyPlayedActivityParams
Expand Down Expand Up @@ -121,4 +114,24 @@ class ClassroomListActivity :
)
)
}

override fun exitProfile(profileType: ProfileType) {
val previousFragment =
supportFragmentManager.findFragmentByTag(TAG_SWITCH_PROFILE_DIALOG)
if (previousFragment != null) {
supportFragmentManager.beginTransaction().remove(previousFragment).commitNow()
}
val exitProfileDialogArguments =
ExitProfileDialogArguments
.newBuilder().apply {
if (enableOnboardingFlowV2.value) {
this.profileType = profileType
}
this.highlightItem = HighlightItem.NONE
}
.build()
val dialogFragment = ExitProfileDialogFragment
.newInstance(exitProfileDialogArguments = exitProfileDialogArguments)
dialogFragment.showNow(supportFragmentManager, TAG_SWITCH_PROFILE_DIALOG)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.oppia.android.app.classroom
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
Expand Down Expand Up @@ -36,6 +37,7 @@ import org.oppia.android.app.classroom.promotedlist.PromotedStoryList
import org.oppia.android.app.classroom.topiclist.AllTopicsHeaderText
import org.oppia.android.app.classroom.topiclist.TopicCard
import org.oppia.android.app.classroom.welcome.WelcomeText
import org.oppia.android.app.home.ExitProfileListener
import org.oppia.android.app.home.HomeItemViewModel
import org.oppia.android.app.home.RouteToTopicPlayStoryListener
import org.oppia.android.app.home.WelcomeViewModel
Expand All @@ -48,6 +50,8 @@ import org.oppia.android.app.home.topiclist.TopicSummaryViewModel
import org.oppia.android.app.model.ClassroomSummary
import org.oppia.android.app.model.LessonThumbnail
import org.oppia.android.app.model.LessonThumbnailGraphic
import org.oppia.android.app.model.Profile
import org.oppia.android.app.model.ProfileType
import org.oppia.android.app.model.TopicSummary
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.utility.datetime.DateTimeUtil
Expand All @@ -59,9 +63,13 @@ import org.oppia.android.domain.oppialogger.analytics.AnalyticsController
import org.oppia.android.domain.profile.ProfileManagementController
import org.oppia.android.domain.topic.TopicListController
import org.oppia.android.domain.translation.TranslationController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.locale.OppiaLocale
import org.oppia.android.util.parser.html.StoryHtmlParserEntityType
import org.oppia.android.util.parser.html.TopicHtmlParserEntityType
import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId
import javax.inject.Inject

Expand All @@ -82,14 +90,18 @@ class ClassroomListFragmentPresenter @Inject constructor(
private val dateTimeUtil: DateTimeUtil,
private val translationController: TranslationController,
private val machineLocale: OppiaLocale.MachineLocale,
private val appStartupStateController: AppStartupStateController,
private val analyticsController: AnalyticsController,
@EnableOnboardingFlowV2
private val enableOnboardingFlowV2: PlatformParameterValue<Boolean>,
private val appStartupStateController: AppStartupStateController
) {
private val routeToTopicPlayStoryListener = activity as RouteToTopicPlayStoryListener
private val exitProfileListener = activity as ExitProfileListener
private lateinit var binding: ClassroomListFragmentBinding
private lateinit var classroomListViewModel: ClassroomListViewModel
private var internalProfileId: Int = -1
private val profileId = activity.intent.extractCurrentUserProfileId()
private var onBackPressedCallback: OnBackPressedCallback? = null

/** Creates and returns the view for the [ClassroomListFragment]. */
fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View? {
Expand Down Expand Up @@ -155,6 +167,10 @@ class ClassroomListFragmentPresenter @Inject constructor(
}
)

profileManagementController.getProfile(profileId).toLiveData().observe(fragment) {
processProfileResult(it)
}

return binding.root
}

Expand Down Expand Up @@ -190,26 +206,25 @@ class ClassroomListFragmentPresenter @Inject constructor(
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ClassroomListScreen() {
val groupedItems = classroomListViewModel.homeItemViewModelListLiveData.value
?.plus(classroomListViewModel.topicList)
?.groupBy { it::class }
val groupedItems = (
classroomListViewModel.homeItemViewModelListLiveData.value.orEmpty() +
classroomListViewModel.topicList
)
.groupBy { it::class }
val topicListSpanCount = integerResource(id = R.integer.home_span_count)
val listState = rememberLazyListState()
val classroomListIndex = groupedItems
?.flatMap { (type, items) -> items.map { type to it } }
?.indexOfFirst { it.first == AllClassroomsViewModel::class }
?: -1
.flatMap { (type, items) -> items.map { type to it } }
.indexOfFirst { it.first == AllClassroomsViewModel::class }

LazyColumn(
modifier = Modifier.testTag(CLASSROOM_LIST_SCREEN_TEST_TAG),
state = listState
) {
groupedItems?.forEach { (type, items) ->
groupedItems.forEach { (type, items) ->
when (type) {
WelcomeViewModel::class -> items.forEach { item ->
item {
WelcomeText(welcomeViewModel = item as WelcomeViewModel)
}
item { WelcomeText(welcomeViewModel = item as WelcomeViewModel) }
}
PromotedStoryListViewModel::class -> items.forEach { item ->
item {
Expand All @@ -223,26 +238,22 @@ class ClassroomListFragmentPresenter @Inject constructor(
item {
ComingSoonTopicList(
comingSoonTopicListViewModel = item as ComingSoonTopicListViewModel,
machineLocale = machineLocale,
machineLocale = machineLocale
)
}
}
AllClassroomsViewModel::class -> items.forEach { _ ->
item {
AllClassroomsHeaderText()
}
item { AllClassroomsHeaderText() }
}
ClassroomSummaryViewModel::class -> stickyHeader() {
ClassroomSummaryViewModel::class -> stickyHeader {
ClassroomList(
classroomSummaryList = items.map { it as ClassroomSummaryViewModel },
selectedClassroomId = classroomListViewModel.selectedClassroomId.get() ?: "",
selectedClassroomId = classroomListViewModel.selectedClassroomId.get().orEmpty(),
isSticky = listState.firstVisibleItemIndex >= classroomListIndex
)
}
AllTopicsViewModel::class -> items.forEach { _ ->
item {
AllTopicsHeaderText()
}
item { AllTopicsHeaderText() }
}
TopicSummaryViewModel::class -> {
gridItems(
Expand All @@ -259,12 +270,61 @@ class ClassroomListFragmentPresenter @Inject constructor(
}
}

private fun processProfileResult(result: AsyncResult<Profile>) {
when (result) {
is AsyncResult.Success -> {
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)
}
}

// This synchronous function call executes independently of the async calls above.
handleBackPress(profileType)
}
is AsyncResult.Failure -> {
oppiaLogger.e(
"ClassroomListFragment", "Failed to fetch profile with id:$profileId", result.error
)
Profile.getDefaultInstance()
}
is AsyncResult.Pending -> {
Profile.getDefaultInstance()
}
}
}

private fun logHomeActivityEvent() {
analyticsController.logImportantEvent(
oppiaLogger.createOpenHomeContext(),
profileId
)
}

private fun handleBackPress(profileType: ProfileType) {
onBackPressedCallback?.remove()

onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
exitProfileListener.exitProfile(profileType)
// The dispatcher can hold a reference to the host
// so we need to null it out to prevent memory leaks.
this.remove()
onBackPressedCallback = null
}
}

onBackPressedCallback?.let { callback ->
activity.onBackPressedDispatcher.addCallback(fragment, callback)
}
}
}

/** Adds a grid of items to a LazyListScope with specified arrangement and item content. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableDialogFragment
import org.oppia.android.app.model.ExitProfileDialogArguments
import org.oppia.android.app.model.HighlightItem
import org.oppia.android.app.model.ProfileType
import org.oppia.android.app.profile.ProfileChooserActivity
import org.oppia.android.util.extensions.getProto
import org.oppia.android.util.extensions.putProto
Expand Down Expand Up @@ -63,18 +64,25 @@ class ExitProfileDialogFragment : InjectableDialogFragment() {
else -> false
}

val soleLearnerProfile = exitProfileDialogArguments.profileType == ProfileType.SOLE_LEARNER

val alertDialog = AlertDialog
.Builder(ContextThemeWrapper(activity as Context, R.style.OppiaAlertDialogTheme))
.setMessage(R.string.home_activity_back_dialog_message)
.setNegativeButton(R.string.home_activity_back_dialog_cancel) { dialog, _ ->
dialog.dismiss()
}
.setPositiveButton(R.string.home_activity_back_dialog_exit) { _, _ ->
val intent = ProfileChooserActivity.createProfileChooserActivity(activity!!)
if (!restoreLastCheckedItem) {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
if (soleLearnerProfile) {
requireActivity().finish()
} else {
val intent = ProfileChooserActivity.createProfileChooserActivity(requireActivity())
if (!restoreLastCheckedItem) {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
}
requireActivity().startActivity(intent)
requireActivity().finish()
}
activity!!.startActivity(intent)
}
.create()
alertDialog.setCanceledOnTouchOutside(false)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.oppia.android.app.home

import org.oppia.android.app.model.ProfileType

/** Listener for when a user wishes to exit their profile. */
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
interface ExitProfileListener {
/**
* Called when back press is clicked on the HomeScreen.
*
* Routing behaviour may change based on [ProfileType]
*/
fun exitProfile(profileType: ProfileType)
}
Loading
Loading