From a9ccfdc1e0aeea4faa36f999a6d19eee7d5bb060 Mon Sep 17 00:00:00 2001 From: Ryan Lepinski Date: Tue, 29 Aug 2023 16:14:24 -0700 Subject: [PATCH] 17.2.1 (#2816) * Fix LA stale date handling * Release 17.2.1 * Fix Xcode15 builds --- .github/workflows/release.yml | 49 ++++++------------- Airship.podspec | 2 +- Airship/AirshipConfig.xcconfig | 2 +- .../AirshipCore/Source/AirshipVersion.swift | 2 +- Airship/AirshipCore/Source/LiveActivity.swift | 21 ++++++-- .../Source/LiveActivityRegistry.swift | 2 +- .../Tests/LiveActivityRegistryTest.swift | 8 +-- AirshipContentExtension.podspec | 2 +- AirshipDebug.podspec | 2 +- AirshipServiceExtension.podspec | 2 +- CHANGELOG.md | 6 +++ 11 files changed, 49 insertions(+), 49 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a3ce9473a..283129fa5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,7 +137,7 @@ jobs: deploy-github: runs-on: macOS-13 - needs: [run-tests, build-package, build-samples] + needs: [run-tests, build-package, build-samples, build-package-xcode15] steps: - uses: actions/checkout@v2 - name: Get the version @@ -168,6 +168,16 @@ jobs: with: name: airship-carthage path: ./build + - name: Download Xcode15 zip distribution + uses: actions/download-artifact@v1 + with: + name: airship + path: ./buildXcode15 + - name: Download Xcode15 Carthage zip distribution + uses: actions/download-artifact@v1 + with: + name: airship-carthage + path: ./buildXcode15 - name: Github Release id: create_release uses: actions/create-release@v1.0.1 @@ -201,49 +211,22 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.IOS_DEPLOY_PREBUILT_PAT }} run: gh --repo urbanairship/ios-library-prebuilt workflow run release.yml - - - name: Slack Notification - uses: homoluctus/slatify@master - if: always() - with: - type: ${{ job.status }} - job_name: "Deploy iOS SDK to Github :octocat:" - url: ${{ secrets.SLACK_WEBHOOK }} - deploy-github-xcode15: - runs-on: macOS-13 - needs: [build-package-xcode15, deploy-github] - steps: - - uses: actions/checkout@v2 - - name: Get the version - id: get_version - run: | - echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - - name: Download zip distribution - uses: actions/download-artifact@v1 - with: - name: airship-xcode15 - path: ./build - - name: Download Carthage zip distribution - uses: actions/download-artifact@v1 - with: - name: airship-carthage-xcode15 - path: ./build - - name: Upload zip distribution + - name: Upload Xcode15 zip distribution uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/Airship.zip + asset_path: ./buildXcode15/Airship.zip asset_name: Airship-Xcode15.zip asset_content_type: application/zip - - name: Upload carthage zip distribution + - name: Upload Xcode 15 carthage zip distribution uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./build/Airship.xcframeworks.zip + asset_path: ./buildXcode15/Airship.xcframeworks.zip asset_name: Airship-Xcode15.xcframeworks.zip asset_content_type: application/zip @@ -252,7 +235,7 @@ jobs: if: always() with: type: ${{ job.status }} - job_name: "Deploy iOS SDK Xcode 15 to Github :octocat:" + job_name: "Deploy iOS SDK to Github :octocat:" url: ${{ secrets.SLACK_WEBHOOK }} deploy-pods: runs-on: macOS-13 diff --git a/Airship.podspec b/Airship.podspec index 049b96301..648fa0231 100644 --- a/Airship.podspec +++ b/Airship.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="17.2.0" +AIRSHIP_VERSION="17.2.1" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/Airship/AirshipConfig.xcconfig b/Airship/AirshipConfig.xcconfig index 4c0a7b313..013096e90 100644 --- a/Airship/AirshipConfig.xcconfig +++ b/Airship/AirshipConfig.xcconfig @@ -1,6 +1,6 @@ //* Copyright Airship and Contributors */ -CURRENT_PROJECT_VERSION = 17.2.0 +CURRENT_PROJECT_VERSION = 17.2.1 // Uncomment to include the preview build warning // OTHER_CFLAGS = $(inherited) -DUA_PREVIEW=1 diff --git a/Airship/AirshipCore/Source/AirshipVersion.swift b/Airship/AirshipCore/Source/AirshipVersion.swift index 97801b39d..1c8b29c91 100644 --- a/Airship/AirshipCore/Source/AirshipVersion.swift +++ b/Airship/AirshipCore/Source/AirshipVersion.swift @@ -4,7 +4,7 @@ import Foundation @objc(UAirshipVersion) public class AirshipVersion: NSObject { - public static let version = "17.2.0" + public static let version = "17.2.1" @objc public class func get() -> String { diff --git a/Airship/AirshipCore/Source/LiveActivity.swift b/Airship/AirshipCore/Source/LiveActivity.swift index 0279051dd..cc653da7e 100644 --- a/Airship/AirshipCore/Source/LiveActivity.swift +++ b/Airship/AirshipCore/Source/LiveActivity.swift @@ -7,7 +7,7 @@ protocol LiveActivityProtocol: Sendable { /// The activity's ID var id: String { get } - var isActive: Bool { get } + var isUpdatable: Bool { get } var pushTokenString: String? { get } @@ -38,8 +38,8 @@ fileprivate struct ActivityProvider: Sendable { struct LiveActivity: LiveActivityProtocol { public let id: String - public var isActive: Bool { - return provider.getActivity()?.activityState == .active + public var isUpdatable: Bool { + return provider.getActivity()?.activityState.isStaleOrActive ?? false } public var pushTokenString: String? { @@ -72,7 +72,7 @@ struct LiveActivity: LiveActivityProtocol { let task = Task { guard let activity = provider.getActivity(), - activity.activityState == .active + activity.activityState.isStaleOrActive else { return } @@ -96,7 +96,7 @@ struct LiveActivity: LiveActivityProtocol { } for await update in activity.activityStateUpdates { - if update != .active || Task.isCancelled { + if !update.isStaleOrActive || Task.isCancelled { await backgroundTask.stop() task.cancel() break @@ -105,6 +105,17 @@ struct LiveActivity: LiveActivityProtocol { } } +@available(iOS 16.1, *) +extension ActivityState { + public var isStaleOrActive: Bool { + if #available(iOS 16.2, *) { + return self == .active || self == .stale + } else { + return self == .active + } + } +} + extension Data { fileprivate var tokenString: String { diff --git a/Airship/AirshipCore/Source/LiveActivityRegistry.swift b/Airship/AirshipCore/Source/LiveActivityRegistry.swift index 52f0d8d53..6a0d6d177 100644 --- a/Airship/AirshipCore/Source/LiveActivityRegistry.swift +++ b/Airship/AirshipCore/Source/LiveActivityRegistry.swift @@ -89,7 +89,7 @@ actor LiveActivityRegistry { name: String ) { - guard liveActivity.isActive else { + guard liveActivity.isUpdatable else { return } diff --git a/Airship/AirshipCore/Tests/LiveActivityRegistryTest.swift b/Airship/AirshipCore/Tests/LiveActivityRegistryTest.swift index 434c465ce..3c06ca5ec 100644 --- a/Airship/AirshipCore/Tests/LiveActivityRegistryTest.swift +++ b/Airship/AirshipCore/Tests/LiveActivityRegistryTest.swift @@ -38,7 +38,7 @@ final class LiveActivityRegistryTest: XCTestCase { ) self.date.offset += 1.0 - activity.isActive = false + activity.isUpdatable = false await assertUpdate( LiveActivityUpdate( @@ -196,9 +196,9 @@ final class LiveActivityRegistryTest: XCTestCase { /// Tried to match as closely as I coudl to the real object private final class TestLiveActivity: LiveActivityProtocol, @unchecked Sendable { let id: String - var isActive: Bool = true { + var isUpdatable: Bool = true { didSet { - statusUpdatesContinuation.yield(isActive) + statusUpdatesContinuation.yield(isUpdatable) } } var pushTokenString: String? { @@ -229,7 +229,7 @@ private final class TestLiveActivity: LiveActivityProtocol, @unchecked Sendable } func track(tokenUpdates: @escaping (String) async -> Void) async { - guard self.isActive else { + guard self.isUpdatable else { return } diff --git a/AirshipContentExtension.podspec b/AirshipContentExtension.podspec index dd59c82a5..f0e2c7e45 100644 --- a/AirshipContentExtension.podspec +++ b/AirshipContentExtension.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="17.2.0" +AIRSHIP_VERSION="17.2.1" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/AirshipDebug.podspec b/AirshipDebug.podspec index 7c9ad20e8..1977e509d 100644 --- a/AirshipDebug.podspec +++ b/AirshipDebug.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="17.2.0" +AIRSHIP_VERSION="17.2.1" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/AirshipServiceExtension.podspec b/AirshipServiceExtension.podspec index 405c65a5a..1ce414c2c 100644 --- a/AirshipServiceExtension.podspec +++ b/AirshipServiceExtension.podspec @@ -1,4 +1,4 @@ -AIRSHIP_VERSION="17.2.0" +AIRSHIP_VERSION="17.2.1" Pod::Spec.new do |s| s.version = AIRSHIP_VERSION diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cd809030..f67627ca8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ [Migration Guides](https://github.com/urbanairship/ios-library/tree/main/Documentation/Migration) +## Version 17.2.1 August 29, 2023 +Patch release that fixes an issue with not being able to update a Live Activity after it becomes stale. Apps that use `staleDate` with Live Activities should update. + +### Changes +- Continue to track a Live Activity after it becomes stale + ## Version 17.2.0 August 25, 2023 Minor release that fixes a reporting issue with hold out groups and In-App Messaging. 17.2.0 will be the minimum version required for global hold out groups.