Skip to content

Commit f0df96a

Browse files
authored
Show stats insights changes prompt in alert and not actionSheet on iPad (#20013)
When showing UIAlertViewController as actionSheet on iPad sourceView and sourceRect is required to be set to avoid a crash.
1 parent 9d584c5 commit f0df96a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

WordPress/Classes/ViewRelated/Stats/Insights/Insights Management/InsightsManagementViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ class InsightsManagementViewController: UITableViewController {
192192
}
193193

194194
private func promptToSave(from viewController: UIViewController?) {
195-
let alert = UIAlertController(title: nil, message: TextContent.savePromptMessage, preferredStyle: .actionSheet)
195+
let alertStyle: UIAlertController.Style = UIDevice.current.userInterfaceIdiom == .pad ? .alert : .actionSheet
196+
let alert = UIAlertController(title: nil, message: TextContent.savePromptMessage, preferredStyle: alertStyle)
196197
alert.addAction(UIAlertAction(title: TextContent.savePromptSaveButton, style: .default, handler: { _ in
197198
self.saveTapped()
198199
}))

0 commit comments

Comments
 (0)