react-native-timezone 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +8 -4
  3. package/android/build.gradle +123 -21
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +1 -3
  6. package/android/src/main/java/com/{rntimezone/RNReactNativeTimezoneModule.java → samitha/rn/timezone/TimezoneModule.java} +15 -10
  7. package/android/src/main/java/com/samitha/rn/timezone/TimezonePackage.java +28 -0
  8. package/ios/Timezone.h +12 -0
  9. package/ios/Timezone.mm +25 -0
  10. package/ios/{RNReactNativeTimezone.xcodeproj → Timezone.xcodeproj}/project.pbxproj +33 -19
  11. package/ios/Timezone.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  12. package/ios/Timezone.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  13. package/ios/Timezone.xcodeproj/project.xcworkspace/xcuserdata/samitha.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  14. package/ios/Timezone.xcodeproj/xcuserdata/samitha.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  15. package/lib/commonjs/index.js +19 -0
  16. package/lib/commonjs/index.js.map +1 -0
  17. package/lib/module/index.js +12 -0
  18. package/lib/module/index.js.map +1 -0
  19. package/lib/typescript/index.test.d.ts +1 -0
  20. package/lib/typescript/index.test.d.ts.map +1 -0
  21. package/package.json +147 -17
  22. package/react-native-timezone.podspec +29 -13
  23. package/src/index.js +20 -0
  24. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  25. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  26. package/android/gradlew +0 -172
  27. package/android/gradlew.bat +0 -84
  28. package/android/src/main/java/com/rntimezone/RNReactNativeTimezonePackage.java +0 -28
  29. package/index.js +0 -6
  30. package/ios/RNReactNativeTimezone.h +0 -11
  31. package/ios/RNReactNativeTimezone.m +0 -25
  32. package/ios/RNReactNativeTimezone.podspec +0 -24
  33. package/ios/RNReactNativeTimezone.xcworkspace/contents.xcworkspacedata +0 -9
  34. package/react-native-timezone-2.0.0.tgz +0 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Samitha Nanayakkara
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md CHANGED
@@ -5,13 +5,17 @@ A Simple react native module to get Timezone of the Android/iOS device.
5
5
  For a project of mine, I had to acquire the current selected timezone of the user. But unfortunately I could not find any react native package or react native in-build function which facilitates this. Thus I created a small library.
6
6
 
7
7
  # Compatibility
8
+ Timezone version 2.0.0 only support React Native version 0.62.3 and above due to React Native Regular Expression Denial of Service (ReDoS) vulnerability.
9
+
8
10
  | React native version | Tested | Result |
9
11
  |----------------------|--------|--------|
10
- | 0.63.0 + | ✅ | ✅ |
12
+ | 0.62.3 + | ✅ | ✅ |
13
+ | 0.62.5 + | ✅ | ✅ |
14
+ | 0.70.5 + | ✅ | ✅ |
11
15
 
12
16
  # Installation
13
17
 
14
- `npm i --save react-native-timezone`
18
+ `npm i react-native-timezone`
15
19
 
16
20
  ## iOS
17
21
 
@@ -26,8 +30,8 @@ getTimeZone = async() => {
26
30
  console.log({ timeZone });
27
31
  }
28
32
  ```
29
-
33
+ Check out the [example]("https://github.com/samitha9125/react-native-timezone/tree/master/example") folder.
30
34
  # API
31
35
  | API | Description |
32
36
  |-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
33
- | getTimeZone | Android : Returns timezone ID using java.util.TimeZone.getID()<br>iOS : This always reflects the current system time zone using localTimeZone of NSTimeZone |
37
+ | getTimeZone | Android : Returns timezone ID using java.util.TimeZone.getID()<br>iOS : This always reflects the current system time zone using localTimeZone of NSTimeZone |
@@ -1,36 +1,138 @@
1
-
2
1
  buildscript {
3
- repositories {
4
- jcenter()
5
- }
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
6
 
7
- dependencies {
8
- classpath 'com.android.tools.build:gradle:1.3.1'
9
- }
7
+ dependencies {
8
+ classpath 'com.android.tools.build:gradle:3.5.3'
9
+ }
10
+ }
11
+
12
+ def isNewArchitectureEnabled() {
13
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
10
14
  }
11
15
 
12
16
  apply plugin: 'com.android.library'
13
17
 
18
+ if (isNewArchitectureEnabled()) {
19
+ apply plugin: 'com.facebook.react'
20
+ }
21
+
22
+ def getExtOrDefault(name) {
23
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Timezone_' + name]
24
+ }
25
+
26
+ def getExtOrIntegerDefault(name) {
27
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Timezone_' + name]).toInteger()
28
+ }
29
+
14
30
  android {
15
- compileSdkVersion 23
16
- buildToolsVersion "23.0.1"
17
-
18
- defaultConfig {
19
- minSdkVersion 16
20
- targetSdkVersion 22
21
- versionCode 1
22
- versionName "1.0"
23
- }
24
- lintOptions {
25
- abortOnError false
31
+ compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
32
+
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault('minSdkVersion')
35
+ targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
36
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
37
+ }
38
+ buildTypes {
39
+ release {
40
+ minifyEnabled false
26
41
  }
42
+ }
43
+
44
+ lintOptions {
45
+ disable 'GradleCompatible'
46
+ }
47
+
48
+ compileOptions {
49
+ sourceCompatibility JavaVersion.VERSION_1_8
50
+ targetCompatibility JavaVersion.VERSION_1_8
51
+ }
52
+
27
53
  }
28
54
 
29
55
  repositories {
30
- mavenCentral()
56
+ mavenCentral()
57
+ google()
58
+
59
+ def found = false
60
+ def defaultDir = null
61
+ def androidSourcesName = 'React Native sources'
62
+
63
+ if (rootProject.ext.has('reactNativeAndroidRoot')) {
64
+ defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
65
+ } else {
66
+ defaultDir = new File(
67
+ projectDir,
68
+ '/../../../node_modules/react-native/android'
69
+ )
70
+ }
71
+
72
+ if (defaultDir.exists()) {
73
+ maven {
74
+ url defaultDir.toString()
75
+ name androidSourcesName
76
+ }
77
+
78
+ logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
79
+ found = true
80
+ } else {
81
+ def parentDir = rootProject.projectDir
82
+
83
+ 1.upto(5, {
84
+ if (found) return true
85
+ parentDir = parentDir.parentFile
86
+
87
+ def androidSourcesDir = new File(
88
+ parentDir,
89
+ 'node_modules/react-native'
90
+ )
91
+
92
+ def androidPrebuiltBinaryDir = new File(
93
+ parentDir,
94
+ 'node_modules/react-native/android'
95
+ )
96
+
97
+ if (androidPrebuiltBinaryDir.exists()) {
98
+ maven {
99
+ url androidPrebuiltBinaryDir.toString()
100
+ name androidSourcesName
101
+ }
102
+
103
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
104
+ found = true
105
+ } else if (androidSourcesDir.exists()) {
106
+ maven {
107
+ url androidSourcesDir.toString()
108
+ name androidSourcesName
109
+ }
110
+
111
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
112
+ found = true
113
+ }
114
+ })
115
+ }
116
+
117
+ if (!found) {
118
+ throw new GradleException(
119
+ "${project.name}: unable to locate React Native android sources. " +
120
+ "Ensure you have you installed React Native as a dependency in your project and try again."
121
+ )
122
+ }
31
123
  }
32
124
 
125
+
33
126
  dependencies {
34
- compile 'com.facebook.react:react-native:+'
127
+ //noinspection GradleDynamicVersion
128
+ implementation "com.facebook.react:react-native:+"
129
+ // From node_modules
130
+ }
131
+
132
+ if (isNewArchitectureEnabled()) {
133
+ react {
134
+ jsRootDir = file("../src/")
135
+ libraryName = "Timezone"
136
+ codegenJavaPackageName = "com.samitha.rn.timezone"
137
+ }
35
138
  }
36
-
@@ -0,0 +1,5 @@
1
+ Timezone_kotlinVersion=1.7.0
2
+ Timezone_minSdkVersion=21
3
+ Timezone_targetSdkVersion=31
4
+ Timezone_compileSdkVersion=31
5
+ Timezone_ndkversion=21.4.7075529
@@ -1,6 +1,4 @@
1
-
2
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.rntimezone">
2
+ package="com.samitha.rn.timezone">
4
3
 
5
4
  </manifest>
6
-
@@ -1,28 +1,33 @@
1
+ package com.samitha.rn.timezone;
1
2
 
2
- package com.rntimezone;
3
+ import androidx.annotation.NonNull;
3
4
 
5
+ import com.facebook.react.bridge.Promise;
4
6
  import com.facebook.react.bridge.ReactApplicationContext;
5
7
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
6
8
  import com.facebook.react.bridge.ReactMethod;
7
- import com.facebook.react.bridge.Callback;
8
- import com.facebook.react.bridge.Promise;
9
+ import com.facebook.react.module.annotations.ReactModule;
10
+
9
11
  import java.util.TimeZone;
10
12
  import java.util.Calendar;
11
13
 
12
- public class RNReactNativeTimezoneModule extends ReactContextBaseJavaModule {
14
+ @ReactModule(name = TimezoneModule.NAME)
15
+ public class TimezoneModule extends ReactContextBaseJavaModule {
16
+ public static final String NAME = "Timezone";
13
17
 
14
- private final ReactApplicationContext reactContext;
15
-
16
- public RNReactNativeTimezoneModule(ReactApplicationContext reactContext) {
18
+ public TimezoneModule(ReactApplicationContext reactContext) {
17
19
  super(reactContext);
18
- this.reactContext = reactContext;
19
20
  }
20
21
 
21
22
  @Override
23
+ @NonNull
22
24
  public String getName() {
23
- return "RNReactNativeTimezone";
25
+ return NAME;
24
26
  }
25
27
 
28
+
29
+ // Example method
30
+ // See https://reactnative.dev/docs/native-modules-android
26
31
  @ReactMethod
27
32
  public void getTimeZone(Promise promise) {
28
33
  try {
@@ -33,4 +38,4 @@ public class RNReactNativeTimezoneModule extends ReactContextBaseJavaModule {
33
38
  promise.reject(e);
34
39
  }
35
40
  }
36
- }
41
+ }
@@ -0,0 +1,28 @@
1
+ package com.samitha.rn.timezone;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class TimezonePackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ modules.add(new TimezoneModule(reactContext));
20
+ return modules;
21
+ }
22
+
23
+ @NonNull
24
+ @Override
25
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
package/ios/Timezone.h ADDED
@@ -0,0 +1,12 @@
1
+
2
+ #ifdef RCT_NEW_ARCH_ENABLED
3
+ #import "RNTimezoneSpec.h"
4
+
5
+ @interface Timezone : NSObject <NativeTimezoneSpec>
6
+ #else
7
+ #import <React/RCTBridgeModule.h>
8
+
9
+ @interface Timezone : NSObject <RCTBridgeModule>
10
+ #endif
11
+
12
+ @end
@@ -0,0 +1,25 @@
1
+ #import "Timezone.h"
2
+
3
+ @implementation Timezone
4
+ RCT_EXPORT_MODULE()
5
+
6
+ // Example method
7
+ // See // https://reactnative.dev/docs/native-modules-ios
8
+ RCT_REMAP_METHOD(getTimeZone,
9
+ withResolver:(RCTPromiseResolveBlock)resolve
10
+ withRejecter:(RCTPromiseRejectBlock)reject)
11
+ {
12
+ NSTimeZone *timeZone = [NSTimeZone localTimeZone];
13
+ resolve(timeZone.name);
14
+ }
15
+
16
+ // Don't compile this code when we build for the old architecture.
17
+ #ifdef RCT_NEW_ARCH_ENABLED
18
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
19
+ (const facebook::react::ObjCTurboModule::InitParams &)params
20
+ {
21
+ return std::make_shared<facebook::react::NativeTimezoneSpecJSI>(params);
22
+ }
23
+ #endif
24
+
25
+ @end
@@ -7,7 +7,7 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- B3E7B58A1CC2AC0600A0062D /* RNReactNativeTimezone.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNReactNativeTimezone.m */; };
10
+ 5E555C0D2413F4C50049A1A2 /* Timezone.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* Timezone.m */; };
11
11
  /* End PBXBuildFile section */
12
12
 
13
13
  /* Begin PBXCopyFilesBuildPhase section */
@@ -23,9 +23,9 @@
23
23
  /* End PBXCopyFilesBuildPhase section */
24
24
 
25
25
  /* Begin PBXFileReference section */
26
- 134814201AA4EA6300B7C361 /* libRNReactNativeTimezone.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNReactNativeTimezone.a; sourceTree = BUILT_PRODUCTS_DIR; };
27
- B3E7B5881CC2AC0600A0062D /* RNReactNativeTimezone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNReactNativeTimezone.h; sourceTree = "<group>"; };
28
- B3E7B5891CC2AC0600A0062D /* RNReactNativeTimezone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNReactNativeTimezone.m; sourceTree = "<group>"; };
26
+ 134814201AA4EA6300B7C361 /* libTimezone.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTimezone.a; sourceTree = BUILT_PRODUCTS_DIR; };
27
+ B3E7B5881CC2AC0600A0062D /* Timezone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timezone.h; sourceTree = "<group>"; };
28
+ B3E7B5891CC2AC0600A0062D /* Timezone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Timezone.m; sourceTree = "<group>"; };
29
29
  /* End PBXFileReference section */
30
30
 
31
31
  /* Begin PBXFrameworksBuildPhase section */
@@ -42,7 +42,7 @@
42
42
  134814211AA4EA7D00B7C361 /* Products */ = {
43
43
  isa = PBXGroup;
44
44
  children = (
45
- 134814201AA4EA6300B7C361 /* libRNReactNativeTimezone.a */,
45
+ 134814201AA4EA6300B7C361 /* libTimezone.a */,
46
46
  );
47
47
  name = Products;
48
48
  sourceTree = "<group>";
@@ -50,8 +50,8 @@
50
50
  58B511D21A9E6C8500147676 = {
51
51
  isa = PBXGroup;
52
52
  children = (
53
- B3E7B5881CC2AC0600A0062D /* RNReactNativeTimezone.h */,
54
- B3E7B5891CC2AC0600A0062D /* RNReactNativeTimezone.m */,
53
+ B3E7B5881CC2AC0600A0062D /* Timezone.h */,
54
+ B3E7B5891CC2AC0600A0062D /* Timezone.m */,
55
55
  134814211AA4EA7D00B7C361 /* Products */,
56
56
  );
57
57
  sourceTree = "<group>";
@@ -59,9 +59,9 @@
59
59
  /* End PBXGroup section */
60
60
 
61
61
  /* Begin PBXNativeTarget section */
62
- 58B511DA1A9E6C8500147676 /* RNReactNativeTimezone */ = {
62
+ 58B511DA1A9E6C8500147676 /* Timezone */ = {
63
63
  isa = PBXNativeTarget;
64
- buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNReactNativeTimezone" */;
64
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Timezone" */;
65
65
  buildPhases = (
66
66
  58B511D71A9E6C8500147676 /* Sources */,
67
67
  58B511D81A9E6C8500147676 /* Frameworks */,
@@ -71,9 +71,9 @@
71
71
  );
72
72
  dependencies = (
73
73
  );
74
- name = RNReactNativeTimezone;
74
+ name = Timezone;
75
75
  productName = RCTDataManager;
76
- productReference = 134814201AA4EA6300B7C361 /* libRNReactNativeTimezone.a */;
76
+ productReference = 134814201AA4EA6300B7C361 /* libTimezone.a */;
77
77
  productType = "com.apple.product-type.library.static";
78
78
  };
79
79
  /* End PBXNativeTarget section */
@@ -82,7 +82,7 @@
82
82
  58B511D31A9E6C8500147676 /* Project object */ = {
83
83
  isa = PBXProject;
84
84
  attributes = {
85
- LastUpgradeCheck = 0830;
85
+ LastUpgradeCheck = 0920;
86
86
  ORGANIZATIONNAME = Facebook;
87
87
  TargetAttributes = {
88
88
  58B511DA1A9E6C8500147676 = {
@@ -90,7 +90,7 @@
90
90
  };
91
91
  };
92
92
  };
93
- buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNReactNativeTimezone" */;
93
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Timezone" */;
94
94
  compatibilityVersion = "Xcode 3.2";
95
95
  developmentRegion = English;
96
96
  hasScannedForEncodings = 0;
@@ -103,7 +103,7 @@
103
103
  projectDirPath = "";
104
104
  projectRoot = "";
105
105
  targets = (
106
- 58B511DA1A9E6C8500147676 /* RNReactNativeTimezone */,
106
+ 58B511DA1A9E6C8500147676 /* Timezone */,
107
107
  );
108
108
  };
109
109
  /* End PBXProject section */
@@ -113,7 +113,7 @@
113
113
  isa = PBXSourcesBuildPhase;
114
114
  buildActionMask = 2147483647;
115
115
  files = (
116
- B3E7B58A1CC2AC0600A0062D /* RNReactNativeTimezone.m in Sources */,
116
+ B3E7B58A1CC2AC0600A0062D /* Timezone.m in Sources */,
117
117
  );
118
118
  runOnlyForDeploymentPostprocessing = 0;
119
119
  };
@@ -128,20 +128,27 @@
128
128
  CLANG_CXX_LIBRARY = "libc++";
129
129
  CLANG_ENABLE_MODULES = YES;
130
130
  CLANG_ENABLE_OBJC_ARC = YES;
131
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
131
132
  CLANG_WARN_BOOL_CONVERSION = YES;
133
+ CLANG_WARN_COMMA = YES;
132
134
  CLANG_WARN_CONSTANT_CONVERSION = YES;
133
135
  CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
134
136
  CLANG_WARN_EMPTY_BODY = YES;
135
137
  CLANG_WARN_ENUM_CONVERSION = YES;
136
138
  CLANG_WARN_INFINITE_RECURSION = YES;
137
139
  CLANG_WARN_INT_CONVERSION = YES;
140
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
141
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
138
142
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
143
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
144
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
139
145
  CLANG_WARN_SUSPICIOUS_MOVE = YES;
140
146
  CLANG_WARN_UNREACHABLE_CODE = YES;
141
147
  CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
142
148
  COPY_PHASE_STRIP = NO;
143
149
  ENABLE_STRICT_OBJC_MSGSEND = YES;
144
150
  ENABLE_TESTABILITY = YES;
151
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
145
152
  GCC_C_LANGUAGE_STANDARD = gnu99;
146
153
  GCC_DYNAMIC_NO_PIC = NO;
147
154
  GCC_NO_COMMON_BLOCKS = YES;
@@ -172,20 +179,27 @@
172
179
  CLANG_CXX_LIBRARY = "libc++";
173
180
  CLANG_ENABLE_MODULES = YES;
174
181
  CLANG_ENABLE_OBJC_ARC = YES;
182
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
175
183
  CLANG_WARN_BOOL_CONVERSION = YES;
184
+ CLANG_WARN_COMMA = YES;
176
185
  CLANG_WARN_CONSTANT_CONVERSION = YES;
177
186
  CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
178
187
  CLANG_WARN_EMPTY_BODY = YES;
179
188
  CLANG_WARN_ENUM_CONVERSION = YES;
180
189
  CLANG_WARN_INFINITE_RECURSION = YES;
181
190
  CLANG_WARN_INT_CONVERSION = YES;
191
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
192
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
182
193
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
194
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
195
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
183
196
  CLANG_WARN_SUSPICIOUS_MOVE = YES;
184
197
  CLANG_WARN_UNREACHABLE_CODE = YES;
185
198
  CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
186
199
  COPY_PHASE_STRIP = YES;
187
200
  ENABLE_NS_ASSERTIONS = NO;
188
201
  ENABLE_STRICT_OBJC_MSGSEND = YES;
202
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
189
203
  GCC_C_LANGUAGE_STANDARD = gnu99;
190
204
  GCC_NO_COMMON_BLOCKS = YES;
191
205
  GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -212,7 +226,7 @@
212
226
  );
213
227
  LIBRARY_SEARCH_PATHS = "$(inherited)";
214
228
  OTHER_LDFLAGS = "-ObjC";
215
- PRODUCT_NAME = RNReactNativeTimezone;
229
+ PRODUCT_NAME = Timezone;
216
230
  SKIP_INSTALL = YES;
217
231
  };
218
232
  name = Debug;
@@ -228,7 +242,7 @@
228
242
  );
229
243
  LIBRARY_SEARCH_PATHS = "$(inherited)";
230
244
  OTHER_LDFLAGS = "-ObjC";
231
- PRODUCT_NAME = RNReactNativeTimezone;
245
+ PRODUCT_NAME = Timezone;
232
246
  SKIP_INSTALL = YES;
233
247
  };
234
248
  name = Release;
@@ -236,7 +250,7 @@
236
250
  /* End XCBuildConfiguration section */
237
251
 
238
252
  /* Begin XCConfigurationList section */
239
- 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNReactNativeTimezone" */ = {
253
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Timezone" */ = {
240
254
  isa = XCConfigurationList;
241
255
  buildConfigurations = (
242
256
  58B511ED1A9E6C8500147676 /* Debug */,
@@ -245,7 +259,7 @@
245
259
  defaultConfigurationIsVisible = 0;
246
260
  defaultConfigurationName = Release;
247
261
  };
248
- 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNReactNativeTimezone" */ = {
262
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "Timezone" */ = {
249
263
  isa = XCConfigurationList;
250
264
  buildConfigurations = (
251
265
  58B511F01A9E6C8500147676 /* Debug */,
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>Timezone.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ const LINKING_ERROR = `The package 'react-native-timezone' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
9
+ ios: "- You have run 'pod install'\n",
10
+ default: ''
11
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
12
+ const Timezone = _reactNative.NativeModules.Timezone ? _reactNative.NativeModules.Timezone : new Proxy({}, {
13
+ get() {
14
+ throw new Error(LINKING_ERROR);
15
+ }
16
+ });
17
+ var _default = Timezone;
18
+ exports.default = _default;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Timezone","NativeModules","Proxy","get","Error"],"sourceRoot":"../../src","sources":["index.js"],"mappings":";;;;;;AAAA;AAEA,MAAMA,aAAa,GAChB,gFAA+E,GAChFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,QAAQ,GAAGC,0BAAa,CAACD,QAAQ,GACnCC,0BAAa,CAACD,QAAQ,GACtB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAAC,eAESK,QAAQ;AAAA"}
@@ -0,0 +1,12 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'react-native-timezone' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
+ const Timezone = NativeModules.Timezone ? NativeModules.Timezone : new Proxy({}, {
7
+ get() {
8
+ throw new Error(LINKING_ERROR);
9
+ }
10
+ });
11
+ export default Timezone;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Timezone","Proxy","get","Error"],"sourceRoot":"../../src","sources":["index.js"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,gFAA+E,GAChFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,QAAQ,GAAGN,aAAa,CAACM,QAAQ,GACnCN,aAAa,CAACM,QAAQ,GACtB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,eAAeI,QAAQ"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.tsx"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,30 +1,160 @@
1
1
  {
2
2
  "name": "react-native-timezone",
3
- "version": "2.0.0",
4
- "description": "React Native library to extract mobile timezone",
5
- "main": "index.js",
3
+ "version": "2.1.1",
4
+ "description": "A Simple react native module to get Timezone of the Android/iOS device.",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!lib/typescript/example",
18
+ "!ios/build",
19
+ "!android/build",
20
+ "!android/gradle",
21
+ "!android/gradlew",
22
+ "!android/gradlew.bat",
23
+ "!android/local.properties",
24
+ "!**/__tests__",
25
+ "!**/__fixtures__",
26
+ "!**/__mocks__",
27
+ "!**/.*"
28
+ ],
29
+ "scripts": {
30
+ "test": "jest",
31
+ "typescript": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
+ "prepare": "bob build",
34
+ "release": "release-it",
35
+ "example": "yarn --cwd example",
36
+ "bootstrap": "yarn example && yarn install && yarn example pods",
37
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
38
+ },
39
+ "keywords": [
40
+ "react-native",
41
+ "ios",
42
+ "android"
43
+ ],
44
+ "repository": "https://github.com/samitha9125/react-native-timezone",
45
+ "author": "Samitha Nanayakkara <samithananayakkara@gmail.com> (https://www.samithananayakkara.com)",
6
46
  "license": "MIT",
7
47
  "bugs": {
8
48
  "url": "https://github.com/samitha9125/react-native-timezone/issues"
9
49
  },
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/samitha9125/react-native-timezone"
13
- },
14
50
  "homepage": "https://github.com/samitha9125/react-native-timezone#readme",
15
- "scripts": {
16
- "test": "echo \"Error: no test specified\" && exit 1"
51
+ "publishConfig": {
52
+ "registry": "https://registry.npmjs.org/"
17
53
  },
18
- "keywords": [
19
- "react-native"
20
- ],
21
- "author": "Samitha9125",
22
54
  "devDependencies": {
23
- "react": "16.11.0",
24
- "react-native": "0.62.3"
55
+ "@arkweid/lefthook": "^0.7.7",
56
+ "@commitlint/config-conventional": "^17.0.2",
57
+ "@react-native-community/eslint-config": "^3.0.2",
58
+ "@release-it/conventional-changelog": "^5.0.0",
59
+ "@types/jest": "^28.1.2",
60
+ "@types/react": "~17.0.21",
61
+ "@types/react-native": "0.70.0",
62
+ "commitlint": "^17.0.2",
63
+ "del-cli": "^5.0.0",
64
+ "eslint": "^8.4.1",
65
+ "eslint-config-prettier": "^8.5.0",
66
+ "eslint-plugin-prettier": "^4.0.0",
67
+ "jest": "^28.1.1",
68
+ "pod-install": "^0.1.0",
69
+ "prettier": "^2.0.5",
70
+ "react": "18.1.0",
71
+ "react-native": "0.70.6",
72
+ "react-native-builder-bob": "^0.20.0",
73
+ "release-it": "^15.0.0",
74
+ "typescript": "^4.5.2"
75
+ },
76
+ "resolutions": {
77
+ "@types/react": "17.0.21"
25
78
  },
26
79
  "peerDependencies": {
27
- "react": ">=16.11.0",
28
- "react-native": ">=0.62.3"
80
+ "react": "*",
81
+ "react-native": "*"
82
+ },
83
+ "engines": {
84
+ "node": ">= 16.0.0"
85
+ },
86
+ "packageManager": "^yarn@1.22.15",
87
+ "jest": {
88
+ "preset": "react-native",
89
+ "modulePathIgnorePatterns": [
90
+ "<rootDir>/example/node_modules",
91
+ "<rootDir>/lib/"
92
+ ]
93
+ },
94
+ "commitlint": {
95
+ "extends": [
96
+ "@commitlint/config-conventional"
97
+ ]
98
+ },
99
+ "release-it": {
100
+ "git": {
101
+ "commitMessage": "chore: release ${version}",
102
+ "tagName": "v${version}"
103
+ },
104
+ "npm": {
105
+ "publish": true
106
+ },
107
+ "github": {
108
+ "release": true
109
+ },
110
+ "plugins": {
111
+ "@release-it/conventional-changelog": {
112
+ "preset": "angular"
113
+ }
114
+ }
115
+ },
116
+ "eslintConfig": {
117
+ "root": true,
118
+ "extends": [
119
+ "@react-native-community",
120
+ "prettier"
121
+ ],
122
+ "rules": {
123
+ "prettier/prettier": [
124
+ "error",
125
+ {
126
+ "quoteProps": "consistent",
127
+ "singleQuote": true,
128
+ "tabWidth": 2,
129
+ "trailingComma": "es5",
130
+ "useTabs": false
131
+ }
132
+ ]
133
+ }
134
+ },
135
+ "eslintIgnore": [
136
+ "node_modules/",
137
+ "lib/"
138
+ ],
139
+ "prettier": {
140
+ "quoteProps": "consistent",
141
+ "singleQuote": true,
142
+ "tabWidth": 2,
143
+ "trailingComma": "es5",
144
+ "useTabs": false
145
+ },
146
+ "react-native-builder-bob": {
147
+ "source": "src",
148
+ "output": "lib",
149
+ "targets": [
150
+ "commonjs",
151
+ "module",
152
+ [
153
+ "typescript",
154
+ {
155
+ "project": "tsconfig.build.json"
156
+ }
157
+ ]
158
+ ]
29
159
  }
30
160
  }
@@ -1,19 +1,35 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
- package = JSON.parse(File.read(File.join(__dir__, './package.json')))
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
4
5
 
5
6
  Pod::Spec.new do |s|
6
- s.name = package['name']
7
- s.version = package['version']
8
- s.summary = package['description']
9
- s.license = package['license']
7
+ s.name = "react-native-timezone"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
10
13
 
11
- s.authors = package['author']
12
- s.homepage = package['homepage']
13
- s.platform = :ios, "9.0"
14
+ s.platforms = { :ios => "11.0" }
15
+ s.source = { :git => "https://github.com/samitha9125/react-native-timezone.git", :tag => "#{s.version}" }
14
16
 
15
- s.source = { :git => "https://github.com/samitha9125/react-native-timezone.git", :tag => "master" }
16
- s.source_files = "ios/*.{h,m}"
17
+ s.source_files = "ios/**/*.{h,m,mm}"
17
18
 
18
- s.dependency 'React'
19
- end
19
+ s.dependency "React-Core"
20
+
21
+ # Don't install the dependencies when we run `pod install` in the old architecture.
22
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
23
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
24
+ s.pod_target_xcconfig = {
25
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
26
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
27
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
28
+ }
29
+ s.dependency "React-Codegen"
30
+ s.dependency "RCT-Folly"
31
+ s.dependency "RCTRequired"
32
+ s.dependency "RCTTypeSafety"
33
+ s.dependency "ReactCommon/turbomodule/core"
34
+ end
35
+ end
package/src/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package 'react-native-timezone' doesn't seem to be linked. Make sure: \n\n` +
5
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
+ '- You rebuilt the app after installing the package\n' +
7
+ '- You are not using Expo Go\n';
8
+
9
+ const Timezone = NativeModules.Timezone
10
+ ? NativeModules.Timezone
11
+ : new Proxy(
12
+ {},
13
+ {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ }
18
+ );
19
+
20
+ export default Timezone;
@@ -1,6 +0,0 @@
1
- #Tue Sep 24 19:00:41 IST 2019
2
- distributionBase=GRADLE_USER_HOME
3
- distributionPath=wrapper/dists
4
- zipStoreBase=GRADLE_USER_HOME
5
- zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
package/android/gradlew DELETED
@@ -1,172 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- ##############################################################################
4
- ##
5
- ## Gradle start up script for UN*X
6
- ##
7
- ##############################################################################
8
-
9
- # Attempt to set APP_HOME
10
- # Resolve links: $0 may be a link
11
- PRG="$0"
12
- # Need this for relative symlinks.
13
- while [ -h "$PRG" ] ; do
14
- ls=`ls -ld "$PRG"`
15
- link=`expr "$ls" : '.*-> \(.*\)$'`
16
- if expr "$link" : '/.*' > /dev/null; then
17
- PRG="$link"
18
- else
19
- PRG=`dirname "$PRG"`"/$link"
20
- fi
21
- done
22
- SAVED="`pwd`"
23
- cd "`dirname \"$PRG\"`/" >/dev/null
24
- APP_HOME="`pwd -P`"
25
- cd "$SAVED" >/dev/null
26
-
27
- APP_NAME="Gradle"
28
- APP_BASE_NAME=`basename "$0"`
29
-
30
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
- DEFAULT_JVM_OPTS=""
32
-
33
- # Use the maximum available, or set MAX_FD != -1 to use that value.
34
- MAX_FD="maximum"
35
-
36
- warn () {
37
- echo "$*"
38
- }
39
-
40
- die () {
41
- echo
42
- echo "$*"
43
- echo
44
- exit 1
45
- }
46
-
47
- # OS specific support (must be 'true' or 'false').
48
- cygwin=false
49
- msys=false
50
- darwin=false
51
- nonstop=false
52
- case "`uname`" in
53
- CYGWIN* )
54
- cygwin=true
55
- ;;
56
- Darwin* )
57
- darwin=true
58
- ;;
59
- MINGW* )
60
- msys=true
61
- ;;
62
- NONSTOP* )
63
- nonstop=true
64
- ;;
65
- esac
66
-
67
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
-
69
- # Determine the Java command to use to start the JVM.
70
- if [ -n "$JAVA_HOME" ] ; then
71
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72
- # IBM's JDK on AIX uses strange locations for the executables
73
- JAVACMD="$JAVA_HOME/jre/sh/java"
74
- else
75
- JAVACMD="$JAVA_HOME/bin/java"
76
- fi
77
- if [ ! -x "$JAVACMD" ] ; then
78
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
-
80
- Please set the JAVA_HOME variable in your environment to match the
81
- location of your Java installation."
82
- fi
83
- else
84
- JAVACMD="java"
85
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
-
87
- Please set the JAVA_HOME variable in your environment to match the
88
- location of your Java installation."
89
- fi
90
-
91
- # Increase the maximum file descriptors if we can.
92
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93
- MAX_FD_LIMIT=`ulimit -H -n`
94
- if [ $? -eq 0 ] ; then
95
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96
- MAX_FD="$MAX_FD_LIMIT"
97
- fi
98
- ulimit -n $MAX_FD
99
- if [ $? -ne 0 ] ; then
100
- warn "Could not set maximum file descriptor limit: $MAX_FD"
101
- fi
102
- else
103
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104
- fi
105
- fi
106
-
107
- # For Darwin, add options to specify how the application appears in the dock
108
- if $darwin; then
109
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110
- fi
111
-
112
- # For Cygwin, switch paths to Windows format before running java
113
- if $cygwin ; then
114
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
- JAVACMD=`cygpath --unix "$JAVACMD"`
117
-
118
- # We build the pattern for arguments to be converted via cygpath
119
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
- SEP=""
121
- for dir in $ROOTDIRSRAW ; do
122
- ROOTDIRS="$ROOTDIRS$SEP$dir"
123
- SEP="|"
124
- done
125
- OURCYGPATTERN="(^($ROOTDIRS))"
126
- # Add a user-defined pattern to the cygpath arguments
127
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
- fi
130
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
- i=0
132
- for arg in "$@" ; do
133
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
-
136
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
- else
139
- eval `echo args$i`="\"$arg\""
140
- fi
141
- i=$((i+1))
142
- done
143
- case $i in
144
- (0) set -- ;;
145
- (1) set -- "$args0" ;;
146
- (2) set -- "$args0" "$args1" ;;
147
- (3) set -- "$args0" "$args1" "$args2" ;;
148
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
- esac
155
- fi
156
-
157
- # Escape application args
158
- save () {
159
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
- echo " "
161
- }
162
- APP_ARGS=$(save "$@")
163
-
164
- # Collect all arguments for the java command, following the shell quoting and substitution rules
165
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
-
167
- # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168
- if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169
- cd "$(dirname "$0")"
170
- fi
171
-
172
- exec "$JAVACMD" "$@"
@@ -1,84 +0,0 @@
1
- @if "%DEBUG%" == "" @echo off
2
- @rem ##########################################################################
3
- @rem
4
- @rem Gradle startup script for Windows
5
- @rem
6
- @rem ##########################################################################
7
-
8
- @rem Set local scope for the variables with windows NT shell
9
- if "%OS%"=="Windows_NT" setlocal
10
-
11
- set DIRNAME=%~dp0
12
- if "%DIRNAME%" == "" set DIRNAME=.
13
- set APP_BASE_NAME=%~n0
14
- set APP_HOME=%DIRNAME%
15
-
16
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
- set DEFAULT_JVM_OPTS=
18
-
19
- @rem Find java.exe
20
- if defined JAVA_HOME goto findJavaFromJavaHome
21
-
22
- set JAVA_EXE=java.exe
23
- %JAVA_EXE% -version >NUL 2>&1
24
- if "%ERRORLEVEL%" == "0" goto init
25
-
26
- echo.
27
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
- echo.
29
- echo Please set the JAVA_HOME variable in your environment to match the
30
- echo location of your Java installation.
31
-
32
- goto fail
33
-
34
- :findJavaFromJavaHome
35
- set JAVA_HOME=%JAVA_HOME:"=%
36
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
-
38
- if exist "%JAVA_EXE%" goto init
39
-
40
- echo.
41
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
- echo.
43
- echo Please set the JAVA_HOME variable in your environment to match the
44
- echo location of your Java installation.
45
-
46
- goto fail
47
-
48
- :init
49
- @rem Get command-line arguments, handling Windows variants
50
-
51
- if not "%OS%" == "Windows_NT" goto win9xME_args
52
-
53
- :win9xME_args
54
- @rem Slurp the command line arguments.
55
- set CMD_LINE_ARGS=
56
- set _SKIP=2
57
-
58
- :win9xME_args_slurp
59
- if "x%~1" == "x" goto execute
60
-
61
- set CMD_LINE_ARGS=%*
62
-
63
- :execute
64
- @rem Setup the command line
65
-
66
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
-
68
- @rem Execute Gradle
69
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
-
71
- :end
72
- @rem End local scope for the variables with windows NT shell
73
- if "%ERRORLEVEL%"=="0" goto mainEnd
74
-
75
- :fail
76
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
- rem the _cmd.exe /c_ return code!
78
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
- exit /b 1
80
-
81
- :mainEnd
82
- if "%OS%"=="Windows_NT" endlocal
83
-
84
- :omega
@@ -1,28 +0,0 @@
1
-
2
- package com.rntimezone;
3
-
4
- import java.util.Arrays;
5
- import java.util.Collections;
6
- import java.util.List;
7
-
8
- import com.facebook.react.ReactPackage;
9
- import com.facebook.react.bridge.NativeModule;
10
- import com.facebook.react.bridge.ReactApplicationContext;
11
- import com.facebook.react.uimanager.ViewManager;
12
- import com.facebook.react.bridge.JavaScriptModule;
13
- public class RNReactNativeTimezonePackage implements ReactPackage {
14
- @Override
15
- public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16
- return Arrays.<NativeModule>asList(new RNReactNativeTimezoneModule(reactContext));
17
- }
18
-
19
- // Deprecated from RN 0.47
20
- public List<Class<? extends JavaScriptModule>> createJSModules() {
21
- return Collections.emptyList();
22
- }
23
-
24
- @Override
25
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
26
- return Collections.emptyList();
27
- }
28
- }
package/index.js DELETED
@@ -1,6 +0,0 @@
1
-
2
- import { NativeModules } from 'react-native';
3
-
4
- const { RNReactNativeTimezone } = NativeModules;
5
-
6
- export default RNReactNativeTimezone;
@@ -1,11 +0,0 @@
1
-
2
- #if __has_include("RCTBridgeModule.h")
3
- #import "RCTBridgeModule.h"
4
- #else
5
- #import <React/RCTBridgeModule.h>
6
- #endif
7
-
8
- @interface RNReactNativeTimezone : NSObject <RCTBridgeModule>
9
-
10
- @end
11
-
@@ -1,25 +0,0 @@
1
-
2
- #import "RNReactNativeTimezone.h"
3
-
4
- @implementation RNReactNativeTimezone
5
-
6
- RCT_EXPORT_MODULE()
7
- RCT_EXPORT_METHOD(getTimeZone:(RCTPromiseResolveBlock)resolve
8
- rejecter:(RCTPromiseRejectBlock)reject) {
9
-
10
- @try{
11
- NSTimeZone *timeZone = [NSTimeZone localTimeZone];
12
- resolve(timeZone.name);
13
- }
14
- @catch(NSException *exception){
15
- NSMutableDictionary * info = [NSMutableDictionary dictionary];
16
- [info setValue:exception.name forKey:@"ExceptionName"];
17
- [info setValue:exception.reason forKey:@"ExceptionReason"];
18
- [info setValue:exception.userInfo forKey:@"ExceptionUserInfo"];
19
- NSError *error = [[NSError alloc] initWithDomain:@"Root Detection Module" code:0 userInfo:info];
20
- reject(@"failed to execute",@"",error);
21
- }
22
- }
23
-
24
- @end
25
-
@@ -1,24 +0,0 @@
1
-
2
- Pod::Spec.new do |s|
3
- s.name = "RNReactNativeTimezone"
4
- s.version = "1.0.0"
5
- s.summary = "RNReactNativeTimezone"
6
- s.description = <<-DESC
7
- RNReactNativeTimezone
8
- DESC
9
- s.homepage = ""
10
- s.license = "MIT"
11
- # s.license = { :type => "MIT", :file => "FILE_LICENSE" }
12
- s.author = { "author" => "author@domain.cn" }
13
- s.platform = :ios, "7.0"
14
- s.source = { :git => "https://github.com/author/RNReactNativeTimezone.git", :tag => "master" }
15
- s.source_files = "RNReactNativeTimezone/**/*.{h,m}"
16
- s.requires_arc = true
17
-
18
-
19
- s.dependency "React"
20
- #s.dependency "others"
21
-
22
- end
23
-
24
-
@@ -1,9 +0,0 @@
1
- // !$*UTF8*$!
2
- <?xml version="1.0" encoding="UTF-8"?>
3
- <Workspace
4
- version = "1.0">
5
- <FileRef
6
- location = "group:RNReactNativeTimezone.xcodeproj">
7
- </FileRef>
8
- </Workspace>
9
-
Binary file