construct the basic code base.
This commit is contained in:
Родитель
b3d62f75ca
Коммит
7d68736e57
|
@ -53,12 +53,17 @@ react-native start
|
|||
```
|
||||
### Run Test
|
||||
|
||||
Current test includes action test, reducer test, middleware test and component test.
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
**PRs are Welcome**
|
||||
|
||||
## License
|
||||
|
|
|
@ -66,6 +66,7 @@ import com.android.build.OutputFile
|
|||
*/
|
||||
|
||||
apply from: "../../node_modules/react-native/react.gradle"
|
||||
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
|
||||
|
||||
/**
|
||||
* Set this to true to create two separate APKs instead of one:
|
||||
|
@ -126,6 +127,10 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':react-native-vector-icons')
|
||||
compile project(':react-native-send-intent')
|
||||
compile project(':react-native-push-notification')
|
||||
compile project(':react-native-code-push')
|
||||
compile project(':react-native-device-info')
|
||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||
compile "com.android.support:appcompat-v7:23.0.1"
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -4,6 +4,10 @@ import android.app.Application;
|
|||
import android.util.Log;
|
||||
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.oblador.vectoricons.VectorIconsPackage;
|
||||
import com.burnweb.rnsendintent.RNSendIntentPackage;
|
||||
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
|
||||
import com.microsoft.codepush.react.CodePush;
|
||||
import com.learnium.RNDeviceInfo.RNDeviceInfo;
|
||||
import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
|
@ -17,6 +21,12 @@ import java.util.List;
|
|||
public class MainApplication extends Application implements ReactApplication {
|
||||
|
||||
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
||||
|
||||
@Override
|
||||
protected String getJSBundleFile() {
|
||||
return CodePush.getJSBundleFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
|
@ -26,6 +36,10 @@ public class MainApplication extends Application implements ReactApplication {
|
|||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage(),
|
||||
new VectorIconsPackage(),
|
||||
new RNSendIntentPackage(),
|
||||
new ReactNativePushNotificationPackage(),
|
||||
new CodePush(null, getApplicationContext(), BuildConfig.DEBUG),
|
||||
new RNDeviceInfo()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<resources>
|
||||
<string moduleConfig="true" name="reactNativeCodePush_androidDeploymentKey"></string>
|
||||
<string name="app_name">MobileCenterReactNativeApp</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
rootProject.name = 'MobileCenterReactNativeApp'
|
||||
include ':react-native-vector-icons'
|
||||
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
|
||||
include ':react-native-send-intent'
|
||||
project(':react-native-send-intent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-send-intent/android')
|
||||
include ':react-native-push-notification'
|
||||
project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
|
||||
include ':react-native-code-push'
|
||||
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
|
||||
include ':react-native-device-info'
|
||||
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
|
||||
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
|
||||
00E356F31AD99517003FC87E /* MobileCenterReactNativeAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* MobileCenterReactNativeAppTests.m */; };
|
||||
016A3EB57527455C86FB9B6F /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DCB78B73B64B4F47AEF36680 /* Foundation.ttf */; };
|
||||
0649B80A9EAD4CEF82DEEB2C /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 03A90D5317764E12B8B9CB8B /* MaterialCommunityIcons.ttf */; };
|
||||
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
|
||||
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
|
||||
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
|
||||
|
@ -21,9 +23,20 @@
|
|||
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
|
||||
140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
||||
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
|
||||
229A7D08ECA74F8AACEE3E2F /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5517E6C0053E4B1B90641655 /* Octicons.ttf */; };
|
||||
3F1096DC29134987B0963FA1 /* libCodePush.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49A05D0E72684A039C0A3ADF /* libCodePush.a */; };
|
||||
3F9F7622B45F47DB9FDC2CF9 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BA6CDA0DF38645FBA74EEA3F /* Zocial.ttf */; };
|
||||
406741C90D344A5C98BA37B3 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FEB3942095E414E82885581 /* libz.tbd */; };
|
||||
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
|
||||
63315BDBCC3F42FAB9A683B0 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E8AACDB6442A404B970AC4B4 /* Ionicons.ttf */; };
|
||||
6D9F611F827747FBAD25C03F /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B7AB16C7FAC84F0898CD5D68 /* libRNVectorIcons.a */; };
|
||||
6ED4990B38494852B1D7EF4F /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = AE342FD49E124EA4BD2F9406 /* MaterialIcons.ttf */; };
|
||||
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
|
||||
882AA0CCE0A94244B831C8D4 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA115C8DC0F74BB1B13E9D2B /* libRNDeviceInfo.a */; };
|
||||
91868384492441929DA19694 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CF552377FDDC40A08120A155 /* EvilIcons.ttf */; };
|
||||
967445A6F99543C49C47BCF0 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D843D873E1AF4A358AD2EB31 /* SimpleLineIcons.ttf */; };
|
||||
AB7289AC917B4E5DABB33A85 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 37C6442EE45D4A4D9F95DBD1 /* FontAwesome.ttf */; };
|
||||
ACD7101537094C4CAC2422F4 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3D32F9E9A5504A528C2EDC7D /* Entypo.ttf */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -90,6 +103,27 @@
|
|||
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
|
||||
remoteInfo = React;
|
||||
};
|
||||
38368A301E400E93000D3001 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = D10B24DEAE6D4CAB87D7A4E8 /* RNDeviceInfo.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = DA5891D81BA9A9FC002B4DB2;
|
||||
remoteInfo = RNDeviceInfo;
|
||||
};
|
||||
38368A331E400E93000D3001 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 7B89936946D847F68C345331 /* RNVectorIcons.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 5DBEB1501B18CEA900B34395;
|
||||
remoteInfo = RNVectorIcons;
|
||||
};
|
||||
38368A451E400F3F000D3001 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 623CB73D55124A85B3F6C94B /* CodePush.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 134814201AA4EA6300B7C361;
|
||||
remoteInfo = CodePush;
|
||||
};
|
||||
3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
|
||||
|
@ -221,6 +255,7 @@
|
|||
00E356EE1AD99517003FC87E /* MobileCenterReactNativeAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MobileCenterReactNativeAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
00E356F21AD99517003FC87E /* MobileCenterReactNativeAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MobileCenterReactNativeAppTests.m; sourceTree = "<group>"; };
|
||||
03A90D5317764E12B8B9CB8B /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = "<group>"; };
|
||||
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
|
||||
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
|
||||
13B07F961A680F5B00A75B9A /* MobileCenterReactNativeApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MobileCenterReactNativeApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
@ -231,11 +266,25 @@
|
|||
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = MobileCenterReactNativeApp/Info.plist; sourceTree = "<group>"; };
|
||||
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = MobileCenterReactNativeApp/main.m; sourceTree = "<group>"; };
|
||||
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
|
||||
37C6442EE45D4A4D9F95DBD1 /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = "<group>"; };
|
||||
3D32F9E9A5504A528C2EDC7D /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; };
|
||||
49A05D0E72684A039C0A3ADF /* libCodePush.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libCodePush.a; sourceTree = "<group>"; };
|
||||
5517E6C0053E4B1B90641655 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
|
||||
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
|
||||
623CB73D55124A85B3F6C94B /* CodePush.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = CodePush.xcodeproj; path = "../node_modules/react-native-code-push/ios/CodePush.xcodeproj"; sourceTree = "<group>"; };
|
||||
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
|
||||
7B89936946D847F68C345331 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
|
||||
7FEB3942095E414E82885581 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
|
||||
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
|
||||
D10B24DEAE6D4CAB87D7A4E8 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
|
||||
AA115C8DC0F74BB1B13E9D2B /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
|
||||
AA115C8DC0F74BB1B13E9D2B /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = "<group>"; };
|
||||
AE342FD49E124EA4BD2F9406 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
|
||||
B7AB16C7FAC84F0898CD5D68 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
|
||||
BA6CDA0DF38645FBA74EEA3F /* Zocial.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Zocial.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; };
|
||||
CF552377FDDC40A08120A155 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
|
||||
D10B24DEAE6D4CAB87D7A4E8 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; };
|
||||
D843D873E1AF4A358AD2EB31 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; };
|
||||
DCB78B73B64B4F47AEF36680 /* Foundation.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Foundation.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = "<group>"; };
|
||||
E8AACDB6442A404B970AC4B4 /* Ionicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Ionicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -263,6 +312,9 @@
|
|||
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
|
||||
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
|
||||
882AA0CCE0A94244B831C8D4 /* libRNDeviceInfo.a in Frameworks */,
|
||||
3F1096DC29134987B0963FA1 /* libCodePush.a in Frameworks */,
|
||||
406741C90D344A5C98BA37B3 /* libz.tbd in Frameworks */,
|
||||
6D9F611F827747FBAD25C03F /* libRNVectorIcons.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -328,6 +380,31 @@
|
|||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
065C1F5268B542269A76909D /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D32F9E9A5504A528C2EDC7D /* Entypo.ttf */,
|
||||
CF552377FDDC40A08120A155 /* EvilIcons.ttf */,
|
||||
37C6442EE45D4A4D9F95DBD1 /* FontAwesome.ttf */,
|
||||
DCB78B73B64B4F47AEF36680 /* Foundation.ttf */,
|
||||
E8AACDB6442A404B970AC4B4 /* Ionicons.ttf */,
|
||||
03A90D5317764E12B8B9CB8B /* MaterialCommunityIcons.ttf */,
|
||||
AE342FD49E124EA4BD2F9406 /* MaterialIcons.ttf */,
|
||||
5517E6C0053E4B1B90641655 /* Octicons.ttf */,
|
||||
D843D873E1AF4A358AD2EB31 /* SimpleLineIcons.ttf */,
|
||||
BA6CDA0DF38645FBA74EEA3F /* Zocial.ttf */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0EC38372BE004F5493D34C4C /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7FEB3942095E414E82885581 /* libz.tbd */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
139105B71AF99BAD00B5F7CC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -375,6 +452,30 @@
|
|||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
38368A121E400E93000D3001 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
38368A311E400E93000D3001 /* libRNDeviceInfo.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
38368A141E400E93000D3001 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
38368A341E400E93000D3001 /* libRNVectorIcons.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
38368A421E400F3F000D3001 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
38368A461E400F3F000D3001 /* libCodePush.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5E91572E1DD0AC6500FF2AA8 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -408,6 +509,8 @@
|
|||
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
|
||||
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
|
||||
D10B24DEAE6D4CAB87D7A4E8 /* RNDeviceInfo.xcodeproj */,
|
||||
7B89936946D847F68C345331 /* RNVectorIcons.xcodeproj */,
|
||||
623CB73D55124A85B3F6C94B /* CodePush.xcodeproj */,
|
||||
);
|
||||
name = Libraries;
|
||||
sourceTree = "<group>";
|
||||
|
@ -428,6 +531,8 @@
|
|||
832341AE1AAA6A7D00B99B32 /* Libraries */,
|
||||
00E356EF1AD99517003FC87E /* MobileCenterReactNativeAppTests */,
|
||||
83CBBA001A601CBA00E9B192 /* Products */,
|
||||
0EC38372BE004F5493D34C4C /* Frameworks */,
|
||||
065C1F5268B542269A76909D /* Resources */,
|
||||
);
|
||||
indentWidth = 2;
|
||||
sourceTree = "<group>";
|
||||
|
@ -508,6 +613,10 @@
|
|||
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 38368A421E400F3F000D3001 /* Products */;
|
||||
ProjectRef = 623CB73D55124A85B3F6C94B /* CodePush.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
|
||||
ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
|
||||
|
@ -552,6 +661,14 @@
|
|||
ProductGroup = 146834001AC3E56700842450 /* Products */;
|
||||
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 38368A121E400E93000D3001 /* Products */;
|
||||
ProjectRef = D10B24DEAE6D4CAB87D7A4E8 /* RNDeviceInfo.xcodeproj */;
|
||||
},
|
||||
{
|
||||
ProductGroup = 38368A141E400E93000D3001 /* Products */;
|
||||
ProjectRef = 7B89936946D847F68C345331 /* RNVectorIcons.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
|
@ -618,6 +735,27 @@
|
|||
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
38368A311E400E93000D3001 /* libRNDeviceInfo.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libRNDeviceInfo.a;
|
||||
remoteRef = 38368A301E400E93000D3001 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
38368A341E400E93000D3001 /* libRNVectorIcons.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libRNVectorIcons.a;
|
||||
remoteRef = 38368A331E400E93000D3001 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
38368A461E400F3F000D3001 /* libCodePush.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libCodePush.a;
|
||||
remoteRef = 38368A451E400F3F000D3001 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
@ -753,6 +891,16 @@
|
|||
files = (
|
||||
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
|
||||
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
|
||||
ACD7101537094C4CAC2422F4 /* Entypo.ttf in Resources */,
|
||||
91868384492441929DA19694 /* EvilIcons.ttf in Resources */,
|
||||
AB7289AC917B4E5DABB33A85 /* FontAwesome.ttf in Resources */,
|
||||
016A3EB57527455C86FB9B6F /* Foundation.ttf in Resources */,
|
||||
63315BDBCC3F42FAB9A683B0 /* Ionicons.ttf in Resources */,
|
||||
0649B80A9EAD4CEF82DEEB2C /* MaterialCommunityIcons.ttf in Resources */,
|
||||
6ED4990B38494852B1D7EF4F /* MaterialIcons.ttf in Resources */,
|
||||
229A7D08ECA74F8AACEE3E2F /* Octicons.ttf in Resources */,
|
||||
967445A6F99543C49C47BCF0 /* SimpleLineIcons.ttf in Resources */,
|
||||
3F9F7622B45F47DB9FDC2CF9 /* Zocial.ttf in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -827,12 +975,14 @@
|
|||
INFOPLIST_FILE = MobileCenterReactNativeAppTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MobileCenterReactNativeApp.app/MobileCenterReactNativeApp";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MobileCenterReactNativeApp.app/MobileCenterReactNativeApp";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -844,12 +994,14 @@
|
|||
INFOPLIST_FILE = MobileCenterReactNativeAppTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MobileCenterReactNativeApp.app/MobileCenterReactNativeApp";
|
||||
LIBRARY_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
"\"$(SRCROOT)/$(TARGET_NAME)\"",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MobileCenterReactNativeApp.app/MobileCenterReactNativeApp";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import <CodePush/CodePush.h>
|
||||
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
@ -18,7 +19,12 @@
|
|||
{
|
||||
NSURL *jsCodeLocation;
|
||||
|
||||
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
|
||||
|
||||
#ifdef DEBUG
|
||||
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
|
||||
#else
|
||||
jsCodeLocation = [CodePush bundleURL];
|
||||
#endif
|
||||
|
||||
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
|
||||
moduleName:@"MobileCenterReactNativeApp"
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
|
|
|
@ -1,54 +1,68 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string></string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>localhost</key>
|
||||
<dict>
|
||||
<key>NSExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>CodePushDeploymentKey</key>
|
||||
<string>deployment-key-here</string>
|
||||
<key>UIAppFonts</key>
|
||||
<array>
|
||||
<string>Entypo.ttf</string>
|
||||
<string>EvilIcons.ttf</string>
|
||||
<string>FontAwesome.ttf</string>
|
||||
<string>Foundation.ttf</string>
|
||||
<string>Ionicons.ttf</string>
|
||||
<string>MaterialCommunityIcons.ttf</string>
|
||||
<string>MaterialIcons.ttf</string>
|
||||
<string>Octicons.ttf</string>
|
||||
<string>SimpleLineIcons.ttf</string>
|
||||
<string>Zocial.ttf</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1 @@
|
|||
pod 'RNVectorIcons', :path => 'node_modules/react-native-vector-icons'
|
|
@ -1,221 +0,0 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import {Actions, Scene, Router} from 'react-native-router-flux';
|
||||
|
||||
|
||||
// var React = require('react');
|
||||
// var ReactNative = require('react-native');
|
||||
// var t = require('tcomb-form-native');
|
||||
|
||||
// var {
|
||||
// AppRegistry,
|
||||
// AsyncStorage,
|
||||
// StyleSheet,
|
||||
// Text,
|
||||
// View,
|
||||
// TouchableHighlight,
|
||||
// AlertIOS,
|
||||
// } = ReactNative;
|
||||
|
||||
// global.Buffer = global.Buffer || require('buffer').Buffer;
|
||||
|
||||
// var STORAGE_KEY = 'id_token';
|
||||
|
||||
// var Form = t.form.Form;
|
||||
|
||||
// var Person = t.struct({
|
||||
// username: t.String,
|
||||
// password: t.String
|
||||
// });
|
||||
|
||||
// const options = {};
|
||||
|
||||
// let myApiUrl = "http://localhost:3001";
|
||||
// let quotePath = "/api/protected/random-quote";
|
||||
// let userPath = "/users";
|
||||
// let userCreatePath = "/sessions/create";
|
||||
|
||||
// let mc_api_url = "https://api.mobile.azure.com";
|
||||
// let get_user = "/v0.1/user";
|
||||
// let get_apps = "/v0.1/apps";
|
||||
// let get_tokens = "/v0.1/api_tokens";
|
||||
|
||||
// let userName = "buptkang@gmail.com";
|
||||
// let userPassword = "Kb@241307684";
|
||||
|
||||
// let storedSessionTokens = "2eb6d0e2250779ad71acde8f383158b48aa0b4b6";
|
||||
|
||||
// var MobileCenter = React.createClass({
|
||||
|
||||
// async _onValueChange(item, selectedValue) {
|
||||
// try {
|
||||
// await AsyncStorage.setItem(item, selectedValue);
|
||||
// } catch (error) {
|
||||
// console.log('AsyncStorage error: ' + error.message);
|
||||
// }
|
||||
// },
|
||||
|
||||
// async _getUserApps() {
|
||||
// var DEMO_TOKEN = await AsyncStorage.getItem(STORAGE_KEY);
|
||||
// fetch(`${mc_api_url}${get_apps}`, {
|
||||
// method: "GET",
|
||||
// headers: {
|
||||
// 'Accept': 'application/json',
|
||||
// 'X-API-Token': storedSessionTokens
|
||||
// }
|
||||
// })
|
||||
// .then((response) => response.json())
|
||||
// .then((responseData) => {
|
||||
// responseData.map(app => AlertIOS.alert("Your Apps:",app.display_name));
|
||||
// //AlertIOS.alert("Your Apps:", responseData.map(app=>))
|
||||
// })
|
||||
// .done();
|
||||
// },
|
||||
|
||||
// async _userLogout() {
|
||||
// try {
|
||||
// await AsyncStorage.removeItem(STORAGE_KEY);
|
||||
// AlertIOS.alert("Logout Success!")
|
||||
// } catch (error) {
|
||||
// console.log('AsyncStorage error: ' + error.message);
|
||||
// }
|
||||
// },
|
||||
|
||||
// _userSignup() {
|
||||
// var value = this.refs.form.getValue();
|
||||
// if (value) { // if validation fails, value will be null
|
||||
// fetch(`${myApiUrl}${userPath}`, {
|
||||
// method: "POST",
|
||||
// headers: {
|
||||
// 'Accept': 'application/json',
|
||||
// 'Content-Type': 'application/json'
|
||||
// },
|
||||
// body: JSON.stringify({
|
||||
// username: value.username,
|
||||
// password: value.password,
|
||||
// })
|
||||
// })
|
||||
// .then((response) => response.json())
|
||||
// .then((responseData) => {
|
||||
// this._onValueChange(STORAGE_KEY, responseData.id_token),
|
||||
// AlertIOS.alert(
|
||||
// "Signup Success!",
|
||||
// "Click the button to get a Chuck Norris quote!"
|
||||
// )
|
||||
// })
|
||||
// .done();
|
||||
// }
|
||||
// },
|
||||
|
||||
// _userLogin() {
|
||||
// let concatStr = userName + ':' + userPassword;
|
||||
// let hashStr = new Buffer(concatStr).toString('base64');
|
||||
// //TODO: check null;
|
||||
// //AlertIOS.alert(hashStr);
|
||||
// // var value = this.refs.form.getValue();
|
||||
// // if (value) { // if validation fails, value will be null
|
||||
// //fetch(`${myApiUrl}${userCreatePath}`, {
|
||||
// fetch(`${mc_api_url}${get_tokens}`, {
|
||||
// method: "GET",
|
||||
// headers: {
|
||||
// 'Accept': 'application/json',
|
||||
// 'Authorization': 'Basic ' + hashStr
|
||||
// }
|
||||
// })
|
||||
// .then((response) => response.json())
|
||||
// .then((responseData) => {
|
||||
// AlertIOS.alert(
|
||||
// "Login Success!",
|
||||
// //responseData[0].id
|
||||
// ),
|
||||
// this._onValueChange(STORAGE_KEY, responseData[0].id)
|
||||
// })
|
||||
// .done();
|
||||
// // }
|
||||
// },
|
||||
|
||||
// render() {
|
||||
// return (
|
||||
// <View style={styles.container}>
|
||||
// <View style={styles.row}>
|
||||
// <Text style={styles.title}>Mobile Center RN Experiment</Text>
|
||||
// </View>
|
||||
// <View style={styles.row}>
|
||||
// <Form
|
||||
// ref="form"
|
||||
// type={Person}
|
||||
// options={options}
|
||||
// />
|
||||
// </View>
|
||||
// <View style={styles.row}>
|
||||
// <TouchableHighlight style={styles.button} onPress={this._userLogin} underlayColor='#99d9f4'>
|
||||
// <Text style={styles.buttonText}>Login</Text>
|
||||
// </TouchableHighlight>
|
||||
// <TouchableHighlight style={styles.button} onPress={this._userLogout} underlayColor='#99d9f4'>
|
||||
// <Text style={styles.buttonText}>Logout</Text>
|
||||
// </TouchableHighlight>
|
||||
// </View>
|
||||
// <View style={styles.row}>
|
||||
// <TouchableHighlight onPress={this._getUserApps} style={styles.button}>
|
||||
// <Text style={styles.buttonText}>Get your apps!</Text>
|
||||
// </TouchableHighlight>
|
||||
// </View>
|
||||
// </View>
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
// var styles = StyleSheet.create({
|
||||
// container: {
|
||||
// justifyContent: 'center',
|
||||
// marginTop: 50,
|
||||
// padding: 20,
|
||||
// backgroundColor: '#ffffff',
|
||||
// },
|
||||
// title: {
|
||||
// fontSize: 30,
|
||||
// alignSelf: 'center',
|
||||
// marginBottom: 30
|
||||
// },
|
||||
// buttonText: {
|
||||
// fontSize: 18,
|
||||
// color: 'white',
|
||||
// alignSelf: 'center'
|
||||
// },
|
||||
// button: {
|
||||
// height: 36,
|
||||
// backgroundColor: '#48BBEC',
|
||||
// borderColor: '#48BBEC',
|
||||
// borderWidth: 1,
|
||||
// borderRadius: 8,
|
||||
// marginBottom: 10,
|
||||
// alignSelf: 'stretch',
|
||||
// justifyContent: 'center'
|
||||
// },
|
||||
// });
|
||||
|
||||
// module.exports = MobileCenter;
|
|
@ -24,15 +24,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import * as types from '../constants/ActionTypes';
|
||||
import * as types from './types';
|
||||
|
||||
export function requestAppList(isRefreshing, loading, typeId, isLoadMore, page = 1) {
|
||||
export function requestAppList(isRefreshing, loading, tokenId, isLoadMore, page = 1) {
|
||||
return {
|
||||
type: types.REQUEST_APP_LIST,
|
||||
isRefreshing,
|
||||
loading,
|
||||
isLoadMore,
|
||||
typeId,
|
||||
tokenId,
|
||||
page,
|
||||
};
|
||||
}
|
||||
|
@ -46,10 +46,10 @@ export function fetchAppList(isRefreshing, loading, isLoadMore = false) {
|
|||
};
|
||||
}
|
||||
|
||||
export function receiveAppList(appList, typeId) {
|
||||
export function receiveAppList(appList, tokenId) {
|
||||
return {
|
||||
type: types.RECEIVE_APP_LIST,
|
||||
appList,
|
||||
typeId
|
||||
tokenId
|
||||
};
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React, { PropTypes } from 'react';
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
TouchableOpacity
|
||||
} from 'react-native';
|
||||
|
||||
const propTypes = {
|
||||
onPress: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
style: Text.propTypes.style,
|
||||
containerStyle: View.propTypes.style,
|
||||
text: PropTypes.string,
|
||||
activeOpacity: PropTypes.number
|
||||
};
|
||||
|
||||
const Button = ({ onPress, disabled, style, containerStyle, text, activeOpacity }) => (
|
||||
<TouchableOpacity
|
||||
style={containerStyle}
|
||||
onPress={onPress}
|
||||
disabled={disabled}
|
||||
activeOpacity={activeOpacity}
|
||||
>
|
||||
<Text style={style}>
|
||||
{text}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
Button.propTypes = propTypes;
|
||||
|
||||
Button.defaultProps = {
|
||||
onPress() {},
|
||||
disabled: false,
|
||||
activeOpacity: 0.8
|
||||
};
|
||||
|
||||
export default Button;
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
StyleSheet
|
||||
} from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
|
||||
export default class TabIcon extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Icon
|
||||
color={this.props.selected ? '#3e9ce9' : '#999999'}
|
||||
name={this.props.iconName}
|
||||
size={25}
|
||||
/>
|
||||
<Text style={[styles.title, { color: this.props.selected ? '#3e9ce9' : '#999999' }]}>
|
||||
{this.props.title}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center'
|
||||
},
|
||||
title: {
|
||||
fontSize: 14
|
||||
}
|
||||
});
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import Apps from '../pages/apps';
|
||||
import * as appsCreators from '../actions/apps';
|
||||
// import CodePush from 'react-native-code-push';
|
||||
|
||||
class AppsContainer extends React.Component{
|
||||
componentDidMount(){
|
||||
//TODO codepush
|
||||
}
|
||||
|
||||
render(){
|
||||
return (
|
||||
<Apps {...this.props}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default connect()(AppsContainer);
|
|
@ -0,0 +1,112 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { StyleSheet, Navigator, View, Text } from 'react-native';
|
||||
import { Router, Scene, ActionConst } from 'react-native-router-flux';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import About from '../pages/about';
|
||||
import Notification from '../pages/notification';
|
||||
import User from '../pages/user';
|
||||
import AppsContainer from './appContainer';
|
||||
import TabIcon from '../components/tabicon';
|
||||
const RouterWithRedux = connect()(Router);
|
||||
|
||||
const getSceneStyle = (props, computedProps) => {
|
||||
const style = {
|
||||
flex: 1,
|
||||
backgroundColor: '#fff',
|
||||
shadowColor: null,
|
||||
shadowOffset: null,
|
||||
shadowOpacity: null,
|
||||
shadowRadius: null,
|
||||
};
|
||||
if (computedProps.isActive) {
|
||||
style.marginTop = computedProps.hideNavBar ?
|
||||
0 : Navigator.NavigationBar.Styles.General.TotalNavHeight;
|
||||
style.marginBottom = computedProps.hideTabBar ? 0 : 50;
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
||||
class MobileCenter extends React.Component{
|
||||
render(){
|
||||
return (
|
||||
<RouterWithRedux
|
||||
titleStyle={styles.navBarTitle}
|
||||
getSceneStyle={getSceneStyle}
|
||||
navigationBarStyle={styles.navBar}
|
||||
>
|
||||
<Scene key='root'>
|
||||
<Scene key='tabbar' tabs pressOpacity={0.8} type={ActionConst.REPLACE}>
|
||||
<Scene
|
||||
key="apps"
|
||||
component={AppsContainer}
|
||||
title="Apps"
|
||||
icon={TabIcon}
|
||||
iconName="md-apps"
|
||||
/>
|
||||
<Scene
|
||||
key="notification"
|
||||
component={Notification}
|
||||
title="Notification"
|
||||
icon={TabIcon}
|
||||
iconName="md-notifications"
|
||||
/>
|
||||
<Scene
|
||||
key="user"
|
||||
component={User}
|
||||
title="My Info"
|
||||
icon={TabIcon}
|
||||
iconName="md-person"
|
||||
/>
|
||||
<Scene
|
||||
key="about"
|
||||
component={About}
|
||||
title="About"
|
||||
icon={TabIcon}
|
||||
iconName="md-information-circle"
|
||||
/>
|
||||
</Scene>
|
||||
</Scene>
|
||||
</RouterWithRedux>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
navBar: {
|
||||
backgroundColor: '#3e9ce9'
|
||||
},
|
||||
navBarTitle: {
|
||||
color: '#fff',
|
||||
fontSize: 20,
|
||||
}
|
||||
});
|
||||
|
||||
export default MobileCenter;
|
|
@ -0,0 +1,34 @@
|
|||
import {addTodo} from '../todo';
|
||||
|
||||
test('adds 1 + 2 to equal 3', () => {
|
||||
const sum = require('../sum');
|
||||
expect(sum(1, 2)).toBe(3);
|
||||
});
|
||||
|
||||
const myBeverage = {
|
||||
delicious: true,
|
||||
sour: false,
|
||||
};
|
||||
|
||||
describe('my beverage', () => {
|
||||
it('is delicious', () => {
|
||||
expect(myBeverage.delicious).toBeTruthy();
|
||||
});
|
||||
|
||||
it('is not sour', () => {
|
||||
expect(myBeverage.sour).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('actions', () => {
|
||||
it('should create an action to add a todo', () => {
|
||||
const text = "Go to the Vault"
|
||||
const id = 1
|
||||
const expectedAction = {
|
||||
type: 'ADD_TODO',
|
||||
text: "Go to the Vault",
|
||||
id: 1
|
||||
}
|
||||
expect(addTodo(text, id)).toEqual(expectedAction)
|
||||
})
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
module.exports = (a, b) => a + b;
|
|
@ -0,0 +1,7 @@
|
|||
export const addTodo = (text, id) => {
|
||||
return {
|
||||
id: id,
|
||||
type: 'ADD_TODO',
|
||||
text
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
// import {Actions, Scene, Router} from 'react-native-router-flux';
|
||||
|
||||
var React = require('react');
|
||||
var ReactNative = require('react-native');
|
||||
var t = require('tcomb-form-native');
|
||||
|
||||
var {
|
||||
AppRegistry,
|
||||
AsyncStorage,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
TouchableHighlight,
|
||||
AlertIOS,
|
||||
} = ReactNative;
|
||||
|
||||
global.Buffer = global.Buffer || require('buffer').Buffer;
|
||||
|
||||
var STORAGE_KEY = 'id_token';
|
||||
|
||||
var Form = t.form.Form;
|
||||
|
||||
var Person = t.struct({
|
||||
username: t.String,
|
||||
password: t.String
|
||||
});
|
||||
|
||||
const options = {};
|
||||
|
||||
let myApiUrl = "http://localhost:3001";
|
||||
let quotePath = "/api/protected/random-quote";
|
||||
let userPath = "/users";
|
||||
let userCreatePath = "/sessions/create";
|
||||
|
||||
let mc_api_url = "https://api.mobile.azure.com";
|
||||
let get_user = "/v0.1/user";
|
||||
let get_apps = "/v0.1/apps";
|
||||
let get_tokens = "/v0.1/api_tokens";
|
||||
|
||||
let userName = "buptkang@gmail.com";
|
||||
let userPassword = "Kb@241307684";
|
||||
|
||||
let storedSessionTokens = "2eb6d0e2250779ad71acde8f383158b48aa0b4b6";
|
||||
|
||||
var MobileCenter = React.createClass({
|
||||
|
||||
async _onValueChange(item, selectedValue) {
|
||||
try {
|
||||
await AsyncStorage.setItem(item, selectedValue);
|
||||
} catch (error) {
|
||||
console.log('AsyncStorage error: ' + error.message);
|
||||
}
|
||||
},
|
||||
|
||||
async _getUserApps() {
|
||||
var DEMO_TOKEN = await AsyncStorage.getItem(STORAGE_KEY);
|
||||
fetch(`${mc_api_url}${get_apps}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'X-API-Token': storedSessionTokens
|
||||
}
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseData) => {
|
||||
responseData.map(app => AlertIOS.alert("Your Apps:",app.display_name));
|
||||
//AlertIOS.alert("Your Apps:", responseData.map(app=>))
|
||||
})
|
||||
.done();
|
||||
},
|
||||
|
||||
async _userLogout() {
|
||||
try {
|
||||
await AsyncStorage.removeItem(STORAGE_KEY);
|
||||
AlertIOS.alert("Logout Success!")
|
||||
} catch (error) {
|
||||
console.log('AsyncStorage error: ' + error.message);
|
||||
}
|
||||
},
|
||||
|
||||
_userSignup() {
|
||||
var value = this.refs.form.getValue();
|
||||
if (value) { // if validation fails, value will be null
|
||||
fetch(`${myApiUrl}${userPath}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: value.username,
|
||||
password: value.password,
|
||||
})
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseData) => {
|
||||
this._onValueChange(STORAGE_KEY, responseData.id_token),
|
||||
AlertIOS.alert(
|
||||
"Signup Success!",
|
||||
"Click the button to get a Chuck Norris quote!"
|
||||
)
|
||||
})
|
||||
.done();
|
||||
}
|
||||
},
|
||||
|
||||
_userLogin() {
|
||||
let concatStr = userName + ':' + userPassword;
|
||||
let hashStr = new Buffer(concatStr).toString('base64');
|
||||
//TODO: check null;
|
||||
//AlertIOS.alert(hashStr);
|
||||
// var value = this.refs.form.getValue();
|
||||
// if (value) { // if validation fails, value will be null
|
||||
//fetch(`${myApiUrl}${userCreatePath}`, {
|
||||
fetch(`${mc_api_url}${get_tokens}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Basic ' + hashStr
|
||||
}
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseData) => {
|
||||
AlertIOS.alert(
|
||||
"Login Success!",
|
||||
//responseData[0].id
|
||||
),
|
||||
this._onValueChange(STORAGE_KEY, responseData[0].id)
|
||||
})
|
||||
.done();
|
||||
// }
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.row}>
|
||||
<Text style={styles.title}>Mobile Center RN Experiment</Text>
|
||||
</View>
|
||||
<View style={styles.row}>
|
||||
<Form
|
||||
ref="form"
|
||||
type={Person}
|
||||
options={options}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.row}>
|
||||
<TouchableHighlight style={styles.button} onPress={this._userLogin} underlayColor='#99d9f4'>
|
||||
<Text style={styles.buttonText}>Login</Text>
|
||||
</TouchableHighlight>
|
||||
<TouchableHighlight style={styles.button} onPress={this._userLogout} underlayColor='#99d9f4'>
|
||||
<Text style={styles.buttonText}>Logout</Text>
|
||||
</TouchableHighlight>
|
||||
</View>
|
||||
<View style={styles.row}>
|
||||
<TouchableHighlight onPress={this._getUserApps} style={styles.button}>
|
||||
<Text style={styles.buttonText}>Get your apps!</Text>
|
||||
</TouchableHighlight>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var styles = StyleSheet.create({
|
||||
container: {
|
||||
justifyContent: 'center',
|
||||
marginTop: 50,
|
||||
padding: 20,
|
||||
backgroundColor: '#ffffff',
|
||||
},
|
||||
title: {
|
||||
fontSize: 30,
|
||||
alignSelf: 'center',
|
||||
marginBottom: 30
|
||||
},
|
||||
buttonText: {
|
||||
fontSize: 18,
|
||||
color: 'white',
|
||||
alignSelf: 'center'
|
||||
},
|
||||
button: {
|
||||
height: 36,
|
||||
backgroundColor: '#48BBEC',
|
||||
borderColor: '#48BBEC',
|
||||
borderWidth: 1,
|
||||
borderRadius: 8,
|
||||
marginBottom: 10,
|
||||
alignSelf: 'stretch',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = MobileCenter;
|
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { StyleSheet, Image, Text, TextInput, Linking, View} from 'react-native';
|
||||
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import { Actions } from 'react-native-router-flux';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import Button from '../components/button';
|
||||
|
||||
|
||||
|
||||
class About extends React.Component{
|
||||
render(){
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.content}>
|
||||
<View style={styles.center}>
|
||||
|
||||
<Text style={styles.title}>
|
||||
React Native Mobile Center
|
||||
</Text>
|
||||
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
},
|
||||
content: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
paddingBottom: 10
|
||||
},
|
||||
center: {
|
||||
flex: 1,
|
||||
alignItems: 'center'
|
||||
},
|
||||
logo: {
|
||||
width: 110,
|
||||
height: 110,
|
||||
marginTop: 50
|
||||
},
|
||||
version: {
|
||||
fontSize: 16,
|
||||
textAlign: 'center',
|
||||
color: '#aaaaaa',
|
||||
marginTop: 5
|
||||
},
|
||||
title: {
|
||||
fontSize: 28,
|
||||
textAlign: 'center',
|
||||
color: '#313131',
|
||||
marginTop: 10
|
||||
},
|
||||
subtitle: {
|
||||
fontSize: 18,
|
||||
textAlign: 'center',
|
||||
color: '#4e4e4e'
|
||||
},
|
||||
disclaimerContent: {
|
||||
flexDirection: 'column'
|
||||
},
|
||||
disclaimer: {
|
||||
fontSize: 14,
|
||||
textAlign: 'center'
|
||||
},
|
||||
bottomContainer: {
|
||||
alignItems: 'center'
|
||||
}
|
||||
});
|
||||
|
||||
export default About;
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { StyleSheet, Image, Text, TextInput, Linking, View} from 'react-native';
|
||||
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import { Actions } from 'react-native-router-flux';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import Button from '../components/button';
|
||||
|
||||
export default class Apps extends React.Component{
|
||||
render(){
|
||||
return (
|
||||
<View>
|
||||
<Text> Hello World </Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { StyleSheet, Image, Text, TextInput, Linking, View} from 'react-native';
|
||||
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import { Actions } from 'react-native-router-flux';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import Button from '../components/button';
|
||||
|
||||
export default class Notification extends React.Component{
|
||||
render(){
|
||||
return (
|
||||
<View>
|
||||
<Text> TODO: Push Notification </Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { StyleSheet, Image, Text, TextInput, Linking, View} from 'react-native';
|
||||
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import { Actions } from 'react-native-router-flux';
|
||||
import Icon from 'react-native-vector-icons/Ionicons';
|
||||
import Button from '../components/button';
|
||||
|
||||
export default class User extends React.Component{
|
||||
render(){
|
||||
return (
|
||||
<View>
|
||||
<Text> TODO: Render User Information.</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import * as types from '../constants/ActionTypes';
|
||||
import * as types from '../actions/types';
|
||||
|
||||
const initialState = {
|
||||
isRefreshing: false,
|
||||
|
@ -47,9 +47,20 @@ export default function app(state = initialState, action){
|
|||
isRefreshing: false,
|
||||
isLoadMore: false,
|
||||
noMore: action.appList.length == 0,
|
||||
appList: state
|
||||
loading: state.appList[action.tokenId] === undefined,
|
||||
appList: state.isLoadMore ? loadMore(state, action) : combine(state, action)
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
function combine(state, action){
|
||||
state.appList[action.tokenId] = action.appList;
|
||||
return state.appList;
|
||||
}
|
||||
|
||||
function loadMore(state, action){
|
||||
state.appList[action.tokenId] = state.appList[action.tokenId].concat(action.tokenId);
|
||||
return state.appList;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import {combineReducers} from 'redux';
|
||||
import app from './apps'
|
||||
import routes from './routes'
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
app,
|
||||
routes
|
||||
});
|
||||
|
||||
export default rootReducer;
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import {ActionConst} from 'react-native-router-flux';
|
||||
|
||||
const initialState = {
|
||||
scene: {},
|
||||
};
|
||||
|
||||
export default function reducer(state = initialState, action = {}){
|
||||
switch(action.type){
|
||||
case ActionConst.FOCUS:
|
||||
return Object.assign({}, state, {
|
||||
scene: action.scene
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import {put, take, call, fork} from 'redux-saga/effects';
|
||||
|
||||
import * as types from '../actions/types';
|
||||
import {fetchAppList, receiveAppList} from '../actions/apps';
|
||||
import {toastShort} from '../utils/ToastUtil';
|
||||
import {request} from '../utils/RequestUtil';
|
||||
|
||||
const get_apps = "/v0.1/apps";
|
||||
|
||||
export function* requestAppList(isRefreshing, loading, tokenId, isLoadMore, page){
|
||||
try{
|
||||
yield put(fetchAppList(isRefreshing, loading, isLoadMore));
|
||||
const appList = yield call(request, get_apps, 'get');
|
||||
//DEBUG here, log
|
||||
yield put(receiveAppList(appList,tokenId));
|
||||
}catch(error){
|
||||
yield put(receiveAppList([], tokenId));
|
||||
toastShort('Network Error, Please Retry!!!');
|
||||
}
|
||||
}
|
||||
|
||||
export function* watchRequestAppList(){
|
||||
while(true){
|
||||
const {
|
||||
isRefreshing,
|
||||
loading,
|
||||
tokenId,
|
||||
isLoadMore,
|
||||
page
|
||||
} = yield take(types.REQUEST_APP_LIST);
|
||||
yield fork(requestAppList, isRefreshing, loading, tokenId, isLoadMore, page);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import { fork } from 'redux-saga/effects';
|
||||
import { watchRequestAppList } from './apps';
|
||||
|
||||
export default function* rootSaga(){
|
||||
yield [
|
||||
fork(watchRequestAppList)
|
||||
];
|
||||
}
|
15
js/setup.js
15
js/setup.js
|
@ -25,15 +25,20 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Text } from 'react-native';
|
||||
import { Provider } from 'react-redux';
|
||||
import configureStore from './store/configureStore';
|
||||
import rootSaga from './sagas/index';
|
||||
import MobileCenter from './containers/mobilecenter';
|
||||
|
||||
// var MobileCenter = require('./MobileCenter');
|
||||
const store = configureStore();
|
||||
|
||||
// //var configureStore = require('')
|
||||
//run root saga
|
||||
store.runSaga(rootSaga);
|
||||
|
||||
const setup = () => (
|
||||
<Text>test</Text>
|
||||
<Provider store={store}>
|
||||
<MobileCenter/>
|
||||
</Provider>
|
||||
);
|
||||
|
||||
export default setup;
|
||||
export default setup;
|
|
@ -25,3 +25,27 @@
|
|||
*/
|
||||
|
||||
import {createStore, applyMiddleware} from 'redux';
|
||||
import createSagaMiddleware, {END} from 'redux-saga';
|
||||
|
||||
import rootReducer from '../reducers/index';
|
||||
|
||||
const middlewares = [];
|
||||
const createLogger = require('redux-logger');
|
||||
|
||||
//configure saga middleware
|
||||
const sagaMiddleware = createSagaMiddleware();
|
||||
middlewares.push(sagaMiddleware);
|
||||
|
||||
if(process.env.NODE_ENV === 'development'){
|
||||
const logger = createLogger();
|
||||
middlewares.push(logger);
|
||||
}
|
||||
const createStoreWithMiddleware = applyMiddleware(...middlewares)(createStore);
|
||||
|
||||
export default function configureStore(initialState) {
|
||||
const store = createStoreWithMiddleware(rootReducer, initialState);
|
||||
// install saga run
|
||||
store.runSaga = sagaMiddleware.run;
|
||||
store.close = () => store.dispatch(END);
|
||||
return store;
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
const HOST = "https://api.mobile.azure.com";
|
||||
|
||||
export const request = (url, method, body) => {
|
||||
let isOk;
|
||||
return new Promise((resolve, reject) => {
|
||||
fetch(HOST + url, {
|
||||
method,
|
||||
headers:{
|
||||
'Accept': 'application/json',
|
||||
'X-API-Token': '2eb6d0e2250779ad71acde8f383158b48aa0b4b6'
|
||||
},
|
||||
body
|
||||
})
|
||||
.then((response) => {
|
||||
if(response.ok){
|
||||
isOk = true;
|
||||
}else{
|
||||
isOk = false;
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((responseData) => {
|
||||
if(isOk){
|
||||
resolve(responseData);
|
||||
} else {
|
||||
reject(responseData);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* Microsoft Mobile Center App
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
* software and associated documentation files (the "Software"), to deal in the Software
|
||||
* without restriction, including without limitation the rights to use, copy, modify,
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or
|
||||
* substantial portions of the Software. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF
|
||||
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
import {
|
||||
Alert,
|
||||
ToastAndroid,
|
||||
Platform
|
||||
} from 'react-native';
|
||||
|
||||
export const toastShort = (content, isAlert) => {
|
||||
if (isAlert || Platform.OS === 'ios') {
|
||||
Alert.alert(
|
||||
'Alert',
|
||||
content.toString()
|
||||
);
|
||||
} else {
|
||||
ToastAndroid.show(content.toString(), ToastAndroid.SHORT);
|
||||
}
|
||||
};
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
"moment": "^2.17.1",
|
||||
"react": "~15.4.0-rc.4",
|
||||
"react-native": "0.40.0",
|
||||
"react-native-code-push": "^1.16.1-beta",
|
||||
"react-native-device-info": "^0.9.7",
|
||||
"react-native-code-push": "^1.17.0-beta",
|
||||
"react-native-device-info": "^0.9.9",
|
||||
"react-native-push-notification": "^2.2.1",
|
||||
"react-native-router-flux": "^3.37.0",
|
||||
"react-native-scrollable-tab-view": "^0.7.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче