-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fsengagement): add fsengagement package
- Loading branch information
1 parent
b6ba811
commit 59c6be8
Showing
47 changed files
with
2,166 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* tslint:disable:max-line-length ter-max-len */ | ||
import * as path from '../path'; | ||
import * as fs from '../fs'; | ||
import { logInfo } from '../../helpers'; | ||
import { Config } from '../../types'; | ||
|
||
/** | ||
* Patches Android for the module. | ||
* | ||
* @param {object} configuration The project configuration. | ||
*/ | ||
exports.android = function installAndroid(configuration: Config): void { | ||
logInfo('patching Android for react-native-fcm'); | ||
|
||
const globalGradle = path.resolve('android', 'build.gradle'); | ||
const appGradle = path.android.gradlePath(); | ||
|
||
// create google-services.json | ||
if (!configuration.firebaseGoogleServices) { | ||
throw new Error('Google Services config is missing.'); | ||
} | ||
|
||
console.log(path.resolve('android', 'app', 'google-services.json')); | ||
fs.writeFileSync(path.resolve('android', 'app', 'google-services.json'), JSON.stringify(configuration.firebaseGoogleServices, null, 2)); | ||
|
||
// add google-services to global gradle | ||
fs.update(globalGradle, '// [Init Script Deps]', `// [Init Script Deps] | ||
classpath 'com.google.gms:google-services:3.1.2'`); | ||
|
||
// add google-services to app gradle | ||
fs.update(appGradle, '// [Init Script EOF]', `// [Init Script EOF] | ||
apply plugin: 'com.google.gms.google-services'`); | ||
// update sdk version | ||
fs.update(appGradle, 'compileSdkVersion 26', 'compileSdkVersion 27'); | ||
fs.update(appGradle, 'targetSdkVersion 24', 'targetSdkVersion 27'); | ||
fs.update(appGradle, 'buildToolsVersion "26.0.2"', 'buildToolsVersion "27.0.3"'); | ||
// add fcm and firebase deps | ||
fs.update(appGradle, "compile project(':react-native-fcm')", `compile project(':react-native-fcm') | ||
compile 'com.google.firebase:firebase-core:15.+' | ||
compile 'com.google.firebase:firebase-messaging:15.+'`); | ||
|
||
// add intent filters and icons to manifest | ||
let icon = ''; | ||
if (configuration.pushIcons && configuration.pushIcons.android) { | ||
icon = `<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/${configuration.pushIcons.android}"/>`; | ||
} | ||
fs.update(path.android.manifestPath(), '</application>', ` | ||
${icon} | ||
<service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true"> | ||
<intent-filter> | ||
<action android:name="com.google.firebase.MESSAGING_EVENT"/> | ||
</intent-filter> | ||
</service> | ||
<service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false"> | ||
<intent-filter> | ||
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> | ||
</intent-filter> | ||
</service> | ||
</application>`); | ||
|
||
// intent bugfix | ||
fs.update(path.android.mainActivityPath(configuration), 'import android.os.Bundle;', `import android.os.Bundle; | ||
import android.content.Intent;`); | ||
fs.update(path.android.mainActivityPath(configuration), 'public static Activity getActivity(){', ` | ||
@Override | ||
public void onNewIntent(Intent intent) { | ||
super.onNewIntent(intent); | ||
setIntent(intent); | ||
} | ||
public static Activity getActivity(){`); | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name": "@brandingbrand/fsengagement", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"prepare": "tsc" | ||
}, | ||
"main": "dist/index", | ||
"dependencies": { | ||
"@brandingbrand/fsnetwork": "2.0.0", | ||
"@types/prop-types": "15.5.3", | ||
"@types/react-native-video": "^2.0.8", | ||
"lodash-es": "^4.17.10", | ||
"prop-types": "^15.6.2", | ||
"react": "^16.3.2", | ||
"react-native": "^0.55.4", | ||
"react-native-device-info": "^0.21.5", | ||
"react-native-fcm": "16.0.0", | ||
"react-native-navigation": "1.1.483", | ||
"react-native-video": "^3.2.1", | ||
"uuid-js": "0.7.5" | ||
}, | ||
"rnpm": { | ||
"commands": { | ||
"prelink": "react-native link react-native-fcm" | ||
} | ||
} | ||
} |
Oops, something went wrong.