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

feat: Firebase config #233

Merged
merged 6 commits into from
Feb 26, 2024

Conversation

volodymyr-chekyrta
Copy link
Contributor

@volodymyr-chekyrta volodymyr-chekyrta commented Feb 12, 2024

This PR returns the default Firebase configuration flow with the google-services.json file.
The manual configuration will be implemented for the Learning site project in a separate module.

  1. Removed manual configuration from the OpenEdXApp.kt
val options = FirebaseOptions.Builder()
                .setProjectId(firebaseConfig.projectId)
                .setApplicationId(firebaseConfig.applicationId)
                .setApiKey(firebaseConfig.apiKey)
                .setGcmSenderId(firebaseConfig.gcmSenderId)
                .build()
Firebase.initialize(this, options)
  1. Introduced the generateGoogleServicesJson function in ConfigHelper.groovy.
def generateGoogleServicesJson(applicationId) {
        def config = fetchConfig()
        def firebase = config.get("FIREBASE")
        if (!firebase) {
            return
        }
        if (!firebase.getOrDefault("ENABLED", false)) {
            return
        }

        def googleServicesJsonPath = projectDir.path + "/app/"
...
  1. The field GCM_SENDER_ID was replaced with PROJECT_NUMBER in the FirebaseConfig.kt file.

How to test:

  1. Create a new Firebase project
  2. Configure the config.yaml file with the necessary data
  3. Launch the app and make a test crash
  4. Check the crash data in the Firebase crashlytics console

Notes:
google-services.json generated by Firebase

{
  "project_info": {
    "project_number": "5322XXXXX9180",
    "project_id": "testconfigprojectXXX-XXXX",
    "storage_bucket": "testconfigprojectXXXX-XXXX.appspot.com"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:532239259180:android:ec6ee6XXXXXdede113e389",
        "android_client_info": {
          "package_name": "com.XXXXX.android.app"
        }
      },
      "oauth_client": [],
      "api_key": [
        {
          "current_key": "AIzaSyByTC1ZXXXXXXEzImslozg_iO5_zPfVs8"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": []
        }
      }
    }
  ],
  "configuration_version": "1"
}

google-services.json generated by ConfigHelper

{
    "project_info": {
        "project_number": "5322XXXXX9180",
        "project_id": "testconfigprojectXXX-XXXX",
        "storage_bucket": "testconfigprojectXXXX-XXXX.appspot.com"
    },
    "client": [
        {
            "client_info": {
                "mobilesdk_app_id": "1:532239259180:android:ec6ee6XXXXXdede113e389",
                "android_client_info": {
                    "package_name": "org.openedx.app"
                }
            },
            "oauth_client": [
                
            ],
            "api_key": [
                {
                    "current_key": "AIzaSyByTC1ZXXXXXXEzImslozg_iO5_zPfVs8"
                }
            ],
            "services": {
                "appinvite_service": {
                    "other_platform_oauth_client": [
                        
                    ]
                }
            }
        }
    ],
    "configuration_version": "1"
}

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 12, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @volodymyr-chekyrta! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@farhan-arshad-dev
Copy link
Contributor

I have started its review.

Added preBuild generateGoogleServicesJson task to ensure that the file is generated after a build variant is changed
@volodymyr-chekyrta
Copy link
Contributor Author

Update
Added preBuild generateGoogleServicesJson task to ensure that the file is generated.

k1rill
k1rill previously approved these changes Feb 14, 2024
Copy link
Contributor

@k1rill k1rill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thank you!

# Conflicts:
#	core/src/main/java/org/openedx/core/config/FirebaseConfig.kt
#	default_config/dev/config.yaml
#	default_config/prod/config.yaml
#	default_config/stage/config.yaml
@volodymyr-chekyrta
Copy link
Contributor Author

@farhan-arshad-dev, feedback addressed.
Ready for another round.

@k1rill k1rill self-requested a review February 26, 2024 14:30
@volodymyr-chekyrta volodymyr-chekyrta merged commit b543768 into openedx:develop Feb 26, 2024
3 checks passed
@openedx-webhooks
Copy link

@volodymyr-chekyrta 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@volodymyr-chekyrta volodymyr-chekyrta deleted the feat/google_config branch February 26, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants