Skip to content

Commit

Permalink
Updates SettingsTableViewController to set title on viewWillAppear
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel committed Jan 30, 2024
1 parent cdc4198 commit fd328f0
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions ooniprobe/View/Settings/SettingsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ @implementation SettingsTableViewController

- (void)viewDidLoad {
[super viewDidLoad];
if (category != nil)
self.title = [LocalizationUtility getNameForSetting:category];
else if (testSuite != nil)
self.title = [LocalizationUtility getNameForTest:testSuite.name];
[self updateTitle];
self.navigationController.navigationBar.topItem.title = @"";

keyboardToolbar = [[UIToolbar alloc] init];
Expand All @@ -30,14 +27,30 @@ - (void)viewDidLoad {

-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self updateTitle];
[self reloadSettings];
}

/**
* Update the title of the view controller.
* If the view controller is for a category(enumerated in ``SettingsUtility/getSettingsCategories``), the title is the name of the category.
* If the view controller is for a test suite, the title is the name of the test suite.
*/
- (void)updateTitle {
self.title = @"";
if (category != nil) {
self.title = [LocalizationUtility getNameForSetting:category];
} else if (testSuite != nil) {
self.title = [LocalizationUtility getNameForTest:testSuite.name];
}
}

-(void)reloadSettings {
if (category != nil)
if (category != nil) {
items = [SettingsUtility getSettingsForCategory:category];
else if (testSuite != nil)
} else if (testSuite != nil) {
items = [SettingsUtility getSettingsForTest:testSuite.name :YES];
}
//hide rows smooth
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
Expand Down

0 comments on commit fd328f0

Please # to comment.