Skip to content

Commit 58ad654

Browse files
author
Evan Greer
committed
Merge branch 'master' into feature/itbl_track_anon_user
# Conflicts: # Iterable-iOS-AppExtensions.podspec # Iterable-iOS-SDK.podspec # swift-sdk/Internal/InternalIterableAPI.swift # swift-sdk/SDK/IterableAPI.swift
2 parents 6f57b12 + 7eab80a commit 58ad654

File tree

7 files changed

+166
-54
lines changed

7 files changed

+166
-54
lines changed
+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Prepare For Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g., 6.5.0)'
8+
required: true
9+
type: string
10+
jira_ticket:
11+
description: 'JIRA ticket MOB number (e.g., 1234)'
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
prepare-release:
21+
runs-on: macos-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Update Changelog
28+
id: update_changelog
29+
run: |
30+
changelog_file="CHANGELOG.md"
31+
32+
# Function to extract content between two patterns, including the first pattern
33+
extract_between() {
34+
awk "/^## \[$1\]/{p=1;print;next} /^## \[/{p=0} p" "$3"
35+
}
36+
37+
# Get the unreleased content
38+
unreleased_content=$(extract_between "Unreleased" "[0-9]" "$changelog_file")
39+
40+
if [ -z "$unreleased_content" ]; then
41+
echo "No unreleased changes found in $changelog_file"
42+
exit 1
43+
fi
44+
45+
# Get the current version - using awk
46+
current_version=$(awk '/^## \[[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?\]/ { match($0, /[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?/); print substr($0, RSTART, RLENGTH); exit }' "$changelog_file")
47+
new_version="${{ github.event.inputs.version }}"
48+
49+
# Validate version format
50+
if ! [[ $new_version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
51+
echo "Invalid version format. Please use semantic versioning (e.g., 6.5.0 or 6.5.0-beta1)"
52+
exit 1
53+
fi
54+
55+
echo "new_version=${new_version}" >> $GITHUB_OUTPUT
56+
57+
# Create temporary file
58+
temp_file=$(mktemp)
59+
60+
# Preserve header and write new content
61+
{
62+
# Preserve the header (first 4 lines)
63+
head -n 4 "$changelog_file"
64+
echo "## [Unreleased]"
65+
echo ""
66+
echo "## [$new_version]"
67+
# Remove the "## [Unreleased]" line from unreleased_content using BSD sed
68+
echo "$unreleased_content" | sed '1{/^## \[Unreleased\]/d;}'
69+
echo ""
70+
# Get the rest of the file starting from the first version entry
71+
sed -n '/^## \[[0-9]/,$p' "$changelog_file"
72+
} > "$temp_file"
73+
74+
# Replace original file
75+
mv "$temp_file" "$changelog_file"
76+
77+
- name: Update Version Numbers
78+
run: |
79+
# Update Iterable-iOS-SDK.podspec
80+
sed -i '' "s/\(s\.version[[:space:]]*=[[:space:]]*\)\".*\"/\1\"${{ github.event.inputs.version }}\"/" Iterable-iOS-SDK.podspec
81+
82+
# Update Iterable-iOS-AppExtensions.podspec
83+
sed -i '' "s/\(s\.version[[:space:]]*=[[:space:]]*\)\".*\"/\1\"${{ github.event.inputs.version }}\"/" Iterable-iOS-AppExtensions.podspec
84+
85+
# Update sdkVersion in IterableAPI.swift
86+
find . -name "IterableAPI.swift" -type f -exec sed -i '' "s/\(static let sdkVersion[[:space:]]*=[[:space:]]*\)\".*\"/\1\"${{ github.event.inputs.version }}\"/" {} \;
87+
88+
- name: Create Pull Request
89+
uses: peter-evans/create-pull-request@v5
90+
with:
91+
token: ${{ secrets.GITHUB_TOKEN }}
92+
title: "MOB-${{ github.event.inputs.jira_ticket }}: Prepare for Release ${{ steps.update_changelog.outputs.new_version }}"
93+
body: |
94+
# Prepare for Release ${{ steps.update_changelog.outputs.new_version }}
95+
96+
## SDK Release Checklist
97+
- [ ] CHANGELOG.md updated with correct version
98+
- [ ] Version numbers updated:
99+
- [ ] Iterable-iOS-SDK.podspec
100+
- [ ] Iterable-iOS-AppExtensions.podspec
101+
- [ ] sdkVersion in IterableAPI.swift
102+
- [ ] README.md reviewed (if needed)
103+
- [ ] All tests passing
104+
- [ ] Documentation updated (if needed)
105+
106+
branch: "MOB-${{ github.event.inputs.jira_ticket }}-prepare-for-release-${{ steps.update_changelog.outputs.new_version }}"
107+
commit-message: "[MOB-${{ github.event.inputs.jira_ticket }}]: Prepare for release ${{ steps.update_changelog.outputs.new_version }}"
108+
labels: release
109+
delete-branch: true

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ CI.swift
2727
.build/arm64-apple-macosx/debug/index/db/v13/p25195--4de704/data.mdb
2828
.build/workspace-state.json
2929
*.mdb
30+
.build/arm64-apple-macosx/debug/IterableSDK.build/output-file-map.json

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1717
- Anonymous user activation is currently in private beta. If you'd like to learn more about it or discuss using it, talk to your Iterable customer success manager (who can also provide detailed documentation).
1818

1919
## [Unreleased]
20+
- Adding section for unreleased changes
21+
22+
## [6.5.11]
23+
### Fixed
24+
- Added missing constructor for `IterableAPIMobileFrameworkInfo`
25+
26+
## [6.5.10]
2027
### Added
2128
- Added `mobileFrameworkInfo` configuration option to `IterableConfig` to identify the mobile framework (Flutter, React Native, or Native) being used with the SDK.
29+
### Fixed
30+
- Fixed notification tracking bug that prevents SDK from receiving push notifications when system notification settings are turned off.
2231

2332
## [6.5.9]
2433
### Added

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ Release notes:
6060
Support policies:
6161

6262
- Iterable's [SDK Support Policy](https://support.iterable.com/hc/articles/360046136171)
63-
- Iterable's [Beta SDK Disclaimer](https://support.iterable.com/hc/articles/360034753412)
6463

6564
Troubleshooting:
6665

swift-sdk/Internal/InternalIterableAPI.swift

+4-11
Original file line numberDiff line numberDiff line change
@@ -316,17 +316,12 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
316316
return SendRequestError.createErroredFuture(reason: errorMessage)
317317
}
318318

319-
guard userId != nil || email != nil else {
319+
guard isEitherUserIdOrEmailSet() else {
320320
let errorMessage = "either userId or email must be present"
321321
onFailure?(errorMessage, nil)
322322
return SendRequestError.createErroredFuture(reason: errorMessage)
323323
}
324324

325-
// We need to call register token here so that we can trigger the device registration
326-
// with the updated notification settings
327-
328-
register(token: hexToken)
329-
330325
return requestHandler.disableDeviceForCurrentUser(hexToken: hexToken, withOnSuccess: onSuccess, onFailure: onFailure)
331326
}
332327

@@ -774,6 +769,8 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
774769

775770
ITBInfo()
776771

772+
guard isSDKInitialized() else { return }
773+
777774
self.authManager.pauseAuthRetries(false)
778775
if let authToken {
779776
self.authManager.setNewToken(authToken)
@@ -923,11 +920,7 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
923920

924921
if self.isEitherUserIdOrEmailSet() {
925922
if hasStoredPermission && (storedEnabled != systemEnabled) {
926-
if !systemEnabled {
927-
self.disableDeviceForCurrentUser()
928-
} else {
929-
self.notificationStateProvider.registerForRemoteNotifications()
930-
}
923+
self.notificationStateProvider.registerForRemoteNotifications()
931924
}
932925

933926
// Always store the current state

swift-sdk/SDK/IterableConfig.swift

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ public enum IterableAPIMobileFrameworkType: String, Codable {
1111
}
1212

1313
public struct IterableAPIMobileFrameworkInfo: Codable {
14-
let frameworkType: IterableAPIMobileFrameworkType
15-
let iterableSdkVersion: String?
14+
public let frameworkType: IterableAPIMobileFrameworkType
15+
public let iterableSdkVersion: String?
16+
17+
public init(frameworkType: IterableAPIMobileFrameworkType, iterableSdkVersion: String?) {
18+
self.frameworkType = frameworkType
19+
self.iterableSdkVersion = iterableSdkVersion
20+
}
1621
}
1722

1823
/// Custom URL handling delegate

swift-sdk/ui-components/uikit/IterableEmbeddedView.swift

+36-40
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
import UIKit
1010

1111
@IBDesignable
12-
public class IterableEmbeddedView:UIView {
12+
public class IterableEmbeddedView: UIView {
1313

1414
/// Set background color of view in container view.
1515
@IBOutlet weak public var contentView: UIView!
@@ -32,8 +32,8 @@ public class IterableEmbeddedView:UIView {
3232
@IBOutlet weak var horizontalButtonStackViewSpacer: UIView!
3333

3434
/// IterableEmbeddedView Image View.
35-
@IBOutlet weak public var imgView: UIImageView!
36-
@IBOutlet weak public var cardImageView: UIImageView!
35+
@IBOutlet weak public var imgView: UIImageView?
36+
@IBOutlet weak public var cardImageView: UIImageView?
3737
@IBOutlet var cardImageTopConstraint: NSLayoutConstraint!
3838
@IBOutlet var titleToTopConstraint: NSLayoutConstraint!
3939

@@ -274,46 +274,42 @@ public class IterableEmbeddedView:UIView {
274274

275275
private func loadViewType(viewType: IterableEmbeddedViewType) {
276276
switch viewType {
277-
case .card:
278-
imgView.isHidden = true
279-
let shouldShowCardImageView = EMimage != nil
280-
if shouldShowCardImageView {
281-
// Show cardImageView
282-
cardImageView.image = EMimage
283-
cardImageView.isHidden = false
284-
cardImageTopConstraint.isActive = true
285-
titleToTopConstraint.isActive = false
286-
titleToTopConstraint?.isActive = false
287-
} else {
288-
// Hide cardImageView and deactivate its constraints
289-
cardImageView.isHidden = true
290-
cardImageTopConstraint.isActive = false
291-
titleToTopConstraint.isActive = true
292-
titleToTopConstraint?.isActive = true
293-
294-
// Remove cardImageView from its superview and release it
295-
cardImageView.removeFromSuperview()
296-
cardImageView = nil
297-
}
298-
case .banner:
299-
imgView.isHidden = EMimage == nil
300-
imgView.isHidden = self.EMimage == nil
301-
imgView.image = EMimage
302-
if !imgView.isHidden {
303-
imgView.widthAnchor.constraint(equalToConstant: 100).isActive = true
304-
}
305-
cardImageView.isHidden = true
306-
cardImageTopConstraint.isActive = false
307-
titleToTopConstraint.isActive = true
308-
cardImageTopConstraint?.isActive = false
309-
titleToTopConstraint?.isActive = true
310-
case .notification:
311-
imgView.isHidden = true
312-
cardImageView.isHidden = true
277+
case .card:
278+
imgView?.isHidden = true
279+
let shouldShowCardImageView = EMimage != nil
280+
if shouldShowCardImageView {
281+
// Show cardImageView
282+
cardImageView?.image = EMimage
283+
cardImageView?.isHidden = false
284+
cardImageTopConstraint.isActive = true
285+
titleToTopConstraint.isActive = false
286+
titleToTopConstraint?.isActive = false
287+
} else {
288+
// Hide cardImageView and deactivate its constraints
289+
cardImageView?.isHidden = true
313290
cardImageTopConstraint.isActive = false
314291
titleToTopConstraint.isActive = true
315-
cardImageTopConstraint?.isActive = false
316292
titleToTopConstraint?.isActive = true
293+
}
294+
case .banner:
295+
imgView?.isHidden = EMimage == nil
296+
imgView?.isHidden = self.EMimage == nil
297+
imgView?.image = EMimage
298+
if let imageView = imgView, !imageView.isHidden {
299+
imgView?.widthAnchor.constraint(equalToConstant: 100).isActive = true
300+
}
301+
cardImageView?.isHidden = true
302+
cardImageTopConstraint.isActive = false
303+
titleToTopConstraint.isActive = true
304+
cardImageTopConstraint?.isActive = false
305+
titleToTopConstraint?.isActive = true
306+
case .notification:
307+
imgView?.isHidden = true
308+
cardImageView?.isHidden = true
309+
cardImageTopConstraint.isActive = false
310+
titleToTopConstraint.isActive = true
311+
cardImageTopConstraint?.isActive = false
312+
titleToTopConstraint?.isActive = true
317313
}
318314
}
319315

0 commit comments

Comments
 (0)