Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Commit 5ed3388

Browse files
committed
Fix crash in Widget because TelemetryManager wasn't initialized
Delay playing trailer from Widget when the app cold starts Add Telemetry signal when a widget is tapped Update Version to 1.1.2 and build to 34
1 parent 8f1a051 commit 5ed3388

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

TheatricalMovieTrailers.xcodeproj/project.pbxproj

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
83B53B3D258A78A3003ACD7D /* TelemetryClient in Frameworks */ = {isa = PBXBuildFile; productRef = 83B53B3C258A78A3003ACD7D /* TelemetryClient */; };
5959
83BAC28E2538CC56004D59BC /* FramedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83BAC28D2538CC56004D59BC /* FramedImage.swift */; };
6060
83BD3612254363A300C4588E /* UIResponder+currentResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83BD3611254363A300C4588E /* UIResponder+currentResponder.swift */; };
61+
83C814C6258CF4150028C6D6 /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8300055C2541B34A0069A8D1 /* Secrets.swift */; };
6162
83CBE5122537600F00E22FAE /* CoverFlowListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83CBE5112537600F00E22FAE /* CoverFlowListView.swift */; };
6263
83D21174253F9CDD00EF54A3 /* SortingMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83D21173253F9CDD00EF54A3 /* SortingMode.swift */; };
6364
83D2117825405FC900EF54A3 /* InlineTrailerPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83D2117725405FC900EF54A3 /* InlineTrailerPlayerView.swift */; };
@@ -460,6 +461,7 @@
460461
8383E904254C60EC00F44F5E /* FramedImage.swift in Sources */,
461462
831F1B6D25499412008D24D4 /* TrailersWidget.swift in Sources */,
462463
831F1B892549BC86008D24D4 /* AppError.swift in Sources */,
464+
83C814C6258CF4150028C6D6 /* Secrets.swift in Sources */,
463465
8387DA7B254CC6520014B669 /* MoviePosterView.swift in Sources */,
464466
8387DA6E254CBD720014B669 /* MoviePosterWithTitle.swift in Sources */,
465467
8387DA78254CC3780014B669 /* LargeMoviePosterWithTitle.swift in Sources */,
@@ -614,7 +616,7 @@
614616
CODE_SIGN_ENTITLEMENTS = TheatricalMovieTrailers/TheatricalMovieTrailers.entitlements;
615617
CODE_SIGN_IDENTITY = "Apple Development";
616618
CODE_SIGN_STYLE = Automatic;
617-
CURRENT_PROJECT_VERSION = 33;
619+
CURRENT_PROJECT_VERSION = 34;
618620
DEVELOPMENT_ASSET_PATHS = "\"TheatricalMovieTrailers/Preview Content\"";
619621
DEVELOPMENT_TEAM = U96PJYMZWW;
620622
ENABLE_PREVIEWS = YES;
@@ -624,7 +626,7 @@
624626
"$(inherited)",
625627
"@executable_path/Frameworks",
626628
);
627-
MARKETING_VERSION = 1.1.1;
629+
MARKETING_VERSION = 1.1.2;
628630
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt;
629631
PRODUCT_NAME = "$(TARGET_NAME)";
630632
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -642,7 +644,7 @@
642644
CODE_SIGN_ENTITLEMENTS = TheatricalMovieTrailers/TheatricalMovieTrailers.entitlements;
643645
CODE_SIGN_IDENTITY = "Apple Development";
644646
CODE_SIGN_STYLE = Automatic;
645-
CURRENT_PROJECT_VERSION = 33;
647+
CURRENT_PROJECT_VERSION = 34;
646648
DEVELOPMENT_ASSET_PATHS = "\"TheatricalMovieTrailers/Preview Content\"";
647649
DEVELOPMENT_TEAM = U96PJYMZWW;
648650
ENABLE_PREVIEWS = YES;
@@ -652,7 +654,7 @@
652654
"$(inherited)",
653655
"@executable_path/Frameworks",
654656
);
655-
MARKETING_VERSION = 1.1.1;
657+
MARKETING_VERSION = 1.1.2;
656658
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt;
657659
PRODUCT_NAME = "$(TARGET_NAME)";
658660
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -669,7 +671,7 @@
669671
CODE_SIGN_ENTITLEMENTS = TrailersWidgetExtension.entitlements;
670672
CODE_SIGN_IDENTITY = "Apple Development";
671673
CODE_SIGN_STYLE = Automatic;
672-
CURRENT_PROJECT_VERSION = 33;
674+
CURRENT_PROJECT_VERSION = 34;
673675
DEVELOPMENT_TEAM = U96PJYMZWW;
674676
INFOPLIST_FILE = TrailersWidget/Info.plist;
675677
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
@@ -678,7 +680,7 @@
678680
"@executable_path/Frameworks",
679681
"@executable_path/../../Frameworks",
680682
);
681-
MARKETING_VERSION = 1.1.1;
683+
MARKETING_VERSION = 1.1.2;
682684
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt.TrailersWidget;
683685
PRODUCT_NAME = "$(TARGET_NAME)";
684686
SKIP_INSTALL = YES;
@@ -695,7 +697,7 @@
695697
CODE_SIGN_ENTITLEMENTS = TrailersWidgetExtension.entitlements;
696698
CODE_SIGN_IDENTITY = "Apple Development";
697699
CODE_SIGN_STYLE = Automatic;
698-
CURRENT_PROJECT_VERSION = 33;
700+
CURRENT_PROJECT_VERSION = 34;
699701
DEVELOPMENT_TEAM = U96PJYMZWW;
700702
INFOPLIST_FILE = TrailersWidget/Info.plist;
701703
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
@@ -704,7 +706,7 @@
704706
"@executable_path/Frameworks",
705707
"@executable_path/../../Frameworks",
706708
);
707-
MARKETING_VERSION = 1.1.1;
709+
MARKETING_VERSION = 1.1.2;
708710
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt.TrailersWidget;
709711
PRODUCT_NAME = "$(TARGET_NAME)";
710712
SKIP_INSTALL = YES;

TheatricalMovieTrailers/SceneDelegate.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
3030
assertionFailure("Malformed id URL parameter: expected integer")
3131
return
3232
}
33-
viewParameters.showTrailerID = Int(id)
33+
/// App needs a bit to catch up
34+
DispatchQueue.main.asyncAfter(0.5) { [self] in
35+
viewParameters.showTrailerID = Int(id)
36+
}
3437
}
3538

3639
// Use a UIHostingController as window root view controller.

TheatricalMovieTrailers/Views/CoverFlowScrollView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import AVKit
99
import SwiftUI
10+
import TelemetryClient
1011

1112
struct CoverFlowScrollView: View {
1213
private let scrollAnchor = UnitPoint(x: 0.5, y: 1.0)
@@ -80,6 +81,7 @@ struct CoverFlowScrollView: View {
8081
}
8182
}
8283
}
84+
// Widget tapped => show trailer by id
8385
.onChange(of: viewParameters.showTrailerID ?? -1) { _ in
8486
handleShowTrailer(viewParameters.showTrailerID, reader)
8587
}
@@ -255,6 +257,9 @@ struct CoverFlowScrollView: View {
255257
self.centeredItem = info
256258
playTrailer(info)
257259
}
260+
// send telemetry
261+
let data = ["trailerID":"\(info.id)", "movieTitle":info.title]
262+
TelemetryManager.send("widgetTapped", with: data)
258263
}
259264
}
260265
}

TrailersWidget/TrailersWidget.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ struct TrailersWidgetEntryView : View {
136136
}
137137

138138
private func sendTelemetry() {
139+
let configuration = TelemetryManagerConfiguration(appID: TelemetryAppId)
140+
TelemetryManager.initialize(with: configuration)
139141
var trailerScopeString: String
140142
switch entry.configuration.trailerScope {
141143
case .releasingSoonest :

0 commit comments

Comments
 (0)