Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from sauvignon1989/feature/upgrade-tvos14
Browse files Browse the repository at this point in the history
Feature/upgrade tvos14
  • Loading branch information
bemyae authored Sep 30, 2020
2 parents 9a4b29d + 3cffc06 commit 2405158
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 93 deletions.
8 changes: 5 additions & 3 deletions Alibili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1020;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = "Xiaonan Zhang";
TargetAttributes = {
CA00AC5422D1DE82005ECFFE = {
Expand Down Expand Up @@ -822,6 +822,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -884,6 +885,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -932,7 +934,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.zephyr1989.Alibili;
PRODUCT_BUNDLE_IDENTIFIER = com.zephyr.Alibili;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Alibili/Alibili-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -961,7 +963,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.zephyr1989.Alibili;
PRODUCT_BUNDLE_IDENTIFIER = com.zephyr.Alibili;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Alibili/Alibili-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
2 changes: 1 addition & 1 deletion Alibili.xcodeproj/xcshareddata/xcschemes/Alibili.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
32 changes: 32 additions & 0 deletions Alibili/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import UIKit
import AVFoundation

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -16,6 +17,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
RootViewNavigator().updateRootViewController()

// let audioSession = AVAudioSession.sharedInstance()
//
// do {
// try audioSession.setCategory(.playback, mode: .default, policy: .default)
//// try audioSession.overrideOutputAudioPort(AVAudioSession.Port.airPlay)
// try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
//
// for outputPort in audioSession.currentRoute.outputs {
//// if outputPort.portType == AVAudioSession.Port.airPlay {
//// return true
//// }
// print(outputPort.portName)
// print(outputPort.portType)
// }
//
// } catch {
// print("fail to set audio session route sharing policy: \(error)")
// }

return true
}

Expand All @@ -35,6 +56,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

// let session = AVAudioSession.sharedInstance()
// do {
// try session.setCategory(.playback, mode: .moviePlayback, policy: .longFormAudio)
// try session.overrideOutputAudioPort(.none)
// try session.setActive(true)
// print("outputs: \(session.currentRoute.outputs)")
//// session.setOutputDataSource(AVAudioSessionDataSourceDescription?)
// } catch {
// print("error: \(error)")
// }
}

func applicationWillTerminate(_ application: UIApplication) {
Expand Down
38 changes: 20 additions & 18 deletions Alibili/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="16097.3" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="JV8-5P-XJg">
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="17156" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="JV8-5P-XJg">
<device id="appleTV" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<deployment identifier="tvOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -22,7 +23,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="CollectionViewCell" id="jV8-Ep-fvi" customClass="CollectionViewCell" customModule="Alibili" customModuleProvider="target">
<rect key="frame" x="90" y="0.0" width="0.0" height="0.0"/>
<rect key="frame" x="80" y="0.0" width="0.0" height="0.0"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -76,8 +77,8 @@
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="Ru8-7Y-r2f"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<navigationItem key="navigationItem" id="pYT-Kz-Lfr"/>
<connections>
Expand Down Expand Up @@ -112,7 +113,7 @@
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" sectionHeaderHeight="7" sectionFooterHeight="7" translatesAutoresizingMaskIntoConstraints="NO" id="M7a-nx-2pg">
<rect key="frame" x="1209" y="68" width="605" height="465"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="PartTableCell" textLabel="BhY-Ls-BsR" rowHeight="83" style="IBUITableViewCellStyleDefault" id="iX7-ed-IMi">
<rect key="frame" x="0.0" y="80" width="605" height="83"/>
Expand All @@ -122,7 +123,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="BhY-Ls-BsR">
<rect key="frame" x="20" y="0.0" width="565" height="83"/>
<rect key="frame" x="30" y="0.0" width="545" height="83"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="38"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -161,8 +162,8 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="9TY-k0-M6k"/>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<navigationItem key="navigationItem" id="3Z9-jf-Wxy"/>
<connections>
Expand Down Expand Up @@ -208,21 +209,21 @@
<tableViewSection id="L6e-ba-OWK">
<cells>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="9sS-93-COo" detailTextLabel="ckx-yE-b3f" rowHeight="130" style="IBUITableViewCellStyleValue1" id="z01-l6-IaY" userLabel="Uname">
<rect key="frame" x="110" y="0.0" width="488" height="130"/>
<rect key="frame" x="100" y="0.0" width="498" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="z01-l6-IaY" id="ldS-py-Doh">
<rect key="frame" x="0.0" y="0.0" width="488" height="130"/>
<rect key="frame" x="0.0" y="0.0" width="498" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9sS-93-COo">
<rect key="frame" x="20" y="31" width="257" height="69"/>
<rect key="frame" x="20" y="31" width="256" height="69"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ckx-yE-b3f">
<rect key="frame" x="346" y="40" width="122" height="58"/>
<rect key="frame" x="356" y="40" width="122" height="58"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
<nil key="textColor"/>
Expand All @@ -235,14 +236,14 @@
</accessibility>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="VPm-3j-rJK" rowHeight="130" style="IBUITableViewCellStyleDefault" id="WBQ-vg-K8b" userLabel="Resolution">
<rect key="frame" x="110" y="144" width="488" height="130"/>
<rect key="frame" x="100" y="144" width="498" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="WBQ-vg-K8b" id="Hjy-gc-rCe">
<rect key="frame" x="0.0" y="0.0" width="488" height="130"/>
<rect key="frame" x="0.0" y="0.0" width="498" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Resolution" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="VPm-3j-rJK">
<rect key="frame" x="20" y="0.0" width="448" height="130"/>
<rect key="frame" x="20" y="0.0" width="458" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<nil key="textColor"/>
Expand All @@ -252,14 +253,14 @@
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="iSc-A7-0zd" rowHeight="130" style="IBUITableViewCellStyleDefault" id="eTD-k3-uED" userLabel="Logout">
<rect key="frame" x="110" y="288" width="488" height="130"/>
<rect key="frame" x="100" y="288" width="498" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="eTD-k3-uED" id="KBM-Ep-Pwe">
<rect key="frame" x="0.0" y="0.0" width="488" height="130"/>
<rect key="frame" x="0.0" y="0.0" width="498" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Logout" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iSc-A7-0zd">
<rect key="frame" x="20" y="0.0" width="448" height="130"/>
<rect key="frame" x="20" y="0.0" width="458" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -332,8 +333,8 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="STc-gB-V6H"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<connections>
<outlet property="qrcodeImageView" destination="0V3-UL-Dgr" id="FHv-6M-mpR"/>
Expand Down Expand Up @@ -567,6 +568,7 @@
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="JNO-CA-QB7"/>
<segue reference="Fzq-JT-ydk"/>
</inferredMetricsTieBreakers>
</document>
43 changes: 43 additions & 0 deletions Alibili/CellDataItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct CellDataItem: Codable, Equatable {
var title :String
var aid :String
var videoDetail: VideoDetail
var bangumi: Bangumi

init(jsonData:JSON) {
self.cid = jsonData["cid"].stringValue
Expand All @@ -24,6 +25,7 @@ struct CellDataItem: Codable, Equatable {
self.aid = jsonData["aid"].stringValue
self.title = jsonData["title"].stringValue
self.videoDetail = VideoDetail(jsonData: jsonData)
self.bangumi = Bangumi(jsonData: jsonData["bangumi"])
}
}

Expand Down Expand Up @@ -80,6 +82,47 @@ struct Owner : Codable{
self.face = jsonData["face"].stringValue
}
}
struct Season : Codable{
var season_id:Int
var title:String
var season_status:String
var is_finish:String
var total_count:String
var newest_ep_id:String
var newest_ep_index:String
var season_type:String

init(jsonData:JSON) {
self.season_id = jsonData["season_id"].int ?? -1
self.title = jsonData["title"].stringValue
self.season_status = jsonData["season_status"].stringValue
self.is_finish = jsonData["is_finish"].stringValue
self.total_count = jsonData["total_count"].stringValue
self.newest_ep_id = jsonData["newest_ep_id"].stringValue
self.newest_ep_index = jsonData["newest_ep_index"].stringValue
self.season_type = jsonData["season_type"].stringValue
}
}

struct Bangumi: Codable{
var ep_id:Int
var title:String
var long_title:String
var episode_status:String
var season:Season
var cover:String

init(jsonData:JSON) {
self.ep_id = jsonData["ep_id"].int ?? -1
self.title = jsonData["title"].stringValue
self.long_title = jsonData["long_title"].stringValue
self.episode_status = jsonData["episode_status"].stringValue
self.season = Season(jsonData: jsonData["season"])
self.cover = jsonData["cover"].stringValue
}
}



// MARK: Equatable

Expand Down
Loading

0 comments on commit 2405158

Please sign in to comment.