Skip to content

Commit

Permalink
Merge branch 'release/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Allui committed Jan 14, 2023
2 parents 516b227 + 2d12b40 commit 6f1bff9
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 31 deletions.
5 changes: 0 additions & 5 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ disabled_rules: # rule identifiers to exclude from running
- nesting
opt_in_rules: # some rules are only opt-in
# Find all the available rules by running:
- empty_count
- force_cast
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
Expand All @@ -21,16 +20,12 @@ excluded: # paths to ignore during linting. Takes precedence over `included`.
# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
empty_count: warning
function_parameter_count:
- 7
- 8
cyclomatic_complexity:
- 10
- 22
functional_body_lenght:
- 40
- 50
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
Expand Down
19 changes: 14 additions & 5 deletions Anilibria.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
46B82AAF2971A2DE003E450B /* YandexMobileMetrica.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 46B82AA929718FB9003E450B /* YandexMobileMetrica.xcframework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
46B82AB12971A2E0003E450B /* YandexMobileMetricaCrashes.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46B82AAA29718FB9003E450B /* YandexMobileMetricaCrashes.xcframework */; platformFilter = ios; };
46B82AB22971A2E0003E450B /* YandexMobileMetricaCrashes.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 46B82AAA29718FB9003E450B /* YandexMobileMetricaCrashes.xcframework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
46F8FA9029731B49002B792B /* UIInterfaceOrientationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46F8FA8F29731B49002B792B /* UIInterfaceOrientationExtension.swift */; };
478A6478D7BA4AB1DDDE943D972AF32F /* MRCommentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02207B1DF4B17181B8FAA6CB086229E /* MRCommentsView.swift */; };
4880C22723DACE23006FABE1 /* MacApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 4880C22623DACE23006FABE1 /* MacApp.m */; };
4880C22C23DAD192006FABE1 /* MacBundle.bundle in Embed PlugIns */ = {isa = PBXBuildFile; fileRef = 4880C21F23DACDCD006FABE1 /* MacBundle.bundle */; platformFilter = maccatalyst; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
Expand Down Expand Up @@ -425,6 +426,7 @@
46A4DAB62917DF82003944FD /* LeftAlignedCollectionViewFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftAlignedCollectionViewFlowLayout.swift; sourceTree = "<group>"; };
46B82AA929718FB9003E450B /* YandexMobileMetrica.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = YandexMobileMetrica.xcframework; sourceTree = "<group>"; };
46B82AAA29718FB9003E450B /* YandexMobileMetricaCrashes.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = YandexMobileMetricaCrashes.xcframework; sourceTree = "<group>"; };
46F8FA8F29731B49002B792B /* UIInterfaceOrientationExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIInterfaceOrientationExtension.swift; sourceTree = "<group>"; };
4880C21F23DACDCD006FABE1 /* MacBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MacBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
4880C22123DACDCD006FABE1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4880C22523DACE23006FABE1 /* MacApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MacApp.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1423,6 +1425,7 @@
C799EBDB22DECA0A00C6BD9B /* UserDefaultsExtension.swift */,
46945633291680EC00145F48 /* ArrayExtension.swift */,
469456392916B50600145F48 /* UIControlExtension.swift */,
46F8FA8F29731B49002B792B /* UIInterfaceOrientationExtension.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -2053,8 +2056,8 @@
C7D4634222CC790900E763DF /* Lint */,
4880C22F23DAD192006FABE1 /* Embed PlugIns */,
F0D43917EF804CB5A3F71795 /* [CP] Embed Pods Frameworks */,
46B82AAD2971956B003E450B /* Strip Script */,
46B82AB02971A2DE003E450B /* Embed Frameworks */,
46B82AAD2971956B003E450B /* Strip Script */,
);
buildRules = (
);
Expand Down Expand Up @@ -2177,6 +2180,7 @@
/* Begin PBXShellScriptBuildPhase section */
46B82AAD2971956B003E450B /* Strip Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -2396,6 +2400,7 @@
C78394E322CFA8F800ACC353 /* ScheduleRequest.swift in Sources */,
C7D462E922CC74EF00E763DF /* AttributeStringBuilder.swift in Sources */,
C7326BBB234CE70D00E194C1 /* CheckRequest.swift in Sources */,
46F8FA9029731B49002B792B /* UIInterfaceOrientationExtension.swift in Sources */,
C7D462FC22CC74EF00E763DF /* BackendRepository.swift in Sources */,
C7D462E222CC74EF00E763DF /* CAPropertyAnimation+Key.swift in Sources */,
C7D462E722CC74EF00E763DF /* Logger.swift in Sources */,
Expand Down Expand Up @@ -2780,7 +2785,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Anilibria/Anilibria.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = 9P3CNK2626;
INFOPLIST_FILE = "$(SRCROOT)/Anilibria/Resources/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Anilibria;
Expand All @@ -2790,10 +2795,12 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.2.1;
PRODUCT_BUNDLE_IDENTIFIER = tv.anilibria.anilibria;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -2806,7 +2813,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Anilibria/Anilibria.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEVELOPMENT_TEAM = 9P3CNK2626;
INFOPLIST_FILE = "$(SRCROOT)/Anilibria/Resources/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Anilibria;
Expand All @@ -2816,11 +2823,13 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.2.1;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = tv.anilibria.anilibria;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ open class BaseNavigationController: UINavigationController {
open override var preferredStatusBarStyle: UIStatusBarStyle {
return self.viewControllers.last?.preferredStatusBarStyle ?? .default
}

// MARK: - Orientation

open override var shouldAutorotate: Bool {
return false
}

open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}

open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return .portrait
}
}

extension BaseNavigationController: UIGestureRecognizerDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ protocol PlayerRoute {
extension PlayerRoute where Self: RouterProtocol {
func openPlayer(series: Series) {
let module = PlayerAssembly.createModule(series: series, parent: self)
ModalRouter(target: module, parent: nil)
.set(level: .statusBar)
module.modalPresentationStyle = .fullScreen
ModalRouter(target: module, parent: self.controller)
.move()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ final class PlayerViewController: BaseViewController {
private let timeFormatter = FormatterFactory.time.create()
private var canUpdateTime: Bool = true
private var playlist: [PlaylistItem] = []
private var currentQuality: VideoQuality = .fullHd
private var currentIndex: Int = 0
private var currentTime: Double = 0
private var bag: AnyCancellable?
private var pipObservation: Any?

private var currentQuality: VideoQuality = .fullHd
private var orientation: UIInterfaceOrientationMask = .all

private let rewindTimes: [Double] = [-15, -5, 5, 15]

private var uiIsVisible: Bool = true {
Expand Down Expand Up @@ -69,7 +71,7 @@ final class PlayerViewController: BaseViewController {
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillAppear(animated)
super.viewWillDisappear(animated)
self.saveState()
#if targetEnvironment(macCatalyst)
let window = UIApplication.getWindow()
Expand Down Expand Up @@ -242,11 +244,11 @@ final class PlayerViewController: BaseViewController {
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .all
return orientation
}

override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return.portrait
return .from(mask: orientation)
}

override var prefersHomeIndicatorAutoHidden: Bool {
Expand All @@ -266,7 +268,12 @@ final class PlayerViewController: BaseViewController {
}

@IBAction func closeAction(_ sender: Any) {
UIDevice.current.set(orientation: .portrait)
self.orientation = .portrait
if #available(iOS 16.0, *) {
self.setNeedsUpdateOfSupportedInterfaceOrientations()
} else {
UIViewController.attemptRotationToDeviceOrientation()
}
self.handler.back()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ final class ScheduleViewController: BaseCollectionViewController {

extension ScheduleViewController: ScheduleViewBehavior {
func set(items: [Schedule]) {
let sections = items.reduce([any SectionAdapterProtocol]()) { _, item in
[SectionAdapter([TitleCellAdapter(viewModel: item.title)]),
ScheduleSeriesSectionAdapter(
item.items.map { ScheduleSeriesCellAdapter(viewModel: $0, seclect: { [weak self] series in
self?.handler.select(series: series)
})}
)]
let sections = items.reduce([any SectionAdapterProtocol]()) { result, item in
result + [SectionAdapter([TitleCellAdapter(viewModel: item.title)]),
ScheduleSeriesSectionAdapter(
item.items.map { ScheduleSeriesCellAdapter(viewModel: $0, seclect: { [weak self] series in
self?.handler.select(series: series)
})}
)]
}

self.reload(sections: sections)
Expand Down
21 changes: 21 additions & 0 deletions Anilibria/Extensions/UIInterfaceOrientationExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// UIInterfaceOrientationExtension.swift
// Anilibria
//
// Created by Ivan Morozov on 14.01.2023.
// Copyright © 2023 Иван Морозов. All rights reserved.
//

import UIKit

extension UIInterfaceOrientation {
static func from(mask: UIInterfaceOrientationMask) -> UIInterfaceOrientation {
switch mask {
case .landscapeLeft: return .landscapeLeft
case .landscapeRight: return .landscapeRight
case .portrait: return .portrait
case .portraitUpsideDown: return .portraitUpsideDown
default: return .portrait
}
}
}
7 changes: 0 additions & 7 deletions Anilibria/Extensions/UIViewExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ extension UIView {
}
}

extension UIDevice {
func set(orientation: UIInterfaceOrientation) {
let value = orientation.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
}
}

extension UIApplication {
static var keyWindowSize: CGSize {
guard let window = getWindow() else {
Expand Down

0 comments on commit 6f1bff9

Please sign in to comment.