This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
android/app/src/main/java/com/microsoft/codepush/react Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -475,11 +475,22 @@ + (void)rollbackPackage
475475{
476476 NSError *error;
477477 NSMutableDictionary *info = [self getCurrentPackageInfo: &error];
478+ if (error) {
479+ return ;
480+ }
478481
482+ NSString *currentPackageFolderPath = [self getCurrentPackageFolderPath: &error];
479483 if (error) {
480484 return ;
481485 }
482486
487+ NSError *deleteError;
488+ [[NSFileManager defaultManager ] removeItemAtPath: currentPackageFolderPath
489+ error: &deleteError];
490+ if (deleteError) {
491+ NSLog (@" Error deleting current package contents at %@ " , currentPackageFolderPath);
492+ }
493+
483494 [info setValue: info[@" previousPackage" ] forKey: @" currentPackage" ];
484495 [info removeObjectForKey: @" previousPackage" ];
485496
Original file line number Diff line number Diff line change @@ -187,6 +187,8 @@ public void installPackage(ReadableMap updatePackage) throws IOException {
187187
188188 public void rollbackPackage () throws IOException {
189189 WritableMap info = getCurrentPackageInfo ();
190+ String currentPackageFolderPath = getCurrentPackageFolderPath ();
191+ CodePushUtils .deleteDirectoryAtPath (currentPackageFolderPath );
190192 info .putString (CURRENT_PACKAGE_KEY , CodePushUtils .tryGetString (info , PREVIOUS_PACKAGE_KEY ));
191193 info .putNull (PREVIOUS_PACKAGE_KEY );
192194 updateCurrentPackageInfo (info );
You can’t perform that action at this time.
0 commit comments