Skip to content

Commit f74c556

Browse files
committed
Add landscape rotation lock direction
1 parent ceebd8d commit f74c556

File tree

7 files changed

+40
-19
lines changed

7 files changed

+40
-19
lines changed

ccViewer/CryptCloudViewer.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@
748748
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
749749
CODE_SIGN_ENTITLEMENTS = ccViewer/ccViewer.entitlements;
750750
CODE_SIGN_STYLE = Automatic;
751-
CURRENT_PROJECT_VERSION = 69;
751+
CURRENT_PROJECT_VERSION = 70;
752752
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
753753
DEVELOPMENT_TEAM = 7A9X38B4YU;
754754
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
@@ -783,7 +783,7 @@
783783
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
784784
CODE_SIGN_ENTITLEMENTS = ccViewer/ccViewer.entitlements;
785785
CODE_SIGN_STYLE = Automatic;
786-
CURRENT_PROJECT_VERSION = 69;
786+
CURRENT_PROJECT_VERSION = 70;
787787
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
788788
DEVELOPMENT_TEAM = 7A9X38B4YU;
789789
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;

ccViewer/ccViewer/AppDelegate.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,3 @@ extension UIApplication {
178178
return controller2
179179
}
180180
}
181-
182-
extension UINavigationController {
183-
override open var shouldAutorotate: Bool {
184-
if UserDefaults.standard.bool(forKey: "MediaViewerRotation") {
185-
return false
186-
}
187-
return true
188-
}
189-
190-
override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
191-
if UserDefaults.standard.bool(forKey: "ForceLandscape") {
192-
return .landscapeLeft
193-
}
194-
return .all
195-
}
196-
}

ccViewer/ccViewer/CustomPlayerViewController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ extension AVPlayerViewController {
3131
}
3232
override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
3333
if UserDefaults.standard.bool(forKey: "ForceLandscape") {
34+
if UserDefaults.standard.bool(forKey: "LandscapeCameraLeft") {
35+
return .landscapeRight
36+
}
3437
return .landscapeLeft
3538
}
3639
return .all

ccViewer/ccViewer/NavigationControllerHide.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ class NavigationControllerHide: UINavigationController {
2424
return topViewController ?? super.childForStatusBarHidden
2525
}
2626

27+
override open var shouldAutorotate: Bool {
28+
if UserDefaults.standard.bool(forKey: "MediaViewerRotation") {
29+
return false
30+
}
31+
return true
32+
}
33+
34+
override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
35+
if UserDefaults.standard.bool(forKey: "ForceLandscape") {
36+
if UserDefaults.standard.bool(forKey: "LandscapeCameraLeft") {
37+
return .landscapeRight
38+
}
39+
return .landscapeLeft
40+
}
41+
return .all
42+
}
43+
2744
/*
2845
// MARK: - Navigation
2946

ccViewer/ccViewer/TableViewControllerSetting.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
8888
NSLocalizedString("Use PDF viewer", comment: ""),
8989
NSLocalizedString("Use Media viewer", comment: ""),
9090
NSLocalizedString("Lock rotation", comment: ""),
91-
NSLocalizedString("Force landscape", comment: "")],
91+
NSLocalizedString("Force landscape", comment: ""),
92+
NSLocalizedString("Landscape with camera left", comment: "")],
9293
[NSLocalizedString("Use FFmpeg Media viewer", comment: ""),
9394
NSLocalizedString("Prior Media viewer is FFmpeg", comment: "")],
9495
[NSLocalizedString("Save last play position", comment: ""),
@@ -182,6 +183,10 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
182183
aSwitch.isEnabled = UIDevice.current.userInterfaceIdiom == .phone
183184
aSwitch.isOn = UserDefaults.standard.bool(forKey: "ForceLandscape")
184185
aSwitch.tag = 11
186+
case 5:
187+
aSwitch.isEnabled = UIDevice.current.userInterfaceIdiom == .phone && UserDefaults.standard.bool(forKey: "ForceLandscape")
188+
aSwitch.isOn = UserDefaults.standard.bool(forKey: "LandscapeCameraLeft")
189+
aSwitch.tag = 15
185190
default:
186191
break
187192
}
@@ -361,12 +366,20 @@ class TableViewControllerSetting: UITableViewController, UITextFieldDelegate {
361366
present(v, animated: false) {
362367
v.dismiss(animated: false, completion: nil)
363368
}
369+
tableView.reloadData()
364370
case 12:
365371
UserDefaults.standard.set(value, forKey: "noOverlaySubtitles")
366372
case 13:
367373
UserDefaults.standard.set(value, forKey: "autoSelectStreams")
368374
case 14:
369375
UserDefaults.standard.set(value, forKey: "keepOpenWhenDone")
376+
case 15:
377+
UserDefaults.standard.set(value, forKey: "LandscapeCameraLeft")
378+
let v = UIViewController()
379+
v.modalPresentationStyle = .fullScreen
380+
present(v, animated: false) {
381+
v.dismiss(animated: false, completion: nil)
382+
}
370383
default:
371384
break
372385
}

ccViewer/ccViewer/ja.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"Use Media viewer" = "メディアで使用";
2525
"Lock rotation" = "画面回転をロックする";
2626
"Force landscape" = "強制的に横画面にする";
27+
"Landscape with camera left" = "横画面でカメラが左側";
2728
"Software decode" = "ソフトウエア デコーダー";
2829
"Use FFmpeg Media viewer" = "FFmpegプレーヤーを使用する";
2930
"Prior Media viewer is FFmpeg" = "優先してFFmpegを使用する";

ffplayer/ffplayer/playerView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ public class FFPlayerViewController: UIViewController {
353353

354354
override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
355355
if UserDefaults.standard.bool(forKey: "ForceLandscape") {
356+
if UserDefaults.standard.bool(forKey: "LandscapeCameraLeft") {
357+
return .landscapeRight
358+
}
356359
return .landscapeLeft
357360
}
358361
return .all

0 commit comments

Comments
 (0)