mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 21:33:12 +08:00 
			
		
		
		
	Try to fix app.json issue
This commit is contained in:
		| @@ -345,10 +345,10 @@ RCT_EXPORT_METHOD(markSuccess) | |||||||
|                                 break; |                                 break; | ||||||
|                             case PushyTypePatchFromPpk: |                             case PushyTypePatchFromPpk: | ||||||
|                             { |                             { | ||||||
|                                 NSString *lastVertionDir = [dir stringByAppendingPathComponent:originHashName]; |                                 NSString *lastVersionDir = [dir stringByAppendingPathComponent:originHashName]; | ||||||
|                                  |                                  | ||||||
|                                 NSString *sourceOrigin = lastVertionDir; |                                 NSString *sourceOrigin = lastVersionDir; | ||||||
|                                 NSString *bundleOrigin = [lastVertionDir stringByAppendingPathComponent:BUNDLE_FILE_NAME]; |                                 NSString *bundleOrigin = [lastVersionDir stringByAppendingPathComponent:BUNDLE_FILE_NAME]; | ||||||
|                                 [self patch:hashName fromBundle:bundleOrigin source:sourceOrigin callback:callback]; |                                 [self patch:hashName fromBundle:bundleOrigin source:sourceOrigin callback:callback]; | ||||||
|                             } |                             } | ||||||
|                                 break; |                                 break; | ||||||
|   | |||||||
| @@ -99,16 +99,9 @@ completionHandler:(void (^)(NSError *error))completionHandler | |||||||
|  |  | ||||||
|         // merge old files |         // merge old files | ||||||
|         if (deletes!= nil) { |         if (deletes!= nil) { | ||||||
|             NSError *error = nil; |  | ||||||
|             NSString *srcDir = [fromDir stringByAppendingPathComponent:@"assets"]; |             NSString *srcDir = [fromDir stringByAppendingPathComponent:@"assets"]; | ||||||
|             NSString *desDir = [toDir stringByAppendingPathComponent:@"assets"]; |             NSString *desDir = [toDir stringByAppendingPathComponent:@"assets"]; | ||||||
|             [self _mergeContentsOfPath:srcDir intoPath:desDir deletes:deletes error:&error]; |             [self _mergeContentsOfPath:srcDir intoPath:desDir deletes:deletes]; | ||||||
|             if (error) { |  | ||||||
|                 if (completionHandler) { |  | ||||||
|                     completionHandler(error); |  | ||||||
|                 } |  | ||||||
|                 return; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         // copy files |         // copy files | ||||||
| @@ -126,10 +119,11 @@ completionHandler:(void (^)(NSError *error))completionHandler | |||||||
|             NSError *error = nil; |             NSError *error = nil; | ||||||
|             [fm copyItemAtPath:fromPath toPath:toPath error:&error]; |             [fm copyItemAtPath:fromPath toPath:toPath error:&error]; | ||||||
|             if (error) { |             if (error) { | ||||||
|                 if (completionHandler) { |                 NSLog(@"Pushy copy error: %@", error.localizedDescription); | ||||||
|                     completionHandler(error); |                 // if (completionHandler) { | ||||||
|                 } |                 //     completionHandler(error); | ||||||
|                 return; |                 // } | ||||||
|  |                 // return; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (completionHandler) { |         if (completionHandler) { | ||||||
| @@ -150,7 +144,7 @@ completionHandler:(void (^)(NSError *error))completionHandler | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
| - (void)_mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir deletes:(NSDictionary *)deletes error:(NSError**)err | - (void)_mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir deletes:(NSDictionary *)deletes | ||||||
| { | { | ||||||
|     NSFileManager *fm = [NSFileManager defaultManager]; |     NSFileManager *fm = [NSFileManager defaultManager]; | ||||||
|     NSDirectoryEnumerator *srcDirEnum = [fm enumeratorAtPath:srcDir]; |     NSDirectoryEnumerator *srcDirEnum = [fm enumeratorAtPath:srcDir]; | ||||||
| @@ -159,7 +153,9 @@ completionHandler:(void (^)(NSError *error))completionHandler | |||||||
|          |          | ||||||
|         NSString *srcFullPath =  [srcDir stringByAppendingPathComponent:subPath]; |         NSString *srcFullPath =  [srcDir stringByAppendingPathComponent:subPath]; | ||||||
|         NSString *potentialDstPath = [dstDir stringByAppendingPathComponent:subPath]; |         NSString *potentialDstPath = [dstDir stringByAppendingPathComponent:subPath]; | ||||||
|          |  | ||||||
|  |         NSError *error = nil; | ||||||
|  |  | ||||||
|         BOOL inDeletes = NO; |         BOOL inDeletes = NO; | ||||||
|         if (deletes) { |         if (deletes) { | ||||||
|             NSString *path = [@"assets" stringByAppendingPathComponent:subPath]; |             NSString *path = [@"assets" stringByAppendingPathComponent:subPath]; | ||||||
| @@ -171,18 +167,19 @@ completionHandler:(void (^)(NSError *error))completionHandler | |||||||
|             BOOL isDirectory = ([fm fileExistsAtPath:srcFullPath isDirectory:&isDirectory] && isDirectory); |             BOOL isDirectory = ([fm fileExistsAtPath:srcFullPath isDirectory:&isDirectory] && isDirectory); | ||||||
|             if (isDirectory) { |             if (isDirectory) { | ||||||
|                 if (![fm fileExistsAtPath:potentialDstPath isDirectory:nil]) { |                 if (![fm fileExistsAtPath:potentialDstPath isDirectory:nil]) { | ||||||
|                     [fm createDirectoryAtPath:potentialDstPath withIntermediateDirectories:YES attributes:nil error:err]; |                     [fm createDirectoryAtPath:potentialDstPath withIntermediateDirectories:YES attributes:nil error:&error]; | ||||||
|                     if (err && *err) { |                     if (error) { | ||||||
|                         return; |                         NSLog(@"Pushy merge error: %@", error.localizedDescription); | ||||||
|  |                         // return; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                  |  | ||||||
|                 if (![fm fileExistsAtPath:potentialDstPath]) { |                 if (![fm fileExistsAtPath:potentialDstPath]) { | ||||||
|                     [fm copyItemAtPath:srcFullPath toPath:potentialDstPath error:err]; |                     [fm copyItemAtPath:srcFullPath toPath:potentialDstPath error:&error]; | ||||||
|                     if (err && *err) { |                     if (error) { | ||||||
|                         return; |                         NSLog(@"Pushy merge error: %@", error.localizedDescription); | ||||||
|  |                         // return; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm