Skip to content

Commit 8d38bd6

Browse files
authored
Merge branch 'feat/geofencing' into bl/sample-app-geofencing
2 parents df5d7b8 + b5d674c commit 8d38bd6

File tree

76 files changed

+3645
-820
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3645
-820
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# A workflow for validating that release branch versions match the version in code
2+
3+
name: Release Branch Version Check
4+
5+
# Triggers the workflow when we push to a rel/* branch or create a tag
6+
on:
7+
push:
8+
branches:
9+
- 'rel/*'
10+
tags:
11+
- '*'
12+
13+
jobs:
14+
version-check:
15+
name: Validate Release Branch Version
16+
runs-on: ubuntu-22.04
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
# Extract version from branch name and Version.swift, then compare them
22+
- name: Validate Version Match
23+
id: validate_version_match
24+
run: |
25+
# Determine if this is a tag or branch push
26+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
27+
VERSION_NAME="${GITHUB_REF#refs/tags/}"
28+
echo "Detected tag push: $VERSION_NAME"
29+
elif [[ "${GITHUB_REF}" == refs/heads/rel/* ]]; then
30+
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
31+
if [[ $BRANCH_NAME =~ ^rel/(.+)$ ]]; then
32+
VERSION_NAME="${BASH_REMATCH[1]}"
33+
echo "Detected rel/* branch push: $VERSION_NAME"
34+
else
35+
ERROR_MESSAGE="Error: branch name does not match expected pattern"
36+
echo "$ERROR_MESSAGE"
37+
echo "ERROR_MESSAGE=$ERROR_MESSAGE" >> $GITHUB_ENV
38+
exit 1
39+
fi
40+
else
41+
echo "Info: Not a rel/* branch or tag push. Exiting successfully."
42+
exit 0
43+
fi
44+
45+
# Extract version from Version.swift
46+
SWIFT_VERSION=$(grep -o '__klaviyoSwiftVersion = "[^"]*"' Sources/KlaviyoCore/Utils/Version.swift | sed 's/.*"\([^"]*\)".*/\1/')
47+
echo "Version.swift version: $SWIFT_VERSION"
48+
49+
# Extract versions from all podspec files
50+
PODSPEC_VERSIONS=""
51+
PODSPEC_ERRORS=""
52+
for podspec in *.podspec; do
53+
if [ -f "$podspec" ]; then
54+
PODSPEC_VERSION=$(grep -o 's\.version.*=.*"[^"]*"' "$podspec" | sed 's/.*"\([^"]*\)".*/\1/')
55+
echo "Podspec $podspec version: $PODSPEC_VERSION"
56+
if [ "$VERSION_NAME" != "$PODSPEC_VERSION" ]; then
57+
PODSPEC_ERRORS="$PODSPEC_ERRORS\n❌ $podspec version mismatch: expected $VERSION_NAME, found $PODSPEC_VERSION"
58+
else
59+
echo "✅ $podspec version matches: $PODSPEC_VERSION"
60+
fi
61+
PODSPEC_VERSIONS="$PODSPEC_VERSIONS $podspec:$PODSPEC_VERSION"
62+
fi
63+
done
64+
65+
# Compare versions
66+
if [ "$VERSION_NAME" = "$SWIFT_VERSION" ] && [ -z "$PODSPEC_ERRORS" ]; then
67+
echo "✅ All version matches confirmed: $VERSION_NAME"
68+
else
69+
ERROR_MESSAGE="❌ Version mismatch detected!"
70+
if [ "$VERSION_NAME" != "$SWIFT_VERSION" ]; then
71+
ERROR_MESSAGE="$ERROR_MESSAGE\n❌ Version.swift mismatch: expected $VERSION_NAME, found $SWIFT_VERSION"
72+
fi
73+
if [ -n "$PODSPEC_ERRORS" ]; then
74+
ERROR_MESSAGE="$ERROR_MESSAGE$PODSPEC_ERRORS"
75+
fi
76+
ERROR_MESSAGE="$ERROR_MESSAGE\n\nPlease update version numbers in Sources/KlaviyoCore/Utils/Version.swift and all *.podspec files (or correct the branch/tag name)."
77+
echo -e "$ERROR_MESSAGE"
78+
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
79+
echo "SWIFT_VERSION=$SWIFT_VERSION" >> $GITHUB_ENV
80+
echo "PODSPEC_VERSIONS=$PODSPEC_VERSIONS" >> $GITHUB_ENV
81+
echo "ERROR_MESSAGE=$ERROR_MESSAGE" >> $GITHUB_ENV
82+
exit 1
83+
fi
84+
85+
# Send Slack notification on failure
86+
- name: Send Slack notification on failure
87+
if: failure()
88+
uses: slackapi/[email protected]
89+
with:
90+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
91+
webhook-type: incoming-webhook
92+
payload: |
93+
text: "🚨 Release Version Mismatch Detected"
94+
blocks:
95+
- type: "section"
96+
text:
97+
type: "mrkdwn"
98+
text: "🚨 Release Version Mismatch Detected\n"
99+
- type: "section"
100+
text:
101+
type: "mrkdwn"
102+
text: "*Repository:* ${{ github.repository }}\n*Ref:* `${{ github.ref_name }}`\n*Expected Version:* `${{ env.VERSION_NAME }}`\n*Version.swift Version:* `${{ env.SWIFT_VERSION }}`\n*Podspec Versions:* `${{ env.PODSPEC_VERSIONS }}`\n*Error:* `${{ env.ERROR_MESSAGE }}`\n*Action:* Please update version numbers in `Sources/KlaviyoCore/Utils/Version.swift` and all `*.podspec` files (or correct the branch/tag name)."
103+
- type: "section"
104+
text:
105+
type: "mrkdwn"
106+
text: "*Workflow Run:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>"

Examples/KlaviyoSwiftExamples/SPMExample/SPMExample/Info.plist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<array>
4141
<string>remote-notification</string>
4242
<string>location</string>
43+
<string>fetch</string>
4344
</array>
4445
<key>NSLocationWhenInUseUsageDescription</key>
4546
<string>This app needs location access to show your current location on the delivery map and help you find nearby delivery zones.</string>

KlaviyoCore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "KlaviyoCore"
3-
s.version = "5.0.2"
3+
s.version = "5.1.0"
44
s.summary = "Core functionalities for the Klaviyo SDK"
55
s.description = <<-DESC
66
Core functionalities and utilities for the Klaviyo SDK.

KlaviyoForms.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "KlaviyoForms"
3-
s.version = "5.0.2"
3+
s.version = "5.1.0"
44
s.summary = "Klaviyo forms is a new way to engage with your app users"
55
s.description = <<-DESC
66
Use Klaviyo forms to include in app forms in your app and engage user with marketing content
@@ -19,5 +19,5 @@ Pod::Spec.new do |s|
1919
]
2020
}
2121
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-package-name KlaviyoSwift -package-name KlaviyoCore' }
22-
s.dependency 'KlaviyoSwift', '~> 5.0.2'
22+
s.dependency 'KlaviyoSwift', '~> 5.1.0'
2323
end

KlaviyoLocation.podspec

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Pod::Spec.new do |s|
2+
s.name = "KlaviyoLocation"
3+
s.version = "5.1.0"
4+
s.summary = "Location services and geofencing for the Klaviyo SDK"
5+
s.description = <<-DESC
6+
Use KlaviyoLocation to enable location-based tracking and geofencing capabilities in your iOS applications.
7+
This module provides geofence management, location tracking, and location-based event triggers.
8+
DESC
9+
s.homepage = "https://github.com/klaviyo/klaviyo-swift-sdk"
10+
s.license = { :type => "MIT", :file => "LICENSE" }
11+
s.author = { "Mobile @ Klaviyo" => "[email protected]" }
12+
s.source = { :git => "https://github.com/klaviyo/klaviyo-swift-sdk.git", :tag => s.version.to_s }
13+
s.swift_version = '5.7'
14+
s.platform = :ios, '13.0'
15+
s.source_files = 'Sources/KlaviyoLocation/**/*.swift'
16+
s.resource_bundles = {
17+
'KlaviyoLocationResources' => [
18+
'Sources/KlaviyoLocation/Assets/*.{json}'
19+
]
20+
}
21+
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-package-name KlaviyoLocation -package-name KlaviyoSwift -package-name KlaviyoCore' }
22+
s.dependency 'KlaviyoSwift'
23+
s.frameworks = 'CoreLocation'
24+
end

KlaviyoSwift.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "KlaviyoSwift"
3-
s.version = "5.0.2"
3+
s.version = "5.1.0"
44
s.summary = "Incorporate Klaviyo's event and person tracking and push notifications functionality into iOS applications"
55

66
s.description = <<-DESC
@@ -17,6 +17,6 @@ Pod::Spec.new do |s|
1717
s.source_files = 'Sources/KlaviyoSwift/**/*.swift'
1818
s.resource_bundles = {"KlaviyoSwift" => ["Sources/KlaviyoSwift/PrivacyInfo.xcprivacy"]}
1919
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-package-name KlaviyoSwift -package-name KlaviyoCore' }
20-
s.dependency 'KlaviyoCore', '~> 5.0.2'
20+
s.dependency 'KlaviyoCore', '~> 5.1.0'
2121
s.dependency 'AnyCodable-FlightSchool'
2222
end

KlaviyoSwiftExtension.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "KlaviyoSwiftExtension"
3-
s.version = "5.0.2"
3+
s.version = "5.1.0"
44
s.summary = "Incorporate Klaviyo's rich push notifications functionality into your iOS applications"
55

66
s.description = <<-DESC

MIGRATION_GUIDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33

44
This guide outlines how developers can migrate from older versions of our SDK to newer ones.
55

6+
## Migrating to v5.1.0
7+
8+
### Deep Linking
9+
10+
#### Custom deep link handling
11+
12+
We have added a deprecation warning for the `handle(notificationResponse:withCompletionHandler:deepLinkHandler:)` method, which will be obsoleted in the next major version of the SDK. This method has been replaced with with [`handle(notificationResponse:withCompletionHandler:)`](https://github.com/klaviyo/klaviyo-swift-sdk/blob/bea7fa7717f0a1c6470d646539fa6e2e4f826645/Sources/KlaviyoSwift/Klaviyo.swift#L206). If you were previously providing your own deep link handling logic using the now-deprecated method, you should now call our new [`registerDeepLinkHandler(_:)`](https://github.com/klaviyo/klaviyo-swift-sdk/blob/bea7fa7717f0a1c6470d646539fa6e2e4f826645/Sources/KlaviyoSwift/Klaviyo.swift#L182) method. For more information, see the [**Deep Linking** section](./README.md#deep-linking) of the README.
13+
14+
#### Handling universal links
15+
16+
This version enhances functionality for universal links, ensuring that links delivered via email campaigns can be opened in-app *and* be tracked as a Klaviyo profile event when clicked. We encourage you to adopt this new functionality to ensure you're getting full support for universal links. Refer to [**Handling Universal Links**](./README.md#handling-universal-links) in the README.
17+
618
## Migrating to v5.0.0
719

820
### In-App Forms

Package.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ let package = Package(
102102
"KlaviyoSwift",
103103
"KlaviyoCore"
104104
]
105+
),
106+
.testTarget(
107+
name: "KlaviyoLocationTests",
108+
dependencies: [
109+
"KlaviyoSwift",
110+
"KlaviyoCore",
111+
"KlaviyoLocation"
112+
]
105113
)
106114
]
107115
)

0 commit comments

Comments
 (0)