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#4881: Build UI for the Android NPS Survey #4945

Merged
merged 261 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
332e82c
Refactor isMoreThanRequiredDaysAgo() to improve readability.
adhiamboperes Mar 23, 2023
755ba43
Add aggregate learning time gating condition
adhiamboperes Mar 23, 2023
29880a3
Create a new dagger bound listener set that will be fired in response…
adhiamboperes Mar 23, 2023
cff02d8
Add the new module to the dagger application components.
adhiamboperes Mar 23, 2023
ac43f52
Fix ktlint newline violations
adhiamboperes Mar 23, 2023
ab4cf13
Inject and initialize ExplorationProgressListener in AbstractOppiaApp…
adhiamboperes Mar 24, 2023
23a3ef7
Add implementation for the ExplorationProgressListener
adhiamboperes Mar 24, 2023
4beb6c4
Refactor ExplorationProgressController to fire events: WIP
adhiamboperes Mar 24, 2023
02d14b4
Add logic to show survey dialog when gating criteria satisfied: WIP
adhiamboperes Mar 29, 2023
7407a91
Refactor the implementation of ExplorationProgressListeners: WIP
adhiamboperes Mar 29, 2023
98a6042
Fix: ktlint
adhiamboperes Mar 29, 2023
8dd5828
Fix formating nits
adhiamboperes Mar 29, 2023
479b493
Refactor MarketFitAnswer field NA_DONT_USE_OPPIA_ANYMORE to NOT_APP…
adhiamboperes Mar 29, 2023
d0ab6d3
Refactor enum constants to not include the enum name.
adhiamboperes Mar 29, 2023
f62bb61
Refactor message ID documentation
adhiamboperes Mar 29, 2023
86cd883
Refactor SurveyQuestionAnswer to SurveyAnswerOption
adhiamboperes Mar 29, 2023
0ad93ef
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 3, 2023
1b89397
Add ExplorationProgressModule to TestApplicationComponents
adhiamboperes Apr 3, 2023
a507668
Add BUILD definition for TopicLearningTimeControllerTest
adhiamboperes Apr 3, 2023
343d4e1
Add tests for TopicLearningTimeController
adhiamboperes Apr 3, 2023
83a5a30
Rename TopicLearningTimeController as ExplorationActiveTimeController
adhiamboperes Apr 3, 2023
c40e4a1
Fix ktlint
adhiamboperes Apr 3, 2023
9384a47
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 3, 2023
6bd92ce
Merge branch 'nps-survey-models' of github.com:oppia/oppia-android in…
adhiamboperes Apr 3, 2023
384de4e
Refactor SurveyQuestion to use oneof instead of repeated answer list
adhiamboperes Apr 4, 2023
cd962ca
Refactor SurveyQuestion to have a language code
adhiamboperes Apr 4, 2023
db2afcf
Add BUILD definitions for survey.proto
adhiamboperes Apr 4, 2023
1a358c7
Refactor SurveyUserAnswer to contain a oneof of the answer enums
adhiamboperes Apr 4, 2023
f48e9f8
Refactored messages for readability and consistency.
adhiamboperes Apr 4, 2023
8887d9f
Remove unused import in oppia_logger.proto
adhiamboperes Apr 4, 2023
56b6ae1
Rename enum field causing conflicts
adhiamboperes Apr 4, 2023
91e0ff1
Add more tests for topic active time
adhiamboperes Apr 6, 2023
4a1eafd
Merge branch 'nps-survey-models' of github.com:oppia/oppia-android in…
adhiamboperes Apr 6, 2023
f6d8ce1
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 11, 2023
f13a7ce
Add SurveyActivity
adhiamboperes Apr 12, 2023
cc61d24
Add custom progressbar drawable
adhiamboperes Apr 12, 2023
3d586fe
Add survey activity layout
adhiamboperes Apr 12, 2023
b272c67
Add survey fragment layout
adhiamboperes Apr 12, 2023
9fe9264
Refactor field names
adhiamboperes Apr 12, 2023
4abac82
Merge branch 'nps-survey-models' of github.com:oppia/oppia-android in…
adhiamboperes Apr 12, 2023
0f25203
Merge branch 'nps-survey-models' of github.com:oppia/oppia-android in…
adhiamboperes Apr 12, 2023
25cd1db
Fix ktlint error
adhiamboperes Apr 12, 2023
cf22347
Add SurveyFragment
adhiamboperes Apr 14, 2023
dac4fcb
Refactor dagger graph so that ExplorationProgressListener is not prov…
adhiamboperes Apr 17, 2023
d87b51e
Refactor the implementation of ExplorationProgressListener
adhiamboperes Apr 17, 2023
aea8d63
Refactor ExplorationProgressController to fire session start/end events
adhiamboperes Apr 17, 2023
1c55c2b
Merge branch 'develop' of github.com:oppia/oppia-android into develop
adhiamboperes Apr 18, 2023
2d8e7a0
Add nps score layout
adhiamboperes Apr 19, 2023
326e689
Refactor survey activity and fragment layouts
adhiamboperes Apr 19, 2023
67126d0
Refactor survey activity and fragment bindings
adhiamboperes Apr 19, 2023
5966f0a
Remove commented out code
adhiamboperes Apr 19, 2023
c32558f
Refactor the save agg time api
adhiamboperes Apr 19, 2023
f1541f9
Refactor all TestApplicationComponents to have ExplorationProgressModule
adhiamboperes Apr 20, 2023
6bb8a6b
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Apr 20, 2023
165f2e8
Fix merge conflicts while pulling develop locally
adhiamboperes Apr 22, 2023
00800a5
Merge branch 'develop' into nps-survey-gating-logic
adhiamboperes Apr 22, 2023
96c6f22
Refactor api access modifiers
adhiamboperes Apr 25, 2023
00d90f8
Add tests for ExplorationActiveTimeController
adhiamboperes Apr 25, 2023
4a58f5f
Fix missing KDOCs
adhiamboperes Apr 25, 2023
56e6fa7
Refactor module for correct multibinding implementation
adhiamboperes Apr 25, 2023
97123cf
Refactor ApplicationLifecycleObserver to handle lifecycle change call…
adhiamboperes Apr 25, 2023
21e6a80
Update from develop
adhiamboperes Apr 25, 2023
5d911ff
Merge remote-tracking branch 'upstream/develop' into nps-survey-updat…
adhiamboperes Apr 25, 2023
dd22f87
Merge branch 'nps-survey-update-test-components' into nps-survey-gati…
adhiamboperes Apr 25, 2023
0fa8745
Fix import ordering in affected test files
adhiamboperes Apr 25, 2023
6c31b57
Add KDOC for SUCCESS in TopicLearningTimeActionStatus
adhiamboperes Apr 25, 2023
63143cd
Fix failing DateTimeUtilTest
adhiamboperes Apr 26, 2023
13ca840
Add test file exemptions for listeners and modules.
adhiamboperes Apr 26, 2023
b8b8be1
Add more enum fields to represent time of day
adhiamboperes Apr 26, 2023
5b222d9
Refactor time of day gating logic to not use calendar directly
adhiamboperes Apr 26, 2023
3dd5e8d
Add test file for SurveyGatingController
adhiamboperes Apr 26, 2023
71d650f
Merge remote-tracking branch 'upstream/develop' into nps-survey-gatin…
adhiamboperes Apr 27, 2023
44ae002
Refactor: remove placeholder alert dialog for survey.
adhiamboperes Apr 27, 2023
3c6e262
Update naming and comments of time related proto fields
adhiamboperes Apr 28, 2023
9044064
Update TimeOfDay enum field naming
adhiamboperes Apr 28, 2023
09342dd
Refactor disk IO operations when fetching gating criteria to Async.
adhiamboperes May 1, 2023
33fa19a
Refactor gating API.
adhiamboperes May 1, 2023
1c1acc0
Add tests for surveyLastShownTimestampMs in ProfileManagementController
adhiamboperes May 1, 2023
c758864
Refactor method names
adhiamboperes May 2, 2023
b9d1fa0
Add bazel BUILD definitions for new survey related files.
adhiamboperes May 2, 2023
0e8216c
Assorted refactors
adhiamboperes May 2, 2023
9a87478
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes May 2, 2023
3fb7a30
Assorted refactors
adhiamboperes May 2, 2023
8083167
Refactor and complete session timer logic that is based on applicatio…
adhiamboperes May 4, 2023
3ab3dcb
Add survey gating criteria constants as platform parameters.
adhiamboperes May 4, 2023
2c25dfd
Add gating test outlines: wip
adhiamboperes May 4, 2023
f3f7f83
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes May 4, 2023
5ea33c5
Fix bazel test failure on class ExplorationActiveTimeControllerTest
adhiamboperes May 5, 2023
60bb0ee
Add test for ExplorationProgressModule
adhiamboperes May 5, 2023
c03db03
Fix formatting error
adhiamboperes May 5, 2023
e38d5d4
Cleanup unused fields.
adhiamboperes May 5, 2023
31e0399
Add test for providing ApplicationLifecycleListener set
adhiamboperes May 5, 2023
49d7e3f
Add test file exemption for ExplorationSessionTimerController
adhiamboperes May 5, 2023
15d7101
Fix failing InitializeDefaultLocaleRule tests
adhiamboperes May 5, 2023
b4fe3b6
Add test definitions for SurveyGatingControllerTest
adhiamboperes May 5, 2023
a8dd23f
Merge remote-tracking branch 'upstream/nps-survey-gating-logic' into …
adhiamboperes May 5, 2023
b128c5e
Add layout strings to file
adhiamboperes May 9, 2023
08ac8a7
Add dimens to file
adhiamboperes May 9, 2023
84d7ec8
Add colors to file
adhiamboperes May 9, 2023
b0a2651
Add multiple choice layout for nps survey
adhiamboperes May 9, 2023
3539431
Add background for secondary buttons in the survey ui
adhiamboperes May 9, 2023
d1dc027
Add layout for exit survey confirmation dialog
adhiamboperes May 9, 2023
8fca036
Add layout for free form answers
adhiamboperes May 9, 2023
b3d1151
Add custom view for creating a cubic bezier curve background
adhiamboperes May 9, 2023
e4289db
Add layout for survey onboarding: WIP
adhiamboperes May 9, 2023
82cc026
Add styles for survey buttons
adhiamboperes May 9, 2023
2d96f17
Merge branch 'develop' of github.com:oppia/oppia-android into nps_sur…
adhiamboperes May 9, 2023
e623f6c
Fix import order
adhiamboperes May 9, 2023
5620e79
Add show survey exit confirmation dialog
adhiamboperes May 10, 2023
d619ede
Add question and answer option strings
adhiamboperes May 10, 2023
ac5f9df
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes May 16, 2023
aa46332
Add extensive tests for gating controller
adhiamboperes May 16, 2023
90c2ece
Add survey gating platform params to test PlatformParam module
adhiamboperes May 16, 2023
73dd240
Fix gating logic error found in tests
adhiamboperes May 16, 2023
8977398
Fix bazel test errors
adhiamboperes May 17, 2023
effdb6b
Merge branch 'nps-survey-gating-logic' of github.com:oppia/oppia-andr…
adhiamboperes May 17, 2023
0087a8b
Add missing imports in TestApplicationComponent
adhiamboperes May 17, 2023
c623e9d
Merge branch 'nps-survey-gating-logic' of github.com:oppia/oppia-andr…
adhiamboperes May 17, 2023
b6ad23d
Create flow for entering the survey at the end of a chapter
adhiamboperes May 19, 2023
9bf61ef
Fix minor issues in ExitSurveyConfirmationDialog
adhiamboperes May 19, 2023
39fe4e3
Add a graph and deck for computing the progress of a survey
adhiamboperes May 21, 2023
5785449
Add logic to create and begin the survey session.
adhiamboperes May 21, 2023
dae7a40
Add question strings
adhiamboperes May 21, 2023
89bc995
Add survey answer radio button color def
adhiamboperes May 21, 2023
cf6dc2d
Add survey session init logic: wip
adhiamboperes May 22, 2023
c888047
Add survey progress information
adhiamboperes May 22, 2023
fa7816f
Add logic to retrieve question text from strings
adhiamboperes May 22, 2023
46f2152
Fix import order
adhiamboperes May 22, 2023
0deb590
Fix broken color resource linking after rename
adhiamboperes May 23, 2023
8a747a0
Add logic for moving back and forth through questions: wip
adhiamboperes May 23, 2023
639231b
Add layout for user type answer options
adhiamboperes May 25, 2023
d46bb2a
Add viewmodel binding for different answer layouts
adhiamboperes May 25, 2023
d51936d
Merge branch 'develop' into nps-survey-gating-logic
adhiamboperes May 25, 2023
b34dda0
Add binding for nested question options
adhiamboperes May 26, 2023
b6a4ec3
Refactor EphemeralSurveyQuestion
adhiamboperes May 26, 2023
f614e6e
Add logic for moving forward through a session
adhiamboperes May 26, 2023
2ca58ca
Add logic for selecting an answer in multiple choice questions
adhiamboperes May 26, 2023
6eabd84
Add logic for selecting an answer in multiple choice questions
adhiamboperes May 26, 2023
f50bb38
Add logic for deciding if can move to next question
adhiamboperes May 26, 2023
bec7fcd
Add logic for deciding if can move to next question
adhiamboperes May 26, 2023
b9be5f4
Add bezier curve on the onboarding background view
adhiamboperes May 28, 2023
fe4a55b
Refactor SurveyController to only contain survey and question creatio…
adhiamboperes May 28, 2023
7178b2b
Add submit answer controller logic: wip
adhiamboperes May 28, 2023
7bb46c7
Refactor welcome dialog to have the correct style
adhiamboperes May 28, 2023
9a19366
Add view model for binding the nps answer layout
adhiamboperes May 28, 2023
5db591a
Merge branch 'develop' into nps-survey-gating-logic
adhiamboperes May 28, 2023
6811e80
Refactor tests for clarity
adhiamboperes May 28, 2023
a59b64e
Add test for edge case
adhiamboperes May 28, 2023
8a2daf8
Fix merge conflicts from develop
adhiamboperes May 28, 2023
dbe8fe0
Add tests for ExplorationSessionTimerController and remove it from ex…
adhiamboperes May 29, 2023
048a08d
Fix session timer control logic
adhiamboperes May 29, 2023
625c4d4
Fix some nits from self-review
adhiamboperes May 29, 2023
0d91d39
Remove check that caused a failure in an existing test
adhiamboperes May 29, 2023
4fee6d8
Fix bazel dependency out-of-order-load
adhiamboperes May 29, 2023
5cde443
Merge branch 'nps-survey-gating-logic' into nps_survey_ui
adhiamboperes May 29, 2023
677c08e
Fix import order
adhiamboperes May 29, 2023
f8259fc
Refactor: reorder deps in BUILD.bazel
adhiamboperes May 29, 2023
158ed2e
Merge branch 'nps-survey-gating-logic' of github.com:oppia/oppia-andr…
adhiamboperes May 29, 2023
34fecf3
Merge remote-tracking branch 'upstream/nps_survey_ui' into nps_survey_ui
adhiamboperes May 29, 2023
07116bb
Refactor survey init logic to the welcome dialog
adhiamboperes May 31, 2023
2060149
Refactor custom view so that calculations happen in onSize changed.
adhiamboperes May 31, 2023
560828a
Refactor custom view so that calculations happen in onSize changed.
adhiamboperes May 31, 2023
df9c5ba
Refactor style the survey welcome dialog
adhiamboperes May 31, 2023
afab9f2
Fix pop dialog backstack issue
adhiamboperes May 31, 2023
806505e
Fix survey navigation button styling
adhiamboperes May 31, 2023
903f913
Add BUILD definitions for all ui files
adhiamboperes May 31, 2023
993bb82
Merge branch 'develop' into nps-survey-gating-logic
adhiamboperes May 31, 2023
dd0f8a8
Reformat BUILD file
adhiamboperes May 31, 2023
8f1724b
Merge branch 'nps-survey-gating-logic' into nps_survey_ui
adhiamboperes May 31, 2023
c2bf5c5
Add bindings for free form questions
adhiamboperes Jun 4, 2023
5cbe32f
Add shadow on survey next navigation button
adhiamboperes Jun 5, 2023
3030628
Fix next button not toggled conditionally on answer available
adhiamboperes Jun 5, 2023
46bf00f
Add styling for nps question layout
adhiamboperes Jun 5, 2023
618a73c
Add binding and answer receiver for nps score
adhiamboperes Jun 5, 2023
fdc9d9b
Merge remote-tracking branch 'upstream/develop' into nps-survey-gatin…
adhiamboperes Jun 5, 2023
2e9abe4
Refactor cachestore read and write methods to be shorter
adhiamboperes Jun 6, 2023
fcc30c6
Refactor unused transformation to direct call
adhiamboperes Jun 6, 2023
8adb230
Refactor retrieve retrieveAggregateLearningTime transformation to syn…
adhiamboperes Jun 6, 2023
a336bca
Fix missing default value in recordAggregateTopicLearningTime()
adhiamboperes Jun 6, 2023
5f9566b
Refactor grace period computation to compare timestamps directly with…
adhiamboperes Jun 6, 2023
9d8e703
Fix nit on verb use in ExplorationProgressListener
adhiamboperes Jun 6, 2023
f30e4da
Add explicit time declaration before running tests
adhiamboperes Jun 6, 2023
8a4cbfc
Add caution for accessing ExplorationProgressListener on multiple thr…
adhiamboperes Jun 6, 2023
dc1d572
Refactor ExplorationActiveTimeController to bind as an instance of Ap…
adhiamboperes Jun 6, 2023
bb9ba2b
Remove the now unused SessionTimerController and test file
adhiamboperes Jun 6, 2023
3cfa556
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Jun 7, 2023
9cb4f1c
Fix KDoc formatting
adhiamboperes Jun 7, 2023
42782f2
Fix survey previous navigation logic
adhiamboperes Jun 10, 2023
982e9c8
Fix Kdocs
adhiamboperes Jun 11, 2023
2329776
Refactor the begin session timer logic to a command pattern
adhiamboperes Jun 8, 2023
5b252d4
Merge branch 'develop' into nps-survey-gating-logic
adhiamboperes Jun 19, 2023
9df0338
Fix associations broken by refactor
adhiamboperes Jun 19, 2023
765ca47
Fix gating controller tests broken by refactor
adhiamboperes Jun 19, 2023
4ff9ae2
Fix timer controller tests that run in 2 app instances
adhiamboperes Jun 19, 2023
0b01345
Fix failing test
adhiamboperes Jun 19, 2023
21bfcac
Add a test to verify that explorationProgressListeners are fired
adhiamboperes Jun 19, 2023
d96ebba
Fix failing tests
adhiamboperes Jun 19, 2023
7a9d266
Merge branch 'nps-survey-gating-logic' into nps_survey_ui
adhiamboperes Jun 19, 2023
d82c136
Add missing file to vcs
adhiamboperes Jun 19, 2023
6d56f75
Merge branch 'nps-survey-gating-logic' into nps_survey_ui
adhiamboperes Jun 19, 2023
386be3f
Add gating platform params to the Alpha Module
adhiamboperes Jun 19, 2023
27a023b
Refactor SurveyActivity to implement AutoLocalizedCompatActivity
adhiamboperes Jun 19, 2023
1581d92
Fix exit confirmation dialog style
adhiamboperes Jun 19, 2023
61d5670
Add a constant that corresponds to the number of questions in the survey
adhiamboperes Jun 19, 2023
6383696
Fix the submit button style
adhiamboperes Jun 19, 2023
2746393
Add text watcher for free form text
adhiamboperes Jun 19, 2023
9786a54
Fix dialog button color
adhiamboperes Jun 19, 2023
bb2fe3f
Create outro dialog
adhiamboperes Jun 19, 2023
8a77338
Merge branch 'develop' of github.com:oppia/oppia-android into nps-sur…
adhiamboperes Jun 19, 2023
1fa54a3
Create test file exemption for TimerSessionState
adhiamboperes Jun 19, 2023
5e203ac
Reformat translation/BUILD.bazel
adhiamboperes Jun 19, 2023
752a316
Merge branch 'nps-survey-gating-logic' into nps_survey_ui
adhiamboperes Jun 19, 2023
4b5070a
Reformat TimerSessionState KDoc
adhiamboperes Jun 19, 2023
c6e9b9b
Merge branch 'nps-survey-gating-logic' into nps_survey_ui
adhiamboperes Jun 19, 2023
a9b92bc
Add exit dialog button functionality
adhiamboperes Jun 20, 2023
14c9ddd
Add question navigation button visibility toggle
adhiamboperes Jun 20, 2023
24c0bd6
Reorder the usertype options to make it easy to index them correctly
adhiamboperes Jun 22, 2023
2f1459f
Add logic for sending the selected answers to the controller
adhiamboperes Jun 23, 2023
609eb1c
Remove unnecessary condition before beginning session timer
adhiamboperes Jun 23, 2023
12f72e4
Merge branch 'develop' into nps-survey-gating-logic
adhiamboperes Jun 23, 2023
8846558
Merge remote-tracking branch 'upstream/nps-survey-gating-logic' into …
adhiamboperes Jun 23, 2023
2bb3a75
Merge branch 'develop' into nps_survey_ui
adhiamboperes Jun 23, 2023
51e1b02
Add test and Kdoc exemptions
adhiamboperes Jun 23, 2023
74fd5b5
Create bazel definitions
adhiamboperes Jun 23, 2023
655b5c5
Add SurveyQuestionModule to tests
adhiamboperes Jun 23, 2023
a9990ba
Add tests for SurveyController
adhiamboperes Jun 24, 2023
ca26c9b
Add tests for the survey progress
adhiamboperes Jun 24, 2023
1f9525b
Add SurveyQuestionModule to app module tests
adhiamboperes Jun 27, 2023
26a20c5
Merge branch 'develop' of github.com:oppia/oppia-android into nps_sur…
adhiamboperes Jun 27, 2023
4d14e39
Fix value resource CI check failures
adhiamboperes Jun 27, 2023
587f098
Fix CI failures
adhiamboperes Jun 27, 2023
b9a0691
Fix back navigation refresh question
adhiamboperes Jun 27, 2023
eb5c529
Fix end survey tests
adhiamboperes Jun 27, 2023
fa4b2c1
Fix buildifier lint error
adhiamboperes Jun 27, 2023
5967df7
Assorted fixes for tests
adhiamboperes Jun 27, 2023
f9edbb9
Assorted fixes for tests
adhiamboperes Jun 27, 2023
6b6b4db
Revert accidentally commiting change in ProfileAndDeviceIdFragmentTes…
adhiamboperes Jun 28, 2023
74af23e
Fix ktlint error
adhiamboperes Jun 29, 2023
a35b89b
Merge branch 'develop' of github.com:oppia/oppia-android into nps_sur…
adhiamboperes Jun 29, 2023
07c2327
Refactor survey creation
adhiamboperes Jun 30, 2023
18aa545
Fix minor issues per initial review
adhiamboperes Jun 30, 2023
d04d4ef
Refactor: remove SurveyQuestionModule and all usages
adhiamboperes Jun 30, 2023
d5da8eb
Refactor function names for clarity
adhiamboperes Jul 1, 2023
2d2cb86
Add functionality for saving and retrieving selected multiple choice …
adhiamboperes Jul 4, 2023
87d52fd
Refactor survey creation process and tests
adhiamboperes Jul 4, 2023
e4c7521
Refactor tests
adhiamboperes Jul 4, 2023
fd9cefd
Fix radio button alignment
adhiamboperes Jul 4, 2023
b8d098a
Merge branch 'develop' of github.com:oppia/oppia-android into nps_sur…
adhiamboperes Jul 4, 2023
ddad1cc
Refactor retrieving previous selection index
adhiamboperes Jul 6, 2023
9c13ebc
Refactor market fit option string
adhiamboperes Jul 7, 2023
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
14 changes: 14 additions & 0 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ LISTENERS = [
"src/main/java/org/oppia/android/app/recyclerview/OnItemDragListener.kt",
"src/main/java/org/oppia/android/app/settings/profile/LoadProfileEditDeletionDialogListener.kt",
"src/main/java/org/oppia/android/app/settings/profile/RouteToProfileEditListener.kt",
"src/main/java/org/oppia/android/app/survey/SelectedAnswerAvailabilityReceiver.kt",
"src/main/java/org/oppia/android/app/topic/RouteToRevisionCardListener.kt",
"src/main/java/org/oppia/android/app/topic/lessons/ChapterSummarySelector.kt",
"src/main/java/org/oppia/android/app/topic/lessons/StorySummarySelector.kt",
Expand Down Expand Up @@ -235,6 +236,12 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/profileprogress/RecentlyPlayedStorySummaryViewModel.kt",
"src/main/java/org/oppia/android/app/story/storyitemviewmodel/StoryChapterSummaryViewModel.kt",
"src/main/java/org/oppia/android/app/story/storyitemviewmodel/StoryHeaderViewModel.kt",
"src/main/java/org/oppia/android/app/survey/SurveyViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/FreeFormItemsViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MarketFitItemsViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MultipleChoiceOptionContentViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/NpsItemsViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt",
"src/main/java/org/oppia/android/app/topic/TopicViewModel.kt",
"src/main/java/org/oppia/android/app/topic/info/TopicInfoViewModel.kt",
"src/main/java/org/oppia/android/app/topic/lessons/ChapterSummaryViewModel.kt",
Expand Down Expand Up @@ -342,6 +349,7 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/story/StoryFragmentScroller.kt",
"src/main/java/org/oppia/android/app/story/storyitemviewmodel/StoryItemViewModel.kt",
"src/main/java/org/oppia/android/app/story/StoryViewModel.kt",
"src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/SurveyAnswerItemViewModel.kt",
"src/main/java/org/oppia/android/app/testing/BindableAdapterTestDataModel.kt",
"src/main/java/org/oppia/android/app/testing/BindableAdapterTestViewModel.kt",
"src/main/java/org/oppia/android/app/testing/CircularProgressIndicatorAdaptersTestViewModel.kt",
Expand Down Expand Up @@ -402,7 +410,10 @@ VIEWS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/customview/LessonThumbnailImageView.kt",
"src/main/java/org/oppia/android/app/customview/PromotedStoryCardView.kt",
"src/main/java/org/oppia/android/app/customview/SegmentedCircularProgressView.kt",
"src/main/java/org/oppia/android/app/customview/SurveyOnboardingBackgroundView.kt",
"src/main/java/org/oppia/android/app/customview/VerticalDashedLineView.kt",
"src/main/java/org/oppia/android/app/survey/SurveyMultipleChoiceOptionView.kt",
"src/main/java/org/oppia/android/app/survey/SurveyNpsItemOptionView.kt",
"src/main/java/org/oppia/android/app/utility/ClickableAreasImage.kt",
]

Expand Down Expand Up @@ -621,6 +632,7 @@ kt_android_library(
"//domain/src/main/java/org/oppia/android/domain/audio:cellular_audio_dialog_controller",
"//model/src/main/proto:arguments_java_proto_lite",
"//model/src/main/proto:question_java_proto_lite",
"//model/src/main/proto:survey_java_proto_lite",
"//model/src/main/proto:topic_java_proto_lite",
"//third_party:androidx_recyclerview_recyclerview",
],
Expand Down Expand Up @@ -781,6 +793,8 @@ kt_android_library(
"//domain/src/main/java/org/oppia/android/domain/oppialogger:startup_listener",
"//domain/src/main/java/org/oppia/android/domain/profile:profile_management_controller",
"//domain/src/main/java/org/oppia/android/domain/spotlight:spotlight_state_controller",
"//domain/src/main/java/org/oppia/android/domain/survey:gating_controller",
"//domain/src/main/java/org/oppia/android/domain/survey:survey_controller",
"//model/src/main/proto:arguments_java_proto_lite",
"//third_party:androidx_databinding_databinding-adapters",
"//third_party:androidx_databinding_databinding-common",
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@
<activity
android:name=".app.testing.activity.TestActivity"
android:theme="@style/OppiaThemeWithoutActionBar" />
<activity
android:name=".app.survey.SurveyActivity"
android:label="@string/survey_activity_title"
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
android:theme="@style/OppiaThemeWithoutActionBar"
android:windowSoftInputMode="adjustResize" />

<provider
android:name="androidx.work.impl.WorkManagerInitializer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import org.oppia.android.app.settings.profile.ProfileRenameActivity
import org.oppia.android.app.settings.profile.ProfileResetPinActivity
import org.oppia.android.app.splash.SplashActivity
import org.oppia.android.app.story.StoryActivity
import org.oppia.android.app.survey.SurveyActivity
import org.oppia.android.app.testing.AdministratorControlsFragmentTestActivity
import org.oppia.android.app.testing.AppCompatCheckBoxBindingAdaptersTestActivity
import org.oppia.android.app.testing.AudioFragmentTestActivity
Expand Down Expand Up @@ -206,4 +207,5 @@ interface ActivityComponentImpl :
fun inject(viewEventLogsActivity: ViewEventLogsActivity)
fun inject(viewEventLogsTestActivity: ViewEventLogsTestActivity)
fun inject(walkthroughActivity: WalkthroughActivity)
fun inject(surveyActivity: SurveyActivity)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package org.oppia.android.app.customview

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Path
import android.util.AttributeSet
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import org.oppia.android.R
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.view.ViewComponentFactory
import org.oppia.android.app.view.ViewComponentImpl
import javax.inject.Inject

/**
* CustomView to add a background to [SurveyWelcomeDialogFragment] and [SurveyOutroDialogFragment].
* Without chaptersFinished and totalChapters values this custom-view cannot be created.
*
* Reference: // https://proandroiddev.com/how-i-drew-custom-shapes-in-bottom-bar-c4539d86afd7 and
* // https://ciechanow.ski/drawing-bezier-curves/
*/
class SurveyOnboardingBackgroundView : View {
@Inject
lateinit var resourceHandler: AppLanguageResourceHandler

private val isRtl by lazy {
resourceHandler.getLayoutDirection() == ViewCompat.LAYOUT_DIRECTION_RTL
}

private lateinit var paint: Paint
private lateinit var path: Path
private var strokeWidth = 2f

constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)

init {
setupCurvePaint()
}

override fun onDraw(canvas: Canvas) {
if (isRtl)
rotationY = 180f
super.onDraw(canvas)

canvas.drawPath(path, paint)
}

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
val width = this.width.toFloat()
val height = this.height.toFloat()

val controlPoint1X = width * 0.5f
val controlPoint1Y = 0f

val controlPoint2X = width * 0.5f
val controlPoint2Y = height * 0.2f

val controlPoint3X = width * 1f
val controlPoint3Y = height * 0.1f

path.reset()
path.moveTo(0f, height * 0.1f)
path.cubicTo(
controlPoint1X,
controlPoint1Y,
controlPoint2X,
controlPoint2Y,
controlPoint3X,
controlPoint3Y
)

path.lineTo(width, height)
path.lineTo(0f, height)
path.lineTo(0f, 0f)
}

private fun setupCurvePaint() {
path = Path()
paint = Paint(Paint.ANTI_ALIAS_FLAG)
paint.apply {
style = Paint.Style.FILL_AND_STROKE
strokeWidth = [email protected]
color = ContextCompat.getColor(
context,
R.color.component_color_survey_onboarding_background_color
)
}
setBackgroundColor(Color.TRANSPARENT)
}

override fun onAttachedToWindow() {
super.onAttachedToWindow()

val viewComponentFactory = FragmentManager.findFragment<Fragment>(this) as ViewComponentFactory
val viewComponent = viewComponentFactory.createViewComponent(this) as ViewComponentImpl
viewComponent.inject(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ import org.oppia.android.app.shim.IntentFactoryShimModule
import org.oppia.android.app.shim.ViewBindingShimModule
import org.oppia.android.app.spotlight.SpotlightFragment
import org.oppia.android.app.story.StoryFragment
import org.oppia.android.app.survey.ExitSurveyConfirmationDialogFragment
import org.oppia.android.app.survey.SurveyFragment
import org.oppia.android.app.survey.SurveyOutroDialogFragment
import org.oppia.android.app.survey.SurveyWelcomeDialogFragment
import org.oppia.android.app.testing.DragDropTestFragment
import org.oppia.android.app.testing.ExplorationTestActivityPresenter
import org.oppia.android.app.testing.ImageRegionSelectionTestFragment
Expand Down Expand Up @@ -177,4 +181,8 @@ interface FragmentComponentImpl : FragmentComponent, ViewComponentBuilderInjecto
fun inject(walkthroughFinalFragment: WalkthroughFinalFragment)
fun inject(walkthroughTopicListFragment: WalkthroughTopicListFragment)
fun inject(walkthroughWelcomeFragment: WalkthroughWelcomeFragment)
fun inject(surveyFragment: SurveyFragment)
fun inject(exitSurveyConfirmationDialogFragment: ExitSurveyConfirmationDialogFragment)
fun inject(surveyWelcomeDialogFragment: SurveyWelcomeDialogFragment)
fun inject(surveyOutroDialogFragment: SurveyOutroDialogFragment)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ import org.oppia.android.app.model.ExplorationActivityParams
import org.oppia.android.app.model.ProfileId
import org.oppia.android.app.model.ReadingTextSize
import org.oppia.android.app.model.Spotlight
import org.oppia.android.app.model.SurveyQuestionName
import org.oppia.android.app.options.OptionsActivity
import org.oppia.android.app.player.stopplaying.ProgressDatabaseFullDialogFragment
import org.oppia.android.app.player.stopplaying.UnsavedExplorationDialogFragment
import org.oppia.android.app.spotlight.SpotlightFragment
import org.oppia.android.app.spotlight.SpotlightManager
import org.oppia.android.app.spotlight.SpotlightShape
import org.oppia.android.app.spotlight.SpotlightTarget
import org.oppia.android.app.survey.SurveyWelcomeDialogFragment
import org.oppia.android.app.survey.TAG_SURVEY_WELCOME_DIALOG
import org.oppia.android.app.topic.TopicActivity
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.app.utility.FontScaleConfigurationUtil
import org.oppia.android.app.viewmodel.ViewModelProvider
import org.oppia.android.databinding.ExplorationActivityBinding
import org.oppia.android.domain.exploration.ExplorationDataController
import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.domain.survey.SurveyGatingController
import org.oppia.android.domain.translation.TranslationController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
Expand All @@ -54,7 +58,8 @@ class ExplorationActivityPresenter @Inject constructor(
private val fontScaleConfigurationUtil: FontScaleConfigurationUtil,
private val translationController: TranslationController,
private val oppiaLogger: OppiaLogger,
private val resourceHandler: AppLanguageResourceHandler
private val resourceHandler: AppLanguageResourceHandler,
private val surveyGatingController: SurveyGatingController
) {
private lateinit var explorationToolbar: Toolbar
private lateinit var explorationToolbarTitle: TextView
Expand Down Expand Up @@ -279,8 +284,9 @@ class ExplorationActivityPresenter @Inject constructor(
oppiaLogger.e("ExplorationActivity", "Failed to stop exploration", it.error)
is AsyncResult.Success -> {
oppiaLogger.d("ExplorationActivity", "Successfully stopped exploration")
backPressActivitySelector()
(activity as ExplorationActivity).finish()
if (isCompletion) {
maybeShowSurveyDialog(profileId, topicId)
}
}
}
}
Expand All @@ -304,6 +310,8 @@ class ExplorationActivityPresenter @Inject constructor(
* current exploration.
*/
fun backButtonPressed() {
// check if survey should be shown
maybeShowSurveyDialog(profileId, topicId)
// If checkpointing is not enabled, show StopExplorationDialogFragment to exit the exploration,
// this is expected to happen if the exploration is marked as completed.
if (!isCheckpointingEnabled) {
Expand Down Expand Up @@ -500,4 +508,47 @@ class ExplorationActivityPresenter @Inject constructor(
}
}
}

private fun maybeShowSurveyDialog(profileId: ProfileId, topicId: String) {
surveyGatingController.maybeShowSurvey(profileId, topicId).toLiveData()
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
.observe(
activity,
{ gatingResult ->
when (gatingResult) {
is AsyncResult.Pending -> {
oppiaLogger.d("ExplorationActivity", "A gating decision is pending")
}
is AsyncResult.Failure -> {
oppiaLogger.e(
"ExplorationActivity",
"Failed to retrieve gating decision",
gatingResult.error
)
backPressActivitySelector()
}
is AsyncResult.Success -> {
if (gatingResult.value) {
val dialogFragment =
SurveyWelcomeDialogFragment.newInstance(profileId, topicId, SURVEY_QUESTIONS)
val transaction = activity.supportFragmentManager.beginTransaction()
transaction
.add(dialogFragment, TAG_SURVEY_WELCOME_DIALOG)
.addToBackStack(null)
.commit()
} else {
backPressActivitySelector()
}
}
}
}
)
}

companion object {
private val SURVEY_QUESTIONS = listOf(
SurveyQuestionName.USER_TYPE,
SurveyQuestionName.MARKET_FIT,
SurveyQuestionName.NPS
)
}
}
Loading