Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 70849c5

Browse files
author
Will Anderson
committed
Merge pull request #1 from Microsoft/implementation-first-pass
Implementation first pass
2 parents c721671 + 053c786 commit 70849c5

File tree

16 files changed

+579
-24
lines changed

16 files changed

+579
-24
lines changed

Examples/HybridMobileDeployCompanion/.npmignore renamed to .npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ DerivedData
2525
#
2626
node_modules/
2727
npm-debug.log
28+
29+
# Don't publish example apps
30+
Examples/

Examples/HybridMobileDeployCompanion/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ DerivedData
2525
#
2626
node_modules/
2727
npm-debug.log
28+
29+
main.jsbundle

Examples/HybridMobileDeployCompanion/HybridMobileDeployCompanion.xcodeproj/project.pbxproj

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
2424
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
2525
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
26+
81551E1B1B3B428000F5B9F1 /* libHybridMobileDeploy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 81551E0F1B3B427200F5B9F1 /* libHybridMobileDeploy.a */; };
2627
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
2728
/* End PBXBuildFile section */
2829

@@ -104,6 +105,13 @@
104105
remoteGlobalIDString = 134814201AA4EA6300B7C361;
105106
remoteInfo = RCTLinking;
106107
};
108+
81551E0E1B3B427200F5B9F1 /* PBXContainerItemProxy */ = {
109+
isa = PBXContainerItemProxy;
110+
containerPortal = 81551E0A1B3B427200F5B9F1 /* HybridMobileDeploy.xcodeproj */;
111+
proxyType = 2;
112+
remoteGlobalIDString = 134814201AA4EA6300B7C361;
113+
remoteInfo = HybridMobileDeploy;
114+
};
107115
832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
108116
isa = PBXContainerItemProxy;
109117
containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
@@ -115,27 +123,28 @@
115123

116124
/* Begin PBXFileReference section */
117125
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = "<group>"; };
118-
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<group>"; };
119-
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj; sourceTree = "<group>"; };
120-
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = "<group>"; };
121-
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
122-
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
123-
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
126+
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<group>"; };
127+
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = "node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj"; sourceTree = "<group>"; };
128+
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = "<group>"; };
129+
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
130+
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
131+
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
124132
00E356EE1AD99517003FC87E /* HybridMobileDeployCompanionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HybridMobileDeployCompanionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
125133
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
126134
00E356F21AD99517003FC87E /* HybridMobileDeployCompanionTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HybridMobileDeployCompanionTests.m; sourceTree = "<group>"; };
127-
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = "<group>"; };
128-
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = "<group>"; };
135+
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
136+
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
129137
13B07F961A680F5B00A75B9A /* HybridMobileDeployCompanion.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HybridMobileDeployCompanion.app; sourceTree = BUILT_PRODUCTS_DIR; };
130138
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = "<group>"; };
131139
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = "<group>"; };
132140
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
133141
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = iOS/Images.xcassets; sourceTree = "<group>"; };
134142
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = "<group>"; };
135143
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = "<group>"; };
136-
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = node_modules/react-native/React/React.xcodeproj; sourceTree = "<group>"; };
137-
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = "<group>"; };
138-
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
144+
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
145+
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
146+
81551E0A1B3B427200F5B9F1 /* HybridMobileDeploy.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = HybridMobileDeploy.xcodeproj; path = ../../HybridMobileDeploy.xcodeproj; sourceTree = "<group>"; };
147+
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
139148
/* End PBXFileReference section */
140149

141150
/* Begin PBXFrameworksBuildPhase section */
@@ -161,6 +170,7 @@
161170
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
162171
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
163172
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
173+
81551E1B1B3B428000F5B9F1 /* libHybridMobileDeploy.a in Frameworks */,
164174
);
165175
runOnlyForDeploymentPostprocessing = 0;
166176
};
@@ -278,9 +288,18 @@
278288
name = Products;
279289
sourceTree = "<group>";
280290
};
291+
81551E0B1B3B427200F5B9F1 /* Products */ = {
292+
isa = PBXGroup;
293+
children = (
294+
81551E0F1B3B427200F5B9F1 /* libHybridMobileDeploy.a */,
295+
);
296+
name = Products;
297+
sourceTree = "<group>";
298+
};
281299
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
282300
isa = PBXGroup;
283301
children = (
302+
81551E0A1B3B427200F5B9F1 /* HybridMobileDeploy.xcodeproj */,
284303
146833FF1AC3E56700842450 /* React.xcodeproj */,
285304
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
286305
00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */,
@@ -390,6 +409,10 @@
390409
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
391410
projectDirPath = "";
392411
projectReferences = (
412+
{
413+
ProductGroup = 81551E0B1B3B427200F5B9F1 /* Products */;
414+
ProjectRef = 81551E0A1B3B427200F5B9F1 /* HybridMobileDeploy.xcodeproj */;
415+
},
393416
{
394417
ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
395418
ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
@@ -514,6 +537,13 @@
514537
remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
515538
sourceTree = BUILT_PRODUCTS_DIR;
516539
};
540+
81551E0F1B3B427200F5B9F1 /* libHybridMobileDeploy.a */ = {
541+
isa = PBXReferenceProxy;
542+
fileType = archive.ar;
543+
path = libHybridMobileDeploy.a;
544+
remoteRef = 81551E0E1B3B427200F5B9F1 /* PBXContainerItemProxy */;
545+
sourceTree = BUILT_PRODUCTS_DIR;
546+
};
517547
832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
518548
isa = PBXReferenceProxy;
519549
fileType = archive.ar;
@@ -629,6 +659,7 @@
629659
"$(inherited)",
630660
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
631661
"$(SRCROOT)/node_modules/react-native/React/**",
662+
"$(SRCROOT)/../..",
632663
);
633664
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
634665
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -645,6 +676,7 @@
645676
"$(inherited)",
646677
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
647678
"$(SRCROOT)/node_modules/react-native/React/**",
679+
"$(SRCROOT)/../..",
648680
);
649681
INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist";
650682
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

Examples/HybridMobileDeployCompanion/iOS/AppDelegate.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#import "RCTRootView.h"
1313

14+
#import "HybridMobileDeploy.h"
15+
1416
@implementation AppDelegate
1517

1618
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -31,7 +33,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3133
* on the same Wi-Fi network.
3234
*/
3335

34-
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
36+
//jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
3537

3638
/**
3739
* OPTION 2
@@ -42,8 +44,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
4244
*
4345
* see http://facebook.github.io/react-native/docs/runningondevice.html
4446
*/
45-
46-
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
47+
48+
jsCodeLocation = [HybridMobileDeploy appBundleUrl];
4749

4850
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
4951
moduleName:@"HybridMobileDeployCompanion"

Examples/HybridMobileDeployCompanion/iOS/main.jsbundle

Lines changed: 0 additions & 8 deletions
This file was deleted.

Examples/HybridMobileDeployCompanion/index.ios.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,41 @@ var {
99
AppRegistry,
1010
StyleSheet,
1111
Text,
12+
TouchableOpacity,
1213
View,
1314
} = React;
1415

16+
var Button = require("react-native-button");
17+
18+
var HybridMobileDeploy = require('react-native-hybrid-mobile-deploy')('http://localhost:3000/', '<deployment key here>');
19+
1520
var HybridMobileDeployCompanion = React.createClass({
21+
componentDidMount: function() {
22+
this.fetchData();
23+
},
24+
fetchData: function() {
25+
HybridMobileDeploy.queryUpdate((err, update) => {
26+
this.setState({ update: update, updateString: JSON.stringify(update) });
27+
});
28+
},
29+
getInitialState: function() {
30+
return { update: false, updateString: "" };
31+
},
32+
handlePress: function() {
33+
console.log("pressed");
34+
},
1635
render: function() {
36+
var updateView;
37+
if (this.state.update) {
38+
updateView = (
39+
<View>
40+
<Text>Update Available: {'\n'} {this.state.update.scriptVersion} - {this.state.update.description}</Text>
41+
<Button style={{color: 'green'}} onPress={this._handlePress}>
42+
Update
43+
</Button>
44+
</View>
45+
);
46+
};
1747
return (
1848
<View style={styles.container}>
1949
<Text style={styles.welcome}>
@@ -26,6 +56,7 @@ var HybridMobileDeployCompanion = React.createClass({
2656
Press Cmd+R to reload,{'\n'}
2757
Cmd+D or shake for dev menu
2858
</Text>
59+
{updateView}
2960
</View>
3061
);
3162
}

Examples/HybridMobileDeployCompanion/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6-
"start": "node_modules/react-native/packager/packager.sh"
6+
"start": "node_modules/react-native/packager/packager.sh --root ../../"
77
},
88
"dependencies": {
9-
"react-native": "^0.4.4"
9+
"react-native": "^0.8.0-rc",
10+
"react-native-button": "^1.2.0"
1011
}
1112
}

HybridMobileDeploy.android.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Stub of UpdateManager for Android.
3+
*
4+
* @providesModule UpdateManager
5+
* @flow
6+
*/
7+
'use strict';
8+
9+
var warning = require('warning');
10+
11+
var HybridMobileDeploy = {
12+
test: function() {
13+
warning("Not yet implemented for Android.");
14+
}
15+
};
16+
17+
module.exports = HybridMobileDeploy;

HybridMobileDeploy.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#import "RCTBridgeModule.h"
2+
3+
@interface HybridMobileDeploy : NSObject <RCTBridgeModule>
4+
+ (NSString *) getBundlePath:(NSString*)bundleName;
5+
+ (NSURL *) getNativeBundleURL:(NSString*)bundleName;
6+
+ (NSURL *)appBundleUrl;
7+
+ (NSURL *)appBundleUrl:(NSString*)bundleName
8+
nativeBundleName:(NSString*)nativeBundleName;
9+
@end

HybridMobileDeploy.ios.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @providesModule HybridMobileDeploy
3+
* @flow
4+
*/
5+
6+
'use strict';
7+
8+
var NativeHybridMobileDeploy = require('react-native').NativeModules.HybridMobileDeploy;
9+
var requestFetchAdapter = require("./request-fetch-adapter.js");
10+
var semver = require('semver');
11+
var Sdk = require("hybrid-mobile-deploy-sdk/script/acquisition-sdk");
12+
var serverUrl;
13+
var appName;
14+
var sdk;
15+
16+
var HybridMobileDeploy = {
17+
queryUpdate: function(cb) {
18+
var pkg = {nativeVersion: "1.2.3", scriptVersion: "1.2.0"};
19+
sdk.queryUpdateWithCurrentPackage(pkg, cb);
20+
},
21+
installUpdate: function(update) {
22+
NativeHybridMobileDeploy.installUpdateFromUrl(update.updateUrl, update.bundleName, (err) => console.log(err), () => console.log("success"));
23+
}
24+
};
25+
26+
module.exports = function(serverUrl, deploymentKey, ignoreNativeVersion) {
27+
sdk = new Sdk(requestFetchAdapter, {
28+
serverUrl: serverUrl,
29+
deploymentKey: deploymentKey,
30+
ignoreNativeVersion: ignoreNativeVersion
31+
});
32+
return HybridMobileDeploy;
33+
};

0 commit comments

Comments
 (0)