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

Initial support for firebase notifications #1390

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: "com.google.gms.google-services"

// Blixt:
apply plugin: "com.google.protobuf"
Expand Down Expand Up @@ -185,6 +186,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.6.0')
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")

Expand Down
207 changes: 140 additions & 67 deletions android/app/src/chainregtest/google-services.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,151 @@
{
"project_info": {
"project_number": "123456789",
"firebase_url": "https://phonyblixt.firebaseio.com",
"project_id": "phony-blixt-wallet",
"storage_bucket": "phony-blixt-wallet.appspot.com"
"project_number": "349959255310",
"firebase_url": "https://blixt-wallet.firebaseio.com",
"project_id": "blixt-wallet",
"storage_bucket": "blixt-wallet.appspot.com"
},
"client": [{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.debug"
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:349959255310:android:674d8ca658d8468d59d35f",
"android_client_info": {
"package_name": "com.blixtwallet"
}
},
"oauth_client": [
{
"client_id": "349959255310-oa9ogtk6vp969jmbeg1hdodt3cp78a9g.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.blixtwallet",
"certificate_hash": "b8c178ee58a694507442dbe627f5343addb4c5bb"
}
},
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCYJ3myPlN9bsL7PRs6_VrWIqEZAQLE8D4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},


{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.experiment1"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.experiment1.debug"
{
"client_info": {
"mobilesdk_app_id": "1:349959255310:android:85ac1e39762a39fb59d35f",
"android_client_info": {
"package_name": "com.blixtwallet.debug"
}
},
"oauth_client": [
{
"client_id": "349959255310-5nm9kipu9dmap1374fkv3mk4adumbabm.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.blixtwallet.debug",
"certificate_hash": "076a963bc0168507ca72117b5a9513fe814b6e9d"
}
},
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCYJ3myPlN9bsL7PRs6_VrWIqEZAQLE8D4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.fakelnd.debug"
{
"client_info": {
"mobilesdk_app_id": "1:349959255310:android:c703af800eb9dff159d35f",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.debug"
}
},
"oauth_client": [
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCYJ3myPlN9bsL7PRs6_VrWIqEZAQLE8D4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.fakelnd"
{
"client_info": {
"mobilesdk_app_id": "1:349959255310:android:b3b30a7ca155ace959d35f",
"android_client_info": {
"package_name": "com.blixtwallet.restore.debug"
}
},
"oauth_client": [
{
"client_id": "349959255310-m1qakerr8ll92b7nu0vclb3f14qggg7i.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.blixtwallet.restore.debug",
"certificate_hash": "076a963bc0168507ca72117b5a9513fe814b6e9d"
}
},
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCYJ3myPlN9bsL7PRs6_VrWIqEZAQLE8D4"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "349959255310-nlhtlfjlcv4jufk8c659flj8colqm8r4.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
}
],
}
],
"configuration_version": "1"
}
}
78 changes: 78 additions & 0 deletions android/app/src/chainregtest/google-services.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"project_info": {
"project_number": "123456789",
"firebase_url": "https://phonyblixt.firebaseio.com",
"project_id": "phony-blixt-wallet",
"storage_bucket": "phony-blixt-wallet.appspot.com"
},
"client": [{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.debug"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},


{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.experiment1"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.experiment1.debug"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.fakelnd.debug"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
},
{
"client_info": {
"mobilesdk_app_id": "1:123465798:android:123465798123",
"android_client_info": {
"package_name": "com.blixtwallet.regtest.fakelnd"
}
},
"api_key": [{
"current_key": "abcde123465789"
}]
}
],
"configuration_version": "1"
}
8 changes: 8 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="barcode" />

<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
Expand All @@ -19,6 +22,10 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />

<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />

<application
android:name=".MainApplication"
android:label="Blixt Wallet${chain}${buildType}"
Expand Down Expand Up @@ -120,5 +127,6 @@
android:value="Run Bitcoin Lightning Network node lnd in order for the user to receive incoming payments"
/>
</service>

</application>
</manifest>
3 changes: 1 addition & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ buildscript {
// Needed for react-native-camera-kit
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
classpath("com.google.protobuf:protobuf-gradle-plugin:0.9.3")// 0.8.12")
// classpath "com.google.gms:google-services:4.3.10" // TODO(hsjoberg): Needed?

classpath ("com.google.gms:google-services:4.4.0")
}
}

Expand Down
15 changes: 9 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import "react-native-gesture-handler";
import React from "react";
import ReactNative, { AppRegistry, LogBox, Platform, UIManager, Text } from "react-native";
import "@react-native-firebase/messaging";
import messaging from "@react-native-firebase/messaging";
import App from "./src/App";
import {name as appName} from "./app.json";
import { name as appName } from "./app.json";
import Long from "long";
import protobuf from "protobufjs";
import { enableES5 } from "immer";
import "./src/i18n/i18n";


protobuf.util.Long = Long;
protobuf.configure();
enableES5();
Expand All @@ -29,11 +30,13 @@ LogBox.ignoreLogs([
"i18next::pluralResolver: Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.",
]);

if (
Platform.OS === "android" &&
UIManager.setLayoutAnimationEnabledExperimental
) {
if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}

// Register background handler
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
console.log("Message handled in the background!", remoteMessage);
});

AppRegistry.registerComponent(appName, () => App);
Loading
Loading