diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e51287f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.cer
+*.certSigningRequest
+
diff --git a/OneSignal iOS Sample Widget/Assets.xcassets/AccentColor.colorset/Contents.json b/OneSignal iOS Sample Widget/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..eb87897
--- /dev/null
+++ b/OneSignal iOS Sample Widget/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/OneSignal iOS Sample Widget/Assets.xcassets/AppIcon.appiconset/Contents.json b/OneSignal iOS Sample Widget/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..13613e3
--- /dev/null
+++ b/OneSignal iOS Sample Widget/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,13 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/OneSignal iOS Sample Widget/Assets.xcassets/Contents.json b/OneSignal iOS Sample Widget/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..73c0059
--- /dev/null
+++ b/OneSignal iOS Sample Widget/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/OneSignal iOS Sample Widget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/OneSignal iOS Sample Widget/Assets.xcassets/WidgetBackground.colorset/Contents.json
new file mode 100644
index 0000000..eb87897
--- /dev/null
+++ b/OneSignal iOS Sample Widget/Assets.xcassets/WidgetBackground.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/OneSignal iOS Sample Widget/Info.plist b/OneSignal iOS Sample Widget/Info.plist
new file mode 100644
index 0000000..0f118fb
--- /dev/null
+++ b/OneSignal iOS Sample Widget/Info.plist
@@ -0,0 +1,11 @@
+
+
+
+
+ NSExtension
+
+ NSExtensionPointIdentifier
+ com.apple.widgetkit-extension
+
+
+
diff --git a/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_Widget.intentdefinition b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_Widget.intentdefinition
new file mode 100644
index 0000000..bdb4045
--- /dev/null
+++ b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_Widget.intentdefinition
@@ -0,0 +1,59 @@
+
+
+
+
+ INEnums
+
+ INIntentDefinitionModelVersion
+ 1.2
+ INIntentDefinitionNamespace
+ 88xZPY
+ INIntentDefinitionSystemVersion
+ 20A294
+ INIntentDefinitionToolsBuildVersion
+ 12A6144
+ INIntentDefinitionToolsVersion
+ 12.0
+ INIntents
+
+
+ INIntentCategory
+ information
+ INIntentDescriptionID
+ tVvJ9c
+ INIntentEligibleForWidgets
+
+ INIntentIneligibleForSuggestions
+
+ INIntentName
+ Configuration
+ INIntentResponse
+
+ INIntentResponseCodes
+
+
+ INIntentResponseCodeName
+ success
+ INIntentResponseCodeSuccess
+
+
+
+ INIntentResponseCodeName
+ failure
+
+
+
+ INIntentTitle
+ Configuration
+ INIntentTitleID
+ gpCwrM
+ INIntentType
+ Custom
+ INIntentVerb
+ View
+
+
+ INTypes
+
+
+
diff --git a/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_Widget.swift b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_Widget.swift
new file mode 100644
index 0000000..6f16dc0
--- /dev/null
+++ b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_Widget.swift
@@ -0,0 +1,68 @@
+//
+// OneSignal_iOS_Sample_Widget.swift
+// OneSignal iOS Sample Widget
+//
+// Created by William Shepherd on 4/23/23.
+//
+
+import WidgetKit
+import SwiftUI
+import Intents
+
+struct Provider: IntentTimelineProvider {
+ func placeholder(in context: Context) -> SimpleEntry {
+ SimpleEntry(date: Date(), configuration: ConfigurationIntent())
+ }
+
+ func getSnapshot(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) {
+ let entry = SimpleEntry(date: Date(), configuration: configuration)
+ completion(entry)
+ }
+
+ func getTimeline(for configuration: ConfigurationIntent, in context: Context, completion: @escaping (Timeline) -> ()) {
+ var entries: [SimpleEntry] = []
+
+ // Generate a timeline consisting of five entries an hour apart, starting from the current date.
+ let currentDate = Date()
+ for hourOffset in 0 ..< 5 {
+ let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
+ let entry = SimpleEntry(date: entryDate, configuration: configuration)
+ entries.append(entry)
+ }
+
+ let timeline = Timeline(entries: entries, policy: .atEnd)
+ completion(timeline)
+ }
+}
+
+struct SimpleEntry: TimelineEntry {
+ let date: Date
+ let configuration: ConfigurationIntent
+}
+
+struct OneSignal_iOS_Sample_WidgetEntryView : View {
+ var entry: Provider.Entry
+
+ var body: some View {
+ Text(entry.date, style: .time)
+ }
+}
+
+struct OneSignal_iOS_Sample_Widget: Widget {
+ let kind: String = "OneSignal_iOS_Sample_Widget"
+
+ var body: some WidgetConfiguration {
+ IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in
+ OneSignal_iOS_Sample_WidgetEntryView(entry: entry)
+ }
+ .configurationDisplayName("My Widget")
+ .description("This is an example widget.")
+ }
+}
+
+struct OneSignal_iOS_Sample_Widget_Previews: PreviewProvider {
+ static var previews: some View {
+ OneSignal_iOS_Sample_WidgetEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent()))
+ .previewContext(WidgetPreviewContext(family: .systemSmall))
+ }
+}
diff --git a/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_WidgetBundle.swift b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_WidgetBundle.swift
new file mode 100644
index 0000000..691ff3c
--- /dev/null
+++ b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_WidgetBundle.swift
@@ -0,0 +1,17 @@
+//
+// OneSignal_iOS_Sample_WidgetBundle.swift
+// OneSignal iOS Sample Widget
+//
+// Created by William Shepherd on 4/23/23.
+//
+
+import WidgetKit
+import SwiftUI
+
+@main
+struct OneSignal_iOS_Sample_WidgetBundle: WidgetBundle {
+ var body: some Widget {
+ OneSignal_iOS_Sample_Widget()
+ OneSignal_iOS_Sample_WidgetLiveActivity()
+ }
+}
diff --git a/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_WidgetLiveActivity.swift b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_WidgetLiveActivity.swift
new file mode 100644
index 0000000..b49fc65
--- /dev/null
+++ b/OneSignal iOS Sample Widget/OneSignal_iOS_Sample_WidgetLiveActivity.swift
@@ -0,0 +1,77 @@
+//
+// OneSignal_iOS_Sample_WidgetLiveActivity.swift
+// OneSignal iOS Sample Widget
+//
+// Created by William Shepherd on 4/23/23.
+//
+
+import ActivityKit
+import WidgetKit
+import SwiftUI
+
+struct OneSignal_iOS_Sample_WidgetAttributes: ActivityAttributes {
+ public struct ContentState: Codable, Hashable {
+ // Dynamic stateful properties about your activity go here!
+ var value: Int
+ }
+
+ // Fixed non-changing properties about your activity go here!
+ var name: String
+}
+
+struct OneSignal_iOS_Sample_WidgetLiveActivity: Widget {
+ var body: some WidgetConfiguration {
+ ActivityConfiguration(for: OneSignal_iOS_Sample_WidgetAttributes.self) { context in
+ // Lock screen/banner UI goes here
+ VStack {
+ Text("Hello")
+ }
+ .activityBackgroundTint(Color.cyan)
+ .activitySystemActionForegroundColor(Color.black)
+
+ } dynamicIsland: { context in
+ DynamicIsland {
+ // Expanded UI goes here. Compose the expanded UI through
+ // various regions, like leading/trailing/center/bottom
+ DynamicIslandExpandedRegion(.leading) {
+ Text("Leading")
+ }
+ DynamicIslandExpandedRegion(.trailing) {
+ Text("Trailing")
+ }
+ DynamicIslandExpandedRegion(.bottom) {
+ Text("Bottom")
+ // more content
+ }
+ } compactLeading: {
+ Text("L")
+ } compactTrailing: {
+ Text("T")
+ } minimal: {
+ Text("Min")
+ }
+ .widgetURL(URL(string: "http://www.apple.com"))
+ .keylineTint(Color.red)
+ }
+ }
+}
+
+struct OneSignal_iOS_Sample_WidgetLiveActivity_Previews: PreviewProvider {
+ static let attributes = OneSignal_iOS_Sample_WidgetAttributes(name: "Me")
+ static let contentState = OneSignal_iOS_Sample_WidgetAttributes.ContentState(value: 3)
+
+ static var previews: some View {
+ attributes
+ .previewContext(contentState, viewKind: .dynamicIsland(.compact))
+ .previewDisplayName("Island Compact")
+ attributes
+ .previewContext(contentState, viewKind: .dynamicIsland(.expanded))
+ .previewDisplayName("Island Expanded")
+ attributes
+ .previewContext(contentState, viewKind: .dynamicIsland(.minimal))
+ .previewDisplayName("Minimal")
+ attributes
+ .previewContext(contentState, viewKind: .content)
+ .previewDisplayName("Notification")
+ }
+}
diff --git a/OneSignal iOS Sample.xcodeproj/project.pbxproj b/OneSignal iOS Sample.xcodeproj/project.pbxproj
index 31c1e15..3ce4c9a 100644
--- a/OneSignal iOS Sample.xcodeproj/project.pbxproj
+++ b/OneSignal iOS Sample.xcodeproj/project.pbxproj
@@ -11,14 +11,73 @@
670113BB29E9A70700D01DE9 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 670113BA29E9A70700D01DE9 /* ContentView.swift */; };
670113BD29E9A70800D01DE9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 670113BC29E9A70800D01DE9 /* Assets.xcassets */; };
670113C029E9A70800D01DE9 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 670113BF29E9A70800D01DE9 /* Preview Assets.xcassets */; };
+ 670113CD29E9AA8400D01DE9 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 670113CC29E9AA8400D01DE9 /* NotificationService.swift */; };
+ 670113D129E9AA8400D01DE9 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 670113CA29E9AA8400D01DE9 /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
+ 670113D829E9D6D900D01DE9 /* OneSignalExtension in Frameworks */ = {isa = PBXBuildFile; productRef = 670113D729E9D6D900D01DE9 /* OneSignalExtension */; };
+ 670113DA29E9D6D900D01DE9 /* OneSignalFramework in Frameworks */ = {isa = PBXBuildFile; productRef = 670113D929E9D6D900D01DE9 /* OneSignalFramework */; };
+ 67324DF529F5F81700886064 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67324DF429F5F81700886064 /* WidgetKit.framework */; };
+ 67324DF729F5F81700886064 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67324DF629F5F81700886064 /* SwiftUI.framework */; };
+ 67324DFA29F5F81700886064 /* OneSignal_iOS_Sample_WidgetBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67324DF929F5F81700886064 /* OneSignal_iOS_Sample_WidgetBundle.swift */; };
+ 67324DFC29F5F81700886064 /* OneSignal_iOS_Sample_WidgetLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67324DFB29F5F81700886064 /* OneSignal_iOS_Sample_WidgetLiveActivity.swift */; };
+ 67324DFE29F5F81700886064 /* OneSignal_iOS_Sample_Widget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67324DFD29F5F81700886064 /* OneSignal_iOS_Sample_Widget.swift */; };
+ 67324E0129F5F81800886064 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 67324E0029F5F81800886064 /* Assets.xcassets */; };
+ 67324E0329F5F81800886064 /* OneSignal_iOS_Sample_Widget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 67324DFF29F5F81700886064 /* OneSignal_iOS_Sample_Widget.intentdefinition */; };
+ 67324E0429F5F81800886064 /* OneSignal_iOS_Sample_Widget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = 67324DFF29F5F81700886064 /* OneSignal_iOS_Sample_Widget.intentdefinition */; };
+ 67324E0729F5F81800886064 /* OneSignal iOS Sample WidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 67324DF229F5F81700886064 /* OneSignal iOS Sample WidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 670113CF29E9AA8400D01DE9 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 670113AD29E9A70700D01DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 670113C929E9AA8400D01DE9;
+ remoteInfo = OneSignalNotificationServiceExtension;
+ };
+ 67324E0529F5F81800886064 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 670113AD29E9A70700D01DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 67324DF129F5F81700886064;
+ remoteInfo = "OneSignal iOS Sample WidgetExtension";
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 670113D529E9AA8400D01DE9 /* Embed Foundation Extensions */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 13;
+ files = (
+ 67324E0729F5F81800886064 /* OneSignal iOS Sample WidgetExtension.appex in Embed Foundation Extensions */,
+ 670113D129E9AA8400D01DE9 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */,
+ );
+ name = "Embed Foundation Extensions";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
670113B529E9A70700D01DE9 /* OneSignal iOS Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "OneSignal iOS Sample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
670113B829E9A70700D01DE9 /* OneSignal_iOS_SampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneSignal_iOS_SampleApp.swift; sourceTree = ""; };
670113BA29E9A70700D01DE9 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
670113BC29E9A70800D01DE9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
670113BF29E9A70800D01DE9 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
+ 670113CA29E9AA8400D01DE9 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
+ 670113CC29E9AA8400D01DE9 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = ""; };
+ 670113CE29E9AA8400D01DE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 67324DF229F5F81700886064 /* OneSignal iOS Sample WidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "OneSignal iOS Sample WidgetExtension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 67324DF429F5F81700886064 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
+ 67324DF629F5F81700886064 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
+ 67324DF929F5F81700886064 /* OneSignal_iOS_Sample_WidgetBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneSignal_iOS_Sample_WidgetBundle.swift; sourceTree = ""; };
+ 67324DFB29F5F81700886064 /* OneSignal_iOS_Sample_WidgetLiveActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneSignal_iOS_Sample_WidgetLiveActivity.swift; sourceTree = ""; };
+ 67324DFD29F5F81700886064 /* OneSignal_iOS_Sample_Widget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OneSignal_iOS_Sample_Widget.swift; sourceTree = ""; };
+ 67324DFF29F5F81700886064 /* OneSignal_iOS_Sample_Widget.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = OneSignal_iOS_Sample_Widget.intentdefinition; sourceTree = ""; };
+ 67324E0029F5F81800886064 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 67324E0229F5F81800886064 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 67E3788E29EDD99200320FC3 /* OneSignal iOS Sample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "OneSignal iOS Sample.entitlements"; sourceTree = ""; };
+ 67E3788F29EDDB4500320FC3 /* OneSignal-iOS-Sample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "OneSignal-iOS-Sample-Info.plist"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -26,6 +85,24 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 670113DA29E9D6D900D01DE9 /* OneSignalFramework in Frameworks */,
+ 670113D829E9D6D900D01DE9 /* OneSignalExtension in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 670113C729E9AA8400D01DE9 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 67324DEF29F5F81700886064 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 67324DF729F5F81700886064 /* SwiftUI.framework in Frameworks */,
+ 67324DF529F5F81700886064 /* WidgetKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -36,6 +113,9 @@
isa = PBXGroup;
children = (
670113B729E9A70700D01DE9 /* OneSignal iOS Sample */,
+ 670113CB29E9AA8400D01DE9 /* OneSignalNotificationServiceExtension */,
+ 67324DF829F5F81700886064 /* OneSignal iOS Sample Widget */,
+ 67324DF329F5F81700886064 /* Frameworks */,
670113B629E9A70700D01DE9 /* Products */,
);
sourceTree = "";
@@ -44,6 +124,8 @@
isa = PBXGroup;
children = (
670113B529E9A70700D01DE9 /* OneSignal iOS Sample.app */,
+ 670113CA29E9AA8400D01DE9 /* OneSignalNotificationServiceExtension.appex */,
+ 67324DF229F5F81700886064 /* OneSignal iOS Sample WidgetExtension.appex */,
);
name = Products;
sourceTree = "";
@@ -51,6 +133,8 @@
670113B729E9A70700D01DE9 /* OneSignal iOS Sample */ = {
isa = PBXGroup;
children = (
+ 67E3788F29EDDB4500320FC3 /* OneSignal-iOS-Sample-Info.plist */,
+ 67E3788E29EDD99200320FC3 /* OneSignal iOS Sample.entitlements */,
670113B829E9A70700D01DE9 /* OneSignal_iOS_SampleApp.swift */,
670113BA29E9A70700D01DE9 /* ContentView.swift */,
670113BC29E9A70800D01DE9 /* Assets.xcassets */,
@@ -67,6 +151,37 @@
path = "Preview Content";
sourceTree = "";
};
+ 670113CB29E9AA8400D01DE9 /* OneSignalNotificationServiceExtension */ = {
+ isa = PBXGroup;
+ children = (
+ 670113CC29E9AA8400D01DE9 /* NotificationService.swift */,
+ 670113CE29E9AA8400D01DE9 /* Info.plist */,
+ );
+ path = OneSignalNotificationServiceExtension;
+ sourceTree = "";
+ };
+ 67324DF329F5F81700886064 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 67324DF429F5F81700886064 /* WidgetKit.framework */,
+ 67324DF629F5F81700886064 /* SwiftUI.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 67324DF829F5F81700886064 /* OneSignal iOS Sample Widget */ = {
+ isa = PBXGroup;
+ children = (
+ 67324DF929F5F81700886064 /* OneSignal_iOS_Sample_WidgetBundle.swift */,
+ 67324DFB29F5F81700886064 /* OneSignal_iOS_Sample_WidgetLiveActivity.swift */,
+ 67324DFD29F5F81700886064 /* OneSignal_iOS_Sample_Widget.swift */,
+ 67324DFF29F5F81700886064 /* OneSignal_iOS_Sample_Widget.intentdefinition */,
+ 67324E0029F5F81800886064 /* Assets.xcassets */,
+ 67324E0229F5F81800886064 /* Info.plist */,
+ );
+ path = "OneSignal iOS Sample Widget";
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -77,16 +192,57 @@
670113B129E9A70700D01DE9 /* Sources */,
670113B229E9A70700D01DE9 /* Frameworks */,
670113B329E9A70700D01DE9 /* Resources */,
+ 670113D529E9AA8400D01DE9 /* Embed Foundation Extensions */,
);
buildRules = (
);
dependencies = (
+ 670113D029E9AA8400D01DE9 /* PBXTargetDependency */,
+ 67324E0629F5F81800886064 /* PBXTargetDependency */,
);
name = "OneSignal iOS Sample";
+ packageProductDependencies = (
+ 670113D729E9D6D900D01DE9 /* OneSignalExtension */,
+ 670113D929E9D6D900D01DE9 /* OneSignalFramework */,
+ );
productName = "OneSignal iOS Sample";
productReference = 670113B529E9A70700D01DE9 /* OneSignal iOS Sample.app */;
productType = "com.apple.product-type.application";
};
+ 670113C929E9AA8400D01DE9 /* OneSignalNotificationServiceExtension */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 670113D229E9AA8400D01DE9 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */;
+ buildPhases = (
+ 670113C629E9AA8400D01DE9 /* Sources */,
+ 670113C729E9AA8400D01DE9 /* Frameworks */,
+ 670113C829E9AA8400D01DE9 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = OneSignalNotificationServiceExtension;
+ productName = OneSignalNotificationServiceExtension;
+ productReference = 670113CA29E9AA8400D01DE9 /* OneSignalNotificationServiceExtension.appex */;
+ productType = "com.apple.product-type.app-extension";
+ };
+ 67324DF129F5F81700886064 /* OneSignal iOS Sample WidgetExtension */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 67324E0A29F5F81800886064 /* Build configuration list for PBXNativeTarget "OneSignal iOS Sample WidgetExtension" */;
+ buildPhases = (
+ 67324DEE29F5F81700886064 /* Sources */,
+ 67324DEF29F5F81700886064 /* Frameworks */,
+ 67324DF029F5F81700886064 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "OneSignal iOS Sample WidgetExtension";
+ productName = "OneSignal iOS Sample WidgetExtension";
+ productReference = 67324DF229F5F81700886064 /* OneSignal iOS Sample WidgetExtension.appex */;
+ productType = "com.apple.product-type.app-extension";
+ };
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -100,6 +256,12 @@
670113B429E9A70700D01DE9 = {
CreatedOnToolsVersion = 14.3;
};
+ 670113C929E9AA8400D01DE9 = {
+ CreatedOnToolsVersion = 14.3;
+ };
+ 67324DF129F5F81700886064 = {
+ CreatedOnToolsVersion = 14.3;
+ };
};
};
buildConfigurationList = 670113B029E9A70700D01DE9 /* Build configuration list for PBXProject "OneSignal iOS Sample" */;
@@ -111,11 +273,16 @@
Base,
);
mainGroup = 670113AC29E9A70700D01DE9;
+ packageReferences = (
+ 670113D629E9D6D900D01DE9 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */,
+ );
productRefGroup = 670113B629E9A70700D01DE9 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
670113B429E9A70700D01DE9 /* OneSignal iOS Sample */,
+ 670113C929E9AA8400D01DE9 /* OneSignalNotificationServiceExtension */,
+ 67324DF129F5F81700886064 /* OneSignal iOS Sample WidgetExtension */,
);
};
/* End PBXProject section */
@@ -130,6 +297,21 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 670113C829E9AA8400D01DE9 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 67324DF029F5F81700886064 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 67324E0129F5F81800886064 /* Assets.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -138,12 +320,45 @@
buildActionMask = 2147483647;
files = (
670113BB29E9A70700D01DE9 /* ContentView.swift in Sources */,
+ 67324E0429F5F81800886064 /* OneSignal_iOS_Sample_Widget.intentdefinition in Sources */,
670113B929E9A70700D01DE9 /* OneSignal_iOS_SampleApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 670113C629E9AA8400D01DE9 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 670113CD29E9AA8400D01DE9 /* NotificationService.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 67324DEE29F5F81700886064 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 67324DFA29F5F81700886064 /* OneSignal_iOS_Sample_WidgetBundle.swift in Sources */,
+ 67324DFE29F5F81700886064 /* OneSignal_iOS_Sample_Widget.swift in Sources */,
+ 67324DFC29F5F81700886064 /* OneSignal_iOS_Sample_WidgetLiveActivity.swift in Sources */,
+ 67324E0329F5F81800886064 /* OneSignal_iOS_Sample_Widget.intentdefinition in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ 670113D029E9AA8400D01DE9 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 670113C929E9AA8400D01DE9 /* OneSignalNotificationServiceExtension */;
+ targetProxy = 670113CF29E9AA8400D01DE9 /* PBXContainerItemProxy */;
+ };
+ 67324E0629F5F81800886064 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 67324DF129F5F81700886064 /* OneSignal iOS Sample WidgetExtension */;
+ targetProxy = 67324E0529F5F81800886064 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
670113C129E9A70800D01DE9 /* Debug */ = {
isa = XCBuildConfiguration;
@@ -262,14 +477,17 @@
670113C429E9A70800D01DE9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ CODE_SIGN_ENTITLEMENTS = "OneSignal iOS Sample/OneSignal iOS Sample.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"OneSignal iOS Sample/Preview Content\"";
DEVELOPMENT_TEAM = J3J28YJX9L;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = "OneSignal-iOS-Sample-Info.plist";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
@@ -282,6 +500,9 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.onesignal.devrel.ios-sample.OneSignal-iOS-Sample";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+ SUPPORTS_MACCATALYST = NO;
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -291,14 +512,17 @@
670113C529E9A70800D01DE9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ CODE_SIGN_ENTITLEMENTS = "OneSignal iOS Sample/OneSignal iOS Sample.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"OneSignal iOS Sample/Preview Content\"";
DEVELOPMENT_TEAM = J3J28YJX9L;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = "OneSignal-iOS-Sample-Info.plist";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
@@ -311,6 +535,113 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.onesignal.devrel.ios-sample.OneSignal-iOS-Sample";
PRODUCT_NAME = "$(TARGET_NAME)";
+ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+ SUPPORTS_MACCATALYST = NO;
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+ 670113D329E9AA8400D01DE9 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = J3J28YJX9L;
+ GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
+ INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension;
+ INFOPLIST_KEY_NSHumanReadableCopyright = "";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.onesignal.devrel.ios-sample.OneSignal-iOS-Sample.OneSignalNotificationServiceExtension";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 670113D429E9AA8400D01DE9 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = J3J28YJX9L;
+ GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
+ INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension;
+ INFOPLIST_KEY_NSHumanReadableCopyright = "";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.onesignal.devrel.ios-sample.OneSignal-iOS-Sample.OneSignalNotificationServiceExtension";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+ 67324E0829F5F81800886064 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = J3J28YJX9L;
+ GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = "OneSignal iOS Sample Widget/Info.plist";
+ INFOPLIST_KEY_CFBundleDisplayName = "OneSignal iOS Sample Widget";
+ INFOPLIST_KEY_NSHumanReadableCopyright = "";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.onesignal.devrel.ios-sample.OneSignal-iOS-Sample.OneSignal-iOS-Sample-Widget";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 67324E0929F5F81800886064 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = J3J28YJX9L;
+ GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = "OneSignal iOS Sample Widget/Info.plist";
+ INFOPLIST_KEY_CFBundleDisplayName = "OneSignal iOS Sample Widget";
+ INFOPLIST_KEY_NSHumanReadableCopyright = "";
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.onesignal.devrel.ios-sample.OneSignal-iOS-Sample.OneSignal-iOS-Sample-Widget";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -338,7 +669,49 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 670113D229E9AA8400D01DE9 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 670113D329E9AA8400D01DE9 /* Debug */,
+ 670113D429E9AA8400D01DE9 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 67324E0A29F5F81800886064 /* Build configuration list for PBXNativeTarget "OneSignal iOS Sample WidgetExtension" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 67324E0829F5F81800886064 /* Debug */,
+ 67324E0929F5F81800886064 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
/* End XCConfigurationList section */
+
+/* Begin XCRemoteSwiftPackageReference section */
+ 670113D629E9D6D900D01DE9 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/OneSignal/OneSignal-XCFramework";
+ requirement = {
+ kind = exactVersion;
+ version = "5.0.0-beta-02";
+ };
+ };
+/* End XCRemoteSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+ 670113D729E9D6D900D01DE9 /* OneSignalExtension */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = 670113D629E9D6D900D01DE9 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */;
+ productName = OneSignalExtension;
+ };
+ 670113D929E9D6D900D01DE9 /* OneSignalFramework */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = 670113D629E9D6D900D01DE9 /* XCRemoteSwiftPackageReference "OneSignal-XCFramework" */;
+ productName = OneSignalFramework;
+ };
+/* End XCSwiftPackageProductDependency section */
};
rootObject = 670113AD29E9A70700D01DE9 /* Project object */;
}
diff --git a/OneSignal iOS Sample.xcodeproj/xcuserdata/iamwill.xcuserdatad/xcschemes/xcschememanagement.plist b/OneSignal iOS Sample.xcodeproj/xcuserdata/iamwill.xcuserdatad/xcschemes/xcschememanagement.plist
index 485444f..2edf330 100644
--- a/OneSignal iOS Sample.xcodeproj/xcuserdata/iamwill.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/OneSignal iOS Sample.xcodeproj/xcuserdata/iamwill.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -4,11 +4,21 @@
SchemeUserState
+ OneSignal iOS Sample WidgetExtension.xcscheme_^#shared#^_
+
+ orderHint
+ 1
+
OneSignal iOS Sample.xcscheme_^#shared#^_
orderHint
0
+ OneSignalNotificationServiceExtension.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
diff --git a/OneSignal iOS Sample/ContentView.swift b/OneSignal iOS Sample/ContentView.swift
index d4f57a6..02d4377 100644
--- a/OneSignal iOS Sample/ContentView.swift
+++ b/OneSignal iOS Sample/ContentView.swift
@@ -6,6 +6,7 @@
//
import SwiftUI
+import OneSignalFramework
struct ContentView: View {
var body: some View {
@@ -14,6 +15,33 @@ struct ContentView: View {
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
+ Button(action: {
+ OneSignal.User.pushSubscription.optIn()
+ }) {
+ Text("Enable Push")
+ .padding()
+ .background(Color.blue)
+ .foregroundColor(.white)
+ .cornerRadius(10)
+ }
+ Button(action: {
+ OneSignal.User.pushSubscription.optOut()
+ }) {
+ Text("Disable Push")
+ .padding()
+ .background(Color.blue)
+ .foregroundColor(.white)
+ .cornerRadius(10)
+ }
+ Button(action: {
+ OneSignal.InAppMessages.addTrigger("show_push_permission_prompt", withValue: "1")
+ }) {
+ Text("Prompt Push Permission")
+ .padding()
+ .background(Color.blue)
+ .foregroundColor(.white)
+ .cornerRadius(10)
+ }
}
.padding()
}
diff --git a/OneSignal iOS Sample/OneSignal iOS Sample.entitlements b/OneSignal iOS Sample/OneSignal iOS Sample.entitlements
new file mode 100644
index 0000000..903def2
--- /dev/null
+++ b/OneSignal iOS Sample/OneSignal iOS Sample.entitlements
@@ -0,0 +1,8 @@
+
+
+
+
+ aps-environment
+ development
+
+
diff --git a/OneSignal iOS Sample/OneSignal_iOS_SampleApp.swift b/OneSignal iOS Sample/OneSignal_iOS_SampleApp.swift
index 5e54927..ee6c388 100644
--- a/OneSignal iOS Sample/OneSignal_iOS_SampleApp.swift
+++ b/OneSignal iOS Sample/OneSignal_iOS_SampleApp.swift
@@ -6,12 +6,46 @@
//
import SwiftUI
+import ActivityKit
+import OneSignalFramework
@main
struct OneSignal_iOS_SampleApp: App {
+ @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
+
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
+
+class AppDelegate: UIResponder, UIApplicationDelegate, OSInAppMessageLifecycleHandler {
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
+ OneSignal.Debug.setLogLevel(.LL_VERBOSE)
+ OneSignal.initialize("202d4f61-1ca9-42df-9d36-bb17d8613abf", withLaunchOptions: launchOptions)
+ OneSignal.InAppMessages.setLifecycleHandler(self)
+
+ return true
+ }
+
+ func onWillDisplay(_ message: OSInAppMessage) {
+ print("IAM onWillDisplay \(message)")
+ }
+
+ func onDidDisplay(_ message: OSInAppMessage) {
+ print("IAM onDidDisplay \(message)")
+ }
+
+ func onWillDismiss(_ message: OSInAppMessage) {
+ print("IAM onWillDismiss \(message)")
+ }
+
+ func onDidDismiss(_ message: OSInAppMessage) {
+ print("IAM onDidDismiss \(message)")
+ }
+
+ func startLiveActivity() {
+ let attributes = OneSignalWidgetAtti
+ }
+}
diff --git a/OneSignal-iOS-Sample-Info.plist b/OneSignal-iOS-Sample-Info.plist
new file mode 100644
index 0000000..2816311
--- /dev/null
+++ b/OneSignal-iOS-Sample-Info.plist
@@ -0,0 +1,12 @@
+
+
+
+
+ NSSupportsLiveActivities
+
+ UIBackgroundModes
+
+ remote-notification
+
+
+
diff --git a/OneSignalNotificationServiceExtension/Info.plist b/OneSignalNotificationServiceExtension/Info.plist
new file mode 100644
index 0000000..57421eb
--- /dev/null
+++ b/OneSignalNotificationServiceExtension/Info.plist
@@ -0,0 +1,13 @@
+
+
+
+
+ NSExtension
+
+ NSExtensionPointIdentifier
+ com.apple.usernotifications.service
+ NSExtensionPrincipalClass
+ $(PRODUCT_MODULE_NAME).NotificationService
+
+
+
diff --git a/OneSignalNotificationServiceExtension/NotificationService.swift b/OneSignalNotificationServiceExtension/NotificationService.swift
new file mode 100644
index 0000000..6eef76b
--- /dev/null
+++ b/OneSignalNotificationServiceExtension/NotificationService.swift
@@ -0,0 +1,37 @@
+//
+// NotificationService.swift
+// OneSignalNotificationServiceExtension
+//
+// Created by William Shepherd on 4/14/23.
+//
+
+import UserNotifications
+
+class NotificationService: UNNotificationServiceExtension {
+
+ var contentHandler: ((UNNotificationContent) -> Void)?
+ var receivedRequest: UNNotificationRequest!
+ var bestAttemptContent: UNMutableNotificationContent?
+
+ override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
+ self.receivedRequest = request
+ self.contentHandler = contentHandler
+ bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
+
+ if let bestAttemptContent = bestAttemptContent {
+ // Modify the notification content here...
+ bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
+
+ contentHandler(bestAttemptContent)
+ }
+ }
+
+ override func serviceExtensionTimeWillExpire() {
+ // Called just before the extension will be terminated by the system.
+ // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
+ if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
+ contentHandler(bestAttemptContent)
+ }
+ }
+
+}