Skip to content

Commit f72276c

Browse files
committed
WIP
1 parent ab35ebe commit f72276c

File tree

8 files changed

+327
-387
lines changed

8 files changed

+327
-387
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
#import "SentryExposure.h"
22
#import <Sentry/PrivateSentrySDKOnly.h>
3-
#import <Sentry/SentryDsn+Private.h>
4-
#import <Sentry/SentryOptions+Private.h>

Samples/iOS-Swift/iOS-Swift-Widget/Sources/SampleWidgetBundle.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
//
2-
// iOS_Swift_WidgetBundle.swift
3-
// iOS-Swift-Widget
4-
//
5-
// Created by Philip Niedertscheider on 04.11.25.
6-
//
7-
81
import SwiftUI
92
import WidgetKit
103

114
@main
12-
struct iOS_Swift_WidgetBundle: WidgetBundle {
5+
struct SampleWidgetBundle: WidgetBundle {
136
var body: some Widget {
147
SampleWidget()
158
SampleWidgetControl()

Samples/iOS-Swift/iOS-Swift-Widget/Sources/SampleWidgetControl.swift

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SwiftUI
44
import WidgetKit
55

66
struct SampleWidgetControl: ControlWidget {
7-
static let kind: String = "io.sentry.sample.iOS-Swift.iOS-Swift-Widget"
7+
static let kind: String = "SampleWidgetControl"
88

99
init() {
1010
setupSentrySDK()
@@ -26,16 +26,14 @@ struct SampleWidgetControl: ControlWidget {
2626
kind: Self.kind,
2727
provider: Provider()
2828
) { value in
29-
ControlWidgetToggle(
30-
"ANR Tracking",
31-
isOn: value.isOn,
32-
action: ToggleIconIntent()
33-
) { isOn in
34-
Label("ANR Tracking", systemImage: isOn ? "checkmark.circle.fill" : "xmark.circle.fill")
29+
ControlWidgetButton(
30+
action: RefreshStatusIntent()
31+
) {
32+
Label("ANR Tracking", systemImage: value.isOn ? "checkmark.circle.fill" : "xmark.circle.fill")
3533
}
3634
}
3735
.displayName("Sentry ANR")
38-
.description("Toggle ANR status icon")
36+
.description("Refresh ANR status")
3937
}
4038
}
4139

@@ -63,14 +61,12 @@ extension SampleWidgetControl {
6361
}
6462

6563
struct ANRConfiguration: ControlConfigurationIntent {
66-
static let title: LocalizedStringResource = "ANR Status"
64+
static var title: LocalizedStringResource { "ANR Status" }
65+
static var description: IntentDescription { "Configure ANR tracking status" }
6766
}
6867

69-
struct ToggleIconIntent: SetValueIntent {
70-
static let title: LocalizedStringResource = "Toggle Icon"
71-
72-
@Parameter(title: "Is On")
73-
var value: Bool
68+
struct RefreshStatusIntent: AppIntent {
69+
static let title: LocalizedStringResource = "Refresh Status"
7470

7571
init() {}
7672

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,58 @@
1-
//
2-
// SampleWidgetLiveActivity.swift
3-
// iOS-Swift-Widget
4-
//
5-
// Created by Philip Niedertscheider on 04.11.25.
6-
//
7-
81
import ActivityKit
2+
import Sentry
93
import SwiftUI
104
import WidgetKit
115

126
struct SampleWidgetAttributes: ActivityAttributes {
13-
public struct ContentState: Codable, Hashable {
14-
// Dynamic stateful properties about your activity go here!
15-
var emoji: String
16-
}
17-
18-
// Fixed non-changing properties about your activity go here!
19-
var name: String
7+
public struct ContentState: Codable, Hashable {}
208
}
219

2210
struct SampleWidgetLiveActivity: Widget {
11+
12+
init() {
13+
setupSentrySDK()
14+
}
15+
2316
var body: some WidgetConfiguration {
24-
ActivityConfiguration(for: SampleWidgetAttributes.self) { context in
17+
ActivityConfiguration(for: SampleWidgetAttributes.self) { _ in
2518
// Lock screen/banner UI goes here
2619
VStack {
27-
Text("Hello \(context.state.emoji)")
20+
Text("Hello World")
2821
}
2922
.activityBackgroundTint(Color.cyan)
3023
.activitySystemActionForegroundColor(Color.black)
3124

32-
} dynamicIsland: { context in
25+
} dynamicIsland: { _ in
3326
DynamicIsland {
34-
// Expanded UI goes here. Compose the expanded UI through
35-
// various regions, like leading/trailing/center/bottom
3627
DynamicIslandExpandedRegion(.leading) {
3728
Text("Leading")
3829
}
3930
DynamicIslandExpandedRegion(.trailing) {
4031
Text("Trailing")
4132
}
4233
DynamicIslandExpandedRegion(.bottom) {
43-
Text("Bottom \(context.state.emoji)")
44-
// more content
34+
Text("Bottom")
4535
}
4636
} compactLeading: {
4737
Text("L")
4838
} compactTrailing: {
49-
Text("T \(context.state.emoji)")
39+
Text("T")
5040
} minimal: {
51-
Text(context.state.emoji)
41+
Text("M")
5242
}
5343
.widgetURL(URL(string: "http://www.apple.com"))
5444
.keylineTint(Color.red)
5545
}
5646
}
57-
}
5847

59-
extension SampleWidgetAttributes {
60-
fileprivate static var preview: SampleWidgetAttributes {
61-
SampleWidgetAttributes(name: "World")
48+
private func setupSentrySDK() {
49+
guard !SentrySDK.isEnabled else {
50+
return
51+
}
52+
SentrySDK.start { options in
53+
options.dsn = "https://[email protected]/5428557"
54+
options.debug = true
55+
options.enableAppHangTracking = true
56+
}
6257
}
6358
}

Samples/iOS-Swift/iOS-Swift-WidgetExtension.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GENERATE_INFOPLIST_FILE = NO
88
SKIP_INSTALL = YES
99
SWIFT_EMIT_LOC_STRINGS = YES
1010

11-
IPHONEOS_DEPLOYMENT_TARGET = 16.0
11+
IPHONEOS_DEPLOYMENT_TARGET = 18.0
1212

1313
CODE_SIGN_STYLE = Automatic
1414

0 commit comments

Comments
 (0)