Merge branch 'main' into PangMo5/refactoring-2

This commit is contained in:
Kwangmin Bae 2021-06-19 08:55:46 +09:00 committed by GitHub
commit a4b1fe0294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 160 additions and 16 deletions

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic_cast_connected_white_24dp-2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cast_connected_white_24dp-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cast_connected_white_24dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic_cast0_white_24dp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cast0_white_24dp-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cast0_white_24dp-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic_cast1_white_24dp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cast1_white_24dp-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cast1_white_24dp-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic_cast2_white_24dp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cast2_white_24dp-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cast2_white_24dp-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic_cast_white_24dp.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_cast_white_24dp-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_cast_white_24dp-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

View File

@ -141,24 +141,14 @@ extension View {
@main
struct JellyfinPlayerApp: App {
let persistenceController = PersistenceController.shared
func test_cast() {
let scanner = CastDeviceScanner()
NotificationCenter.default.addObserver(forName: CastDeviceScanner.deviceListDidChange, object: scanner, queue: nil) { _ in
dump(scanner.devices)
}
scanner.startScanning()
}
var body: some Scene {
WindowGroup {
SplashView()
.environment(\.managedObjectContext, persistenceController.container.viewContext)
.withHostingWindow { window in
window?.rootViewController = PreferenceUIHostingController(wrappedView: SplashView().environment(\.managedObjectContext, persistenceController.container.viewContext))
}.onAppear(perform: test_cast)
}
}
}
}

View File

@ -110,7 +110,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="riN-y1-ABZ">
<rect key="frame" x="801" y="24" width="56" height="56"/>
<rect key="frame" x="817" y="32" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" image="gear" catalog="system">
@ -130,6 +130,20 @@
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="highlightedColor" systemColor="labelColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="XVc-27-uDe" userLabel="Cast Button">
<rect key="frame" x="766" y="32" width="40" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<imageReference key="image" image="CastDisconnected"/>
<preferredSymbolConfiguration key="preferredSymbolConfiguration" scale="large"/>
</state>
<connections>
<action selector="castButtonPressed:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="LwK-pi-uQ2"/>
<action selector="settingsButtonTapped:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="snD-hW-TSY"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.5954241071428571" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<gestureRecognizers/>
@ -173,6 +187,7 @@
</constraints>
</view>
<connections>
<outlet property="castButton" destination="XVc-27-uDe" id="FII-I9-nHf"/>
<outlet property="jumpBackButton" destination="bYM-Xp-bZO" id="K2u-5Q-dkm"/>
<outlet property="jumpForwardButton" destination="An8-jF-FAY" id="4hN-YB-yVd"/>
<outlet property="mainActionButton" destination="t2L-Oz-fe9" id="nQR-2e-64l"/>
@ -196,10 +211,11 @@
</connections>
</tapGestureRecognizer>
</objects>
<point key="canvasLocation" x="129.38388625592415" y="72.307692307692307"/>
<point key="canvasLocation" x="129.24107142857142" y="71.014492753623188"/>
</scene>
</scenes>
<resources>
<image name="CastDisconnected" width="20" height="20"/>
<image name="chevron.backward" catalog="system" width="96" height="128"/>
<image name="gear" catalog="system" width="128" height="119"/>
<image name="gobackward.15" catalog="system" width="121" height="128"/>

View File

@ -50,7 +50,8 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
@IBOutlet weak var jumpBackButton: UIButton!
@IBOutlet weak var jumpForwardButton: UIButton!
@IBOutlet weak var playerSettingsButton: UIButton!
@IBOutlet weak var castButton: UIButton!
var shouldShowLoadingScreen: Bool = false
var ssTargetValueOffset: Int = 0
var ssStartValue: Int = 0
@ -172,7 +173,11 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
self.mainActionButton.setImage(UIImage(systemName: "play"), for: .normal)
}
}
@IBAction func castButtonPressed(_ sender: Any) {
}
func settingsPopoverDismissed() {
optionsVC?.dismiss(animated: true, completion: nil)
self.mediaPlayer.play()
@ -273,7 +278,24 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
UIDevice.current.setValue(value, forKey: "orientation")
}
}
func mediaHasStartedPlaying() {
let scanner = CastDeviceScanner()
NotificationCenter.default.addObserver(forName: CastDeviceScanner.deviceListDidChange, object: scanner, queue: nil) { _ in
dump(scanner.devices)
if(!scanner.devices.isEmpty) {
self.castButton.isEnabled = true;
self.castButton.setImage(UIImage(named: "CastDisconnected"), for: .normal)
} else {
self.castButton.isEnabled = false;
self.castButton.setImage(nil, for: .normal)
}
}
scanner.startScanning()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
overrideUserInterfaceStyle = .dark
@ -430,6 +452,7 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
mediaPlayer.currentVideoSubTitleIndex = selectedCaptionTrack
mediaPlayer.pause()
mediaPlayer.play()
self.mediaHasStartedPlaying()
})
.store(in: &cancellables)
}