Skip to content

Instantly share code, notes, and snippets.

View katharinepadilha's full-sized avatar

Katharine Padilha katharinepadilha

View GitHub Profile
@katharinepadilha
katharinepadilha / AppDelegate.m
Created August 8, 2019 00:25
AppDelegate to firebase setup
#import <Firebase.h>
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
//...
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@katharinepadilha
katharinepadilha / Podfile
Created August 5, 2019 00:59
Podfile.lock for firebase
platform :ios, '9.0'
target 'yourapp' do
# ...
pod 'Firebase/Core', '~> 6.2.0'
pod 'Firebase/Messaging', '~> 6.2.0'
# ...
end
@katharinepadilha
katharinepadilha / MainApplication.java
Created August 5, 2019 00:24
MainApplication.java setup for firebase
//...
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
//...
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
@katharinepadilha
katharinepadilha / build.gradle
Last active August 8, 2019 18:32
build.gradle for firebase setup
buildscript {
//...
dependencies {
//...
classpath 'com.google.gms:google-services:4.2.0'
//...
}
}
//...
@katharinepadilha
katharinepadilha / build.gradle
Last active August 8, 2019 18:32
app/build.gradle setup for firebase
//...
dependencies {
//...
implementation "com.google.android.gms:play-services-base:17.0.0"
implementation "com.google.firebase:firebase-core:17.0.1"
implementation "com.google.firebase:firebase-messaging:19.0.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' <-- Add this line if you wish to use badge on Android
//...
}
@katharinepadilha
katharinepadilha / AndroidManifest.xml
Created August 5, 2019 00:17
AndroidManifest setup for firebase
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
...
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
@katharinepadilha
katharinepadilha / App.js
Last active December 1, 2019 20:03
App.js setup for firebase notifications
//...
async getToken() {
let fcmToken = await AsyncStorage.getItem('fcmToken');
if (!fcmToken) {
fcmToken = await firebase.messaging().getToken();
if (fcmToken) {
await AsyncStorage.setItem('fcmToken', fcmToken);
}
}
}
@katharinepadilha
katharinepadilha / Eslint extension + Standard + VSCode
Created May 21, 2019 00:25
Eslint extension + Standard + VSCode configuration
Donwload ESLint and Prettier extensions from VSCode store
Place the code bellow in your Settings.json
{
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"[javascript]": {
"editor.formatOnSave": false
},