diff --git a/.gitignore b/.gitignore index 09fafc75..a4f9bab5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules dist +.idea .DS_Store .idea @@ -9,6 +10,7 @@ build/ coverage/ *.tgz +.DS_Store # Coverage coverage/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 7ea23dcf..aa3b7b92 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,6 @@ }, "[yaml]": { "editor.defaultFormatter": "redhat.vscode-yaml" - } + }, + "oxc.enable": true } diff --git a/build.gradle b/build.gradle index 2ecd0d6d..ffe450fd 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ spotless { java { target 'src/android/**/*.java', 'example/IonicCapOneSignal/android/app/src/**/*.java' targetExclude '**/build/**' - palantirJavaFormat('2.28.0') + palantirJavaFormat('2.85.0') removeUnusedImports() trimTrailingWhitespace() endWithNewline() @@ -34,7 +34,7 @@ spotless { } format 'xml', { - target '**/*.xml' + target 'plugin.xml' trimTrailingWhitespace() indentWithSpaces(4) endWithNewline() diff --git a/bun.lock b/bun.lock index ca433cf2..42733b1e 100644 --- a/bun.lock +++ b/bun.lock @@ -10,7 +10,7 @@ "@vitest/coverage-v8": "^4.0.2", "concurrently": "^9.2.1", "happy-dom": "^20.0.8", - "oxlint": "^1.24.0", + "oxlint": "^1.42.0", "prettier": "^3.6.2", "typescript": "^5.9.3", "vite": "^7.1.12", @@ -120,21 +120,21 @@ "@microsoft/tsdoc-config": ["@microsoft/tsdoc-config@0.17.1", "", { "dependencies": { "@microsoft/tsdoc": "0.15.1", "ajv": "~8.12.0", "jju": "~1.4.0", "resolve": "~1.22.2" } }, "sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw=="], - "@oxlint/darwin-arm64": ["@oxlint/darwin-arm64@1.24.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-1Kd2+Ai1ttskhbJR+DNU4Y4YEDyP/cd50nWt2rAe2aE78dMOalaVGps3s8UnJkXpDL9ZqkgOHVDE5Doj2lxatw=="], + "@oxlint/darwin-arm64": ["@oxlint/darwin-arm64@1.42.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ui5CdAcDsXPQwZQEXOOSWsilJWhgj9jqHCvYBm2tDE8zfwZZuF9q58+hGKH1x5y0SV4sRlyobB2Quq6uU6EgeA=="], - "@oxlint/darwin-x64": ["@oxlint/darwin-x64@1.24.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-/R9VbnuTp7bLIBh6ucDHjx0po0wLQODLqzy+L/Frn5z4ifMVdE63DB+LHO8QAj+WEQleQq3u/MMms7RFPulCLA=="], + "@oxlint/darwin-x64": ["@oxlint/darwin-x64@1.42.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-wo0M/hcpHRv7vFje99zHHqheOhVEwUOKjOgBKyi0M99xcLizv04kcSm1rTd6HSCeZgOtiJYZRVAlKhQOQw2byQ=="], - "@oxlint/linux-arm64-gnu": ["@oxlint/linux-arm64-gnu@1.24.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-fA90bIQ1b44eNg0uULlTonqsADVIBnMz169mav6IhfZL9V6DpBCUWrV+8tEQCxbDvYC0WY1guBpPo2QWUnC/Dw=="], + "@oxlint/linux-arm64-gnu": ["@oxlint/linux-arm64-gnu@1.42.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-j4QzfCM8ks+OyM+KKYWDiBEQsm5RCW50H1Wz16wUyoFsobJ+X5qqcJxq6HvkE07m8euYmZelyB0WqsiDoz1v8g=="], - "@oxlint/linux-arm64-musl": ["@oxlint/linux-arm64-musl@1.24.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-p7Bv9FTQ1lf4Z7OiIFwiy+cY2fxN6IJc0+2gJ4z2fpaQ0J2rQQcKdJ5RLQTxf+tAu7hyqjc6bf61EAGa9lb/GA=="], + "@oxlint/linux-arm64-musl": ["@oxlint/linux-arm64-musl@1.42.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-g5b1Uw7zo6yw4Ymzyd1etKzAY7xAaGA3scwB8tAp3QzuY7CYdfTwlhiLKSAKbd7T/JBgxOXAGNcLDorJyVTXcg=="], - "@oxlint/linux-x64-gnu": ["@oxlint/linux-x64-gnu@1.24.0", "", { "os": "linux", "cpu": "x64" }, "sha512-wIQOpTONiJ9pYPnLEq7UFuml8mpmSFTfUveNbT2rw9iXfj2nLMf7NIqGnUYQdvnnOi+maag9uei/WImXIm9LQQ=="], + "@oxlint/linux-x64-gnu": ["@oxlint/linux-x64-gnu@1.42.0", "", { "os": "linux", "cpu": "x64" }, "sha512-HnD99GD9qAbpV4q9iQil7mXZUJFpoBdDavfcC2CgGLPlawfcV5COzQPNwOgvPVkr7C0cBx6uNCq3S6r9IIiEIg=="], - "@oxlint/linux-x64-musl": ["@oxlint/linux-x64-musl@1.24.0", "", { "os": "linux", "cpu": "x64" }, "sha512-HxcDX/SpTH7yC/Rn2MinjSHZmNpn79yJkBid792DWjP9bo0CnlNXOXMPXsbm+WqptvqQ9yUPCxf7KascUvxLyQ=="], + "@oxlint/linux-x64-musl": ["@oxlint/linux-x64-musl@1.42.0", "", { "os": "linux", "cpu": "x64" }, "sha512-8NTe8A78HHFn+nBi+8qMwIjgv9oIBh+9zqCPNLH56ah4vKOPvbePLI6NIv9qSkmzrBuu8SB+FJ2TH/G05UzbNA=="], - "@oxlint/win32-arm64": ["@oxlint/win32-arm64@1.24.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-P1KtZ/xL+TcNTTmOtEsVrpqAdmpu2UCRAILjoqQyrYvI/CW6SdvoJfMBTntKOZaB52Peq2BHTgsYovON8q4FfQ=="], + "@oxlint/win32-arm64": ["@oxlint/win32-arm64@1.42.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-lAPS2YAuu+qFqoTNPFcNsxXjwSV0M+dOgAzzVTAN7Yo2ifj+oLOx0GsntWoM78PvQWI7Q827ZxqtU2ImBmDapA=="], - "@oxlint/win32-x64": ["@oxlint/win32-x64@1.24.0", "", { "os": "win32", "cpu": "x64" }, "sha512-JMbMm7i1esFl12fRdOQwoeEeufWXxihOme8pZpI6jrwWK1kCIANMb5agI5Lkjf5vToQOP3DLXYc29aDm16fw6g=="], + "@oxlint/win32-x64": ["@oxlint/win32-x64@1.42.0", "", { "os": "win32", "cpu": "x64" }, "sha512-3/KmyUOHNriL6rLpaFfm9RJxdhpXY2/Ehx9UuorJr2pUA+lrZL15FAEx/DOszYm5r10hfzj40+efAHcCilNvSQ=="], "@rollup/pluginutils": ["@rollup/pluginutils@5.3.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q=="], @@ -434,7 +434,7 @@ "open": ["open@8.4.2", "", { "dependencies": { "define-lazy-prop": "^2.0.0", "is-docker": "^2.1.1", "is-wsl": "^2.2.0" } }, "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ=="], - "oxlint": ["oxlint@1.24.0", "", { "optionalDependencies": { "@oxlint/darwin-arm64": "1.24.0", "@oxlint/darwin-x64": "1.24.0", "@oxlint/linux-arm64-gnu": "1.24.0", "@oxlint/linux-arm64-musl": "1.24.0", "@oxlint/linux-x64-gnu": "1.24.0", "@oxlint/linux-x64-musl": "1.24.0", "@oxlint/win32-arm64": "1.24.0", "@oxlint/win32-x64": "1.24.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.2.0" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint", "oxc_language_server": "bin/oxc_language_server" } }, "sha512-swXlnHT7ywcCApkctIbgOSjDYHwMa12yMU0iXevfDuHlYkRUcbQrUv6nhM5v6B0+Be3zTBMNDGPAMQv0oznzRQ=="], + "oxlint": ["oxlint@1.42.0", "", { "optionalDependencies": { "@oxlint/darwin-arm64": "1.42.0", "@oxlint/darwin-x64": "1.42.0", "@oxlint/linux-arm64-gnu": "1.42.0", "@oxlint/linux-arm64-musl": "1.42.0", "@oxlint/linux-x64-gnu": "1.42.0", "@oxlint/linux-x64-musl": "1.42.0", "@oxlint/win32-arm64": "1.42.0", "@oxlint/win32-x64": "1.42.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.11.2" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-qnspC/lrp8FgKNaONLLn14dm+W5t0SSlus6V5NJpgI2YNT1tkFYZt4fBf14ESxf9AAh98WBASnW5f0gtw462Lg=="], "package-json-from-dist": ["package-json-from-dist@1.0.1", "", {}, "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="], diff --git a/example/IonicCapOneSignal/ios/App/App.xcodeproj/project.pbxproj b/example/IonicCapOneSignal/ios/App/App.xcodeproj/project.pbxproj index 730f829d..4f70d324 100644 --- a/example/IonicCapOneSignal/ios/App/App.xcodeproj/project.pbxproj +++ b/example/IonicCapOneSignal/ios/App/App.xcodeproj/project.pbxproj @@ -7,40 +7,36 @@ objects = { /* Begin PBXBuildFile section */ - 233AB0E51F2674B91F894E2B /* Pods_ExampleWidgetExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81206892589BDD8D3AD2E4C0 /* Pods_ExampleWidgetExtension.framework */; }; 2FAD9763203C412B000D30F8 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 2FAD9762203C412B000D30F8 /* config.xml */; }; - 4711E13D2BFD3D4800C4D895 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4711E13C2BFD3D4800C4D895 /* WidgetKit.framework */; }; - 4711E13F2BFD3D4800C4D895 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4711E13E2BFD3D4800C4D895 /* SwiftUI.framework */; }; - 4711E1422BFD3D4800C4D895 /* ExampleWidgetBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4711E1412BFD3D4800C4D895 /* ExampleWidgetBundle.swift */; }; - 4711E1442BFD3D4800C4D895 /* ExampleWidgetLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4711E1432BFD3D4800C4D895 /* ExampleWidgetLiveActivity.swift */; }; - 4711E1482BFD3D4900C4D895 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4711E1472BFD3D4900C4D895 /* Assets.xcassets */; }; - 4711E14C2BFD3D4900C4D895 /* ExampleWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 4711E13B2BFD3D4800C4D895 /* ExampleWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 50379B232058CBB4000EE86E /* capacitor.config.json in Resources */ = {isa = PBXBuildFile; fileRef = 50379B222058CBB4000EE86E /* capacitor.config.json */; }; 504EC3081FED79650016851F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC3071FED79650016851F /* AppDelegate.swift */; }; 504EC30D1FED79650016851F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30B1FED79650016851F /* Main.storyboard */; }; 504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; }; 504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; }; 50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; }; - 81C4E9CD2F0A465679025B7F /* Pods_OneSignalNotificationServiceExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBDA86C51D8754A054E82596 /* Pods_OneSignalNotificationServiceExtension.framework */; }; + 6CC238711590FC48BDB1C6F5 /* Pods_OneSignalNotificationServiceExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBDA86C51D8754A054E82596 /* Pods_OneSignalNotificationServiceExtension.framework */; }; A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; }; - CF153A042BEC768C00741F42 /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = CF153A032BEC768C00741F42 /* NotificationService.m */; }; - CF153A082BEC768C00741F42 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = CF153A002BEC768C00741F42 /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + E82F91DB2F2AD82100850070 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = E82F91D42F2AD82100850070 /* OneSignalNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + E82F91E62F2AD8AE00850070 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4711E13C2BFD3D4800C4D895 /* WidgetKit.framework */; }; + E82F91E72F2AD8AE00850070 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4711E13E2BFD3D4800C4D895 /* SwiftUI.framework */; }; + E82F91F82F2AD8B000850070 /* OneSignalWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = E82F91E52F2AD8AE00850070 /* OneSignalWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + F6587EE508B63805B551B7C6 /* Pods_OneSignalWidgetExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC7311AA94AC3F6FDFA5E495 /* Pods_OneSignalWidgetExtension.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 4711E14A2BFD3D4900C4D895 /* PBXContainerItemProxy */ = { + E82F91D92F2AD82100850070 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 504EC2FC1FED79650016851F /* Project object */; proxyType = 1; - remoteGlobalIDString = 4711E13A2BFD3D4800C4D895; - remoteInfo = ExampleWidgetExtension; + remoteGlobalIDString = E82F91D32F2AD82100850070; + remoteInfo = OneSignalNotificationServiceExtension; }; - CF153A062BEC768C00741F42 /* PBXContainerItemProxy */ = { + E82F91F62F2AD8B000850070 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 504EC2FC1FED79650016851F /* Project object */; proxyType = 1; - remoteGlobalIDString = CF1539FF2BEC768C00741F42; - remoteInfo = OneSignalNotificationServiceExtension; + remoteGlobalIDString = E82F91E42F2AD8AE00850070; + remoteInfo = OneSignalWidgetExtension; }; /* End PBXContainerItemProxy section */ @@ -51,8 +47,8 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( - CF153A082BEC768C00741F42 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */, - 4711E14C2BFD3D4900C4D895 /* ExampleWidgetExtension.appex in Embed Foundation Extensions */, + E82F91DB2F2AD82100850070 /* OneSignalNotificationServiceExtension.appex in Embed Foundation Extensions */, + E82F91F82F2AD8B000850070 /* OneSignalWidgetExtension.appex in Embed Foundation Extensions */, ); name = "Embed Foundation Extensions"; runOnlyForDeploymentPostprocessing = 0; @@ -60,16 +56,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0CD40CAE3F5EF50D737C2067 /* Pods-ExampleWidgetExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleWidgetExtension.release.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleWidgetExtension/Pods-ExampleWidgetExtension.release.xcconfig"; sourceTree = ""; }; - 1F3B965497F5BEF67C4BE9C0 /* Pods-ExampleWidgetExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleWidgetExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ExampleWidgetExtension/Pods-ExampleWidgetExtension.debug.xcconfig"; sourceTree = ""; }; 2FAD9762203C412B000D30F8 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = config.xml; sourceTree = ""; }; - 4711E13B2BFD3D4800C4D895 /* ExampleWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ExampleWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 4711E13C2BFD3D4800C4D895 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; 4711E13E2BFD3D4800C4D895 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; - 4711E1412BFD3D4800C4D895 /* ExampleWidgetBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWidgetBundle.swift; sourceTree = ""; }; - 4711E1432BFD3D4800C4D895 /* ExampleWidgetLiveActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWidgetLiveActivity.swift; sourceTree = ""; }; - 4711E1472BFD3D4900C4D895 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 4711E1492BFD3D4900C4D895 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = ""; }; 504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -79,44 +68,79 @@ 504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; }; 58CED0A0F03E31F92FFD8025 /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.release.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.release.xcconfig"; sourceTree = ""; }; - 81206892589BDD8D3AD2E4C0 /* Pods_ExampleWidgetExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ExampleWidgetExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6AC3A76DD07F75F94E44CB02 /* Pods-OneSignalWidgetExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalWidgetExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalWidgetExtension/Pods-OneSignalWidgetExtension.debug.xcconfig"; sourceTree = ""; }; + AC7311AA94AC3F6FDFA5E495 /* Pods_OneSignalWidgetExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OneSignalWidgetExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + ACA94966EDDBC597E95F5866 /* Pods-OneSignalWidgetExtension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalWidgetExtension.release.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalWidgetExtension/Pods-OneSignalWidgetExtension.release.xcconfig"; sourceTree = ""; }; AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; }; BBDA86C51D8754A054E82596 /* Pods_OneSignalNotificationServiceExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_OneSignalNotificationServiceExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - CF153A002BEC768C00741F42 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - CF153A022BEC768C00741F42 /* NotificationService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = ""; }; - CF153A032BEC768C00741F42 /* NotificationService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationService.m; sourceTree = ""; }; - CF153A052BEC768C00741F42 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - CF153A0D2BEC76F300741F42 /* OneSignalNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OneSignalNotificationServiceExtension.entitlements; sourceTree = ""; }; CF94745C2BE491A8008E57E8 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = ""; }; + E82F91D42F2AD82100850070 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + E82F91E52F2AD8AE00850070 /* OneSignalWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = OneSignalWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; EBEAC4EBEBB12957B79AE4D6 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; path = "Pods/Target Support Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension.debug.xcconfig"; sourceTree = ""; }; FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + E82F91DC2F2AD82100850070 /* Exceptions for "OneSignalNotificationServiceExtension" folder in "OneSignalNotificationServiceExtension" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = E82F91D32F2AD82100850070 /* OneSignalNotificationServiceExtension */; + }; + E82F91F92F2AD8B000850070 /* Exceptions for "OneSignalWidget" folder in "OneSignalWidgetExtension" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = E82F91E42F2AD8AE00850070 /* OneSignalWidgetExtension */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + E82F91D52F2AD82100850070 /* OneSignalNotificationServiceExtension */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + E82F91DC2F2AD82100850070 /* Exceptions for "OneSignalNotificationServiceExtension" folder in "OneSignalNotificationServiceExtension" target */, + ); + path = OneSignalNotificationServiceExtension; + sourceTree = ""; + }; + E82F91E82F2AD8AE00850070 /* OneSignalWidget */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + E82F91F92F2AD8B000850070 /* Exceptions for "OneSignalWidget" folder in "OneSignalWidgetExtension" target */, + ); + path = OneSignalWidget; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + /* Begin PBXFrameworksBuildPhase section */ - 4711E1382BFD3D4800C4D895 /* Frameworks */ = { + 504EC3011FED79650016851F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4711E13F2BFD3D4800C4D895 /* SwiftUI.framework in Frameworks */, - 4711E13D2BFD3D4800C4D895 /* WidgetKit.framework in Frameworks */, - 233AB0E51F2674B91F894E2B /* Pods_ExampleWidgetExtension.framework in Frameworks */, + A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 504EC3011FED79650016851F /* Frameworks */ = { + E82F91D12F2AD82100850070 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */, + 6CC238711590FC48BDB1C6F5 /* Pods_OneSignalNotificationServiceExtension.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - CF1539FD2BEC768C00741F42 /* Frameworks */ = { + E82F91E22F2AD8AE00850070 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 81C4E9CD2F0A465679025B7F /* Pods_OneSignalNotificationServiceExtension.framework in Frameworks */, + E82F91E72F2AD8AE00850070 /* SwiftUI.framework in Frameworks */, + E82F91E62F2AD8AE00850070 /* WidgetKit.framework in Frameworks */, + F6587EE508B63805B551B7C6 /* Pods_OneSignalWidgetExtension.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -130,28 +154,17 @@ BBDA86C51D8754A054E82596 /* Pods_OneSignalNotificationServiceExtension.framework */, 4711E13C2BFD3D4800C4D895 /* WidgetKit.framework */, 4711E13E2BFD3D4800C4D895 /* SwiftUI.framework */, - 81206892589BDD8D3AD2E4C0 /* Pods_ExampleWidgetExtension.framework */, + AC7311AA94AC3F6FDFA5E495 /* Pods_OneSignalWidgetExtension.framework */, ); name = Frameworks; sourceTree = ""; }; - 4711E1402BFD3D4800C4D895 /* ExampleWidget */ = { - isa = PBXGroup; - children = ( - 4711E1412BFD3D4800C4D895 /* ExampleWidgetBundle.swift */, - 4711E1432BFD3D4800C4D895 /* ExampleWidgetLiveActivity.swift */, - 4711E1472BFD3D4900C4D895 /* Assets.xcassets */, - 4711E1492BFD3D4900C4D895 /* Info.plist */, - ); - path = ExampleWidget; - sourceTree = ""; - }; 504EC2FB1FED79650016851F = { isa = PBXGroup; children = ( 504EC3061FED79650016851F /* App */, - CF153A012BEC768C00741F42 /* OneSignalNotificationServiceExtension */, - 4711E1402BFD3D4800C4D895 /* ExampleWidget */, + E82F91D52F2AD82100850070 /* OneSignalNotificationServiceExtension */, + E82F91E82F2AD8AE00850070 /* OneSignalWidget */, 504EC3051FED79650016851F /* Products */, 7F8756D8B27F46E3366F6CEA /* Pods */, 27E2DDA53C4D2A4D1A88CE4A /* Frameworks */, @@ -162,8 +175,8 @@ isa = PBXGroup; children = ( 504EC3041FED79650016851F /* App.app */, - CF153A002BEC768C00741F42 /* OneSignalNotificationServiceExtension.appex */, - 4711E13B2BFD3D4800C4D895 /* ExampleWidgetExtension.appex */, + E82F91D42F2AD82100850070 /* OneSignalNotificationServiceExtension.appex */, + E82F91E52F2AD8AE00850070 /* OneSignalWidgetExtension.appex */, ); name = Products; sourceTree = ""; @@ -191,44 +204,15 @@ AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */, EBEAC4EBEBB12957B79AE4D6 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */, 58CED0A0F03E31F92FFD8025 /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */, - 1F3B965497F5BEF67C4BE9C0 /* Pods-ExampleWidgetExtension.debug.xcconfig */, - 0CD40CAE3F5EF50D737C2067 /* Pods-ExampleWidgetExtension.release.xcconfig */, + 6AC3A76DD07F75F94E44CB02 /* Pods-OneSignalWidgetExtension.debug.xcconfig */, + ACA94966EDDBC597E95F5866 /* Pods-OneSignalWidgetExtension.release.xcconfig */, ); name = Pods; sourceTree = ""; }; - CF153A012BEC768C00741F42 /* OneSignalNotificationServiceExtension */ = { - isa = PBXGroup; - children = ( - CF153A0D2BEC76F300741F42 /* OneSignalNotificationServiceExtension.entitlements */, - CF153A022BEC768C00741F42 /* NotificationService.h */, - CF153A032BEC768C00741F42 /* NotificationService.m */, - CF153A052BEC768C00741F42 /* Info.plist */, - ); - path = OneSignalNotificationServiceExtension; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 4711E13A2BFD3D4800C4D895 /* ExampleWidgetExtension */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4711E14D2BFD3D4900C4D895 /* Build configuration list for PBXNativeTarget "ExampleWidgetExtension" */; - buildPhases = ( - 66EB456BC3B42EA076C84421 /* [CP] Check Pods Manifest.lock */, - 4711E1372BFD3D4800C4D895 /* Sources */, - 4711E1382BFD3D4800C4D895 /* Frameworks */, - 4711E1392BFD3D4800C4D895 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ExampleWidgetExtension; - productName = ExampleWidgetExtension; - productReference = 4711E13B2BFD3D4800C4D895 /* ExampleWidgetExtension.appex */; - productType = "com.apple.product-type.app-extension"; - }; 504EC3031FED79650016851F /* App */ = { isa = PBXNativeTarget; buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */; @@ -243,30 +227,54 @@ buildRules = ( ); dependencies = ( - CF153A072BEC768C00741F42 /* PBXTargetDependency */, - 4711E14B2BFD3D4900C4D895 /* PBXTargetDependency */, + E82F91DA2F2AD82100850070 /* PBXTargetDependency */, + E82F91F72F2AD8B000850070 /* PBXTargetDependency */, ); name = App; productName = App; productReference = 504EC3041FED79650016851F /* App.app */; productType = "com.apple.product-type.application"; }; - CF1539FF2BEC768C00741F42 /* OneSignalNotificationServiceExtension */ = { + E82F91D32F2AD82100850070 /* OneSignalNotificationServiceExtension */ = { isa = PBXNativeTarget; - buildConfigurationList = CF153A0C2BEC768C00741F42 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */; + buildConfigurationList = E82F91DD2F2AD82100850070 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */; buildPhases = ( - DF1DA50ACCDF3713362D15E8 /* [CP] Check Pods Manifest.lock */, - CF1539FC2BEC768C00741F42 /* Sources */, - CF1539FD2BEC768C00741F42 /* Frameworks */, - CF1539FE2BEC768C00741F42 /* Resources */, + 093D0E157E335C6D7D83CCFA /* [CP] Check Pods Manifest.lock */, + E82F91D02F2AD82100850070 /* Sources */, + E82F91D12F2AD82100850070 /* Frameworks */, + E82F91D22F2AD82100850070 /* Resources */, ); buildRules = ( ); dependencies = ( ); + fileSystemSynchronizedGroups = ( + E82F91D52F2AD82100850070 /* OneSignalNotificationServiceExtension */, + ); name = OneSignalNotificationServiceExtension; productName = OneSignalNotificationServiceExtension; - productReference = CF153A002BEC768C00741F42 /* OneSignalNotificationServiceExtension.appex */; + productReference = E82F91D42F2AD82100850070 /* OneSignalNotificationServiceExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; + E82F91E42F2AD8AE00850070 /* OneSignalWidgetExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = E82F91FA2F2AD8B000850070 /* Build configuration list for PBXNativeTarget "OneSignalWidgetExtension" */; + buildPhases = ( + D18E85312C31D08E6DB76240 /* [CP] Check Pods Manifest.lock */, + E82F91E12F2AD8AE00850070 /* Sources */, + E82F91E22F2AD8AE00850070 /* Frameworks */, + E82F91E32F2AD8AE00850070 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + E82F91E82F2AD8AE00850070 /* OneSignalWidget */, + ); + name = OneSignalWidgetExtension; + productName = OneSignalWidgetExtension; + productReference = E82F91E52F2AD8AE00850070 /* OneSignalWidgetExtension.appex */; productType = "com.apple.product-type.app-extension"; }; /* End PBXNativeTarget section */ @@ -275,21 +283,19 @@ 504EC2FC1FED79650016851F /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1530; + LastSwiftUpdateCheck = 2620; LastUpgradeCheck = 0920; TargetAttributes = { - 4711E13A2BFD3D4800C4D895 = { - CreatedOnToolsVersion = 15.3; - ProvisioningStyle = Automatic; - }; 504EC3031FED79650016851F = { CreatedOnToolsVersion = 9.2; LastSwiftMigration = 1100; ProvisioningStyle = Automatic; }; - CF1539FF2BEC768C00741F42 = { - CreatedOnToolsVersion = 15.3; - ProvisioningStyle = Automatic; + E82F91D32F2AD82100850070 = { + CreatedOnToolsVersion = 26.2; + }; + E82F91E42F2AD8AE00850070 = { + CreatedOnToolsVersion = 26.2; }; }; }; @@ -307,21 +313,13 @@ projectRoot = ""; targets = ( 504EC3031FED79650016851F /* App */, - CF1539FF2BEC768C00741F42 /* OneSignalNotificationServiceExtension */, - 4711E13A2BFD3D4800C4D895 /* ExampleWidgetExtension */, + E82F91D32F2AD82100850070 /* OneSignalNotificationServiceExtension */, + E82F91E42F2AD8AE00850070 /* OneSignalWidgetExtension */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 4711E1392BFD3D4800C4D895 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 4711E1482BFD3D4900C4D895 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 504EC3021FED79650016851F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -335,7 +333,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - CF1539FE2BEC768C00741F42 /* Resources */ = { + E82F91D22F2AD82100850070 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E82F91E32F2AD8AE00850070 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -345,40 +350,40 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = { + 093D0E157E335C6D7D83CCFA /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-OneSignalNotificationServiceExtension-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 66EB456BC3B42EA076C84421 /* [CP] Check Pods Manifest.lock */ = { + 6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ExampleWidgetExtension-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -400,7 +405,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - DF1DA50ACCDF3713362D15E8 /* [CP] Check Pods Manifest.lock */ = { + D18E85312C31D08E6DB76240 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -415,7 +420,7 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-OneSignalNotificationServiceExtension-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-OneSignalWidgetExtension-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -425,43 +430,40 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 4711E1372BFD3D4800C4D895 /* Sources */ = { + 504EC3001FED79650016851F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4711E1422BFD3D4800C4D895 /* ExampleWidgetBundle.swift in Sources */, - 4711E1442BFD3D4800C4D895 /* ExampleWidgetLiveActivity.swift in Sources */, + 504EC3081FED79650016851F /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 504EC3001FED79650016851F /* Sources */ = { + E82F91D02F2AD82100850070 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 504EC3081FED79650016851F /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - CF1539FC2BEC768C00741F42 /* Sources */ = { + E82F91E12F2AD8AE00850070 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - CF153A042BEC768C00741F42 /* NotificationService.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 4711E14B2BFD3D4900C4D895 /* PBXTargetDependency */ = { + E82F91DA2F2AD82100850070 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 4711E13A2BFD3D4800C4D895 /* ExampleWidgetExtension */; - targetProxy = 4711E14A2BFD3D4900C4D895 /* PBXContainerItemProxy */; + target = E82F91D32F2AD82100850070 /* OneSignalNotificationServiceExtension */; + targetProxy = E82F91D92F2AD82100850070 /* PBXContainerItemProxy */; }; - CF153A072BEC768C00741F42 /* PBXTargetDependency */ = { + E82F91F72F2AD8B000850070 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = CF1539FF2BEC768C00741F42 /* OneSignalNotificationServiceExtension */; - targetProxy = CF153A062BEC768C00741F42 /* PBXContainerItemProxy */; + target = E82F91E42F2AD8AE00850070 /* OneSignalWidgetExtension */; + targetProxy = E82F91F62F2AD8B000850070 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -485,86 +487,6 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 4711E14E2BFD3D4900C4D895 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 1F3B965497F5BEF67C4BE9C0 /* Pods-ExampleWidgetExtension.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 99SW8E36CT; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ExampleWidget/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = ExampleWidget; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 17.4; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 1.0; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.ExampleWidget; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 4711E14F2BFD3D4900C4D895 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 0CD40CAE3F5EF50D737C2067 /* Pods-ExampleWidgetExtension.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 99SW8E36CT; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = ExampleWidget/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = ExampleWidget; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 17.4; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MARKETING_VERSION = 1.0; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.ExampleWidget; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; 504EC3141FED79650016851F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -677,7 +599,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App/App.entitlements; CODE_SIGN_STYLE = Automatic; @@ -703,7 +624,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = App/App.entitlements; CODE_SIGN_STYLE = Automatic; @@ -724,7 +644,7 @@ }; name = Release; }; - CF153A0A2BEC768C00741F42 /* Debug */ = { + E82F91DE2F2AD82100850070 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = EBEAC4EBEBB12957B79AE4D6 /* Pods-OneSignalNotificationServiceExtension.debug.xcconfig */; buildSettings = { @@ -735,7 +655,6 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 99SW8E36CT; @@ -745,7 +664,7 @@ INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 26.2; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -755,16 +674,20 @@ MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtensionA; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtensionCordova; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; - CF153A0B2BEC768C00741F42 /* Release */ = { + E82F91DF2F2AD82100850070 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 58CED0A0F03E31F92FFD8025 /* Pods-OneSignalNotificationServiceExtension.release.xcconfig */; buildSettings = { @@ -775,7 +698,6 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 99SW8E36CT; @@ -785,7 +707,49 @@ INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = OneSignalNotificationServiceExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 26.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtensionCordova; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + E82F91FB2F2AD8B000850070 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6AC3A76DD07F75F94E44CB02 /* Pods-OneSignalWidgetExtension.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 99SW8E36CT; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = OneSignalWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = OneSignalWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 26.2; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -793,12 +757,59 @@ ); LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MARKETING_VERSION = 1.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalNotificationServiceExtensionA; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalWidget; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_APPROACHABLE_CONCURRENCY = YES; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + E82F91FC2F2AD8B000850070 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = ACA94966EDDBC597E95F5866 /* Pods-OneSignalWidgetExtension.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 99SW8E36CT; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = OneSignalWidget/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = OneSignalWidget; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 26.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MARKETING_VERSION = 1.0; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example.OneSignalWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -806,15 +817,6 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 4711E14D2BFD3D4900C4D895 /* Build configuration list for PBXNativeTarget "ExampleWidgetExtension" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4711E14E2BFD3D4900C4D895 /* Debug */, - 4711E14F2BFD3D4900C4D895 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -833,11 +835,20 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - CF153A0C2BEC768C00741F42 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = { + E82F91DD2F2AD82100850070 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E82F91DE2F2AD82100850070 /* Debug */, + E82F91DF2F2AD82100850070 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E82F91FA2F2AD8B000850070 /* Build configuration list for PBXNativeTarget "OneSignalWidgetExtension" */ = { isa = XCConfigurationList; buildConfigurations = ( - CF153A0A2BEC768C00741F42 /* Debug */, - CF153A0B2BEC768C00741F42 /* Release */, + E82F91FB2F2AD8B000850070 /* Debug */, + E82F91FC2F2AD8B000850070 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/example/IonicCapOneSignal/ios/App/App.xcodeproj/xcshareddata/xcschemes/OneSignalNotificationServiceExtension.xcscheme b/example/IonicCapOneSignal/ios/App/App.xcodeproj/xcshareddata/xcschemes/OneSignalNotificationServiceExtension.xcscheme index 592218dc..e9848335 100644 --- a/example/IonicCapOneSignal/ios/App/App.xcodeproj/xcshareddata/xcschemes/OneSignalNotificationServiceExtension.xcscheme +++ b/example/IonicCapOneSignal/ios/App/App.xcodeproj/xcshareddata/xcschemes/OneSignalNotificationServiceExtension.xcscheme @@ -16,7 +16,7 @@ buildForAnalyzing = "YES"> diff --git a/example/IonicCapOneSignal/ios/App/App/Info.plist b/example/IonicCapOneSignal/ios/App/App/Info.plist index 4497c318..d22a272f 100644 --- a/example/IonicCapOneSignal/ios/App/App/Info.plist +++ b/example/IonicCapOneSignal/ios/App/App/Info.plist @@ -2,6 +2,8 @@ + NSSupportsLiveActivities + CFBundleDevelopmentRegion en CFBundleDisplayName @@ -28,8 +30,6 @@ Test Location NSLocationWhenInUseUsageDescription Test Location2 - NSSupportsLiveActivities - OneSignal_disable_badge_clearing OneSignal_require_privacy_consent diff --git a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/Info.plist b/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/Info.plist index 7d7e9e5d..57421ebf 100644 --- a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/Info.plist +++ b/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/Info.plist @@ -7,7 +7,7 @@ NSExtensionPointIdentifier com.apple.usernotifications.service NSExtensionPrincipalClass - NotificationService + $(PRODUCT_MODULE_NAME).NotificationService diff --git a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.h b/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.h deleted file mode 100644 index 3f3a3a87..00000000 --- a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// NotificationService.h -// OneSignalNotificationServiceExtension -// -// Created by Jenna Antilla on 5/8/24. -// - -#import - -@interface NotificationService : UNNotificationServiceExtension - -@end diff --git a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.m b/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.m deleted file mode 100644 index e24d645c..00000000 --- a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.m +++ /dev/null @@ -1,40 +0,0 @@ -#import - -#import "NotificationService.h" - -@interface NotificationService () - -@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver); -@property (nonatomic, strong) UNNotificationRequest *receivedRequest; -@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent; - -@end - -@implementation NotificationService - -- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler { - self.receivedRequest = request; - self.contentHandler = contentHandler; - self.bestAttemptContent = [request.content mutableCopy]; - - /* DEBUGGING: Uncomment the 2 lines below and comment out the one above to ensure this extension is executing - Note, this extension only runs when mutable-content is set - Setting an attachment or action buttons automatically adds this */ - // NSLog(@"Running NotificationServiceExtension"); - // self.bestAttemptContent.body = [@"[Modified] " stringByAppendingString:self.bestAttemptContent.body]; - - [OneSignalExtension didReceiveNotificationExtensionRequest:self.receivedRequest - withMutableNotificationContent:self.bestAttemptContent - withContentHandler:self.contentHandler]; -} - -- (void)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. - - [OneSignalExtension serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent]; - - self.contentHandler(self.bestAttemptContent); -} - -@end diff --git a/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift b/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift new file mode 100644 index 00000000..ab391a33 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalNotificationServiceExtension/NotificationService.swift @@ -0,0 +1,32 @@ +import UserNotifications +import OneSignalExtension + +class NotificationService: UNNotificationServiceExtension { + var contentHandler: ((UNNotificationContent) -> Void)? + var receivedRequest: UNNotificationRequest! + var bestAttemptContent: UNMutableNotificationContent? + + // Note this extension only runs when `mutable_content` is set + // Setting an attachment or action buttons automatically sets the property to true + override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { + self.receivedRequest = request + self.contentHandler = contentHandler + self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent) + + if let bestAttemptContent = bestAttemptContent { + // DEBUGGING: Uncomment the 2 lines below to check this extension is executing +// print("Running NotificationServiceExtension") +// bestAttemptContent.body = "[Modified] " + bestAttemptContent.body + + OneSignalExtension.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler) + } + } + + override func serviceExtensionTimeWillExpire() { + // 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 { + OneSignalExtension.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent) + contentHandler(bestAttemptContent) + } + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/AppIntent.swift b/example/IonicCapOneSignal/ios/App/OneSignalWidget/AppIntent.swift new file mode 100644 index 00000000..c29cd6c2 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/AppIntent.swift @@ -0,0 +1,18 @@ +// +// AppIntent.swift +// OneSignalWidget +// +// Created by Fadi George on 1/28/26. +// + +import WidgetKit +import AppIntents + +struct ConfigurationAppIntent: WidgetConfigurationIntent { + static var title: LocalizedStringResource { "Configuration" } + static var description: IntentDescription { "This is an example widget." } + + // An example configurable parameter. + @Parameter(title: "Favorite Emoji", default: "πŸ˜ƒ") + var favoriteEmoji: String +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/AccentColor.colorset/Contents.json b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..23058801 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/Contents.json b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/Info.plist b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Info.plist new file mode 100644 index 00000000..0f118fb7 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/Info.plist @@ -0,0 +1,11 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.widgetkit-extension + + + diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidget.swift b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidget.swift new file mode 100644 index 00000000..0cd287a1 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidget.swift @@ -0,0 +1,88 @@ +// +// OneSignalWidget.swift +// OneSignalWidget +// +// Created by Fadi George on 1/28/26. +// + +import WidgetKit +import SwiftUI + +struct Provider: AppIntentTimelineProvider { + func placeholder(in context: Context) -> SimpleEntry { + SimpleEntry(date: Date(), configuration: ConfigurationAppIntent()) + } + + func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry { + SimpleEntry(date: Date(), configuration: configuration) + } + + func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> 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) + } + + return Timeline(entries: entries, policy: .atEnd) + } + +// func relevances() async -> WidgetRelevances { +// // Generate a list containing the contexts this widget is relevant in. +// } +} + +struct SimpleEntry: TimelineEntry { + let date: Date + let configuration: ConfigurationAppIntent +} + +struct OneSignalWidgetEntryView : View { + var entry: Provider.Entry + + var body: some View { + VStack { + Text("Time:") + Text(entry.date, style: .time) + + Text("Favorite Emoji:") + Text(entry.configuration.favoriteEmoji) + } + } +} + +struct OneSignalWidget: Widget { + let kind: String = "OneSignalWidget" + + var body: some WidgetConfiguration { + AppIntentConfiguration(kind: kind, intent: ConfigurationAppIntent.self, provider: Provider()) { entry in + OneSignalWidgetEntryView(entry: entry) + .containerBackground(.fill.tertiary, for: .widget) + } + } +} + +extension ConfigurationAppIntent { + fileprivate static var smiley: ConfigurationAppIntent { + let intent = ConfigurationAppIntent() + intent.favoriteEmoji = "πŸ˜€" + return intent + } + + fileprivate static var starEyes: ConfigurationAppIntent { + let intent = ConfigurationAppIntent() + intent.favoriteEmoji = "🀩" + return intent + } +} + +#Preview(as: .systemSmall) { + OneSignalWidget() +} timeline: { + SimpleEntry(date: .now, configuration: .smiley) + SimpleEntry(date: .now, configuration: .starEyes) +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetBundle.swift b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetBundle.swift new file mode 100644 index 00000000..00c632d6 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetBundle.swift @@ -0,0 +1,18 @@ +// +// OneSignalWidgetBundle.swift +// OneSignalWidget +// +// Created by Fadi George on 1/28/26. +// + +import WidgetKit +import SwiftUI + +@main +struct OneSignalWidgetBundle: WidgetBundle { + var body: some Widget { + OneSignalWidget() + OneSignalWidgetControl() + OneSignalWidgetLiveActivity() + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetControl.swift b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetControl.swift new file mode 100644 index 00000000..85fe1076 --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetControl.swift @@ -0,0 +1,77 @@ +// +// OneSignalWidgetControl.swift +// OneSignalWidget +// +// Created by Fadi George on 1/28/26. +// + +import AppIntents +import SwiftUI +import WidgetKit + +struct OneSignalWidgetControl: ControlWidget { + static let kind: String = "com.onesignal.example.OneSignalWidget" + + var body: some ControlWidgetConfiguration { + AppIntentControlConfiguration( + kind: Self.kind, + provider: Provider() + ) { value in + ControlWidgetToggle( + "Start Timer", + isOn: value.isRunning, + action: StartTimerIntent(value.name) + ) { isRunning in + Label(isRunning ? "On" : "Off", systemImage: "timer") + } + } + .displayName("Timer") + .description("A an example control that runs a timer.") + } +} + +extension OneSignalWidgetControl { + struct Value { + var isRunning: Bool + var name: String + } + + struct Provider: AppIntentControlValueProvider { + func previewValue(configuration: TimerConfiguration) -> Value { + OneSignalWidgetControl.Value(isRunning: false, name: configuration.timerName) + } + + func currentValue(configuration: TimerConfiguration) async throws -> Value { + let isRunning = true // Check if the timer is running + return OneSignalWidgetControl.Value(isRunning: isRunning, name: configuration.timerName) + } + } +} + +struct TimerConfiguration: ControlConfigurationIntent { + static let title: LocalizedStringResource = "Timer Name Configuration" + + @Parameter(title: "Timer Name", default: "Timer") + var timerName: String +} + +struct StartTimerIntent: SetValueIntent { + static let title: LocalizedStringResource = "Start a timer" + + @Parameter(title: "Timer Name") + var name: String + + @Parameter(title: "Timer is running") + var value: Bool + + init() {} + + init(_ name: String) { + self.name = name + } + + func perform() async throws -> some IntentResult { + // Start the timer… + return .result() + } +} diff --git a/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetLiveActivity.swift b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetLiveActivity.swift new file mode 100644 index 00000000..ea1f2e9d --- /dev/null +++ b/example/IonicCapOneSignal/ios/App/OneSignalWidget/OneSignalWidgetLiveActivity.swift @@ -0,0 +1,80 @@ +// +// OneSignalWidgetLiveActivity.swift +// OneSignalWidget +// +// Created by Fadi George on 1/28/26. +// + +import ActivityKit +import WidgetKit +import SwiftUI + +struct OneSignalWidgetAttributes: ActivityAttributes { + public struct ContentState: Codable, Hashable { + // Dynamic stateful properties about your activity go here! + var emoji: String + } + + // Fixed non-changing properties about your activity go here! + var name: String +} + +struct OneSignalWidgetLiveActivity: Widget { + var body: some WidgetConfiguration { + ActivityConfiguration(for: OneSignalWidgetAttributes.self) { context in + // Lock screen/banner UI goes here + VStack { + Text("Hello \(context.state.emoji)") + } + .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 \(context.state.emoji)") + // more content + } + } compactLeading: { + Text("L") + } compactTrailing: { + Text("T \(context.state.emoji)") + } minimal: { + Text(context.state.emoji) + } + .widgetURL(URL(string: "http://www.apple.com")) + .keylineTint(Color.red) + } + } +} + +extension OneSignalWidgetAttributes { + fileprivate static var preview: OneSignalWidgetAttributes { + OneSignalWidgetAttributes(name: "World") + } +} + +extension OneSignalWidgetAttributes.ContentState { + fileprivate static var smiley: OneSignalWidgetAttributes.ContentState { + OneSignalWidgetAttributes.ContentState(emoji: "πŸ˜€") + } + + fileprivate static var starEyes: OneSignalWidgetAttributes.ContentState { + OneSignalWidgetAttributes.ContentState(emoji: "🀩") + } +} + +#Preview("Notification", as: .content, using: OneSignalWidgetAttributes.preview) { + OneSignalWidgetLiveActivity() +} contentStates: { + OneSignalWidgetAttributes.ContentState.smiley + OneSignalWidgetAttributes.ContentState.starEyes +} diff --git a/example/IonicCapOneSignal/ios/App/Podfile b/example/IonicCapOneSignal/ios/App/Podfile index 18e5fc8f..26b1075d 100644 --- a/example/IonicCapOneSignal/ios/App/Podfile +++ b/example/IonicCapOneSignal/ios/App/Podfile @@ -28,6 +28,6 @@ target 'OneSignalNotificationServiceExtension' do pod 'OneSignalXCFramework', '>= 5.0', '< 6.0' end -target 'ExampleWidgetExtension' do +target 'OneSignalWidgetExtension' do pod 'OneSignalXCFramework', '>= 5.0', '< 6.0' -end \ No newline at end of file +end diff --git a/example/IonicCapOneSignal/ios/App/Podfile.lock b/example/IonicCapOneSignal/ios/App/Podfile.lock index 5b3f8276..d58bede4 100644 --- a/example/IonicCapOneSignal/ios/App/Podfile.lock +++ b/example/IonicCapOneSignal/ios/App/Podfile.lock @@ -6,10 +6,10 @@ PODS: - CapacitorCordova (7.4.5) - CordovaPluginsStatic (7.4.5): - CapacitorCordova - - OneSignalXCFramework (= 5.2.16) - - OneSignalXCFramework (5.2.16): - - OneSignalXCFramework/OneSignalComplete (= 5.2.16) - - OneSignalXCFramework/OneSignal (5.2.16): + - OneSignalXCFramework (= 5.4.0) + - OneSignalXCFramework (5.4.0): + - OneSignalXCFramework/OneSignalComplete (= 5.4.0) + - OneSignalXCFramework/OneSignal (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalLiveActivities @@ -17,38 +17,38 @@ PODS: - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalComplete (5.2.16): + - OneSignalXCFramework/OneSignalComplete (5.4.0): - OneSignalXCFramework/OneSignal - OneSignalXCFramework/OneSignalInAppMessages - OneSignalXCFramework/OneSignalLocation - - OneSignalXCFramework/OneSignalCore (5.2.16) - - OneSignalXCFramework/OneSignalExtension (5.2.16): + - OneSignalXCFramework/OneSignalCore (5.4.0) + - OneSignalXCFramework/OneSignalExtension (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalInAppMessages (5.2.16): + - OneSignalXCFramework/OneSignalInAppMessages (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalOutcomes - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLiveActivities (5.2.16): + - OneSignalXCFramework/OneSignalLiveActivities (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalLocation (5.2.16): + - OneSignalXCFramework/OneSignalLocation (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore - OneSignalXCFramework/OneSignalUser - - OneSignalXCFramework/OneSignalNotifications (5.2.16): + - OneSignalXCFramework/OneSignalNotifications (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalExtension - OneSignalXCFramework/OneSignalOutcomes - - OneSignalXCFramework/OneSignalOSCore (5.2.16): + - OneSignalXCFramework/OneSignalOSCore (5.4.0): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalOutcomes (5.2.16): + - OneSignalXCFramework/OneSignalOutcomes (5.4.0): - OneSignalXCFramework/OneSignalCore - - OneSignalXCFramework/OneSignalUser (5.2.16): + - OneSignalXCFramework/OneSignalUser (5.4.0): - OneSignalXCFramework/OneSignalCore - OneSignalXCFramework/OneSignalNotifications - OneSignalXCFramework/OneSignalOSCore @@ -79,9 +79,9 @@ SPEC CHECKSUMS: Capacitor: 12914e6f1b7835e161a74ebd19cb361efa37a7dd CapacitorApp: 63b237168fc869e758481dba283315a85743ee78 CapacitorCordova: 31bbe4466000c6b86d9b7f1181ee286cff0205aa - CordovaPluginsStatic: 635eeb2ab70de321095206fce1767c4de7d5b4f1 - OneSignalXCFramework: 8ed6648481bee0bd973a138fecd80331b798524f + CordovaPluginsStatic: 3d602e37c70cd6b14f24da42db9435a84ccbaa7b + OneSignalXCFramework: 95b6391df5a91b448003149c1a633ade42ceca1e -PODFILE CHECKSUM: a31c0839423113e26e8afc91cc07a41d59e58245 +PODFILE CHECKSUM: 4e290bb2df47012150def12d11e3a198a5384f5e COCOAPODS: 1.16.2 diff --git a/example/IonicCapOneSignal/src/OSButtons.tsx b/example/IonicCapOneSignal/src/OSButtons.tsx index 25f49af6..d51d4bfd 100644 --- a/example/IonicCapOneSignal/src/OSButtons.tsx +++ b/example/IonicCapOneSignal/src/OSButtons.tsx @@ -1,6 +1,6 @@ +import { IonButton, IonContent, IonText } from '@ionic/react'; import OneSignal from 'onesignal-cordova-plugin'; import * as React from 'react'; -import { IonButton, IonContent, IonText } from '@ionic/react'; export interface Props { loggingFunction: Function; inputFieldValue: string; @@ -262,6 +262,29 @@ class OSButtons extends React.Component { OneSignal.logout(); }); + const trackEventButton = renderButtonView('Track Event', () => { + loggingFunction(`Tracking custom events`); + const platform = window.cordova?.platformId || 'unknown'; + OneSignal.User.trackEvent(`Cordova-${platform}-noprops`); + + OneSignal.User.trackEvent(`Cordova-${platform}`, { + someNum: 123, + someFloat: 3.14159, + someString: 'abc', + someBool: true, + someObject: { + abc: '123', + nested: { + def: '456', + }, + ghi: null, + }, + someArray: [1, 2], + someMixedArray: [1, '2', { abc: '123' }, null], + someNull: null, + }); + }); + const sendTagWithKeyButton = renderButtonView( 'Send tag with key my_tag', async () => { @@ -373,6 +396,7 @@ class OSButtons extends React.Component { return [ loginButton, logoutButton, + trackEventButton, addEmailButton, removeEmailButton, sendTagWithKeyButton, diff --git a/package.json b/package.json index a342280f..cd468015 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "5.2.20", + "version": "5.3.0", "name": "onesignal-cordova-plugin", "author": "Josh Kasten, Brad Hesse, Rodrigo Gomez-Palacio", "files": [ @@ -33,7 +33,7 @@ "@vitest/coverage-v8": "^4.0.2", "concurrently": "^9.2.1", "happy-dom": "^20.0.8", - "oxlint": "^1.24.0", + "oxlint": "^1.42.0", "prettier": "^3.6.2", "typescript": "^5.9.3", "vite": "^7.1.12", diff --git a/plugin.xml b/plugin.xml index 95702ad2..8a9cb546 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="5.3.0"> OneSignal Push Notifications Josh Kasten, Bradley Hesse, Rodrigo Gomez-Palacio @@ -26,7 +26,7 @@ - + @@ -74,7 +74,7 @@ - + diff --git a/src/android/com/onesignal/cordova/OneSignalController.java b/src/android/com/onesignal/cordova/OneSignalController.java index 225262b2..5608e2d6 100644 --- a/src/android/com/onesignal/cordova/OneSignalController.java +++ b/src/android/com/onesignal/cordova/OneSignalController.java @@ -342,4 +342,61 @@ public static boolean startDefaultLiveActivity() { // doesn't apply to Android return true; } + + /** Custom Events */ + public static boolean trackEvent(JSONArray data) { + try { + String eventName = data.getString(0); + Map properties = null; + + if (data.length() > 1 && !data.isNull(1)) { + JSONObject propertiesObject = data.getJSONObject(1); + properties = jsonObjectToMap(propertiesObject); + } + + OneSignal.getUser().trackEvent(eventName, properties); + return true; + } catch (Throwable t) { + t.printStackTrace(); + return false; + } + } + + /** Convert JSONObject to Map, recursively converting nested objects and arrays */ + private static Map jsonObjectToMap(JSONObject json) throws JSONException { + Map map = new HashMap<>(); + Iterator keys = json.keys(); + + while (keys.hasNext()) { + String key = keys.next(); + Object value = json.get(key); + // Skip null values as the native SDK doesn't accept them + if (value != JSONObject.NULL) { + map.put(key, convertJsonValue(value)); + } + } + + return map; + } + + /** Convert JSON value to native Java type */ + private static Object convertJsonValue(Object value) throws JSONException { + if (value instanceof JSONObject) { + return jsonObjectToMap((JSONObject) value); + } else if (value instanceof JSONArray) { + JSONArray jsonArray = (JSONArray) value; + Collection list = new ArrayList<>(); + for (int i = 0; i < jsonArray.length(); i++) { + Object item = jsonArray.get(i); + // Skip null values in arrays + if (item != JSONObject.NULL) { + list.add(convertJsonValue(item)); + } + } + return list; + } else { + // Primitive types (String, Integer, Double, Boolean, etc.) + return value; + } + } } diff --git a/src/android/com/onesignal/cordova/OneSignalPush.java b/src/android/com/onesignal/cordova/OneSignalPush.java index 02a65751..407678ce 100644 --- a/src/android/com/onesignal/cordova/OneSignalPush.java +++ b/src/android/com/onesignal/cordova/OneSignalPush.java @@ -139,6 +139,7 @@ public class OneSignalPush extends CordovaPlugin private static final String REMOVE_PUSH_TO_START_TOKEN = "removePushToStartToken"; private static final String SETUP_DEFAULT_ACTIVITY = "setupDefaultLiveActivity"; private static final String START_DEFAULT_LIVE_ACTIVITY = "startDefaultLiveActivity"; + private static final String TRACK_EVENT = "trackEvent"; private static final HashMap notificationWillDisplayCache = new HashMap<>(); private static final HashMap preventDefaultCache = new HashMap<>(); @@ -369,7 +370,7 @@ public boolean init(CallbackContext callbackContext, JSONArray data) { initDone = true; OneSignalWrapper.setSdkType("cordova"); - OneSignalWrapper.setSdkVersion("050220"); + OneSignalWrapper.setSdkVersion("050300"); try { String appId = data.getString(0); OneSignal.initWithContext(this.cordova.getActivity(), appId); @@ -640,11 +641,14 @@ public boolean execute(String action, JSONArray data, CallbackContext callbackCo result = OneSignalController.startDefaultLiveActivity(); break; + case TRACK_EVENT: + result = OneSignalController.trackEvent(data); + break; + default: Logging.error(TAG + "Invalid action : " + action, null); CallbackHelper.callbackError(callbackContext, "Invalid action : " + action); } - return result; } diff --git a/src/ios/OneSignalPush.h b/src/ios/OneSignalPush.h index 1a86dbb5..e907318a 100644 --- a/src/ios/OneSignalPush.h +++ b/src/ios/OneSignalPush.h @@ -121,6 +121,9 @@ - (void)addUniqueOutcome:(CDVInvokedUrlCommand *_Nonnull)command; - (void)addOutcomeWithValue:(CDVInvokedUrlCommand *_Nonnull)command; +// Custom Events +- (void)trackEvent:(CDVInvokedUrlCommand *_Nonnull)command; + // Location - (void)requestLocationPermission:(CDVInvokedUrlCommand *_Nonnull)command; - (void)setLocationShared:(CDVInvokedUrlCommand *_Nonnull)command; diff --git a/src/ios/OneSignalPush.m b/src/ios/OneSignalPush.m index 43aa0848..45070a9d 100644 --- a/src/ios/OneSignalPush.m +++ b/src/ios/OneSignalPush.m @@ -119,7 +119,7 @@ void processNotificationClicked(OSNotificationClickEvent *event) { void initOneSignalObject(NSDictionary *launchOptions) { OneSignalWrapper.sdkType = @"cordova"; - OneSignalWrapper.sdkVersion = @"050220"; + OneSignalWrapper.sdkVersion = @"050300"; [OneSignal initialize:nil withLaunchOptions:launchOptions]; } @@ -808,4 +808,19 @@ - (void)startDefaultLiveActivity:(CDVInvokedUrlCommand *)command { } #endif } + +/** + * Custom Events + */ + +- (void)trackEvent:(CDVInvokedUrlCommand *)command { + NSString *eventName = command.arguments[0]; + NSDictionary *properties = nil; + + if (command.arguments.count > 1 && command.arguments[1] != [NSNull null]) { + properties = command.arguments[1]; + } + + [OneSignal.User trackEventWithName:eventName properties:properties]; +} @end diff --git a/www/UserNamespace.test.ts b/www/UserNamespace.test.ts index 81bddae3..2dfbcfc9 100644 --- a/www/UserNamespace.test.ts +++ b/www/UserNamespace.test.ts @@ -443,4 +443,67 @@ describe('User', () => { await expect(promise).rejects.toThrow('Failed to get external id'); }); }); + + describe('trackEvent', () => { + test('should call cordova.exec with only event name', () => { + const eventName = 'purchase'; + + user.trackEvent(eventName); + + expect(window.cordova.exec).toHaveBeenCalledWith( + expect.any(Function), + expect.any(Function), + 'OneSignalPush', + 'trackEvent', + [eventName], + ); + }); + + test('should call cordova.exec with event name and properties', () => { + const eventName = 'purchase'; + const properties = { amount: 99.99, currency: 'USD' }; + + user.trackEvent(eventName, properties); + + expect(window.cordova.exec).toHaveBeenCalledWith( + expect.any(Function), + expect.any(Function), + 'OneSignalPush', + 'trackEvent', + [eventName, properties], + ); + }); + + test('should not call cordova.exec when properties are not serializable', () => { + const eventName = 'purchase'; + const circularObj: Record = { name: 'test' }; + circularObj.self = circularObj; + const consoleSpy = vi + .spyOn(console, 'error') + .mockImplementation(() => {}); + + user.trackEvent(eventName, circularObj); + + expect(consoleSpy).toHaveBeenCalledWith( + 'Properties must be a JSON-serializable object', + ); + expect(window.cordova.exec).not.toHaveBeenCalled(); + consoleSpy.mockRestore(); + }); + + test('should not call cordova.exec when properties is an array', () => { + const eventName = 'purchase'; + const consoleSpy = vi + .spyOn(console, 'error') + .mockImplementation(() => {}); + + user.trackEvent(eventName, ['item1', 'item2'] as unknown as object); + + expect(consoleSpy).toHaveBeenCalledWith( + 'Properties must be a JSON-serializable object', + ); + expect(window.cordova.exec).not.toHaveBeenCalled(); + consoleSpy.mockRestore(); + }); + }); }); diff --git a/www/UserNamespace.ts b/www/UserNamespace.ts index 7ae2edd5..3d73ddc8 100644 --- a/www/UserNamespace.ts +++ b/www/UserNamespace.ts @@ -1,4 +1,4 @@ -import { noop, removeListener } from './helpers'; +import { isObjectSerializable, noop, removeListener } from './helpers'; import PushSubscription from './PushSubscriptionNamespace'; // Represents the current user state @@ -251,4 +251,19 @@ export default class User { ); }); } + + /** + * Track a custom event with the provided name and optional properties. + * @param {string} name - The name of the custom event + * @param {object} [properties] - Optional properties to associate with the event + * @returns void + */ + trackEvent(name: string, properties?: object): void { + if (properties !== undefined && !isObjectSerializable(properties)) { + console.error('Properties must be a JSON-serializable object'); + return; + } + const args = properties ? [name, properties] : [name]; + window.cordova.exec(noop, noop, 'OneSignalPush', 'trackEvent', args); + } } diff --git a/www/helpers.ts b/www/helpers.ts index 46a80fd6..723814b2 100644 --- a/www/helpers.ts +++ b/www/helpers.ts @@ -15,3 +15,18 @@ export function removeListener( /** No-op function for cordova.exec error/success callbacks */ export const noop = () => {}; + +/** + * Returns true if the value is a JSON-serializable object. + */ +export function isObjectSerializable(value: unknown): boolean { + if (!(typeof value === 'object' && value !== null && !Array.isArray(value))) { + return false; + } + try { + JSON.stringify(value); + return true; + } catch { + return false; + } +}