This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
55,728 additions
and
181 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
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 @@ | ||
{} |
This file was deleted.
Oops, something went wrong.
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
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,66 @@ | ||
'use strict'; | ||
|
||
var NativeCodePush = require("react-native").NativeModules.CodePush; | ||
|
||
var Platform = require("Platform"); | ||
var Alert; | ||
|
||
if (Platform.OS === "android") { | ||
/* | ||
* Promisify native methods. Assumes that every native method takes | ||
* two callback functions, resolve and reject. | ||
*/ | ||
var methodsToPromisify = [ | ||
"installUpdate", | ||
"downloadUpdate", | ||
"getConfiguration", | ||
"getCurrentPackage", | ||
"isFailedUpdate", | ||
"isFirstRun", | ||
"notifyApplicationReady" | ||
]; | ||
|
||
methodsToPromisify.forEach((methodName) => { | ||
var aMethod = NativeCodePush[methodName]; | ||
NativeCodePush[methodName] = function() { | ||
var args = [].slice.apply(arguments); | ||
return new Promise((resolve, reject) => { | ||
args.push(resolve); | ||
args.push(reject); | ||
aMethod.apply(this, args); | ||
}); | ||
} | ||
}); | ||
|
||
var CodePushDialog = require("react-native").NativeModules.CodePushDialog; | ||
Alert = { | ||
alert: function(title, message, buttons) { | ||
if (buttons.length > 2) { | ||
throw "Can only show 2 buttons for Android dialog."; | ||
} | ||
|
||
var button1Text = buttons[0] ? buttons[0].text : null; | ||
var button2Text = buttons[1] ? buttons[1].text : null; | ||
|
||
CodePushDialog.showDialog( | ||
title, message, button1Text, button2Text, | ||
(buttonPressedId) => { | ||
buttons[buttonPressedId].onPress && buttons[buttonPressedId].onPress(); | ||
}, | ||
(error) => { | ||
throw error; | ||
}); | ||
} | ||
}; | ||
} else if (Platform.OS === "ios") { | ||
var { AlertIOS } = require("react-native"); | ||
Alert = AlertIOS; | ||
} | ||
|
||
var PackageMixins = require("./package-mixins")(NativeCodePush); | ||
|
||
module.exports = { | ||
NativeCodePush: NativeCodePush, | ||
PackageMixins: PackageMixins, | ||
Alert: Alert | ||
} |
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
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 @@ | ||
{} |
3 changes: 0 additions & 3 deletions
3
Examples/CodePushDemoApp/CodePushDemoAppTests/InstallUpdateTests/InstallUpdateTestApp.ios.js
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/** | ||
* @providesModule QueryUpdateTestApp | ||
*/ | ||
'use strict'; | ||
|
||
var React = require('react-native'); | ||
|
3 changes: 0 additions & 3 deletions
3
Examples/CodePushDemoApp/CodePushDemoAppTests/QueryUpdateTests/QueryUpdateTestApp.ios.js
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/** | ||
* @providesModule QueryUpdateTestApp | ||
*/ | ||
'use strict'; | ||
|
||
var React = require('react-native'); | ||
|
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,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.1" | ||
|
||
defaultConfig { | ||
applicationId "com.microsoft.codepushdemoapp" | ||
minSdkVersion 16 | ||
targetSdkVersion 22 | ||
versionCode 1 | ||
versionName "1.0.0" | ||
ndk { | ||
abiFilters "armeabi-v7a", "x86" | ||
} | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:23.0.0' | ||
compile 'com.facebook.react:react-native:0.15.1' | ||
compile project(':react-native-code-push') | ||
} |
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,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
22 changes: 22 additions & 0 deletions
22
Examples/CodePushDemoApp/android/app/src/main/AndroidManifest.xml
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,22 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.microsoft.codepushdemoapp"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:icon="@mipmap/ic_launcher" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name="com.microsoft.codepushdemoapp.MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.