Skip to content

Commit

Permalink
feat(fsengagement): add fsengagement package
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Schwob authored and bweissbart committed Dec 12, 2018
1 parent b6ba811 commit 59c6be8
Show file tree
Hide file tree
Showing 47 changed files with 2,166 additions and 0 deletions.
75 changes: 75 additions & 0 deletions packages/flagship/src/lib/modules/react-native-fcm.ts
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(){`);
};
6 changes: 6 additions & 0 deletions packages/flagship/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export interface Config {
ios: CodepushConfig;
};

pushIcons?: {
android?: string;
ios?: string;
};
firebaseGoogleServices?: any;

zendeskChat?: {
accountKey: string;
};
Expand Down
Binary file added packages/fsengagement/assets/images/backArrow.png
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.
Binary file added packages/fsengagement/assets/images/closeBronze.png
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.
Binary file added packages/fsengagement/assets/images/gradient.png
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.
Binary file added packages/fsengagement/assets/images/rightArrow.png
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.
Binary file added packages/fsengagement/assets/images/share.png
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.
Binary file added packages/fsengagement/assets/images/whenIcon.png
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.
Binary file added packages/fsengagement/assets/images/whereIcon.png
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.
Binary file added packages/fsengagement/assets/images/whyIcon.png
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.
27 changes: 27 additions & 0 deletions packages/fsengagement/package.json
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"
}
}
}
Loading

0 comments on commit 59c6be8

Please sign in to comment.