Skip to content

Commit 8b39743

Browse files
brustolinphilipphofmannarmcknight
authored
fix: Finish transaction for external view controllers (#3440)
View controllers from frameworks in inAppIncludes option are not being swizzled, and so, their transactions are not being closed, but we do start the transaction, because start happens with swizzling of UIViewController. Co-authored-by: Philipp Hofmann <[email protected]> Co-authored-by: Andrew McKnight <[email protected]>
1 parent e0291c9 commit 8b39743

File tree

20 files changed

+919
-82
lines changed

20 files changed

+919
-82
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
### Fixes
2020

21+
- Finish transaction for external view controllers (#3440)
2122
- Fix inaccurate number of frames for transactions (#3439)
2223

2324
## 8.16.0
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Foundation
2+
import Sentry
3+
import UIKit
4+
5+
class ExternalViewController: UIViewController {
6+
7+
override func viewDidAppear(_ animated: Bool) {
8+
super.viewDidAppear(animated)
9+
SentrySDK.reportFullyDisplayed()
10+
}
11+
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#import <Foundation/Foundation.h>
2+
3+
//! Project version number for iOS_External.
4+
FOUNDATION_EXPORT double iOS_ExternalVersionNumber;
5+
6+
//! Project version string for iOS_External.
7+
FOUNDATION_EXPORT const unsigned char iOS_ExternalVersionString[];
8+
9+
// In this header, you should import all the public headers of your framework using statements like
10+
// #import <iOS_External/PublicHeader.h>

Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj

Lines changed: 289 additions & 0 deletions
Large diffs are not rendered by default.

Samples/iOS-Swift/iOS-Swift/AppDelegate.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3131
options.attachViewHierarchy = true
3232
options.environment = "test-app"
3333
options.enableTimeToFullDisplayTracing = true
34+
35+
options.add(inAppInclude: "iOS_External")
3436

3537
let isBenchmarking = ProcessInfo.processInfo.arguments.contains("--io.sentry.test.benchmarking")
3638

Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@
143143
<action selector="uiClickTransaction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="UJy-CY-NIQ"/>
144144
</connections>
145145
</button>
146+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tvP-G7-z60">
147+
<rect key="frame" x="0.0" y="308" width="259" height="28"/>
148+
<fontDescription key="fontDescription" type="system" pointSize="13"/>
149+
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
150+
<state key="normal" title="External View Controller"/>
151+
<connections>
152+
<segue destination="oCp-Df-BWS" kind="show" id="iFk-us-OK4"/>
153+
</connections>
154+
</button>
146155
</subviews>
147156
</stackView>
148157
</subviews>
@@ -389,6 +398,22 @@
389398
</objects>
390399
<point key="canvasLocation" x="1020" y="1685"/>
391400
</scene>
401+
<!--External View Controller-->
402+
<scene sceneID="FBQ-Cn-whQ">
403+
<objects>
404+
<viewController id="oCp-Df-BWS" customClass="ExternalViewController" customModule="iOS_External" sceneMemberID="viewController">
405+
<view key="view" contentMode="scaleToFill" id="xra-iw-aq3">
406+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
407+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
408+
<viewLayoutGuide key="safeArea" id="Hqn-KI-o6p"/>
409+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
410+
</view>
411+
<navigationItem key="navigationItem" id="AWo-oj-ODl"/>
412+
</viewController>
413+
<placeholder placeholderIdentifier="IBFirstResponder" id="CiN-t1-bFc" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
414+
</objects>
415+
<point key="canvasLocation" x="649" y="2399"/>
416+
</scene>
392417
<!--Navigation Controller-->
393418
<scene sceneID="0gQ-IO-Fn5">
394419
<objects>

0 commit comments

Comments
 (0)