mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	refactor hvigor-plugin to use 2-space indentation for JSON and improve condition checks in RCTPushy
This commit is contained in:
		| @@ -30,11 +30,9 @@ export function reactNativeUpdatePlugin() { | |||||||
|             versionName, |             versionName, | ||||||
|           }; |           }; | ||||||
|  |  | ||||||
|           fs.writeFileSync(metaFilePath, JSON.stringify(metaContent, null, 4)); |           fs.writeFileSync(metaFilePath, JSON.stringify(metaContent, null, 2)); | ||||||
|           console.log(`Build time written to ${metaFilePath}`); |           console.log(`Build time written to ${metaFilePath}`); | ||||||
|         }, |         }, | ||||||
|         dependencies: [], |  | ||||||
|         postDependencies: ['default@BuildJS'], |  | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
|   }; |   }; | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ RCT_EXPORT_MODULE(RCTPushy); | |||||||
|     NSString *storedBuildTime = [defaults stringForKey:paramBuildTime]; |     NSString *storedBuildTime = [defaults stringForKey:paramBuildTime]; | ||||||
|      |      | ||||||
|     // If stored versions don't exist, write current versions first |     // If stored versions don't exist, write current versions first | ||||||
|     if (!storedPackageVersion || !storedBuildTime) { |     if (!storedPackageVersion && !storedBuildTime) { | ||||||
|         [defaults setObject:curPackageVersion forKey:paramPackageVersion]; |         [defaults setObject:curPackageVersion forKey:paramPackageVersion]; | ||||||
|         [defaults setObject:curBuildTime forKey:paramBuildTime]; |         [defaults setObject:curBuildTime forKey:paramBuildTime]; | ||||||
|         storedPackageVersion = curPackageVersion; |         storedPackageVersion = curPackageVersion; | ||||||
| @@ -86,7 +86,7 @@ RCT_EXPORT_MODULE(RCTPushy); | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     BOOL packageVersionChanged = ![curPackageVersion isEqualToString:storedPackageVersion]; |     BOOL packageVersionChanged = ![curPackageVersion isEqualToString:storedPackageVersion]; | ||||||
|     BOOL buildTimeChanged = ![curBuildTime isEqualToString:storedBuildTime]; |     BOOL buildTimeChanged = curBuildTime && ![curBuildTime isEqualToString:storedBuildTime]; | ||||||
|      |      | ||||||
|     if (packageVersionChanged || buildTimeChanged) { |     if (packageVersionChanged || buildTimeChanged) { | ||||||
|         // Clear all update data and store new versions |         // Clear all update data and store new versions | ||||||
| @@ -304,8 +304,8 @@ RCT_EXPORT_METHOD(setNeedUpdate:(NSDictionary *)options | |||||||
|     if (hash.length) { |     if (hash.length) { | ||||||
|         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; |         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||||||
|         NSString *lastVersion = nil; |         NSString *lastVersion = nil; | ||||||
|         if ([defaults objectForKey:keyPushyInfo]) { |         NSDictionary *pushyInfo = [defaults objectForKey:keyPushyInfo] | ||||||
|             NSDictionary *pushyInfo = [defaults objectForKey:keyPushyInfo]; |         if (pushyInfo) { | ||||||
|             lastVersion = pushyInfo[paramCurrentVersion]; |             lastVersion = pushyInfo[paramCurrentVersion]; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "react-native-update", |   "name": "react-native-update", | ||||||
|   "version": "10.35.4", |   "version": "10.35.5", | ||||||
|   "description": "react-native hot update", |   "description": "react-native hot update", | ||||||
|   "main": "src/index", |   "main": "src/index", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm