From 094160fbeee1069d94f582b864cd93889dc824b6 Mon Sep 17 00:00:00 2001 From: khanhduytran0 Date: Thu, 6 Jul 2023 16:15:32 +0700 Subject: [PATCH] Fix[UI]: profile states on switch/delete --- Natives/LauncherMenuViewController.m | 2 +- Natives/LauncherNavigationController.m | 1 - Natives/LauncherPrefGameDirViewController.m | 2 +- Natives/LauncherProfilesViewController.m | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Natives/LauncherMenuViewController.m b/Natives/LauncherMenuViewController.m index f5ba7079..19e6bc34 100644 --- a/Natives/LauncherMenuViewController.m +++ b/Natives/LauncherMenuViewController.m @@ -314,7 +314,7 @@ // Update profiles and local version list if needed if (shouldUpdateProfiles) { [contentNavigationController fetchLocalVersionList]; - [PLProfiles updateCurrent]; + [contentNavigationController performSelector:@selector(reloadProfileList)]; } // Update tableView whenever we have diff --git a/Natives/LauncherNavigationController.m b/Natives/LauncherNavigationController.m index 2a45fc49..1f7635ab 100644 --- a/Natives/LauncherNavigationController.m +++ b/Natives/LauncherNavigationController.m @@ -148,7 +148,6 @@ [remoteVersionList addObjectsFromArray:responseObject[@"versions"]]; NSDebugLog(@"[VersionList] Got %d versions", remoteVersionList.count); setPrefObject(@"internal.latest_version", responseObject[@"latest"]); - [self fetchLocalVersionList]; self.buttonInstall.enabled = YES; } failure:^(NSURLSessionTask *operation, NSError *error) { NSDebugLog(@"[VersionList] Warning: Unable to fetch version list: %@", error.localizedDescription); diff --git a/Natives/LauncherPrefGameDirViewController.m b/Natives/LauncherPrefGameDirViewController.m index b0979b9e..c4305dea 100644 --- a/Natives/LauncherPrefGameDirViewController.m +++ b/Natives/LauncherPrefGameDirViewController.m @@ -47,7 +47,7 @@ [NSFileManager.defaultManager createSymbolicLinkAtPath:lasmPath withDestinationPath:multidirPath error:nil]; [NSFileManager.defaultManager changeCurrentDirectoryPath:lasmPath]; toggleIsolatedPref(NO); - [self.navigationController performSelector:@selector(reloadProfileList) withObject:nil]; + [self.navigationController performSelector:@selector(reloadProfileList)]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section diff --git a/Natives/LauncherProfilesViewController.m b/Natives/LauncherProfilesViewController.m index 95c380dc..b7c957ec 100644 --- a/Natives/LauncherProfilesViewController.m +++ b/Natives/LauncherProfilesViewController.m @@ -71,7 +71,7 @@ // Pickup changes made in the profile editor and switching instance [PLProfiles updateCurrent]; [self.tableView reloadData]; - [self.navigationController performSelector:@selector(reloadProfileList) withObject:nil]; + [self.navigationController performSelector:@selector(reloadProfileList)]; } - (void)actionTogglePrefIsolation:(UISwitch *)sender { @@ -203,6 +203,7 @@ confirmAlert.popoverPresentationController.sourceRect = cell.bounds; UIAlertAction *ok = [UIAlertAction actionWithTitle:localize(@"OK", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { [PLProfiles.current.profiles removeObjectForKey:cell.textLabel.text]; + [PLProfiles.current save]; [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; }]; UIAlertAction *cancel = [UIAlertAction actionWithTitle:localize(@"Cancel", nil) style:UIAlertActionStyleCancel handler:nil];