Skip to content

Commit

Permalink
Merge release/2024.06.25T04.11.09 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
TakayukiCho committed Jun 26, 2024
2 parents efdd7ed + e6cfdd8 commit 5afc90d
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .spm-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.15.0
2.16.0
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| モジュール名 | Description | 最新のバージョン |
| :-- | :-- | :-- |
| KarteCore | イベントトラッキング機能を提供します。 | 2.27.0 |
| KarteCore | イベントトラッキング機能を提供します。 | 2.28.0 |
| KarteInAppMessaging | アプリ内メッセージ機能を提供します。 | 2.17.1 |
| KarteRemoteNotification | プッシュ通知の受信および効果測定機能を提供します。 | 2.11.0 |
| KarteVariables | 設定値配信機能を提供します。 | 2.10.0 |
Expand All @@ -11,13 +11,20 @@
| KarteUtilities | KarteCore モジュール等が利用するUtility機能を提供します。通常直接参照する必要はありません。 | 3.12.0 |
| KarteNotificationServiceExtension | リッチプッシュ通知機能を提供します。 | 1.2.0 |

# Releases - 2024.06.25
## Version 2.16.0

### Core 2.28.0
** 🔨CHANGED**
- AppTrackingTransparencyの許諾状況をKARTE側に同期する機能を追加しました。

# Releases - 2024.06.13
## Version 2.15.0

### CrashReporting 2.8.0
** 🔨CHANGED**
- Privacy manifestの設定を更新しました。

### InAppMessaging 2.17.1
** 💊FIXED**
- 一部の別ライブラリと併用した場合にcrashする不具合を修正しました。
Expand Down
24 changes: 22 additions & 2 deletions Karte.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@
0CFD001924ECF53100598C8C /* TrackClientSessionMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFD001824ECF53100598C8C /* TrackClientSessionMock.swift */; };
0CFD001D24ECF8BB00598C8C /* TrackClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFD001C24ECF8BB00598C8C /* TrackClientTests.swift */; };
0CFD001F24ED08E800598C8C /* ReachabilityServiceMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CFD001E24ED08E800598C8C /* ReachabilityServiceMock.swift */; };
142B4AEA2C2551DD0090ADDD /* ATTService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142B4AE92C2551DD0090ADDD /* ATTService.swift */; };
142B4AEC2C25542C0090ADDD /* ATTStatusUpdatedSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142B4AEB2C25542C0090ADDD /* ATTStatusUpdatedSpec.swift */; };
142B4AEE2C2554D00090ADDD /* ATTServiceSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 142B4AED2C2554D00090ADDD /* ATTServiceSpec.swift */; };
1E9A3C652949BBFD006B54D3 /* ApiKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E9A3C642949BBFD006B54D3 /* ApiKey.swift */; };
1ECAFE542B5D3608003638E8 /* DecodingError+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECAFE532B5D3608003638E8 /* DecodingError+Extension.swift */; };
1EE766B7297546440040278E /* Karte-custom-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1EE766B6297544B60040278E /* Karte-custom-Info.plist */; };
Expand Down Expand Up @@ -931,6 +934,9 @@
0CFD001824ECF53100598C8C /* TrackClientSessionMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackClientSessionMock.swift; sourceTree = "<group>"; };
0CFD001C24ECF8BB00598C8C /* TrackClientTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackClientTests.swift; sourceTree = "<group>"; };
0CFD001E24ED08E800598C8C /* ReachabilityServiceMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReachabilityServiceMock.swift; sourceTree = "<group>"; };
142B4AE92C2551DD0090ADDD /* ATTService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ATTService.swift; sourceTree = "<group>"; };
142B4AEB2C25542C0090ADDD /* ATTStatusUpdatedSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ATTStatusUpdatedSpec.swift; sourceTree = "<group>"; };
142B4AED2C2554D00090ADDD /* ATTServiceSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ATTServiceSpec.swift; sourceTree = "<group>"; };
1E9A3C642949BBFD006B54D3 /* ApiKey.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiKey.swift; sourceTree = "<group>"; };
1ECAFE532B5D3608003638E8 /* DecodingError+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DecodingError+Extension.swift"; sourceTree = "<group>"; };
1EE766B6297544B60040278E /* Karte-custom-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Karte-custom-Info.plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1814,6 +1820,7 @@
683762F8252F201D00E690CE /* SelectorDetector.swift */,
0C50509129C17ECA007C5C9B /* JailbreakDetection.swift */,
0C8392C02406C7750014C2BF /* CoreService.swift */,
142B4AE82C2551C90090ADDD /* ATT */,
0C8392582406C4260014C2BF /* AppInfo */,
1E9A3C632949BBFD006B54D3 /* ApiKey */,
0CE339AF23F39C9300E2EB98 /* AppKey */,
Expand Down Expand Up @@ -2157,6 +2164,7 @@
0CE792FF238653AD00F0D932 /* PluginNativeAppIdentifyEventSpec.swift */,
0CE79300238653AD00F0D932 /* ViewEventSpec.swift */,
0CE79301238653AD00F0D932 /* FetchVariablesEventSpec.swift */,
142B4AEB2C25542C0090ADDD /* ATTStatusUpdatedSpec.swift */,
0CE79302238653AD00F0D932 /* EventSpec.swift */,
0CE79303238653AD00F0D932 /* EventFieldNameSpec.swift */,
0CE79304238653AD00F0D932 /* IdentifyEventSpec.swift */,
Expand Down Expand Up @@ -2236,6 +2244,7 @@
isa = PBXGroup;
children = (
0CA52D5C2387BE9E00A575BC /* ConfigurationTests.swift */,
142B4AED2C2554D00090ADDD /* ATTServiceSpec.swift */,
6807B2AA251D80C900CDAB43 /* ExperimentalConfigurationTests.swift */,
0CA52D582387BE4C00A575BC /* OptOutConfigSpec.swift */,
0CA52D682387CC4D00A575BC /* VersionServiceSpec.swift */,
Expand Down Expand Up @@ -2276,6 +2285,14 @@
path = KarteVariablesTests;
sourceTree = "<group>";
};
142B4AE82C2551C90090ADDD /* ATT */ = {
isa = PBXGroup;
children = (
142B4AE92C2551DD0090ADDD /* ATTService.swift */,
);
path = ATT;
sourceTree = "<group>";
};
1E9A3C632949BBFD006B54D3 /* ApiKey */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3106,6 +3123,7 @@
0C69D41524EB9DC600D75893 /* TrackingTask.swift in Sources */,
0CE339EC23F39C9300E2EB98 /* AppKey.swift in Sources */,
36F3BC7824F8DAC1002D4382 /* LogAppender.swift in Sources */,
142B4AEA2C2551DD0090ADDD /* ATTService.swift in Sources */,
0C8392652406C54E0014C2BF /* SystemInfo.swift in Sources */,
0C8392BB2406C7010014C2BF /* JSONConvertible.swift in Sources */,
0C75093925007A7500624E3C /* OperationMode.swift in Sources */,
Expand Down Expand Up @@ -3316,6 +3334,7 @@
0C8392FD240822A40014C2BF /* EventNameSpec.swift in Sources */,
0CFD001D24ECF8BB00598C8C /* TrackClientTests.swift in Sources */,
0C69D41824EBA34500D75893 /* RegisterPushCommandSpec.swift in Sources */,
142B4AEC2C25542C0090ADDD /* ATTStatusUpdatedSpec.swift in Sources */,
0CFD001124EBD2DC00598C8C /* TrackCallbackSpec.swift in Sources */,
0C83931A240838050014C2BF /* InspectorSpec.swift in Sources */,
0C839312240831B30014C2BF /* LifecycleEventSpec.swift in Sources */,
Expand Down Expand Up @@ -3343,6 +3362,7 @@
68BBBCD524BB5156009A1CE0 /* IAMProcessSpec.swift in Sources */,
0CE79326238653AD00F0D932 /* Support.swift in Sources */,
680C29B52446B99200FB1363 /* TrackBodyParametersSpec.swift in Sources */,
142B4AEE2C2554D00090ADDD /* ATTServiceSpec.swift in Sources */,
0C8392F02407BF370014C2BF /* VisitorIdGeneratorMock.swift in Sources */,
0C8393112408319F0014C2BF /* IdentifySpec.swift in Sources */,
0CCFA7BB24A5D8D500E0F184 /* NotificationSettingsProviderMock.swift in Sources */,
Expand Down Expand Up @@ -3828,7 +3848,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.27.0;
MARKETING_VERSION = 2.28.0;
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteCore;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3863,7 +3883,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.27.0;
MARKETING_VERSION = 2.28.0;
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteCore;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
2 changes: 1 addition & 1 deletion KarteCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'KarteCore'
s.version = '2.27.0'
s.version = '2.28.0'
s.summary = 'KARTE Core SDK'
s.homepage = 'https://karte.io'
s.author = { 'PLAID' => 'dev.share@plaid.co.jp' }
Expand Down
41 changes: 41 additions & 0 deletions KarteCore/Core/ATT/ATTService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright 2024 PLAID, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import AppTrackingTransparency

@available(iOS 14, *)
internal class ATTService {
static func getATTStatusLabel(attStatus: ATTrackingManager.AuthorizationStatus) -> String {
switch attStatus {
case .authorized:
"authorized"
case .restricted:
"restricted"
case .notDetermined:
"notDetermined"
case .denied:
"denied"
@unknown default:
"unknown"
}
}

static func sendATTStatus(attStatus: ATTrackingManager.AuthorizationStatus) {
let attStatusLabel = getATTStatusLabel(attStatus: attStatus)
Tracker.track(event: Event(.attStatusUpdated(attStatus: attStatusLabel)))
}
}
7 changes: 7 additions & 0 deletions KarteCore/Core/CoreService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

import Foundation
import KarteUtilities
import AppTrackingTransparency

internal class CoreService {
lazy var appInfo: AppInfo = {
AppInfo()
}()

lazy var pvService: PvService = {
PvService()
}()
Expand Down Expand Up @@ -116,6 +118,11 @@ internal class CoreService {
visitorIdService.renew()
}

@available(iOS 14, *)
func sendATTStatus(attStatus: ATTrackingManager.AuthorizationStatus) {
ATTService.sendATTStatus(attStatus: attStatus)
}

func teardown() {
visitorIdService.clean()
versionService.clean()
Expand Down
18 changes: 18 additions & 0 deletions KarteCore/KarteApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import KarteUtilities
import UIKit
import AppTrackingTransparency

/// KARTE SDKのエントリポイントであると共に、SDKの構成および依存ライブラリ等の管理を行うクラスです。
///
Expand Down Expand Up @@ -164,6 +165,18 @@ public extension KarteApp {
shared.renewVisitorId()
}

/// AppTrackingTransparencyの許諾状況をKARTE側に送信します。
///
/// att_status_updatedというイベント経由で送信許諾状況を送信しています。
///
/// - Parameters:
/// - attStatus: `ATTrackingManager.AuthorizationStatus`
@available(iOS 14, *)
@objc
class func sendATTStatus(attStatus: ATTrackingManager.AuthorizationStatus) {
shared.sendATTStatus(attStatus: attStatus)
}

/// KARTE SDKの機能に関連するカスタムURLスキームを処理します。
///
/// なお初期化が行われていない状態で呼び出した場合はカスタムURLスキームの処理は行われません。
Expand Down Expand Up @@ -317,6 +330,11 @@ extension KarteApp {
coreService?.renewVisitorId()
}

@available(iOS 14, *)
func sendATTStatus(attStatus: ATTrackingManager.AuthorizationStatus) {
coreService?.sendATTStatus(attStatus: attStatus)
}

func application(_ app: UIApplication, open url: URL) -> Bool {
var handled = false
for module in modules {
Expand Down
10 changes: 10 additions & 0 deletions KarteCore/Tracking/Event/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public extension Event {
case pluginNativeAppIdentify(subscribe: Bool, fcmToken: String?)
/// `_fetch_variables` イベント
case fetchVariables
/// `att_status_updated`イベント
case attStatusUpdated(attStatus: String)

/// 列挙子に応じた `イベント名` および `オブジェクト` を返します。
func build() -> (EventName, [String: JSONValue]) {
Expand Down Expand Up @@ -185,6 +187,14 @@ public extension Event {
name = .pluginNativeAppIdentify
vals = values.compactMapValues { $0 }

case let .attStatusUpdated(attStatus: attStatus):
let values: [String: JSONConvertible?] = [
field(.attStatus): attStatus
]

name = .attStatusUpdated
vals = values.compactMapValues { $0 }

case .fetchVariables:
name = .fetchVariables
vals = [:]
Expand Down
2 changes: 2 additions & 0 deletions KarteCore/Tracking/Event/EventFieldName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public extension EventFieldName {
static let viewName = EventFieldName("view_name")
/// title フィールド
static let title = EventFieldName("title")
// attStatusフィールド
static let attStatus = EventFieldName("att_status")
}

extension EventFieldName {
Expand Down
5 changes: 4 additions & 1 deletion KarteCore/Tracking/Event/EventName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public struct EventName: Codable {
.messageReady, .messageOpen, .messageClick, .messageClose, .messageSuppressed,
.massPushClick,
.pluginNativeAppIdentify,
.fetchVariables:
.fetchVariables,
.attStatusUpdated:
return false
default:
return true
Expand Down Expand Up @@ -122,4 +123,6 @@ public extension EventName {
static let pluginNativeAppIdentify = EventName("plugin_native_app_identify")
/// _fetch_variables イベント
static let fetchVariables = EventName("_fetch_variables")
/// att_status_updated イベント
static let attStatusUpdated = EventName("att_status_updated")
}
57 changes: 57 additions & 0 deletions KarteTests/KarteCoreTests/UnitTests/Core/ATTServiceSpec.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Copyright 2024 PLAID, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Quick
import Nimble
@testable import KarteCore
import AppTrackingTransparency


class ATTServiceSpec: QuickSpec {

override func spec() {
describe("its run") {
it("returns authorized label") {
if #available(iOS 14, *) {
let result = ATTService.getATTStatusLabel(attStatus: ATTrackingManager.AuthorizationStatus.authorized)
expect(result).to(equal("authorized"))
}
}

it("returns denied label") {
if #available(iOS 14, *) {
let result = ATTService.getATTStatusLabel(attStatus: ATTrackingManager.AuthorizationStatus.denied)
expect(result).to(equal("denied"))
}
}

it("returns restricted label") {
if #available(iOS 14, *) {
let result = ATTService.getATTStatusLabel(attStatus: ATTrackingManager.AuthorizationStatus.restricted)
expect(result).to(equal("restricted"))
}

}

it("returns notDetermined label") {
if #available(iOS 14, *) {
let result = ATTService.getATTStatusLabel(attStatus: ATTrackingManager.AuthorizationStatus.notDetermined)
expect(result).to(equal("notDetermined"))
}
}
}
}
}
Loading

0 comments on commit 5afc90d

Please sign in to comment.