Skip to content

Commit

Permalink
version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
sheiladoherty-dolby committed Sep 23, 2024
1 parent bca42f6 commit ba06577
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 37 deletions.
1 change: 1 addition & 0 deletions interactive-player/Interactive Viewer/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ struct Constants {
// Demo stream name and account ID
static let streamName = "multiview"
static let accountID = "k9Mwad"
static let sdkVersion = "2.0.0"
}
14 changes: 14 additions & 0 deletions interactive-player/Interactive Viewer/Utils/Bundle+Version.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Bundle+Version.swift
//

import Foundation

public extension Bundle {
var releaseVersionNumber: String? {
return infoDictionary?["CFBundleShortVersionString"] as? String
}
var buildVersionNumber: String? {
return infoDictionary?["CFBundleVersion"] as? String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,60 @@ struct SettingsScreen<Content: View>: View {
}
.hidden()

List {
moreSettings

Toggle(isOn: Binding<Bool>(
get: { viewModel.showSourceLabels },
set: { viewModel.setShowSourceLabels($0) })
) {
Text(
"settings.show-source-labels.label",
bundle: .main,
style: .titleMedium,
font: .custom("AvenirNext-Regular", size: FontSize.body)
VStack {
List {
moreSettings

Toggle(isOn: Binding<Bool>(
get: { viewModel.showSourceLabels },
set: { viewModel.setShowSourceLabels($0) })
) {
Text(
"settings.show-source-labels.label",
bundle: .main,
style: .titleMedium,
font: .custom("AvenirNext-Regular", size: FontSize.body)
)
}

SettingsCell(text: "settings.default-multiview-layout.label",
textColor: .white,
value: viewModel.mutliviewSelectedLabelKey,
valueColor: .gray,
image: .textLink,
bundle: .main,
action: { isShowingMultiviewScreen = true }
)

SettingsCell(text: "settings.stream-sort-order.label",
textColor: .white,
value: viewModel.streamSortOrderSelectedLabelKey,
image: .textLink,
bundle: .main,
action: { isShowingStreamSortOrderScreen = true }
)

SettingsCell(text: "settings.audio-selection.label",
textColor: .white,
value: viewModel.audioSelectedLabelKey,
image: .textLink,
bundle: .main,
action: { isShowingAudioSelectionScreen = true }
)
}

SettingsCell(text: "settings.default-multiview-layout.label",
textColor: .white,
value: viewModel.mutliviewSelectedLabelKey,
valueColor: .gray,
image: .textLink,
bundle: .main,
action: { isShowingMultiviewScreen = true }
)
Spacer()

SettingsCell(text: "settings.stream-sort-order.label",
textColor: .white,
value: viewModel.streamSortOrderSelectedLabelKey,
image: .textLink,
bundle: .main,
action: { isShowingStreamSortOrderScreen = true }
Text(
"\(viewModel.appVersion)",
style: .bodyMedium,
font: .custom("AvenirNext-Regular", size: FontSize.body)
)

SettingsCell(text: "settings.audio-selection.label",
textColor: .white,
value: viewModel.audioSelectedLabelKey,
image: .textLink,
bundle: .main,
action: { isShowingAudioSelectionScreen = true }
Text(
"\(viewModel.sdkVersion)",
style: .bodyMedium,
font: .custom("AvenirNext-Regular", size: FontSize.body)
)
}
.environment(\.defaultMinListRowHeight, Layout.spacing6x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ 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 Down Expand Up @@ -54,6 +57,13 @@ final class SettingsViewModel: ObservableObject {
streamSortOrderSelectedLabelKey = "place.holder"
audioSelectedLabelKey = "place.holder"

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

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

setupSettingsObservers()
}

Expand Down
4 changes: 4 additions & 0 deletions interactive-player/RTSViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
896AECC02C812225002CD12D /* V1toV2.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 896AECBF2C812225002CD12D /* V1toV2.xcmappingmodel */; };
89C391E22CA218CC00861FD5 /* Bundle+Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89C391E12CA218CC00861FD5 /* Bundle+Version.swift */; };
B6376BC22A1C4120007AD9D9 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6376BC12A1C4120007AD9D9 /* Constants.swift */; };
E82112CE2C2A33150003DBF7 /* VideoQuality.swift in Sources */ = {isa = PBXBuildFile; fileRef = E82112CB2C2A33140003DBF7 /* VideoQuality.swift */; };
E82112CF2C2A33150003DBF7 /* StreamSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = E82112CA2C2A33140003DBF7 /* StreamSettings.swift */; };
Expand Down Expand Up @@ -91,6 +92,7 @@
/* Begin PBXFileReference section */
3FE90C1B26B2AF4200B206A3 /* RTSViewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTSViewer.swift; sourceTree = "<group>"; };
896AECBF2C812225002CD12D /* V1toV2.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; path = V1toV2.xcmappingmodel; sourceTree = "<group>"; };
89C391E12CA218CC00861FD5 /* Bundle+Version.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Version.swift"; sourceTree = "<group>"; };
B6376BC12A1C4120007AD9D9 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
E8067F482A329F680083E94B /* InteractiveVieweriOSFirebaseReleaseSettings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = InteractiveVieweriOSFirebaseReleaseSettings.xcconfig; sourceTree = "<group>"; };
E82112C72C2A330C0003DBF7 /* PiPManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiPManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -405,6 +407,7 @@
E87FD1822AD8E1EF00E9164A /* DateProvider.swift */,
E87FD1842AD8E1EF00E9164A /* Task+Delayed.swift */,
E8B4B14B2ADD03DF003DDA44 /* URL+LogPath.swift */,
89C391E12CA218CC00861FD5 /* Bundle+Version.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -600,6 +603,7 @@
E821130F2C2A37900003DBF7 /* LiveIndicatorViewModel.swift in Sources */,
E83CD9F92A10878C008690FD /* StreamDetailInputScreen.swift in Sources */,
E846A8A22C785D220052D6C8 /* V2MigrationPolicy.swift in Sources */,
89C391E22CA218CC00861FD5 /* Bundle+Version.swift in Sources */,
E82112CF2C2A33150003DBF7 /* StreamSettings.swift in Sources */,
E82112D82C2A331C0003DBF7 /* UserDefaultsBacked.swift in Sources */,
E82112D12C2A33150003DBF7 /* StreamDetail.swift in Sources */,
Expand Down
8 changes: 8 additions & 0 deletions rts-viewer-tvos/RTSViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
6D61A9FC299DBC30004CAF9E /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D61A9FA299DBC30004CAF9E /* ErrorView.swift */; };
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 @@ -95,6 +97,8 @@
6D61A9FA299DBC30004CAF9E /* ErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorView.swift; sourceTree = "<group>"; };
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 @@ -232,6 +236,8 @@
E89D288F2C747AFE002254AB /* SerialTasks.swift */,
E83CDA4F2A1092A3008690FD /* ImageAsset.swift */,
E8752B50298C7D02002D5C2B /* DateProvider.swift */,
89C391E32CA21D9500861FD5 /* Bundle+Version.swift */,
89C391E52CA21E1300861FD5 /* Constants.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -564,6 +570,7 @@
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 All @@ -576,6 +583,7 @@
6D6382B92977BCAE00DF4DA7 /* StatisticsView.swift in Sources */,
E844ABED296DA5B20067B78C /* StreamingView.swift in Sources */,
E83CDA3D2A10917A008690FD /* NavigationHeaderView.swift in Sources */,
89C391E42CA21D9500861FD5 /* Bundle+Version.swift in Sources */,
E8BA8E102991CB0E0043DEE1 /* StreamingViewModel.swift in Sources */,
E8C776D92C2BEEA5002DE392 /* VideoQuality.swift in Sources */,
631DD25826F1E18E0023D24A /* ContentView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
//

import DolbyIOUIKit
import SwiftUI
import RTSCore
import SwiftUI

struct StreamDetailInputView: View {

@State private var streamName: String = ""
@State private var accountID: String = ""

Expand All @@ -21,7 +20,6 @@ struct StreamDetailInputView: View {
var body: some View {
BackgroundContainerView {
ZStack {

/*
NavigationLink - Adds an unnecessary padding across its containing view -
so screen navigations are not visually rendered - but only used for programmatic navigation
Expand All @@ -47,6 +45,23 @@ struct StreamDetailInputView: View {
)

Spacer()
HStack(spacing: Layout.spacing6x) {
DolbyIOUIKit.Text(
text: "\(viewModel.appVersion)",
font: .avenirNextRegular(
withStyle: .caption,
size: FontSize.caption1
)
)

DolbyIOUIKit.Text(
text: "\(viewModel.sdkVersion)",
font: .avenirNextRegular(
withStyle: .caption,
size: FontSize.caption1
)
)
}
FooterView(text: "stream-detail-input.footnote.label")
.padding(.bottom, Layout.spacing3x)
}
Expand All @@ -63,7 +78,7 @@ struct StreamDetailInputView: View {
}
.navigationHeaderView()
.navigationBarHidden(true)
.alert("stream-detail-input.credentials-error.label", isPresented: $isShowingErrorAlert) { }
.alert("stream-detail-input.credentials-error.label", isPresented: $isShowingErrorAlert) {}
.alert("stream-detail-input.clear-streams.label", isPresented: $isShowingClearStreamsAlert, actions: {
Button(
"stream-detail-input.clear-streams.alert.clear.button",
Expand Down Expand Up @@ -151,7 +166,6 @@ private struct StreamDetailInputBox: View {
}

VStack(spacing: Layout.spacing3x) {

TextField("stream-detail-input.streamName.placeholder.label", text: $streamName)
.onReceive(streamName.publisher) { _ in
streamName = String(streamName.prefix(64))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ final class StreamDetailInputViewModel: ObservableObject {
}
@Published private(set) var hasSavedStreams: Bool = false

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

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

if let version = Bundle.main.releaseVersionNumber,
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
Expand Down
14 changes: 14 additions & 0 deletions rts-viewer-tvos/RTSViewer/Utils/Bundle+Version.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Bundle+Version.swift
//

import Foundation

public extension Bundle {
var releaseVersionNumber: String? {
return infoDictionary?["CFBundleShortVersionString"] as? String
}
var buildVersionNumber: String? {
return infoDictionary?["CFBundleVersion"] as? String
}
}
9 changes: 9 additions & 0 deletions rts-viewer-tvos/RTSViewer/Utils/Constants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// Constants.swift
//

import Foundation

enum Constants {
static let sdkVersion = "2.0.0"
}

0 comments on commit ba06577

Please sign in to comment.