Skip to content

Commit

Permalink
chore(Cross): [IOAPPX-432] Development Push notifications for Android (
Browse files Browse the repository at this point in the history
…#6416)

## Short description
This PR enables testing of push notifications for the development
environment on Android.

## List of changes proposed in this pull request
- Mock google-services.json file removed in favour of a development one
- Such file contains configuration ids and api keys that link to the
Firebase development project. Its content is normally embedded into the
application bundle and it is easily extracted so it does not contain any
secret that should not be committed.
- Code that avoided push notification initialisation on Android has been
removed, since we now have a valid configuration file
- Note that this works only on Android. iOS sandbox is not supported yet

## How to test
Using the io-dev-api server, run the application on a real device or on
an emulator that uses a Google Play Services image. Use the Firebase
Console to send and receive a push notification.

Co-authored-by: Alessandro <[email protected]>
  • Loading branch information
Vangaorth and Hantex9 authored Dec 19, 2024
1 parent 1ddf587 commit 8cf64a9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 49 deletions.
29 changes: 29 additions & 0 deletions google-services-dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "100508770872",
"project_id": "io---app-dev",
"storage_bucket": "io---app-dev.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:100508770872:android:3bae755a9e0015bde77ccd",
"android_client_info": {
"package_name": "it.pagopa.io.app"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDxRvOra_wlultFBZc4D8nbtJ2fyNzUCpk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
40 changes: 0 additions & 40 deletions mock-google-services.json

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/generate-api-models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ for elem in "${apisNoClient[@]}"; do
done
wait

cp mock-google-services.json ./android/app/google-services.json
cp google-services-dev.json ./android/app/google-services.json

yarn generate:locales
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
loadPreviousPageMessages,
reloadAllMessages
} from "../../messages/store/actions";
import { isDevEnv } from "../../../utils/environment";
import {
trackMessageNotificationParsingFailure,
trackMessageNotificationTap
Expand Down Expand Up @@ -75,16 +74,9 @@ function handleForegroundMessageReload() {
})
);
}
// TODO: shall we deep link in foreground?
// see https://pagopaspa.slack.com/archives/C013V764P9U/p1639558176007600
}

function configurePushNotifications() {
// if isDevEnv is enabled and we are on Android, we need to disable the push notifications to avoid crash for missing firebase settings
if (isDevEnv && Platform.OS === "android") {
return;
}

// Create the default channel used for notifications, the callback return false if the channel already exists
PushNotification.createChannel(
{
Expand Down

0 comments on commit 8cf64a9

Please sign in to comment.