Commit f7cf9364 authored by Quentin Muret's avatar Quentin Muret Committed by Kateryna Kostiuk

code cleaning: remove switches used to know if the device is an iPhone X

- replace switches for detecting if the device is an iPhone X by using 
the hasnotch boolean of the UIdevice extension

Change-Id: Ic5a0386bb9d7273b05a53a460c0844f97db821b8
Reviewed-by: Kateryna Kostiuk<kateryna.kostiuk@savoirfairelinux.com>
parent 95213577
......@@ -233,11 +233,9 @@ class ConversationViewController: UIViewController,
var heightOffset = CGFloat(0.0)
if keyboardHeight != self.messageAccessoryView.frame.height {
let device = UIDevice.modelName
switch device {
case "iPhone X", "iPhone XS", "iPhone XS Max", "iPhone XR" :
if UIDevice.current.hasNotch {
heightOffset = -55
default :
} else {
heightOffset = -20
}
self.view.addGestureRecognizer(keyboardDismissTapRecognizer)
......@@ -287,12 +285,10 @@ class ConversationViewController: UIViewController,
}
var dnlabelYOffset: CGFloat
let device = UIDevice.modelName
switch device {
case "iPhone X", "iPhone XS", "iPhone XS Max", "iPhone XR" :
if UIDevice.current.hasNotch {
dnlabelYOffset = 4
userNameYOffset = 20
default :
} else {
dnlabelYOffset = -2
userNameYOffset = 12
}
......
......@@ -64,12 +64,10 @@ class ScanViewController: UIViewController, StoryboardBased, AVCaptureMetadataOu
override func viewDidLoad() {
super.viewDidLoad()
let device = UIDevice.modelName
switch device {
case "iPhone X", "iPhone XS", "iPhone XS Max", "iPhone XR" :
if UIDevice.current.hasNotch {
self.bottomMarginTitleConstraint.constant = 45
self.bottomCloseButtonConstraint.constant = 17
default :
} else {
self.bottomMarginTitleConstraint.constant = 35
self.bottomCloseButtonConstraint.constant = 25
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment