Skip to content

Commit

Permalink
Fixed deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
KoCMoHaBTa committed Sep 13, 2022
1 parent 2a7e2e6 commit bf1488c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 49 deletions.
39 changes: 3 additions & 36 deletions MHAppKit/Extensions/Foundation/NSError+Presentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,48 +71,15 @@ extension Error {
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
}

///Show the receiver as a local notification.
///- parameter title: The title of the notification
///- parameter configurationHandler: A closure used for addition configuration of the UILocalNotification
///- note: The message of the notification is the receiver's `localizedDescription`.
@available(tvOS, unavailable)
public func showAsLocalNotification(withTitle title: String, configurationHandler: ((UILocalNotification) -> Void)) {

let message = self.localizedDescription

let notification = UILocalNotification()
notification.fireDate = nil
notification.alertBody = message

if #available(iOS 8.2, *) {

notification.alertTitle = title
}

configurationHandler(notification)

UIApplication.shared.scheduleLocalNotification(notification)
}

///Show the receiver as a local notification.
///- parameter title: The title of the notification
///- note: The message of the notification is the receiver's `localizedDescription`.
@available(tvOS, unavailable)
public func showAsLocalNotification(withTitle title: String) {

if #available(iOS 10, *) {

self.showAsLocalNotification(withTitle: title) { (notificationContent: UNMutableNotificationContent) in

//default empty configuration
}
}
else {

self.showAsLocalNotification(withTitle: title) { (notificationContent: UILocalNotification) in

//default empty configuration
}
self.showAsLocalNotification(withTitle: title) { (notificationContent: UNMutableNotificationContent) in

//default empty configuration
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,7 @@ extension Dictionary where Key == UIImagePickerController.InfoKey, Value == Any
@available(tvOS 10, *)
public func fetchAsset() -> PHAsset? {

if #available(iOS 11.0, *), let asset = self.asset {

return asset
}

guard let url = self.referenceURL else {

return nil
}

return PHAsset.fetchAssets(withALAssetURLs: [url], options: nil).firstObject
return self.asset
}
}

Expand Down
2 changes: 1 addition & 1 deletion MHAppKit/Extensions/UIKit/UIView/UIView+Snapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extension UIView {

if #available(iOS 10.0, *), #available(tvOS 10.0, *) {

let rendererFormat = UIGraphicsImageRendererFormat.default()
let rendererFormat = UIGraphicsImageRendererFormat.preferred()
rendererFormat.opaque = self.isOpaque
let renderer = UIGraphicsImageRenderer(size: self.bounds.size, format: rendererFormat)

Expand Down
2 changes: 1 addition & 1 deletion MHAppKit/ViewControllers/StaticTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ open class StaticTableViewController: UITableViewController, UINavigationControl

let h = self.refreshControl?.frame.size.height ?? 0
var offset = self.tableView.contentOffset
offset.y = -h - self.topLayoutGuide.length
offset.y = -h - self.view.safeAreaInsets.top
self.tableView.setContentOffset(offset, animated: animated)
}

Expand Down

0 comments on commit bf1488c

Please sign in to comment.