mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	update ios xcode preject;
This commit is contained in:
		| @@ -14,8 +14,4 @@ | ||||
|              origin:(NSString *)origin | ||||
|       toDestination:(NSString *)destination; | ||||
|  | ||||
| + (BOOL)hdiffPatch:(NSString *)path | ||||
|             origin:(NSString *)origin | ||||
|      toDestination:(NSString *)destination; | ||||
|  | ||||
| @end | ||||
|   | ||||
| @@ -8,7 +8,6 @@ | ||||
|  | ||||
| #import "BSDiff.h" | ||||
| #include "bspatch.h" | ||||
| #include "../../../android/jni/hpatch.h" | ||||
|  | ||||
| @implementation BSDiff | ||||
|  | ||||
| @@ -34,26 +33,4 @@ | ||||
|     return YES; | ||||
| } | ||||
|  | ||||
| + (BOOL)hdiffPatch:(NSString *)patch | ||||
|             origin:(NSString *)origin | ||||
|      toDestination:(NSString *)destination | ||||
| { | ||||
|     if (![[NSFileManager defaultManager] fileExistsAtPath:patch]) { | ||||
|         return NO; | ||||
|     } | ||||
|     if (![[NSFileManager defaultManager] fileExistsAtPath:origin]) { | ||||
|         return NO; | ||||
|     } | ||||
|      | ||||
|     if ([[NSFileManager defaultManager] fileExistsAtPath:destination]) { | ||||
|         [[NSFileManager defaultManager] removeItemAtPath:destination error:nil]; | ||||
|     } | ||||
|      | ||||
|     int err = hpatch_by_file([origin UTF8String], [destination UTF8String], [patch UTF8String]); | ||||
|     if (err) { | ||||
|         return NO; | ||||
|     } | ||||
|     return YES; | ||||
| } | ||||
|  | ||||
| @end | ||||
|   | ||||
							
								
								
									
										16
									
								
								ios/RCTPushy/HDiffPatch/HDiffPatch.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								ios/RCTPushy/HDiffPatch/HDiffPatch.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| // | ||||
| //  HDiffPatch.h | ||||
| //  RCTPushy | ||||
| // | ||||
| //  Created by HouSisong, All rights reserved. | ||||
| // | ||||
|  | ||||
| #import <Foundation/Foundation.h> | ||||
|  | ||||
| @interface HDiffPatch : NSObject | ||||
|  | ||||
| + (BOOL)hdiffPatch:(NSString *)path | ||||
|             origin:(NSString *)origin | ||||
|      toDestination:(NSString *)destination; | ||||
|  | ||||
| @end | ||||
							
								
								
									
										35
									
								
								ios/RCTPushy/HDiffPatch/HDiffPatch.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								ios/RCTPushy/HDiffPatch/HDiffPatch.m
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| // | ||||
| //  BSDiff.m | ||||
| //  RCTPushy | ||||
| // | ||||
| //  Created by HouSisong, All rights reserved. | ||||
| // | ||||
|  | ||||
| #import "HDiffPatch.h" | ||||
| #include "../../../android/jni/hpatch.h" | ||||
|  | ||||
| @implementation HDiffPatch | ||||
|  | ||||
| + (BOOL)hdiffPatch:(NSString *)patch | ||||
|             origin:(NSString *)origin | ||||
|      toDestination:(NSString *)destination | ||||
| { | ||||
|     if (![[NSFileManager defaultManager] fileExistsAtPath:patch]) { | ||||
|         return NO; | ||||
|     } | ||||
|     if (![[NSFileManager defaultManager] fileExistsAtPath:origin]) { | ||||
|         return NO; | ||||
|     } | ||||
|      | ||||
|     if ([[NSFileManager defaultManager] fileExistsAtPath:destination]) { | ||||
|         [[NSFileManager defaultManager] removeItemAtPath:destination error:nil]; | ||||
|     } | ||||
|      | ||||
|     int err = hpatch_by_file([origin UTF8String], [destination UTF8String], [patch UTF8String]); | ||||
|     if (err) { | ||||
|         return NO; | ||||
|     } | ||||
|     return YES; | ||||
| } | ||||
|  | ||||
| @end | ||||
| @@ -9,6 +9,7 @@ | ||||
| #import "RCTPushyManager.h" | ||||
| #import "ZipArchive.h" | ||||
| #import "BSDiff.h" | ||||
| #import "HDiffPatch.h" | ||||
| #import "bspatch.h" | ||||
|  | ||||
| @implementation RCTPushyManager { | ||||
| @@ -94,7 +95,7 @@ | ||||
|      completionHandler:(void (^)(BOOL success))completionHandler | ||||
| { | ||||
|     dispatch_async(_opQueue, ^{ | ||||
|         BOOL success = [BSDiff hdiffPatch:path origin:origin toDestination:destination]; | ||||
|         BOOL success = [HDiffPatch hdiffPatch:path origin:origin toDestination:destination]; | ||||
|         if (completionHandler) { | ||||
|             completionHandler(success); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sisong
					sisong