Added Notificatio Navigations

This commit is contained in:
2024-08-05 17:37:06 +05:30
parent c8ec96a832
commit 72bd8dd3f2
12 changed files with 262 additions and 126 deletions

View File

@@ -22,7 +22,7 @@ class GamesWebViewVC: UIViewController {
appDelegate.deviceOrientation = .landscapeRight
let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
rotateToLandsScapeDevice()
// rotateToLandsScapeDevice()
}
guard let url else{return}
@@ -34,31 +34,10 @@ class GamesWebViewVC: UIViewController {
webView.load(request)
}
func rotateToLandsScapeDevice(){
// let appDelegate = UIApplication.shared.delegate as! AppDelegate
// appDelegate.myOrientation = .landscapeRight
// if #available(iOS 16.0, *) {
// let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
// windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: UIInterfaceOrientationMask.landscapeRight))
// } else {
// UIDevice.current.setValue(UIInterfaceOrientationMask.landscapeRight.rawValue, forKey: "orientation")
// }
// UIView.setAnimationsEnabled(true)
}
func rotateToPotraitScapeDevice(){
// let appDelegate = UIApplication.shared.delegate as! AppDelegate
// appDelegate.myOrientation = .portrait
// if #available(iOS 16.0, *) {
// let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
// windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: UIInterfaceOrientationMask.portrait))
// } else {
// UIDevice.current.setValue(UIInterfaceOrientationMask.landscapeRight.rawValue, forKey: "orientation")
// }
//// UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
// UIView.setAnimationsEnabled(true)
}
// func rotateView(to angle: CGFloat) {
// // Apply rotation to the view's transform
// view.transform = CGAffineTransform(rotationAngle: angle)
// }
@IBAction func backBtnTapped(_ sender: UIButton) {
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
@@ -67,17 +46,20 @@ class GamesWebViewVC: UIViewController {
vcPush.contentLabel = "Clicking \"OK\" will exit you from the game. Are you sure you want to proceed?"
vcPush.yesBtnText = "OK"
vcPush.noBtnText = "Cancel"
vcPush.onDoneBlock = { mode in
vcPush.onDoneBlock = { [weak self] mode in
guard let self else{return}
switch mode{
case .yes:
appDelegate.deviceOrientation = .portrait
if orientation == .landscape{
appDelegate.deviceOrientation = .portrait
let value = UIInterfaceOrientation.portrait.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}else{
Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false) { _ in
self.dismiss(animated: true)
}
}
let value = UIInterfaceOrientation.portrait.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
UIViewController.attemptRotationToDeviceOrientation()
// Timer.scheduledTimer(withTimeInterval: 1, repeats: false) { _ in
// self.dismiss(animated: true)
// }
case .no:
print("no")
}
@@ -100,8 +82,8 @@ class GamesWebViewVC: UIViewController {
private func checkOrientation() {
let isPortrait = UIScreen.main.bounds.size.width < UIScreen.main.bounds.size.height
if isPortrait {
print("Device is in portrait mode")
Timer.scheduledTimer(withTimeInterval: 0.4, repeats: false) { _ in
// print("Device is in portrait mode")
Timer.scheduledTimer(withTimeInterval: 0.8, repeats: false) { _ in
self.dismiss(animated: true)
}
} else {