Skip to content

Commit

Permalink
Release 18.7.1 (#3174)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlepinski authored Aug 1, 2024
1 parent 87e5260 commit abfd0aa
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Airship.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.7.0"
AIRSHIP_VERSION="18.7.1"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
4 changes: 4 additions & 0 deletions Airship/Airship.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
6E1767F729B923D100D65F60 /* ChannelAuthTokenAPIClientTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E1767F429B923D100D65F60 /* ChannelAuthTokenAPIClientTest.swift */; };
6E1767F829B923D100D65F60 /* TestChannelAuthTokenAPIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E1767F529B923D100D65F60 /* TestChannelAuthTokenAPIClient.swift */; };
6E1767FA29B92F1700D65F60 /* AirshipUtilsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E1767F929B92F1700D65F60 /* AirshipUtilsTest.swift */; };
6E1802F92C5C2DEC00198D0D /* AirshipAnalyticFeedTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E1802F82C5C2DEC00198D0D /* AirshipAnalyticFeedTest.swift */; };
6E1892B1268CE8FE00417887 /* AirshipLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E8E1C9A26447B3800B11791 /* AirshipLock.swift */; };
6E1892B2268CE8FE00417887 /* AirshipLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E8E1C9A26447B3800B11791 /* AirshipLock.swift */; };
6E1892C8268D15C300417887 /* PreferenceCenterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E1892C7268D15C300417887 /* PreferenceCenterTest.swift */; };
Expand Down Expand Up @@ -2172,6 +2173,7 @@
6E1767F429B923D100D65F60 /* ChannelAuthTokenAPIClientTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChannelAuthTokenAPIClientTest.swift; sourceTree = "<group>"; };
6E1767F529B923D100D65F60 /* TestChannelAuthTokenAPIClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestChannelAuthTokenAPIClient.swift; sourceTree = "<group>"; };
6E1767F929B92F1700D65F60 /* AirshipUtilsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AirshipUtilsTest.swift; sourceTree = "<group>"; };
6E1802F82C5C2DEC00198D0D /* AirshipAnalyticFeedTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AirshipAnalyticFeedTest.swift; sourceTree = "<group>"; };
6E1892C7268D15C300417887 /* PreferenceCenterTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferenceCenterTest.swift; sourceTree = "<group>"; };
6E1892C9268D16E200417887 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6E1892D0268E26A100417887 /* MockPreferenceCenterOpenDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockPreferenceCenterOpenDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5053,6 +5055,7 @@
6E96ED1329417A600053CC91 /* EventStoreTest.swift */,
6E96ED192941A0EC0053CC91 /* EventTestUtils.swift */,
6E4326042B7C361F00A9B000 /* AssociatedIdentifiersTest.swift */,
6E1802F82C5C2DEC00198D0D /* AirshipAnalyticFeedTest.swift */,
);
name = Analytics;
sourceTree = "<group>";
Expand Down Expand Up @@ -7160,6 +7163,7 @@
6E4325D32B7AD96800A9B000 /* AirshipTest.swift in Sources */,
6068E0342B2B7CA100349E82 /* RetailEventTemplateTest.swift in Sources */,
6087DB882B278F7600449BA8 /* JsonValueMatcherTest.swift in Sources */,
6E1802F92C5C2DEC00198D0D /* AirshipAnalyticFeedTest.swift in Sources */,
6E4325C52B7AC3F700A9B000 /* TestPush.swift in Sources */,
6E8B4BF12888606D00AA336E /* ChannelTest.swift in Sources */,
32C68D0529424449006BBB29 /* RemoteDataTest.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ final class AutomationEngineTest: XCTestCase {
appVersion: "1.0.0"
)

let analyticsFeed = AirshipAnalyticsFeed()
let analyticsFeed = AirshipAnalyticsFeed() { true }
let scheduleConditionsChangedNotifier = ScheduleConditionsChangedNotifier()
let eventFeed = await AutomationEventFeed(applicationMetrics: metrics, applicationStateTracker: AppStateTracker.shared, analyticsFeed: analyticsFeed)
let analytics = TestAnalytics()
Expand Down Expand Up @@ -148,7 +148,7 @@ final class AutomationEngineTest: XCTestCase {
}
}

actor TestAdditionalAudienceResolver: AdditionalAudienceCheckerResolverProtocol {
actor TestAdditionalAudienceResolver: AdditionalAudienceCheckerResolverProtocol {
struct ResolveRequest {
let channelID: String
let contactID: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class AutomationEventFeedTest: XCTestCase, @unchecked Sendable {
private let date = UATestDate(offset: 0, dateOverride: Date())
private let datastore = PreferenceDataStore(appKey: UUID().uuidString)
private var subject: AutomationEventFeed!
private let analyticsFeed: AirshipAnalyticsFeed = AirshipAnalyticsFeed()
private let analyticsFeed: AirshipAnalyticsFeed = AirshipAnalyticsFeed() { true }
private let stateTracker: TestAppStateTracker = TestAppStateTracker()

var iterator: AsyncStream<AutomationEvent>.Iterator!
Expand All @@ -24,8 +24,6 @@ final class AutomationEventFeedTest: XCTestCase, @unchecked Sendable {
iterator = await subject.feed.makeAsyncIterator()
}



func testFirstAttachProducesInitAndVersionUpdated() async throws {
await subject.attach()

Expand Down
2 changes: 1 addition & 1 deletion Airship/AirshipConfig.xcconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//* Copyright Airship and Contributors */

CURRENT_PROJECT_VERSION = 18.7.0
CURRENT_PROJECT_VERSION = 18.7.1

// Uncomment to include the preview build warning
// OTHER_CFLAGS = $(inherited) -DUA_PREVIEW=1
27 changes: 21 additions & 6 deletions Airship/AirshipCore/Source/AirshipAnalyticsFeed.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
/* Copyright Airship and Contributors */

import Foundation
@preconcurrency
import Combine

/// For internal use only. :nodoc:
public final class AirshipAnalyticsFeed: Sendable {
private let isEnabled: @Sendable () -> Bool

public init(isEnabled: @Sendable @escaping () -> Bool) {
self.isEnabled = isEnabled
}

public convenience init(privacyManager: AirshipPrivacyManager, isAnalyticsEnabled: Bool) {
self.init(
isEnabled: { [weak privacyManager] in
return privacyManager?.isEnabled(.analytics) == true && isAnalyticsEnabled
}
)
}

public enum Event: Equatable, Sendable {
case screen(screen: String?)
case analytics(eventType: EventType, body: AirshipJSON, value: Double? = 1)
Expand All @@ -19,10 +31,13 @@ public final class AirshipAnalyticsFeed: Sendable {
}
}

func notifyEvent(_ event: Event) async {
@discardableResult
func notifyEvent(_ event: Event) async -> Bool {
guard isEnabled() else {
return false
}

await channel.send(event)
return true
}


public init() {}
}
2 changes: 1 addition & 1 deletion Airship/AirshipCore/Source/AirshipVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Foundation

public struct AirshipVersion {
public static let version = "18.7.0"
public static let version = "18.7.1"
public static func get() -> String {
return version
}
Expand Down
6 changes: 5 additions & 1 deletion Airship/AirshipCore/Source/Analytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class AirshipAnalytics: AirshipAnalyticsProtocol, @unchecked Sendable {
eventSubject.eraseToAnyPublisher()
}

public let eventFeed: AirshipAnalyticsFeed = AirshipAnalyticsFeed()
public let eventFeed: AirshipAnalyticsFeed

private var isAnalyticsEnabled: Bool {
return self.privacyManager.isEnabled(.analytics) &&
Expand Down Expand Up @@ -114,6 +114,10 @@ final class AirshipAnalytics: AirshipAnalyticsProtocol, @unchecked Sendable {
self.permissionsManager = permissionsManager
self.eventManager = eventManager
self.sessionTracker = sessionTracker ?? SessionTracker()
self.eventFeed = AirshipAnalyticsFeed(
privacyManager: privacyManager,
isAnalyticsEnabled: config.isAnalyticsEnabled
)

self.eventManager.addHeaderProvider {
await self.makeHeaders()
Expand Down
55 changes: 55 additions & 0 deletions Airship/AirshipCore/Tests/AirshipAnalyticFeedTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Copyright Airship and Contributors */

import XCTest
@testable
import AirshipCore

final class AirshipAnalyticFeedTest: XCTestCase {
private let dataStore: PreferenceDataStore = PreferenceDataStore(appKey: UUID().uuidString)
private var privacyManager: AirshipPrivacyManager!

override func setUp() async throws {
self.privacyManager = await AirshipPrivacyManager(
dataStore: dataStore,
config: RuntimeConfig(config: AirshipConfig(), dataStore: dataStore),
defaultEnabledFeatures: .all
)
}

func testFeed() async throws {
let feed = makeFeed()
var updates = await feed.updates.makeAsyncIterator()

let result = await feed.notifyEvent(.screen(screen: "foo"))
XCTAssertTrue(result)

let next = await updates.next()
XCTAssertEqual(next, .screen(screen: "foo"))
}

func testFeedAnalyticsDisabled() async throws {
let feed = makeFeed()
privacyManager.disableFeatures(.analytics)
var updates = await feed.updates.makeAsyncIterator()

var result = await feed.notifyEvent(.screen(screen: "foo"))
XCTAssertFalse(result)

privacyManager.enableFeatures(.analytics)
result = await feed.notifyEvent(.screen(screen: "bar"))
XCTAssertTrue(result)

let next = await updates.next()
XCTAssertEqual(next, .screen(screen: "bar"))
}

func testFeedDisabled() async throws {
let feed = makeFeed(enabled: false)
let result = await feed.notifyEvent(.screen(screen: "foo"))
XCTAssertFalse(result)
}

private func makeFeed(enabled: Bool = true) -> AirshipAnalyticsFeed {
return AirshipAnalyticsFeed(privacyManager: privacyManager, isAnalyticsEnabled: enabled)
}
}
2 changes: 1 addition & 1 deletion Airship/AirshipCore/Tests/TestAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
import Combine

public class TestAnalytics: InternalAnalyticsProtocol, AirshipComponent, @unchecked Sendable {
public var eventFeed: AirshipAnalyticsFeed = AirshipAnalyticsFeed()
public var eventFeed: AirshipAnalyticsFeed = AirshipAnalyticsFeed { true }

let eventSubject = PassthroughSubject<AirshipEventData, Never>()

Expand Down
2 changes: 1 addition & 1 deletion AirshipContentExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.7.0"
AIRSHIP_VERSION="18.7.1"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
2 changes: 1 addition & 1 deletion AirshipDebug.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.7.0"
AIRSHIP_VERSION="18.7.1"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
2 changes: 1 addition & 1 deletion AirshipServiceExtension.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AIRSHIP_VERSION="18.7.0"
AIRSHIP_VERSION="18.7.1"

Pod::Spec.new do |s|
s.version = AIRSHIP_VERSION
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

# iOS Changelog

## Version 18.7.1 August 1, 2024
Patch release that prevents In-App Automation, Scenes, and Surveys from being able to trigger off custom events or screen views
when analytics is disabled. The actual event was not being tracked by Airship in these cases, just processed locally.

### Changes
- Prevent screen view and custom events from being processed by automations when analytics is disabled.


## Version 18.7.0 July 30, 2024
Minor release that fixes some layout issues with images and videos in a Scene, accessibility improvements, and fixes a potential crash with JSON encoding/decoding due
to using a JSONEncoder/JSONDecoder across threads.
Expand Down

0 comments on commit abfd0aa

Please sign in to comment.