Skip to content

Commit

Permalink
retrieve version from Millicast
Browse files Browse the repository at this point in the history
  • Loading branch information
sheiladoherty-dolby committed Sep 26, 2024
1 parent ba06577 commit 380f8f5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 46 deletions.
1 change: 0 additions & 1 deletion interactive-player/Interactive Viewer/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ struct Constants {
// Demo stream name and account ID
static let streamName = "multiview"
static let accountID = "k9Mwad"
static let sdkVersion = "2.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
//

import Combine
import Foundation
import DolbyIOUIKit
import Foundation
import MillicastSDK
import RTSCore
import SwiftUI

final class SettingsViewModel: ObservableObject {

let sdkVersion: String = "SDK Version \(MCLogger.getVersion())"
var appVersion: String = ""
private let settingsManager: SettingsManager
private let mode: SettingsMode

Expand All @@ -22,9 +24,6 @@ final class SettingsViewModel: ObservableObject {
}
}

@Published private(set) var appVersion: String = ""
@Published private(set) var sdkVersion: String = ""

@Published private(set) var showSourceLabels = StreamSettings.default.showSourceLabels
@Published private(set) var multiviewLayout = StreamSettings.default.multiviewLayout
@Published private(set) var streamSortOrder = StreamSettings.default.streamSortOrder
Expand All @@ -48,22 +47,21 @@ final class SettingsViewModel: ObservableObject {

switch mode {
case .global:
self.settingsScreenTitle = "settings.global.title.label"
settingsScreenTitle = "settings.global.title.label"
case .stream:
self.settingsScreenTitle = "settings.stream.title.label"
settingsScreenTitle = "settings.stream.title.label"
}

mutliviewSelectedLabelKey = "place.holder"
streamSortOrderSelectedLabelKey = "place.holder"
audioSelectedLabelKey = "place.holder"

if let version = Bundle.main.releaseVersionNumber,
let build = Bundle.main.buildVersionNumber {
let build = Bundle.main.buildVersionNumber
{
appVersion = "App Version \(version).\(build)"
}

sdkVersion = "SDK Version \(Constants.sdkVersion)"

setupSettingsObservers()
}

Expand Down Expand Up @@ -127,7 +125,6 @@ final class SettingsViewModel: ObservableObject {
}

extension SettingsViewModel {

private func setupSettingsObservers() {
settingsManager.publisher(for: mode)
.receive(on: DispatchQueue.main)
Expand All @@ -139,10 +136,10 @@ extension SettingsViewModel {
}

private func updateState(for settings: StreamSettings) {
self.showSourceLabels = settings.showSourceLabels
self.multiviewLayout = settings.multiviewLayout
self.streamSortOrder = settings.streamSortOrder
self.audioSelection = settings.audioSelection
showSourceLabels = settings.showSourceLabels
multiviewLayout = settings.multiviewLayout
streamSortOrder = settings.streamSortOrder
audioSelection = settings.audioSelection

updateMultiviewSelection()
updateStreamSortOrderSelection()
Expand Down Expand Up @@ -192,23 +189,24 @@ extension SettingsViewModel {
case .global:
items = [
.init(key: "audio-selection.first-source.label",
selected: audioSelection == .firstSource),
selected: audioSelection == .firstSource),
.init(key: "audio-selection.follow-video.label",
selected: audioSelection == .followVideo)]
selected: audioSelection == .followVideo)
]
default:
items = [
.init(key: "audio-selection.first-source.label",
selected: audioSelection == .firstSource),
selected: audioSelection == .firstSource),
.init(key: "audio-selection.follow-video.label",
selected: audioSelection == .followVideo),
selected: audioSelection == .followVideo),
.init(key: "audio-selection.main-source.label",
selected: audioSelection == .mainSource)
selected: audioSelection == .mainSource)
]

settings.audioSources.forEach {
items.append(
.init(key: LocalizedStringKey($0),
selected: audioSelection == .source(sourceId: $0))
selected: audioSelection == .source(sourceId: $0))
)
}
}
Expand Down
Binary file modified rts-viewer-tvos/.DS_Store
Binary file not shown.
4 changes: 0 additions & 4 deletions rts-viewer-tvos/RTSViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
6D61AA07299F51AC004CAF9E /* VideoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D61AA06299F51AC004CAF9E /* VideoView.swift */; };
6D6382B92977BCAE00DF4DA7 /* StatisticsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D6382B72977BCAE00DF4DA7 /* StatisticsView.swift */; };
89C391E42CA21D9500861FD5 /* Bundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89C391E32CA21D9500861FD5 /* Bundle+Version.swift */; };
89C391E62CA21E1300861FD5 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89C391E52CA21E1300861FD5 /* Constants.swift */; };
B696B5332987790B00831FFF /* PersistentSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = B696B5312987790B00831FFF /* PersistentSettings.swift */; };
E80E2BCB2C1010BE001733EA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E80E2BC82C1010BE001733EA /* Assets.xcassets */; };
E80E2BCC2C1010BE001733EA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E80E2BC92C1010BE001733EA /* Localizable.strings */; };
Expand Down Expand Up @@ -98,7 +97,6 @@
6D61AA06299F51AC004CAF9E /* VideoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoView.swift; sourceTree = "<group>"; };
6D6382B72977BCAE00DF4DA7 /* StatisticsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsView.swift; sourceTree = "<group>"; };
89C391E32CA21D9500861FD5 /* Bundle+Version.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Version.swift"; sourceTree = "<group>"; };
89C391E52CA21E1300861FD5 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
B696B5312987790B00831FFF /* PersistentSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistentSettings.swift; sourceTree = "<group>"; };
E80E2BC82C1010BE001733EA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
E80E2BC92C1010BE001733EA /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -237,7 +235,6 @@
E83CDA4F2A1092A3008690FD /* ImageAsset.swift */,
E8752B50298C7D02002D5C2B /* DateProvider.swift */,
89C391E32CA21D9500861FD5 /* Bundle+Version.swift */,
89C391E52CA21E1300861FD5 /* Constants.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -570,7 +567,6 @@
buildActionMask = 2147483647;
files = (
E83CDA512A1092A3008690FD /* ImageAsset.swift in Sources */,
89C391E62CA21E1300861FD5 /* Constants.swift in Sources */,
E8D5AE59299068E20019C132 /* StreamDetailInputViewModel.swift in Sources */,
E83CDA3A2A10917A008690FD /* FooterView.swift in Sources */,
E8BA8E202991EF3C0043DEE1 /* SettingsView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,38 @@

import Combine
import Foundation
import MillicastSDK
import RTSCore

@MainActor
final class StreamDetailInputViewModel: ObservableObject {
private let streamDataManager: StreamDataManagerProtocol

private var subscriptions: [AnyCancellable] = []

@Published private(set) var hasSavedStreams: Bool = false
@Published var streamDetails: [StreamDetail] = [] {
didSet {
hasSavedStreams = !streamDetails.isEmpty
}
}
@Published private(set) var hasSavedStreams: Bool = false

@Published private(set) var appVersion: String = ""
@Published private(set) var sdkVersion: String = ""
let sdkVersion = "SDK Version \(MCLogger.getVersion())"
var appVersion: String = ""
private let streamDataManager: StreamDataManagerProtocol
private var subscriptions: [AnyCancellable] = []

init(streamDataManager: StreamDataManagerProtocol = StreamDataManager.shared) {
self.streamDataManager = streamDataManager

if let version = Bundle.main.releaseVersionNumber,
let build = Bundle.main.buildVersionNumber {
let build = Bundle.main.buildVersionNumber
{
appVersion = "App Version \(version).\(build)"
}

sdkVersion = "SDK Version \(Constants.sdkVersion)"

streamDataManager.streamDetailsSubject
.receive(on: DispatchQueue.main)
.sink { [weak self] streamDetails in
self?.streamDetails = streamDetails
}
.store(in: &subscriptions)
.store(in: &subscriptions)
}

func checkIfCredentialsAreValid(streamName: String, accountID: String) -> Bool {
Expand Down
9 changes: 0 additions & 9 deletions rts-viewer-tvos/RTSViewer/Utils/Constants.swift

This file was deleted.

0 comments on commit 380f8f5

Please sign in to comment.