Skip to content

Instantly share code, notes, and snippets.

View tjkang's full-sized avatar

강태종 tjkang

  • Seoul, South Korea
View GitHub Profile
@tjkang
tjkang / Fastfile
Last active August 11, 2017 16:46
Fastfile recipes for Beta_Crashlytics
fastlane_version "2.25.0"
default_platform :ios
platform :ios do
lane :beta do |values|
# Before calling match, we make sure all our devices are registered on the Apple Developer Portal
register_devices(
devices_file: "./fastlane/devices.txt",
username: '[email protected]'
@tjkang
tjkang / index.js
Created March 23, 2017 15:24
Cloud Function for Push Notification
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
/**
* Triggers when new subject added in the list and sends a notification.
*/
exports.sendNotification = functions.database.ref('/subjects/{subjectKey}').onWrite((event) => {
@tjkang
tjkang / login.js
Created March 23, 2017 04:11
subscribe and unsubscribe to topic for push notification
import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { Actions } from 'react-native-router-flux';
import FCM from 'react-native-fcm';
.....
_onLoginSuccess = () => {
const topic = '/topics/list'
FCM.subscribeToTopic(topic); // subscribe to topic
@tjkang
tjkang / app.js
Created March 23, 2017 03:49
AppServer code for Push Notification
var firebase = require('firebase-admin');
var request = require('request');
// Fetch the service account key JSON file contents
var serviceAccount = require("path/to/serviceAccountKey.json");
var env = require("path/to/env.json");
// Your Firebase Cloud Messaging Server API key
var API_KEY = env.CLOUD_MESSAGE_API_KEY;
@tjkang
tjkang / SubjectListScene.js
Created March 23, 2017 03:35
Sending a push notification from the RN App
_onPress = () => {
const subjectsRef = firebase.database().ref('subjects');
const notificationReqsRef = firebase.database().ref('notificationRequests');
const subjectData = {
author: 'TJ',
title: this.state.subjectText,
};
const notificationReq = {
from_username: 'TJ',
message: `just posted new topic "${this.state.topicText}"`,
@tjkang
tjkang / App.js
Last active October 5, 2018 13:09
Push Notification for React Native
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
StyleSheet,
Text,