Remove strong self references
This commit is contained in:
parent
fdea0d4573
commit
1389b54b98
|
@ -33,7 +33,7 @@ struct HostingWindowFinder: UIViewRepresentable {
|
||||||
func makeUIView(context: Context) -> UIView {
|
func makeUIView(context: Context) -> UIView {
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
DispatchQueue.main.async { [weak view] in
|
DispatchQueue.main.async { [weak view] in
|
||||||
self.callback(view?.window)
|
callback(view?.window)
|
||||||
}
|
}
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ struct ContentView: View {
|
||||||
if(!needsToSelectServer && !isSignInErrored) {
|
if(!needsToSelectServer && !isSignInErrored) {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
ScrollView() {
|
ScrollView() {
|
||||||
Spacer().frame(height: self.isPortrait ? 0 : 15)
|
Spacer().frame(height: isPortrait ? 0 : 15)
|
||||||
ContinueWatchingView()
|
ContinueWatchingView()
|
||||||
NextUpView().padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
|
NextUpView().padding(EdgeInsets(top: 4, leading: 0, bottom: 0, trailing: 0))
|
||||||
ForEach(librariesShowRecentlyAdded, id: \.self) { library_id in
|
ForEach(librariesShowRecentlyAdded, id: \.self) { library_id in
|
||||||
|
@ -377,7 +377,7 @@ struct ContentView: View {
|
||||||
Image(systemName: "gear")
|
Image(systemName: "gear")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.popover( isPresented: self.$showSettingsPopover, arrowEdge: .bottom) { SettingsView(close: $showSettingsPopover).environmentObject(self.globalData) }
|
}.popover( isPresented: $showSettingsPopover, arrowEdge: .bottom) { SettingsView(close: $showSettingsPopover).environmentObject(globalData) }
|
||||||
}
|
}
|
||||||
.tabItem({
|
.tabItem({
|
||||||
Text("Home")
|
Text("Home")
|
||||||
|
@ -406,10 +406,10 @@ struct ContentView: View {
|
||||||
} else {
|
} else {
|
||||||
Text("Signing in...")
|
Text("Signing in...")
|
||||||
.onAppear(perform: {
|
.onAppear(perform: {
|
||||||
DispatchQueue.main.async { [self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
_viewDidLoad.wrappedValue = false
|
_viewDidLoad.wrappedValue = false
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
self.jsi.did = false;
|
self?.jsi.did = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct EpisodeItemView: View {
|
||||||
|
|
||||||
init(item: ResumeItem) {
|
init(item: ResumeItem) {
|
||||||
self.item = item;
|
self.item = item;
|
||||||
self.fullItem = DetailItem();
|
fullItem = DetailItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
func lockOrientations() {
|
func lockOrientations() {
|
||||||
|
|
|
@ -121,7 +121,7 @@ struct MovieItemView: View {
|
||||||
|
|
||||||
init(item: ResumeItem) {
|
init(item: ResumeItem) {
|
||||||
self.item = item;
|
self.item = item;
|
||||||
self.fullItem = DetailItem();
|
fullItem = DetailItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
func lockOrientations() {
|
func lockOrientations() {
|
||||||
|
|
|
@ -34,8 +34,8 @@ extension String {
|
||||||
|
|
||||||
return "\(padString)\(self)"
|
return "\(padString)\(self)"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlayerDemo: View {
|
struct PlayerDemo: View {
|
||||||
@EnvironmentObject var globalData: GlobalData
|
@EnvironmentObject var globalData: GlobalData
|
||||||
var item: DetailItem;
|
var item: DetailItem;
|
||||||
|
@ -55,7 +55,7 @@ struct PlayerDemo: View {
|
||||||
@State private var captionConfiguration: Bool = false {
|
@State private var captionConfiguration: Bool = false {
|
||||||
didSet {
|
didSet {
|
||||||
if(captionConfiguration == false) {
|
if(captionConfiguration == false) {
|
||||||
DispatchQueue.global(qos: .userInitiated).async { [self] in
|
DispatchQueue.global(qos: .userInitiated).async { _ in
|
||||||
vlcplayer.pause()
|
vlcplayer.pause()
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
vlcplayer.play()
|
vlcplayer.play()
|
||||||
|
@ -205,7 +205,7 @@ struct PlayerDemo: View {
|
||||||
|
|
||||||
func startStream() {
|
func startStream() {
|
||||||
_streamLoading.wrappedValue = true;
|
_streamLoading.wrappedValue = true;
|
||||||
let request = RestRequest(method: .post, url: (globalData.server?.baseURI ?? "") + "/Items/\(item.Id)/PlaybackInfo?UserId=\(globalData.user?.user_id ?? "")&StartTimeTicks=\(item.Progress)&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=70000000")
|
let request = RestRequest(method: .post, url: (globalData.server?.baseURI ?? "") + "/Items/\(item.Id)/PlaybackInfo?UserId=\(globalData.user?.user_id ?? "")&StartTimeTicks=\(Int(item.Progress))&IsPlayback=true&AutoOpenLiveStream=true&MaxStreamingBitrate=70000000")
|
||||||
request.headerParameters["X-Emby-Authorization"] = globalData.authHeader
|
request.headerParameters["X-Emby-Authorization"] = globalData.authHeader
|
||||||
request.contentType = "application/json"
|
request.contentType = "application/json"
|
||||||
request.acceptType = "application/json"
|
request.acceptType = "application/json"
|
||||||
|
@ -251,8 +251,8 @@ struct PlayerDemo: View {
|
||||||
_isPlaying.wrappedValue = true;
|
_isPlaying.wrappedValue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.global(qos: .userInteractive).async { [self] in
|
DispatchQueue.global(qos: .userInteractive).async { [weak self] in
|
||||||
self.keepUpWithPlayerState()
|
self?.keepUpWithPlayerState()
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
||||||
|
@ -361,8 +361,8 @@ struct PlayerDemo: View {
|
||||||
let videoDuration = Double(vlcplayer.time.intValue + abs(vlcplayer.remainingTime.intValue))
|
let videoDuration = Double(vlcplayer.time.intValue + abs(vlcplayer.remainingTime.intValue))
|
||||||
if(bool == true) {
|
if(bool == true) {
|
||||||
vlcplayer.pause()
|
vlcplayer.pause()
|
||||||
DispatchQueue.global(qos: .userInitiated).async { [self] in
|
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
|
||||||
self.processScrubbingState()
|
self?.processScrubbingState()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Scrub is value from 0..1 - find position in video and add / or remove.
|
//Scrub is value from 0..1 - find position in video and add / or remove.
|
||||||
|
@ -390,6 +390,11 @@ struct PlayerDemo: View {
|
||||||
.onAppear(perform: startStream)
|
.onAppear(perform: startStream)
|
||||||
.navigationBarHidden(true)
|
.navigationBarHidden(true)
|
||||||
.navigationBarBackButtonHidden(true)
|
.navigationBarBackButtonHidden(true)
|
||||||
|
.prefersHomeIndicatorAutoHidden(true)
|
||||||
|
.preferredColorScheme(.dark)
|
||||||
|
.introspectTabBarController { (UITabBarController) in
|
||||||
|
UITabBarController.tabBar.isHidden = true
|
||||||
|
}
|
||||||
.statusBar(hidden: true)
|
.statusBar(hidden: true)
|
||||||
.edgesIgnoringSafeArea(.all)
|
.edgesIgnoringSafeArea(.all)
|
||||||
.onTapGesture(perform: resetTimer)
|
.onTapGesture(perform: resetTimer)
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct SeasonItemView: View {
|
||||||
@State private var hasAppearedOnce: Bool = false;
|
@State private var hasAppearedOnce: Bool = false;
|
||||||
init(item: ResumeItem) {
|
init(item: ResumeItem) {
|
||||||
self.item = item;
|
self.item = item;
|
||||||
self.fullItem = DetailItem();
|
fullItem = DetailItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadData() {
|
func loadData() {
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct SeriesItemView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
LoadingView(isShowing: $isLoading) {
|
LoadingView(isShowing: $isLoading) {
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
Grid(tracks: self.tracks, spacing: GridSpacing(horizontal: 0, vertical: 20)) {
|
Grid(tracks: tracks, spacing: GridSpacing(horizontal: 0, vertical: 20)) {
|
||||||
ForEach(items, id: \.Id) { item in
|
ForEach(items, id: \.Id) { item in
|
||||||
NavigationLink(destination: ItemView(item: item )) {
|
NavigationLink(destination: ItemView(item: item )) {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
|
@ -131,7 +131,7 @@ struct SeriesItemView: View {
|
||||||
}.frame(width: 100)
|
}.frame(width: 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer().frame(height: 2).gridSpan(column: self.isPortrait ? 3 : 6)
|
Spacer().frame(height: 2).gridSpan(column: isPortrait ? 3 : 6)
|
||||||
}.gridContentMode(.scroll)
|
}.gridContentMode(.scroll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,8 @@ class PlayerUIView: UIView, VLCMediaPlayerDelegate {
|
||||||
func videoSetup() {
|
func videoSetup() {
|
||||||
if(lastUrl == nil || lastUrl?.videoUrl != url.wrappedValue.videoUrl) {
|
if(lastUrl == nil || lastUrl?.videoUrl != url.wrappedValue.videoUrl) {
|
||||||
lastUrl = url.wrappedValue
|
lastUrl = url.wrappedValue
|
||||||
print("update called")
|
|
||||||
print(self.url.wrappedValue.videoUrl)
|
|
||||||
mediaPlayer.wrappedValue.stop()
|
mediaPlayer.wrappedValue.stop()
|
||||||
mediaPlayer.wrappedValue.media = VLCMedia(url: self.url.wrappedValue.videoUrl)
|
mediaPlayer.wrappedValue.media = VLCMedia(url: url.wrappedValue.videoUrl)
|
||||||
self.url.wrappedValue.subtitles.forEach() { sub in
|
self.url.wrappedValue.subtitles.forEach() { sub in
|
||||||
if(sub.id != -1 && sub.delivery == "External") {
|
if(sub.id != -1 && sub.delivery == "External") {
|
||||||
mediaPlayer.wrappedValue.addPlaybackSlave(sub.url, type: .subtitle, enforce: false)
|
mediaPlayer.wrappedValue.addPlaybackSlave(sub.url, type: .subtitle, enforce: false)
|
||||||
|
@ -70,7 +68,7 @@ class PlayerUIView: UIView, VLCMediaPlayerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaPlayer.wrappedValue.perform(Selector(("setTextRendererFontSize:")), with: 14)
|
mediaPlayer.wrappedValue.perform(Selector(("setTextRendererFontSize:")), with: 14)
|
||||||
mediaPlayer.wrappedValue.perform(Selector(("setTextRendererFont:")), with: "Copperplate")
|
//mediaPlayer.wrappedValue.perform(Selector(("setTextRendererFont:")), with: "Copperplate")
|
||||||
mediaPlayer.wrappedValue.jumpForward(Int32(startTime/10000000))
|
mediaPlayer.wrappedValue.jumpForward(Int32(startTime/10000000))
|
||||||
mediaPlayer.wrappedValue.play()
|
mediaPlayer.wrappedValue.play()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue