Skip to content

Commit

Permalink
fix: Websites categories action causes crash. (#562)
Browse files Browse the repository at this point in the history
Fixes  ooni/probe#2744

## Proposed Changes

  - Add extra controls for alert on iPad.
  • Loading branch information
aanorbel authored Jun 19, 2024
1 parent df1ea33 commit e8472e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ooniprobe/View/Settings/SettingsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ -(IBAction)selectLanguage:(id)sender{
position:CSToastPositionBottom];
}]];
}

// Check if the device is an iPad
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
alert.popoverPresentationController.sourceView = self.view;
alert.popoverPresentationController.sourceRect = CGRectMake(self.view.bounds.size.width, self.view.bounds.size.height, 1.0, 1.0);
alert.popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
}

[self presentViewController:alert animated:YES completion:nil];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ - (IBAction)showListActions:(id)sender {
[SettingsUtility updateAllWebsiteCategories:false];
[self.navigationController popViewControllerAnimated:YES];
}]];

// Check if the device is an iPad
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
alert.popoverPresentationController.sourceView = self.view;
alert.popoverPresentationController.sourceRect = CGRectMake(self.view.bounds.size.width / 2.0, self.view.bounds.size.height / 2.0, 1.0, 1.0);
}

[self presentViewController:alert animated:YES completion:nil];
}

Expand Down

0 comments on commit e8472e6

Please sign in to comment.