Skip to content

Instantly share code, notes, and snippets.

View naishe's full-sized avatar
🚀
Let's Launch This Thing!

Nishant Neeraj naishe

🚀
Let's Launch This Thing!
View GitHub Profile
@naishe
naishe / build.gradle.diff
Created August 2, 2020 03:32
Integrating CodePush 2
// file: android/app/build.gradle
apply from: "../../node_modules/react-native/react.gradle"
+ apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" // CodePush
@naishe
naishe / MainApplication.java.diff
Created August 2, 2020 03:36
Integrating CodePush 3
// File: android/app/src/main/java/com/myapp/MainApplication.java
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
+ import com.microsoft.codepush.react.CodePush; // 1. CodePush
public class MainApplication extends MultiDexApplication implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
@naishe
naishe / strings.xml.diff
Created August 2, 2020 03:40
Integrating CodePush 4
<!-- android/app/src/main/res/values/strings.xml -->
<resources>
<string name="app_name">myapp</string>
+ <string moduleConfig="true" name="CodePushDeploymentKey">Jbach1Qk_achQarrrhNOA9zwVlJnruLsa9jsr</string>
</resources>
@naishe
naishe / settings.gradle.diff
Created August 2, 2020 03:43
Integrating CodePush 5
// android/settings.gradle
rootProject.name = 'myapp'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
- include ':app'
+ include ':app', ':react-native-code-push'
+ project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
@naishe
naishe / index.js.diff
Created August 2, 2020 03:45
Integrating CodePush 6
import {AppRegistry} from 'react-native';
- import App from './App';
+ import AppWrappedInCodePush from './AppWrappedInCodePush';
import {name as appName} from './app.json';
- AppRegistry.registerComponent(appName, () => App);
+ AppRegistry.registerComponent(appName, () => AppWrappedInCodePush);
@naishe
naishe / codepush_rn_versions.md
Last active August 2, 2020 04:05
Integrating CodePush 7

For future versions refer this repo: https://github.com/microsoft/react-native-code-push

React Native version(s) Supporting CodePush version(s)
<0.14 Unsupported
v0.14 v1.3 (introduced Android support)
v0.15-v0.18 v1.4-v1.6 (introduced iOS asset support)
v0.19-v0.28 v1.7-v1.17 (introduced Android asset support)
v0.29-v0.30 v1.13-v1.17 (RN refactored native hosting code)
v0.31-v0.33 v1.14.6-v1.17 (RN refactored native hosting code)
@naishe
naishe / AppDelegate.m.diff
Created August 2, 2020 09:42
Integrating CodePush 7 (iOS 1)
// file name: ios/ThatMate/AppDelegate.m
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
+#import <CodePush/CodePush.h> // CodePush
// --- code not shown for brevity ---
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
- #ifdef FB_SONARKIT_ENABLED
@naishe
naishe / Info.plist.diff
Created August 2, 2020 09:45
CodePush 8 (iOS 2)
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>CodePushDeploymentKey</key>
+ <string>Jbach1Qk_achQarrrhNOA9zwVlJnruLsa9jsr</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
@naishe
naishe / AppWrappedInCodePush.tsx
Created August 4, 2020 05:52
Integrating CodePush Advanced: 1
import React, {Component} from 'react';
import App from './App';
import codePush from 'react-native-code-push';
import AsyncStorage from '@react-native-community/async-storage';
import {
CODEPUSH_STAGING_DEPLOYMENT_KEY,
CODEPUSH_PRODUCTION_DEPLOYMENT_KEY,
} from './utils/constants';
const codePushOptions = {checkFrequency: codePush.CheckFrequency.MANUAL};
@naishe
naishe / costants.ts
Created August 4, 2020 05:56
CodePush Deployment Keys
// CODEPUSH RELATED DATA
export const CODEPUSH_STAGING_DEPLOYMENT_KEY = 'jhai-muzz27Nt7Y11KLp-cBsNA22EGjGHEYfr';
export const CODEPUSH_PRODUCTION_DEPLOYMENT_KEY = 'Jbach1Qk_achQarrrhNOA9zwVlJnruLsa9jsr';