|
@@ -220,7 +220,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
|
checkCounter()
|
|
|
}
|
|
|
|
|
|
- func getiPhoneModel() -> String {
|
|
|
+ static func getiPhoneModel() -> String {
|
|
|
var systemInfo = utsname()
|
|
|
uname(&systemInfo)
|
|
|
let machineMirror = Mirror(reflecting: systemInfo.machine)
|
|
@@ -240,7 +240,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
|
return model
|
|
|
}
|
|
|
|
|
|
- func mapToDevice(identifier: String) -> String? {
|
|
|
+ static func mapToDevice(identifier: String) -> String? {
|
|
|
// Add mappings for iPhone models as needed
|
|
|
switch identifier {
|
|
|
case "iPhone1,1", "iPhone1,2", "iPhone2,1", "iPhone3,1", "iPhone3,2", "iPhone3,3", "iPhone4,1", "iPhone5,1", "iPhone5,2", "iPhone5,3", "iPhone5,4", "iPhone6,1", "iPhone6,2", "iPhone7,1", "iPhone7,2", "iPhone8,1", "iPhone8,2", "iPhone8,4", "iPhone9,1", "iPhone9,2", "iPhone9,3", "iPhone9,4", "iPhone10,1", "iPhone10,2", "iPhone10,4", "iPhone10,5": return "iPhone under X"
|
|
@@ -439,46 +439,47 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
|
}
|
|
|
|
|
|
func createMidFloatingButton(){
|
|
|
- ViewController.chatButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80, width: 45, height: 45))
|
|
|
+ var minYIpX: CGFloat = 0
|
|
|
+ let iPhoneModel = ViewController.getiPhoneModel()
|
|
|
+ if iPhoneModel == "iPhone X or newer" {
|
|
|
+ minYIpX += 20
|
|
|
+ }
|
|
|
+ ViewController.chatButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80 - minYIpX, width: 45, height: 45))
|
|
|
ViewController.chatButton.setBackgroundImage(UIImage(named: "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal), for: .normal)
|
|
|
ViewController.chatButton.layer.shadowColor = UIColor.black.cgColor
|
|
|
ViewController.chatButton.layer.shadowOpacity = 0.1
|
|
|
ViewController.chatButton.layer.shadowOffset = CGSize(width: 4, height: 4)
|
|
|
ViewController.chatButton.addTarget(self, action: #selector(chatTap), for: .touchUpInside)
|
|
|
|
|
|
- ViewController.callButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80, width: 45, height: 45))
|
|
|
+ ViewController.callButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80 - minYIpX, width: 45, height: 45))
|
|
|
ViewController.callButton.setBackgroundImage(UIImage(named: "pb_button_call", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal), for: .normal)
|
|
|
ViewController.callButton.layer.shadowColor = UIColor.black.cgColor
|
|
|
ViewController.callButton.layer.shadowOpacity = 0.1
|
|
|
ViewController.callButton.layer.shadowOffset = CGSize(width: 4, height: 4)
|
|
|
ViewController.callButton.addTarget(self, action: #selector(callTap), for: .touchUpInside)
|
|
|
|
|
|
- ViewController.ccButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80, width: 45, height: 45))
|
|
|
+ ViewController.ccButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80 - minYIpX, width: 45, height: 45))
|
|
|
ViewController.ccButton.setBackgroundImage(UIImage(named: "pb_button_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal), for: .normal)
|
|
|
ViewController.ccButton.layer.shadowColor = UIColor.black.cgColor
|
|
|
ViewController.ccButton.layer.shadowOpacity = 0.1
|
|
|
ViewController.ccButton.layer.shadowOffset = CGSize(width: 4, height: 4)
|
|
|
ViewController.ccButton.addTarget(self, action: #selector(ccTap), for: .touchUpInside)
|
|
|
|
|
|
- ViewController.streamingButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80, width: 45, height: 45))
|
|
|
+ ViewController.streamingButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80 - minYIpX, width: 45, height: 45))
|
|
|
ViewController.streamingButton.setBackgroundImage(UIImage(named: "pb_button_stream", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal), for: .normal)
|
|
|
ViewController.streamingButton.layer.shadowColor = UIColor.black.cgColor
|
|
|
ViewController.streamingButton.layer.shadowOpacity = 0.1
|
|
|
ViewController.streamingButton.layer.shadowOffset = CGSize(width: 4, height: 4)
|
|
|
ViewController.streamingButton.addTarget(self, action: #selector(streamTap), for: .touchUpInside)
|
|
|
|
|
|
- ViewController.postButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80, width: 45, height: 45))
|
|
|
+ ViewController.postButton = UIButton(frame: CGRect(x: self.view.bounds.width / 2 - 22.5 , y: self.view.bounds.height - 80 - minYIpX, width: 45, height: 45))
|
|
|
ViewController.postButton.setBackgroundImage(UIImage(named: "pb_button_post", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal), for: .normal)
|
|
|
ViewController.postButton.layer.shadowColor = UIColor.black.cgColor
|
|
|
ViewController.postButton.layer.shadowOpacity = 0.1
|
|
|
ViewController.postButton.layer.shadowOffset = CGSize(width: 4, height: 4)
|
|
|
ViewController.postButton.addTarget(self, action: #selector(postTap), for: .touchUpInside)
|
|
|
let buttonCenterX = self.view.bounds.width / 2
|
|
|
- var buttonCenterY = self.view.bounds.height - self.tabBar.bounds.height
|
|
|
- let iPhoneModel = getiPhoneModel()
|
|
|
- if iPhoneModel == "iPhone X or newer" {
|
|
|
- buttonCenterY -= 30
|
|
|
- }
|
|
|
+ let buttonCenterY = self.view.bounds.height - self.tabBar.bounds.height - (iPhoneModel == "iPhone X or newer" ? 30 : 0)
|
|
|
//print("buttonCenterX \(buttonCenterX)")
|
|
|
//print("buttonCenterY \(buttonCenterY)")
|
|
|
ViewController.middleButton = UIButton(frame: CGRect(x: buttonCenterX - 40 , y: buttonCenterY - 40, width: 80, height: 80))
|
|
@@ -1189,6 +1190,11 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
|
if ViewController.alwaysHideButton && !ViewController.isExpandButton {
|
|
|
return
|
|
|
}
|
|
|
+ var minYIpX: CGFloat = 0
|
|
|
+ let iPhoneModel = getiPhoneModel()
|
|
|
+ if iPhoneModel == "iPhone X or newer" {
|
|
|
+ minYIpX += 20
|
|
|
+ }
|
|
|
if ViewController.isExpandButton {
|
|
|
ViewController.isExpandButton = false
|
|
|
let xChatPosition = ViewController.chatButton.frame.origin.x + 90
|
|
@@ -1209,11 +1215,11 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
|
// if !ViewController.isBlue {
|
|
|
// ViewController.middleButton.transform = CGAffineTransform(rotationAngle: 0)
|
|
|
// }
|
|
|
- ViewController.chatButton.frame.origin = CGPoint(x: xChatPosition, y: yChatPosition)
|
|
|
- ViewController.callButton.frame.origin = CGPoint(x: xCallPosition, y: yCallPosition)
|
|
|
- ViewController.ccButton.frame.origin = CGPoint(x: xCCPosition, y: yCCPosition)
|
|
|
- ViewController.streamingButton.frame.origin = CGPoint(x: xStreamingPosition, y: yStreamingPosition)
|
|
|
- ViewController.postButton.frame.origin = CGPoint(x: xPostPosition, y: yPostPosition)
|
|
|
+ ViewController.chatButton.frame.origin = CGPoint(x: xChatPosition, y: yChatPosition + minYIpX)
|
|
|
+ ViewController.callButton.frame.origin = CGPoint(x: xCallPosition, y: yCallPosition + minYIpX)
|
|
|
+ ViewController.ccButton.frame.origin = CGPoint(x: xCCPosition, y: yCCPosition + minYIpX)
|
|
|
+ ViewController.streamingButton.frame.origin = CGPoint(x: xStreamingPosition, y: yStreamingPosition + minYIpX)
|
|
|
+ ViewController.postButton.frame.origin = CGPoint(x: xPostPosition, y: yPostPosition + minYIpX)
|
|
|
})
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
|
|
|
if !ViewController.isExpandButton {
|
|
@@ -1241,11 +1247,11 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
|
// if !ViewController.isBlue{
|
|
|
// ViewController.middleButton.transform = CGAffineTransform(rotationAngle: .pi / 2)
|
|
|
// }
|
|
|
- ViewController.chatButton.frame.origin = CGPoint(x: xChatPosition, y: yChatPosition)
|
|
|
- ViewController.callButton.frame.origin = CGPoint(x: xCallPosition, y: yCallPosition)
|
|
|
- ViewController.ccButton.frame.origin = CGPoint(x: xCCPosition, y: yCCPosition)
|
|
|
- ViewController.streamingButton.frame.origin = CGPoint(x: xStreamingPosition, y: yStreamingPosition)
|
|
|
- ViewController.postButton.frame.origin = CGPoint(x: xPostPosition, y: yPostPosition)
|
|
|
+ ViewController.chatButton.frame.origin = CGPoint(x: xChatPosition, y: yChatPosition - minYIpX)
|
|
|
+ ViewController.callButton.frame.origin = CGPoint(x: xCallPosition, y: yCallPosition - minYIpX)
|
|
|
+ ViewController.ccButton.frame.origin = CGPoint(x: xCCPosition, y: yCCPosition - minYIpX)
|
|
|
+ ViewController.streamingButton.frame.origin = CGPoint(x: xStreamingPosition, y: yStreamingPosition - minYIpX)
|
|
|
+ ViewController.postButton.frame.origin = CGPoint(x: xPostPosition, y: yPostPosition - minYIpX)
|
|
|
})
|
|
|
}
|
|
|
}
|