Skip to content

Commit 7111a70

Browse files
committed
Fix Bug where Disabled EmoitonKit was causing Crash due to missing Camera Capabilities
Squashed commit of the following: Author: Lara Marie Reimer <[email protected]> - Refactor - Make sure to check if enabled before starting thinking aloud and emotionkit
1 parent 747a404 commit 7111a70

19 files changed

+101
-43
lines changed

CUU.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'CUU'
11-
s.version = '2.0.3'
11+
s.version = '2.0.4'
1212
s.summary = 'CUU is a framework to help analyzing the usage of your applications.'
1313

1414
# This description is used to generate tags and improve search results.

CUU/Classes/CUU.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,12 @@ public class CUU {
126126

127127
featureKit.handleAdditionalCrumbActionsForFeatures(with: actionCrumb)
128128
}
129+
130+
static func isActivated(for kit: CUUStartOption) -> Bool {
131+
if let options = UserDefaults.standard.array(forKey: CUUConstants.CUUUserDefaultsKeys.optionsKey) as? [Int] {
132+
let values = options.map({ CUUStartOption(rawValue: $0) })
133+
return values.contains(kit)
134+
}
135+
return false
136+
}
129137
}

CUU/Classes/CUUCore/ViewControllers/CUUActivityViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUActivityViewController: UIActivityViewController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUCloudSharingController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUCloudSharingController: UICloudSharingController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUCollectionViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUCollectionViewController: UICollectionViewController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUDocumentBrowserViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUDocumentBrowserViewController: UIDocumentBrowserViewController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUDocumentPickerViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUDocumentPickerViewController: UIDocumentPickerViewController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUImagePickerController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUImagePickerController: UIImagePickerController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUNavigationController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUNavigationController: UINavigationController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

CUU/Classes/CUUCore/ViewControllers/CUUPageViewController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ open class CUUPageViewController: UIPageViewController {
2020

2121
override open func viewDidLoad() {
2222
super.viewDidLoad()
23-
emotionsKitSetupTracking()
23+
24+
if CUU.isActivated(for: .Emotions) {
25+
emotionsKitSetupTracking()
26+
}
2427
}
2528

2629
override open func viewDidAppear(_ animated: Bool) {

0 commit comments

Comments
 (0)