From 366e249bf5ca44a9ceef6b294b98d9cb606ea259 Mon Sep 17 00:00:00 2001 From: Ibrahim Hassan Date: Tue, 30 Oct 2018 19:00:15 +0530 Subject: [PATCH 1/8] Updated Code Swift 4.2 Compliance --- CRNotificationsExample.xcodeproj/project.pbxproj | 4 ++-- .../CRNotifications/Classes/CRNotification.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CRNotificationsExample.xcodeproj/project.pbxproj b/CRNotificationsExample.xcodeproj/project.pbxproj index 9eb8fa1..9654fdc 100644 --- a/CRNotificationsExample.xcodeproj/project.pbxproj +++ b/CRNotificationsExample.xcodeproj/project.pbxproj @@ -353,7 +353,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.casperriboe.CRNotificationsExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -369,7 +369,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.casperriboe.CRNotificationsExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift b/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift index 89009ac..9257cd9 100644 --- a/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift +++ b/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift @@ -97,8 +97,8 @@ internal class CRNotification: UIView { } private func setupTargets() { - NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: UIDevice.orientationDidChangeNotification, object: nil) let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissNotification)) let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(self.dismissNotification)) swipeRecognizer.direction = .up @@ -157,7 +157,7 @@ internal class CRNotification: UIView { /** Animates in the notification **/ internal func showNotification() { - UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.68, initialSpringVelocity: 0.1, options: UIViewAnimationOptions(), animations: { + UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.68, initialSpringVelocity: 0.1, options: UIView.AnimationOptions(), animations: { self.frame.origin.y = self.topInset() + 10 }) } From 041d85c1d8bfe7a9cd26a3d1abe135a6148e9644 Mon Sep 17 00:00:00 2001 From: Ibrahim Hassan Date: Tue, 30 Oct 2018 19:16:07 +0530 Subject: [PATCH 2/8] Updated Code --- CRNotifications/Classes/CRNotification.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRNotifications/Classes/CRNotification.swift b/CRNotifications/Classes/CRNotification.swift index 89009ac..9257cd9 100644 --- a/CRNotifications/Classes/CRNotification.swift +++ b/CRNotifications/Classes/CRNotification.swift @@ -97,8 +97,8 @@ internal class CRNotification: UIView { } private func setupTargets() { - NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: UIDevice.orientationDidChangeNotification, object: nil) let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissNotification)) let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(self.dismissNotification)) swipeRecognizer.direction = .up @@ -157,7 +157,7 @@ internal class CRNotification: UIView { /** Animates in the notification **/ internal func showNotification() { - UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.68, initialSpringVelocity: 0.1, options: UIViewAnimationOptions(), animations: { + UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.68, initialSpringVelocity: 0.1, options: UIView.AnimationOptions(), animations: { self.frame.origin.y = self.topInset() + 10 }) } From f6213bed955aeb128af00d1ffb888d678f1b4da7 Mon Sep 17 00:00:00 2001 From: dkcas11 Date: Tue, 11 Dec 2018 20:33:11 +0100 Subject: [PATCH 3/8] Added missing Swift 4.2 changes --- CRNotificationsExample/AppDelegate.swift | 2 +- Pods/Pods.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CRNotificationsExample/AppDelegate.swift b/CRNotificationsExample/AppDelegate.swift index 54636ac..ffe6bfc 100644 --- a/CRNotificationsExample/AppDelegate.swift +++ b/CRNotificationsExample/AppDelegate.swift @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj index 37e299e..8479bea 100644 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -407,7 +407,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -646,7 +646,7 @@ SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; From 7f10f8fee98b59ff04e2765ebc72ce4bf8b5be8e Mon Sep 17 00:00:00 2001 From: dkcas11 Date: Tue, 11 Dec 2018 20:33:23 +0100 Subject: [PATCH 4/8] Added workspace settings to use Legacy Build System --- .../xcshareddata/WorkspaceSettings.xcsettings | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 CRNotificationsExample.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/CRNotificationsExample.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/CRNotificationsExample.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..949b678 --- /dev/null +++ b/CRNotificationsExample.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Original + + From 6cc28eca97c726f372de2df5373a0d99c6fa88a2 Mon Sep 17 00:00:00 2001 From: dkcas11 Date: Tue, 11 Dec 2018 20:33:32 +0100 Subject: [PATCH 5/8] Fixed Xcode warnings --- .../project.pbxproj | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CRNotificationsExample.xcodeproj/project.pbxproj b/CRNotificationsExample.xcodeproj/project.pbxproj index 9654fdc..d9043fb 100644 --- a/CRNotificationsExample.xcodeproj/project.pbxproj +++ b/CRNotificationsExample.xcodeproj/project.pbxproj @@ -121,7 +121,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0820; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = Criboe; TargetAttributes = { AF90178E1E817E2600F4D8F8 = { @@ -260,15 +260,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -309,15 +317,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; From c998934ca55e11a10b0a31fd602f825cba9ae3e1 Mon Sep 17 00:00:00 2001 From: dkcas11 Date: Tue, 11 Dec 2018 20:57:10 +0100 Subject: [PATCH 6/8] Added support for iPhone XR/XS/XS Max and latest iPad Pros --- .../Classes/CRNotification.swift | 9 ++--- .../Classes/DeviceManager.swift | 37 +++++++++++++++---- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift b/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift index 9257cd9..771c14e 100644 --- a/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift +++ b/Pods/CRNotifications/CRNotifications/Classes/CRNotification.swift @@ -43,8 +43,8 @@ internal class CRNotification: UIView { internal init() { let deviceWidth = min(UIScreen.main.bounds.width, UIScreen.main.bounds.height) - let widthFactor: CGFloat = DeviceManager.value(iPhone35: 0.9, iPhone40: 0.9, iPhone47: 0.9, iPhone55: 0.85, iPhone58: 0.9, iPadSmall: 0.5, iPadMedium: 0.45, iPadBig: 0.4) - let heightFactor: CGFloat = DeviceManager.value(iPhone35: 0.2, iPhone40: 0.2, iPhone47: 0.2, iPhone55: 0.2, iPhone58: 0.2, iPadSmall: 0.18, iPadMedium: 0.17, iPadBig: 0.17) + let widthFactor: CGFloat = DeviceManager.value(iPhone35: 0.9, iPhone40: 0.9, iPhone47: 0.9, iPhone55: 0.85, iPhone58: 0.9, iPhone61: 0.9, iPadSmall: 0.5, iPadMedium: 0.45, iPadBig: 0.4) + let heightFactor: CGFloat = DeviceManager.value(iPhone35: 0.22, iPhone40: 0.22, iPhone47: 0.2, iPhone55: 0.2, iPhone58: 0.18, iPhone61: 0.18, iPadSmall: 0.18, iPadMedium: 0.17, iPadBig: 0.17) let width = deviceWidth * widthFactor let height = width * heightFactor @@ -82,8 +82,8 @@ internal class CRNotification: UIView { ]) NSLayoutConstraint.activate([ - titleLabel.topAnchor.constraint(greaterThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 6), - titleLabel.topAnchor.constraint(lessThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 2), + titleLabel.topAnchor.constraint(lessThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 6), + titleLabel.topAnchor.constraint(greaterThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 2), titleLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: 8), titleLabel.trailingAnchor.constraint(equalTo: titleLabel.superview!.trailingAnchor, constant: -8) ]) @@ -97,7 +97,6 @@ internal class CRNotification: UIView { } private func setupTargets() { - NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: UIDevice.orientationDidChangeNotification, object: nil) let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissNotification)) let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(self.dismissNotification)) diff --git a/Pods/CRNotifications/CRNotifications/Classes/DeviceManager.swift b/Pods/CRNotifications/CRNotifications/Classes/DeviceManager.swift index e9152ce..dc09827 100644 --- a/Pods/CRNotifications/CRNotifications/Classes/DeviceManager.swift +++ b/Pods/CRNotifications/CRNotifications/Classes/DeviceManager.swift @@ -46,6 +46,16 @@ // iPhone58 // 1125x2436 (375x812) // - iPhone X +// - iPhone XS +// +// iPhone61 +// 828x1792 (414x896) +// - iPhone XR +// +// iPhone 65 +// 1242x2688 (414x896) +// - iPhone XS Max +// // // ---------------------------------------------------- // Created by Casper Riboe on 21/07/2017. @@ -78,8 +88,10 @@ internal class DeviceManager { return .iPhone55 case CGSize(width: 621.0, height: 1104.0): return .iPhone55 - case CGSize(width: 562.5, height: 1218.0): - return .iPhone58 + case CGSize(width: 562.5, height: 1218.0): + return .iPhone58 + case CGSize(width: 414.0, height: 896.0): + return .iPhone61 case CGSize(width: 384.0, height: 512.0): return .iPadSmall case CGSize(width: 768.0, height: 1024.0): @@ -94,7 +106,7 @@ internal class DeviceManager { } /// Returns a value based on the current iPhone device. - internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T) -> T { + internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPhone61: T) -> T { switch device() { case .iPhone35: return iPhone35 @@ -104,6 +116,8 @@ internal class DeviceManager { return iPhone47 case .iPhone55: return iPhone55 + case .iPhone61: + return iPhone61 default: return iPhone58 } @@ -122,7 +136,7 @@ internal class DeviceManager { } /// Returns a value based on the current iPhone or iPad device. - internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPadSmall: T, iPadMedium: T, iPadBig: T) -> T { + internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPhone61: T, iPadSmall: T, iPadMedium: T, iPadBig: T) -> T { switch device() { case .iPhone35: return iPhone35 @@ -134,22 +148,30 @@ internal class DeviceManager { return iPhone55 case .iPhone58: return iPhone58 + case .iPhone61: + return iPhone61 case .iPadSmall: return iPadSmall case .iPadMedium: return iPadMedium + case .iPadBig: + return iPadBig default: - return iPadBig + if UIDevice.current.userInterfaceIdiom == .pad { + return iPadBig + } else { + return iPhone55 + } } } /// Returns a value based on the current iPhone or iPad device. internal static func value(iPhone: T, iPad: T) -> T { - return value(iPhone35: iPhone, iPhone40: iPhone, iPhone47: iPhone, iPhone55: iPhone, iPhone58: iPhone, iPadSmall: iPad, iPadMedium: iPad, iPadBig: iPad) + return value(iPhone35: iPhone, iPhone40: iPhone, iPhone47: iPhone, iPhone55: iPhone, iPhone58: iPhone, iPhone61: iPhone, iPadSmall: iPad, iPadMedium: iPad, iPadBig: iPad) } internal static func value(iPhoneX: T, other: T) -> T { - return value(iPhone35: other, iPhone40: other, iPhone47: other, iPhone55: other, iPhone58: iPhoneX, iPadSmall: other, iPadMedium: other, iPadBig: other) + return value(iPhone35: other, iPhone40: other, iPhone47: other, iPhone55: other, iPhone58: iPhoneX, iPhone61: iPhoneX, iPadSmall: other, iPadMedium: other, iPadBig: other) } } @@ -161,6 +183,7 @@ internal enum Device { case iPhone47 case iPhone55 case iPhone58 + case iPhone61 case iPadSmall case iPadMedium From 4928bb1f71578d83b6af93109088c7248fcde532 Mon Sep 17 00:00:00 2001 From: dkcas11 Date: Tue, 11 Dec 2018 20:59:45 +0100 Subject: [PATCH 7/8] Updated some files --- CRNotifications/Classes/CRNotification.swift | 9 ++--- CRNotifications/Classes/DeviceManager.swift | 37 +++++++++++++++---- .../Classes/CRNotification.swift | 13 +++---- .../Classes/DeviceManager.swift | 37 +++++++++++++++---- 4 files changed, 70 insertions(+), 26 deletions(-) diff --git a/CRNotifications/Classes/CRNotification.swift b/CRNotifications/Classes/CRNotification.swift index 9257cd9..771c14e 100644 --- a/CRNotifications/Classes/CRNotification.swift +++ b/CRNotifications/Classes/CRNotification.swift @@ -43,8 +43,8 @@ internal class CRNotification: UIView { internal init() { let deviceWidth = min(UIScreen.main.bounds.width, UIScreen.main.bounds.height) - let widthFactor: CGFloat = DeviceManager.value(iPhone35: 0.9, iPhone40: 0.9, iPhone47: 0.9, iPhone55: 0.85, iPhone58: 0.9, iPadSmall: 0.5, iPadMedium: 0.45, iPadBig: 0.4) - let heightFactor: CGFloat = DeviceManager.value(iPhone35: 0.2, iPhone40: 0.2, iPhone47: 0.2, iPhone55: 0.2, iPhone58: 0.2, iPadSmall: 0.18, iPadMedium: 0.17, iPadBig: 0.17) + let widthFactor: CGFloat = DeviceManager.value(iPhone35: 0.9, iPhone40: 0.9, iPhone47: 0.9, iPhone55: 0.85, iPhone58: 0.9, iPhone61: 0.9, iPadSmall: 0.5, iPadMedium: 0.45, iPadBig: 0.4) + let heightFactor: CGFloat = DeviceManager.value(iPhone35: 0.22, iPhone40: 0.22, iPhone47: 0.2, iPhone55: 0.2, iPhone58: 0.18, iPhone61: 0.18, iPadSmall: 0.18, iPadMedium: 0.17, iPadBig: 0.17) let width = deviceWidth * widthFactor let height = width * heightFactor @@ -82,8 +82,8 @@ internal class CRNotification: UIView { ]) NSLayoutConstraint.activate([ - titleLabel.topAnchor.constraint(greaterThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 6), - titleLabel.topAnchor.constraint(lessThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 2), + titleLabel.topAnchor.constraint(lessThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 6), + titleLabel.topAnchor.constraint(greaterThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 2), titleLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: 8), titleLabel.trailingAnchor.constraint(equalTo: titleLabel.superview!.trailingAnchor, constant: -8) ]) @@ -97,7 +97,6 @@ internal class CRNotification: UIView { } private func setupTargets() { - NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: UIDevice.orientationDidChangeNotification, object: nil) let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissNotification)) let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(self.dismissNotification)) diff --git a/CRNotifications/Classes/DeviceManager.swift b/CRNotifications/Classes/DeviceManager.swift index e9152ce..dc09827 100644 --- a/CRNotifications/Classes/DeviceManager.swift +++ b/CRNotifications/Classes/DeviceManager.swift @@ -46,6 +46,16 @@ // iPhone58 // 1125x2436 (375x812) // - iPhone X +// - iPhone XS +// +// iPhone61 +// 828x1792 (414x896) +// - iPhone XR +// +// iPhone 65 +// 1242x2688 (414x896) +// - iPhone XS Max +// // // ---------------------------------------------------- // Created by Casper Riboe on 21/07/2017. @@ -78,8 +88,10 @@ internal class DeviceManager { return .iPhone55 case CGSize(width: 621.0, height: 1104.0): return .iPhone55 - case CGSize(width: 562.5, height: 1218.0): - return .iPhone58 + case CGSize(width: 562.5, height: 1218.0): + return .iPhone58 + case CGSize(width: 414.0, height: 896.0): + return .iPhone61 case CGSize(width: 384.0, height: 512.0): return .iPadSmall case CGSize(width: 768.0, height: 1024.0): @@ -94,7 +106,7 @@ internal class DeviceManager { } /// Returns a value based on the current iPhone device. - internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T) -> T { + internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPhone61: T) -> T { switch device() { case .iPhone35: return iPhone35 @@ -104,6 +116,8 @@ internal class DeviceManager { return iPhone47 case .iPhone55: return iPhone55 + case .iPhone61: + return iPhone61 default: return iPhone58 } @@ -122,7 +136,7 @@ internal class DeviceManager { } /// Returns a value based on the current iPhone or iPad device. - internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPadSmall: T, iPadMedium: T, iPadBig: T) -> T { + internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPhone61: T, iPadSmall: T, iPadMedium: T, iPadBig: T) -> T { switch device() { case .iPhone35: return iPhone35 @@ -134,22 +148,30 @@ internal class DeviceManager { return iPhone55 case .iPhone58: return iPhone58 + case .iPhone61: + return iPhone61 case .iPadSmall: return iPadSmall case .iPadMedium: return iPadMedium + case .iPadBig: + return iPadBig default: - return iPadBig + if UIDevice.current.userInterfaceIdiom == .pad { + return iPadBig + } else { + return iPhone55 + } } } /// Returns a value based on the current iPhone or iPad device. internal static func value(iPhone: T, iPad: T) -> T { - return value(iPhone35: iPhone, iPhone40: iPhone, iPhone47: iPhone, iPhone55: iPhone, iPhone58: iPhone, iPadSmall: iPad, iPadMedium: iPad, iPadBig: iPad) + return value(iPhone35: iPhone, iPhone40: iPhone, iPhone47: iPhone, iPhone55: iPhone, iPhone58: iPhone, iPhone61: iPhone, iPadSmall: iPad, iPadMedium: iPad, iPadBig: iPad) } internal static func value(iPhoneX: T, other: T) -> T { - return value(iPhone35: other, iPhone40: other, iPhone47: other, iPhone55: other, iPhone58: iPhoneX, iPadSmall: other, iPadMedium: other, iPadBig: other) + return value(iPhone35: other, iPhone40: other, iPhone47: other, iPhone55: other, iPhone58: iPhoneX, iPhone61: iPhoneX, iPadSmall: other, iPadMedium: other, iPadBig: other) } } @@ -161,6 +183,7 @@ internal enum Device { case iPhone47 case iPhone55 case iPhone58 + case iPhone61 case iPadSmall case iPadMedium diff --git a/Pods/Target Support Files/CRNotifications/Classes/CRNotification.swift b/Pods/Target Support Files/CRNotifications/Classes/CRNotification.swift index 89009ac..771c14e 100644 --- a/Pods/Target Support Files/CRNotifications/Classes/CRNotification.swift +++ b/Pods/Target Support Files/CRNotifications/Classes/CRNotification.swift @@ -43,8 +43,8 @@ internal class CRNotification: UIView { internal init() { let deviceWidth = min(UIScreen.main.bounds.width, UIScreen.main.bounds.height) - let widthFactor: CGFloat = DeviceManager.value(iPhone35: 0.9, iPhone40: 0.9, iPhone47: 0.9, iPhone55: 0.85, iPhone58: 0.9, iPadSmall: 0.5, iPadMedium: 0.45, iPadBig: 0.4) - let heightFactor: CGFloat = DeviceManager.value(iPhone35: 0.2, iPhone40: 0.2, iPhone47: 0.2, iPhone55: 0.2, iPhone58: 0.2, iPadSmall: 0.18, iPadMedium: 0.17, iPadBig: 0.17) + let widthFactor: CGFloat = DeviceManager.value(iPhone35: 0.9, iPhone40: 0.9, iPhone47: 0.9, iPhone55: 0.85, iPhone58: 0.9, iPhone61: 0.9, iPadSmall: 0.5, iPadMedium: 0.45, iPadBig: 0.4) + let heightFactor: CGFloat = DeviceManager.value(iPhone35: 0.22, iPhone40: 0.22, iPhone47: 0.2, iPhone55: 0.2, iPhone58: 0.18, iPhone61: 0.18, iPadSmall: 0.18, iPadMedium: 0.17, iPadBig: 0.17) let width = deviceWidth * widthFactor let height = width * heightFactor @@ -82,8 +82,8 @@ internal class CRNotification: UIView { ]) NSLayoutConstraint.activate([ - titleLabel.topAnchor.constraint(greaterThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 6), - titleLabel.topAnchor.constraint(lessThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 2), + titleLabel.topAnchor.constraint(lessThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 6), + titleLabel.topAnchor.constraint(greaterThanOrEqualTo: titleLabel.superview!.topAnchor, constant: 2), titleLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: 8), titleLabel.trailingAnchor.constraint(equalTo: titleLabel.superview!.trailingAnchor, constant: -8) ]) @@ -97,8 +97,7 @@ internal class CRNotification: UIView { } private func setupTargets() { - NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil) - + NotificationCenter.default.addObserver(self, selector: #selector(didRotate), name: UIDevice.orientationDidChangeNotification, object: nil) let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.dismissNotification)) let swipeRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(self.dismissNotification)) swipeRecognizer.direction = .up @@ -157,7 +156,7 @@ internal class CRNotification: UIView { /** Animates in the notification **/ internal func showNotification() { - UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.68, initialSpringVelocity: 0.1, options: UIViewAnimationOptions(), animations: { + UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 0.68, initialSpringVelocity: 0.1, options: UIView.AnimationOptions(), animations: { self.frame.origin.y = self.topInset() + 10 }) } diff --git a/Pods/Target Support Files/CRNotifications/Classes/DeviceManager.swift b/Pods/Target Support Files/CRNotifications/Classes/DeviceManager.swift index e9152ce..dc09827 100644 --- a/Pods/Target Support Files/CRNotifications/Classes/DeviceManager.swift +++ b/Pods/Target Support Files/CRNotifications/Classes/DeviceManager.swift @@ -46,6 +46,16 @@ // iPhone58 // 1125x2436 (375x812) // - iPhone X +// - iPhone XS +// +// iPhone61 +// 828x1792 (414x896) +// - iPhone XR +// +// iPhone 65 +// 1242x2688 (414x896) +// - iPhone XS Max +// // // ---------------------------------------------------- // Created by Casper Riboe on 21/07/2017. @@ -78,8 +88,10 @@ internal class DeviceManager { return .iPhone55 case CGSize(width: 621.0, height: 1104.0): return .iPhone55 - case CGSize(width: 562.5, height: 1218.0): - return .iPhone58 + case CGSize(width: 562.5, height: 1218.0): + return .iPhone58 + case CGSize(width: 414.0, height: 896.0): + return .iPhone61 case CGSize(width: 384.0, height: 512.0): return .iPadSmall case CGSize(width: 768.0, height: 1024.0): @@ -94,7 +106,7 @@ internal class DeviceManager { } /// Returns a value based on the current iPhone device. - internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T) -> T { + internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPhone61: T) -> T { switch device() { case .iPhone35: return iPhone35 @@ -104,6 +116,8 @@ internal class DeviceManager { return iPhone47 case .iPhone55: return iPhone55 + case .iPhone61: + return iPhone61 default: return iPhone58 } @@ -122,7 +136,7 @@ internal class DeviceManager { } /// Returns a value based on the current iPhone or iPad device. - internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPadSmall: T, iPadMedium: T, iPadBig: T) -> T { + internal static func value(iPhone35: T, iPhone40: T, iPhone47: T, iPhone55: T, iPhone58: T, iPhone61: T, iPadSmall: T, iPadMedium: T, iPadBig: T) -> T { switch device() { case .iPhone35: return iPhone35 @@ -134,22 +148,30 @@ internal class DeviceManager { return iPhone55 case .iPhone58: return iPhone58 + case .iPhone61: + return iPhone61 case .iPadSmall: return iPadSmall case .iPadMedium: return iPadMedium + case .iPadBig: + return iPadBig default: - return iPadBig + if UIDevice.current.userInterfaceIdiom == .pad { + return iPadBig + } else { + return iPhone55 + } } } /// Returns a value based on the current iPhone or iPad device. internal static func value(iPhone: T, iPad: T) -> T { - return value(iPhone35: iPhone, iPhone40: iPhone, iPhone47: iPhone, iPhone55: iPhone, iPhone58: iPhone, iPadSmall: iPad, iPadMedium: iPad, iPadBig: iPad) + return value(iPhone35: iPhone, iPhone40: iPhone, iPhone47: iPhone, iPhone55: iPhone, iPhone58: iPhone, iPhone61: iPhone, iPadSmall: iPad, iPadMedium: iPad, iPadBig: iPad) } internal static func value(iPhoneX: T, other: T) -> T { - return value(iPhone35: other, iPhone40: other, iPhone47: other, iPhone55: other, iPhone58: iPhoneX, iPadSmall: other, iPadMedium: other, iPadBig: other) + return value(iPhone35: other, iPhone40: other, iPhone47: other, iPhone55: other, iPhone58: iPhoneX, iPhone61: iPhoneX, iPadSmall: other, iPadMedium: other, iPadBig: other) } } @@ -161,6 +183,7 @@ internal enum Device { case iPhone47 case iPhone55 case iPhone58 + case iPhone61 case iPadSmall case iPadMedium From 340ad7635d835e2408fedf18417a2cba06fa9ebb Mon Sep 17 00:00:00 2001 From: dkcas11 Date: Tue, 11 Dec 2018 21:00:09 +0100 Subject: [PATCH 8/8] Bumped version to 1.1.7 --- CRNotifications.podspec | 2 +- CRNotificationsExample/Info.plist | 2 +- Pods/Target Support Files/CRNotifications/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CRNotifications.podspec b/CRNotifications.podspec index aa24f39..14a648d 100644 --- a/CRNotifications.podspec +++ b/CRNotifications.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'CRNotifications' - s.version = '1.1.6' + s.version = '1.1.7' s.summary = 'Custom in-app notifications.' s.description = <<-DESC diff --git a/CRNotificationsExample/Info.plist b/CRNotificationsExample/Info.plist index 419d28c..c898d2f 100644 --- a/CRNotificationsExample/Info.plist +++ b/CRNotificationsExample/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.6 + 1.1.7 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/Pods/Target Support Files/CRNotifications/Info.plist b/Pods/Target Support Files/CRNotifications/Info.plist index 552f63e..f187429 100644 --- a/Pods/Target Support Files/CRNotifications/Info.plist +++ b/Pods/Target Support Files/CRNotifications/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.1.6 + 1.1.7 CFBundleSignature ???? CFBundleVersion