-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainViewController.swift
131 lines (111 loc) · 5.74 KB
/
MainViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import UIKit
import AppTrackingTransparency
class MainViewController: BaseViewController {
@IBOutlet weak var vodButton: UIButton!
@IBOutlet weak var liveButton: UIButton!
@IBOutlet weak var liveNoSeekButton: UIButton!
@IBOutlet weak var vodExtensionButton: UIButton!
@IBOutlet weak var liveExtensionButton: UIButton!
@IBOutlet weak var liveNoSeekExtensionButton: UIButton!
@IBOutlet weak var contentButton: UIButton!
@IBOutlet weak var webSdkButton: UIButton!
@IBOutlet weak var vodAdsButton: UIButton!
@IBOutlet weak var liveAdsButton: UIButton!
@IBOutlet weak var liveAdsExtensionButton: UIButton!
@IBOutlet weak var liveTimeShiftedButton: UIButton!
@IBOutlet weak var liveTimeShiftedExtensionButton: UIButton!
@IBOutlet weak var liveAdsBitmovinButton: UIButton!
@IBOutlet weak var vodBitmovinButton: UIButton!
@IBOutlet weak var liveNoSeekBitmovinButton: UIButton!
@IBOutlet weak var liveBitmovinButton: UIButton!
@IBOutlet weak var vodAdsBitmovinButton: UIButton!
@IBOutlet weak var vodBitmovinExtensionButton: UIButton!
@IBOutlet weak var vodAdsBitmovinExtensionButton: UIButton!
@IBOutlet weak var liveBitmovinExtensionButton: UIButton!
@IBOutlet weak var liveNoSeekBitmovinExtensionButton: UIButton!
@IBOutlet weak var LiveAdsBitmovinExtensionButton: UIButton!
@IBOutlet weak var bitmovinExtensionStackView: UIStackView!
@IBOutlet weak var bitmovinStackView: UIStackView!
@IBOutlet weak var idfaButton: UIButton!
@IBOutlet weak var optInSwitch: UISwitch!
@IBOutlet weak var vodIMAExtensionButton: UIButton!
@IBOutlet weak var bitmovinButton: UIButton!
@IBAction func didTapSwitchButton(_ sender: Any) {
let defaults = UserDefaults.standard
defaults.set(optInSwitch.isOn, forKey: "optin")
print(optInSwitch.isOn)
}
@IBAction func didTapIDFAButton(_ sender: UIButton) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization() { status in
switch status {
case .authorized:
print("authorized")
case .notDetermined:
break
case .restricted:
break
case .denied:
break
@unknown default:
break
}
}
} else {
// Fallback on earlier versions
}
idfaButton.isHidden = true
}
@IBOutlet weak var manualStackView: UIStackView!
@IBOutlet weak var extensionStackView: UIStackView!
override func viewDidLoad() {
super.viewDidLoad()
styleUI()
}
private func styleUI() {
setNavigationBarTitle(title: "S2S Demo App for iOS")
vodButton.setUpLayer(button: vodButton, title: "Video on Demand")
liveButton.setUpLayer(button: liveButton, title: "LIVE")
liveNoSeekButton.setUpLayer(button: liveNoSeekButton, title: "LIVE (No Seek)")
liveTimeShiftedButton.setUpLayer(button: liveTimeShiftedButton, title: "Live TimeShift")
vodAdsButton.setUpLayer(button: vodAdsButton, title: "VoD IMA")
liveAdsButton.setUpLayer(button: liveAdsButton, title: "LIVE IMA")
liveAdsExtensionButton.setUpLayer(button: liveAdsExtensionButton, title: "LIVE IMA")
vodIMAExtensionButton.setUpLayer(button: vodIMAExtensionButton, title: "VoD IMA ")
vodExtensionButton.setUpLayer(button: vodExtensionButton, title: "Video on Demand")
liveTimeShiftedExtensionButton.setUpLayer(button: liveTimeShiftedExtensionButton, title: "Live Timeshifted")
liveExtensionButton.setUpLayer(button: liveExtensionButton, title: "LIVE")
liveNoSeekExtensionButton.setUpLayer(button: liveNoSeekExtensionButton, title: "LIVE (No Seek)")
contentButton.setUpLayer(button: contentButton, title: "Content")
webSdkButton.setUpLayer(button: webSdkButton, title: "Web Sdk")
liveAdsBitmovinButton.setUpLayer(button: liveAdsBitmovinButton, title: "Live Ads")
vodBitmovinButton.setUpLayer(button: vodBitmovinButton, title: "VoD")
liveNoSeekBitmovinButton.setUpLayer(button: liveNoSeekBitmovinButton, title: "Live No Seek")
liveBitmovinButton.setUpLayer(button: liveBitmovinButton, title: "Live")
vodAdsBitmovinButton.setUpLayer(button: vodAdsBitmovinButton, title: "VoD Ads")
vodBitmovinExtensionButton.setUpLayer(button: vodBitmovinExtensionButton, title: "VoD")
vodAdsBitmovinExtensionButton.setUpLayer(button: vodAdsBitmovinExtensionButton, title: "VoD ads")
liveBitmovinExtensionButton.setUpLayer(button: liveBitmovinExtensionButton, title: "Live")
liveNoSeekBitmovinExtensionButton.setUpLayer(button: liveNoSeekBitmovinExtensionButton, title: "Live no seek")
LiveAdsBitmovinExtensionButton.setUpLayer(button: LiveAdsBitmovinExtensionButton, title: "Live Ads")
let defaults = UserDefaults.standard
optInSwitch.isOn = defaults.bool(forKey: "optin")
if #available(iOS 14, *) {
idfaButton.isHidden = ATTrackingManager.trackingAuthorizationStatus != .notDetermined
} else {
// Fallback on earlier versions
}
}
@IBAction func showBitmovinExtension(_ sender: Any) {
bitmovinExtensionStackView.isHidden = !bitmovinExtensionStackView.isHidden
}
@IBAction func showBitmovin(_ sender: Any) {
bitmovinStackView.isHidden = !bitmovinStackView.isHidden
}
@IBAction func showManualImplementaion(_ sender: Any) {
manualStackView.isHidden = !manualStackView.isHidden
}
@IBAction func showExtensionImplementation(_ sender: Any) {
extensionStackView.isHidden = !extensionStackView.isHidden
}
}