Explorar el Código

create project

wusuopu hace 8 años
commit
e218095a06

+ 1
- 0
.gitignore Ver fichero

@@ -0,0 +1 @@
1
+xcuserdata

+ 11
- 0
index.js Ver fichero

@@ -0,0 +1,11 @@
1
+import { NativeModules } from 'react-native'
2
+
3
+export default {
4
+  disableIdleTimer() {
5
+    NativeModules.RNIdle.disableIdleTimer()
6
+  },
7
+
8
+  enableIdleTimer() {
9
+    NativeModules.RNIdle.enableIdleTimer()
10
+  }
11
+}

+ 269
- 0
ios/RNIdle.xcodeproj/project.pbxproj Ver fichero

@@ -0,0 +1,269 @@
1
+// !$*UTF8*$!
2
+{
3
+	archiveVersion = 1;
4
+	classes = {
5
+	};
6
+	objectVersion = 46;
7
+	objects = {
8
+
9
+/* Begin PBXBuildFile section */
10
+		6FB6F0DD1D8CE22100D9AE37 /* RNIdle.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6FB6F0DC1D8CE22100D9AE37 /* RNIdle.h */; };
11
+		6FB6F0DF1D8CE22100D9AE37 /* RNIdle.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FB6F0DE1D8CE22100D9AE37 /* RNIdle.m */; };
12
+/* End PBXBuildFile section */
13
+
14
+/* Begin PBXCopyFilesBuildPhase section */
15
+		6FB6F0D71D8CE22100D9AE37 /* CopyFiles */ = {
16
+			isa = PBXCopyFilesBuildPhase;
17
+			buildActionMask = 2147483647;
18
+			dstPath = "include/$(PRODUCT_NAME)";
19
+			dstSubfolderSpec = 16;
20
+			files = (
21
+				6FB6F0DD1D8CE22100D9AE37 /* RNIdle.h in CopyFiles */,
22
+			);
23
+			runOnlyForDeploymentPostprocessing = 0;
24
+		};
25
+/* End PBXCopyFilesBuildPhase section */
26
+
27
+/* Begin PBXFileReference section */
28
+		6FB6F0D91D8CE22100D9AE37 /* libRNIdle.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNIdle.a; sourceTree = BUILT_PRODUCTS_DIR; };
29
+		6FB6F0DC1D8CE22100D9AE37 /* RNIdle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNIdle.h; sourceTree = "<group>"; };
30
+		6FB6F0DE1D8CE22100D9AE37 /* RNIdle.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNIdle.m; sourceTree = "<group>"; };
31
+/* End PBXFileReference section */
32
+
33
+/* Begin PBXFrameworksBuildPhase section */
34
+		6FB6F0D61D8CE22100D9AE37 /* Frameworks */ = {
35
+			isa = PBXFrameworksBuildPhase;
36
+			buildActionMask = 2147483647;
37
+			files = (
38
+			);
39
+			runOnlyForDeploymentPostprocessing = 0;
40
+		};
41
+/* End PBXFrameworksBuildPhase section */
42
+
43
+/* Begin PBXGroup section */
44
+		6FB6F0D01D8CE22100D9AE37 = {
45
+			isa = PBXGroup;
46
+			children = (
47
+				6FB6F0DB1D8CE22100D9AE37 /* RNIdle */,
48
+				6FB6F0DA1D8CE22100D9AE37 /* Products */,
49
+			);
50
+			sourceTree = "<group>";
51
+		};
52
+		6FB6F0DA1D8CE22100D9AE37 /* Products */ = {
53
+			isa = PBXGroup;
54
+			children = (
55
+				6FB6F0D91D8CE22100D9AE37 /* libRNIdle.a */,
56
+			);
57
+			name = Products;
58
+			sourceTree = "<group>";
59
+		};
60
+		6FB6F0DB1D8CE22100D9AE37 /* RNIdle */ = {
61
+			isa = PBXGroup;
62
+			children = (
63
+				6FB6F0DC1D8CE22100D9AE37 /* RNIdle.h */,
64
+				6FB6F0DE1D8CE22100D9AE37 /* RNIdle.m */,
65
+			);
66
+			path = RNIdle;
67
+			sourceTree = "<group>";
68
+		};
69
+/* End PBXGroup section */
70
+
71
+/* Begin PBXNativeTarget section */
72
+		6FB6F0D81D8CE22100D9AE37 /* RNIdle */ = {
73
+			isa = PBXNativeTarget;
74
+			buildConfigurationList = 6FB6F0E21D8CE22100D9AE37 /* Build configuration list for PBXNativeTarget "RNIdle" */;
75
+			buildPhases = (
76
+				6FB6F0D51D8CE22100D9AE37 /* Sources */,
77
+				6FB6F0D61D8CE22100D9AE37 /* Frameworks */,
78
+				6FB6F0D71D8CE22100D9AE37 /* CopyFiles */,
79
+			);
80
+			buildRules = (
81
+			);
82
+			dependencies = (
83
+			);
84
+			name = RNIdle;
85
+			productName = RNIdle;
86
+			productReference = 6FB6F0D91D8CE22100D9AE37 /* libRNIdle.a */;
87
+			productType = "com.apple.product-type.library.static";
88
+		};
89
+/* End PBXNativeTarget section */
90
+
91
+/* Begin PBXProject section */
92
+		6FB6F0D11D8CE22100D9AE37 /* Project object */ = {
93
+			isa = PBXProject;
94
+			attributes = {
95
+				LastUpgradeCheck = 0730;
96
+				ORGANIZATIONNAME = lcj;
97
+				TargetAttributes = {
98
+					6FB6F0D81D8CE22100D9AE37 = {
99
+						CreatedOnToolsVersion = 7.3;
100
+					};
101
+				};
102
+			};
103
+			buildConfigurationList = 6FB6F0D41D8CE22100D9AE37 /* Build configuration list for PBXProject "RNIdle" */;
104
+			compatibilityVersion = "Xcode 3.2";
105
+			developmentRegion = English;
106
+			hasScannedForEncodings = 0;
107
+			knownRegions = (
108
+				en,
109
+			);
110
+			mainGroup = 6FB6F0D01D8CE22100D9AE37;
111
+			productRefGroup = 6FB6F0DA1D8CE22100D9AE37 /* Products */;
112
+			projectDirPath = "";
113
+			projectRoot = "";
114
+			targets = (
115
+				6FB6F0D81D8CE22100D9AE37 /* RNIdle */,
116
+			);
117
+		};
118
+/* End PBXProject section */
119
+
120
+/* Begin PBXSourcesBuildPhase section */
121
+		6FB6F0D51D8CE22100D9AE37 /* Sources */ = {
122
+			isa = PBXSourcesBuildPhase;
123
+			buildActionMask = 2147483647;
124
+			files = (
125
+				6FB6F0DF1D8CE22100D9AE37 /* RNIdle.m in Sources */,
126
+			);
127
+			runOnlyForDeploymentPostprocessing = 0;
128
+		};
129
+/* End PBXSourcesBuildPhase section */
130
+
131
+/* Begin XCBuildConfiguration section */
132
+		6FB6F0E01D8CE22100D9AE37 /* Debug */ = {
133
+			isa = XCBuildConfiguration;
134
+			buildSettings = {
135
+				ALWAYS_SEARCH_USER_PATHS = NO;
136
+				CLANG_ANALYZER_NONNULL = YES;
137
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
138
+				CLANG_CXX_LIBRARY = "libc++";
139
+				CLANG_ENABLE_MODULES = YES;
140
+				CLANG_ENABLE_OBJC_ARC = YES;
141
+				CLANG_WARN_BOOL_CONVERSION = YES;
142
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
143
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
144
+				CLANG_WARN_EMPTY_BODY = YES;
145
+				CLANG_WARN_ENUM_CONVERSION = YES;
146
+				CLANG_WARN_INT_CONVERSION = YES;
147
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
148
+				CLANG_WARN_UNREACHABLE_CODE = YES;
149
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
150
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
151
+				COPY_PHASE_STRIP = NO;
152
+				DEBUG_INFORMATION_FORMAT = dwarf;
153
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
154
+				ENABLE_TESTABILITY = YES;
155
+				GCC_C_LANGUAGE_STANDARD = gnu99;
156
+				GCC_DYNAMIC_NO_PIC = NO;
157
+				GCC_NO_COMMON_BLOCKS = YES;
158
+				GCC_OPTIMIZATION_LEVEL = 0;
159
+				GCC_PREPROCESSOR_DEFINITIONS = (
160
+					"DEBUG=1",
161
+					"$(inherited)",
162
+				);
163
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
164
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
165
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
166
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
167
+				GCC_WARN_UNUSED_FUNCTION = YES;
168
+				GCC_WARN_UNUSED_VARIABLE = YES;
169
+				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
170
+				MTL_ENABLE_DEBUG_INFO = YES;
171
+				ONLY_ACTIVE_ARCH = YES;
172
+				SDKROOT = iphoneos;
173
+			};
174
+			name = Debug;
175
+		};
176
+		6FB6F0E11D8CE22100D9AE37 /* Release */ = {
177
+			isa = XCBuildConfiguration;
178
+			buildSettings = {
179
+				ALWAYS_SEARCH_USER_PATHS = NO;
180
+				CLANG_ANALYZER_NONNULL = YES;
181
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
182
+				CLANG_CXX_LIBRARY = "libc++";
183
+				CLANG_ENABLE_MODULES = YES;
184
+				CLANG_ENABLE_OBJC_ARC = YES;
185
+				CLANG_WARN_BOOL_CONVERSION = YES;
186
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
187
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
188
+				CLANG_WARN_EMPTY_BODY = YES;
189
+				CLANG_WARN_ENUM_CONVERSION = YES;
190
+				CLANG_WARN_INT_CONVERSION = YES;
191
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
192
+				CLANG_WARN_UNREACHABLE_CODE = YES;
193
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
194
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
195
+				COPY_PHASE_STRIP = NO;
196
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
197
+				ENABLE_NS_ASSERTIONS = NO;
198
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
199
+				GCC_C_LANGUAGE_STANDARD = gnu99;
200
+				GCC_NO_COMMON_BLOCKS = YES;
201
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
202
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
203
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
204
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
205
+				GCC_WARN_UNUSED_FUNCTION = YES;
206
+				GCC_WARN_UNUSED_VARIABLE = YES;
207
+				IPHONEOS_DEPLOYMENT_TARGET = 9.3;
208
+				MTL_ENABLE_DEBUG_INFO = NO;
209
+				SDKROOT = iphoneos;
210
+				VALIDATE_PRODUCT = YES;
211
+			};
212
+			name = Release;
213
+		};
214
+		6FB6F0E31D8CE22100D9AE37 /* Debug */ = {
215
+			isa = XCBuildConfiguration;
216
+			buildSettings = {
217
+				HEADER_SEARCH_PATHS = (
218
+					"$(SRCROOT)/../../../node_modules/react-native/React",
219
+					"$(SRCROOT)/../react-native/React",
220
+					"$(SRCROOT)/node_modules/react-native/React",
221
+					"$(inherited)",
222
+					"$(SRCROOT)/../../React/**",
223
+				);
224
+				OTHER_LDFLAGS = "-ObjC";
225
+				PRODUCT_NAME = "$(TARGET_NAME)";
226
+				SKIP_INSTALL = YES;
227
+			};
228
+			name = Debug;
229
+		};
230
+		6FB6F0E41D8CE22100D9AE37 /* Release */ = {
231
+			isa = XCBuildConfiguration;
232
+			buildSettings = {
233
+				HEADER_SEARCH_PATHS = (
234
+					"$(SRCROOT)/../../../node_modules/react-native/React",
235
+					"$(SRCROOT)/../react-native/React",
236
+					"$(SRCROOT)/node_modules/react-native/React",
237
+					"$(inherited)",
238
+					"$(SRCROOT)/../../React/**",
239
+				);
240
+				OTHER_LDFLAGS = "-ObjC";
241
+				PRODUCT_NAME = "$(TARGET_NAME)";
242
+				SKIP_INSTALL = YES;
243
+			};
244
+			name = Release;
245
+		};
246
+/* End XCBuildConfiguration section */
247
+
248
+/* Begin XCConfigurationList section */
249
+		6FB6F0D41D8CE22100D9AE37 /* Build configuration list for PBXProject "RNIdle" */ = {
250
+			isa = XCConfigurationList;
251
+			buildConfigurations = (
252
+				6FB6F0E01D8CE22100D9AE37 /* Debug */,
253
+				6FB6F0E11D8CE22100D9AE37 /* Release */,
254
+			);
255
+			defaultConfigurationIsVisible = 0;
256
+			defaultConfigurationName = Release;
257
+		};
258
+		6FB6F0E21D8CE22100D9AE37 /* Build configuration list for PBXNativeTarget "RNIdle" */ = {
259
+			isa = XCConfigurationList;
260
+			buildConfigurations = (
261
+				6FB6F0E31D8CE22100D9AE37 /* Debug */,
262
+				6FB6F0E41D8CE22100D9AE37 /* Release */,
263
+			);
264
+			defaultConfigurationIsVisible = 0;
265
+		};
266
+/* End XCConfigurationList section */
267
+	};
268
+	rootObject = 6FB6F0D11D8CE22100D9AE37 /* Project object */;
269
+}

+ 7
- 0
ios/RNIdle.xcodeproj/project.xcworkspace/contents.xcworkspacedata Ver fichero

@@ -0,0 +1,7 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Workspace
3
+   version = "1.0">
4
+   <FileRef
5
+      location = "self:RNIdle.xcodeproj">
6
+   </FileRef>
7
+</Workspace>

+ 15
- 0
ios/RNIdle/RNIdle.h Ver fichero

@@ -0,0 +1,15 @@
1
+//
2
+//  RNIdle.h
3
+//  RNIdle
4
+//
5
+//  Created by lcj on 9/17/16.
6
+//  Copyright © 2016 lcj. All rights reserved.
7
+//
8
+
9
+#import <UIKit/UIKit.h>
10
+#import "RCTBridgeModule.h"
11
+
12
+
13
+@interface RNIdle : NSObject <RCTBridgeModule>
14
+
15
+@end

+ 26
- 0
ios/RNIdle/RNIdle.m Ver fichero

@@ -0,0 +1,26 @@
1
+//
2
+//  RNIdle.m
3
+//  RNIdle
4
+//
5
+//  Created by lcj on 9/17/16.
6
+//  Copyright © 2016 lcj. All rights reserved.
7
+//
8
+
9
+#import "RNIdle.h"
10
+
11
+@implementation RNIdle
12
+
13
+RCT_EXPORT_METHOD(disableIdleTimer)
14
+{
15
+    //  DON'T let the device go to sleep during our sync
16
+    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
17
+    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
18
+}
19
+
20
+RCT_EXPORT_METHOD(enableIdleTimer)
21
+{
22
+    //  DON'T let the device go to sleep during our sync
23
+    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
24
+}
25
+
26
+@end

+ 18
- 0
package.json Ver fichero

@@ -0,0 +1,18 @@
1
+{
2
+  "name": "react-native-idle",
3
+  "version": "1.0.0",
4
+  "description": "",
5
+  "main": "index.js",
6
+  "scripts": {
7
+  },
8
+  "author": "",
9
+  "license": "ISC",
10
+  "rnpm": {
11
+    "android": {
12
+      "packageInstance": "new RNIdlePackage()"
13
+    },
14
+    "ios": {
15
+      "project": "ios/RNIdle.xcodeproj"
16
+    }
17
+  }
18
+}