-
Notifications
You must be signed in to change notification settings - Fork 521
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 #5001. This is PR 5 of 6 Planned PRs. We are adding a whole new infrastructure for uploading data to Firebase Firestore. ### Key Changes - Introducing a `FirestoreDataController` that handles Anonymous Authentication and logging to Firestore, based on connectivity status. - Adding the Firestore, Auth and AppCheck dependencies, and reppining these maven dependencies. - New event logger for converting event logs to documents(hashmaps) and uploading them to firestore. - Introduce AuthenticationController This new controller provides functionality to retrieve the current signed in user and also sign in a user anonymously, and can be called from anywhere. It has a fake that is to be used in tests. - Adding the newly created `utility` module files to `CODEOWNERS` - Creating wrappers for FirebaseAuth, and Firestore in order to allow switching out with fakes in tests and development versions using dagger. The implementation relies on an AuthenticationWrapper to switch out the real and fake authentication controllers for testing purposes. To do this, I created a dagger module to provide the correct listener where needed, hence the test file changes in the _app_ module tests. ### Technical Decisions - I opted to create a new cache for events that will eventually be uploaded to Firestore. This means they will not be accidentally uploaded to Firebase. - I opted to use EventLogs and convert them to Documents on the fly as opposed to creating an entirely new model and logging infrastruture that is Firestore-specific. - I calculated the `FirestoreLogStorageCacheSize` based on the [average length of a Google Review ](https://www.meetsoci.com/resources/insights/brands-franchises/state-of-google-reviews/#:~:text=Average%20review%20length%20ranges%20from,per%20review%20for%20department%20stores.&text=In%20comparison%20to%20other%20local%20platforms%2C%20Google%20reviews%20skew%20positively.)and the [storage size computation specs](https://firebase.google.com/docs/firestore/storage-size) defined by Firebase. I computed it based on 10 profiles on a device over a 3 month period. - I opted to use existing log upload infrastructure to upload to firebase, as opposed to creating a whole new upload workflow so I can reuse the existing test infrastructure as well. ### Dependency Updates - I added dependencies for Firestore and Auth. The selected versions were both the earliest compatible with the rest of our existing dependencies and the latest that didn't cause proguarding issues. There were incidental updates to transitive dependencies, both major and minor. ### Proguard Added new -dontwarns for the following: `-dontwarn javax.naming.**` [Reference](https://github.com/firebase/firebase-android-sdk/blob/00d4626/firebase-firestore/proguard.txt.) ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [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)). ## Upload Screenshots ### Firestore Upload <img width="1130" alt="Screenshot 2024-01-23 at 11 18 26" src="https://github.com/oppia/oppia-android/assets/59600948/c555c283-06e5-471d-9084-b9a3b30f8592"> ## Querying Synced Firestore Data on BigQuery <img width="1071" alt="Screenshot 2024-01-23 at 11 26 26" src="https://github.com/oppia/oppia-android/assets/59600948/3ba78102-5521-4cb7-bd69-6ede5d777e7d"> <img width="1071" alt="Screenshot 2024-01-23 at 11 26 44" src="https://github.com/oppia/oppia-android/assets/59600948/46579afe-3c7b-4d5d-8bcf-a4e133a5f609">
- Loading branch information
1 parent
2648001
commit 164f33b
Showing
242 changed files
with
5,214 additions
and
592 deletions.
There are no files selected for viewing
Validating CODEOWNERS 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.