Skip to content

Commit 395d5f3

Browse files
author
TakayukiCho
committed
Merge release/2024.08.26T08.56.08 into master
2 parents 5afc90d + 2ddf211 commit 395d5f3

13 files changed

+175
-29
lines changed

.spm-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.16.0
1+
2.17.0

CHANGELOG.md

+20-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,30 @@
22

33
| モジュール名 | Description | 最新のバージョン |
44
| :-- | :-- | :-- |
5-
| KarteCore | イベントトラッキング機能を提供します。 | 2.28.0 |
6-
| KarteInAppMessaging | アプリ内メッセージ機能を提供します。 | 2.17.1 |
5+
| KarteCore | イベントトラッキング機能を提供します。 | 2.29.0 |
6+
| KarteInAppMessaging | アプリ内メッセージ機能を提供します。 | 2.18.0 |
77
| KarteRemoteNotification | プッシュ通知の受信および効果測定機能を提供します。 | 2.11.0 |
88
| KarteVariables | 設定値配信機能を提供します。 | 2.10.0 |
99
| KarteVisualTracking | ビジュアルトラッキング機能を提供します。 | 2.12.0 |
10-
| KarteCrashReporting | クラッシュイベントのトラッキング機能を提供します。 | 2.8.0 |
11-
| KarteUtilities | KarteCore モジュール等が利用するUtility機能を提供します。通常直接参照する必要はありません。 | 3.12.0 |
10+
| KarteCrashReporting | クラッシュイベントのトラッキング機能を提供します。 | 2.8.0 |
11+
| KarteUtilities | KarteCore モジュール等が利用するUtility機能を提供します。通常直接参照する必要はありません。 | 3.12.0 |
1212
| KarteNotificationServiceExtension | リッチプッシュ通知機能を提供します。 | 1.2.0 |
1313

14+
# Releases - 2024.08.26
15+
## Version 2.17.0
16+
17+
### Core 2.29.0
18+
** 🔨CHANGED**
19+
- イベント送信のログにイベント内容を付与しました。
20+
21+
### InAppMessaging 2.18.0
22+
** 🔨CHANGED**
23+
- InAppMessagingの画面境界の自動判定のOn/Offを切り替え可能にしました
24+
25+
** 💊FIXED**
26+
- suppressed状態で設定値配信を取得した場合に_message_suppressedが発生しないように変更しました。
27+
- UIActivityViewControllerなどのシェア機能と接客の同時表示時にタップできない領域が発生していたため、当該状況では接客を非表示にするよう修正しました。
28+
1429
# Releases - 2024.06.25
1530
## Version 2.16.0
1631

@@ -25,7 +40,7 @@
2540
** 🔨CHANGED**
2641
- Privacy manifestの設定を更新しました。
2742

28-
### InAppMessaging 2.17.1
43+
### InAppMessaging 2.17.1
2944
** 💊FIXED**
3045
- 一部の別ライブラリと併用した場合にcrashする不具合を修正しました。
3146

Gemfile.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ GEM
297297
trailblazer-option (>= 0.1.1, < 0.2.0)
298298
uber (< 0.2.0)
299299
retriable (3.1.2)
300-
rexml (3.2.8)
301-
strscan (>= 3.0.9)
300+
rexml (3.3.6)
301+
strscan
302302
rouge (2.0.7)
303303
ruby-macho (2.5.1)
304304
ruby2_keywords (0.0.5)
@@ -344,13 +344,13 @@ GEM
344344
word_wrap (1.0.0)
345345
xcinvoke (0.3.0)
346346
liferaft (~> 0.0.6)
347-
xcodeproj (1.24.0)
347+
xcodeproj (1.25.0)
348348
CFPropertyList (>= 2.3.3, < 4.0)
349349
atomos (~> 0.1.3)
350350
claide (>= 1.0.2, < 2.0)
351351
colored2 (~> 3.1)
352352
nanaimo (~> 0.3.0)
353-
rexml (~> 3.2.4)
353+
rexml (>= 3.3.2, < 4.0)
354354
xcpretty (0.3.0)
355355
rouge (~> 2.0.7)
356356
xcpretty-travis-formatter (1.0.1)

Karte.xcodeproj/project.pbxproj

+8-4
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@
413413
68C9FAD425C55C2F0069EA3D /* ActionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68C9FAD325C55C2F0069EA3D /* ActionProtocol.swift */; };
414414
68E47D0225C7B6E0003C878F /* ActionFactorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68E47D0125C7B6E0003C878F /* ActionFactorySpec.swift */; };
415415
68E62712254036AA005148FC /* Karte-mock-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 68E62711254036AA005148FC /* Karte-mock-Info.plist */; };
416+
71F1F95F2C650FFA00CB7C17 /* ShareActivityDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F1F95E2C650FFA00CB7C17 /* ShareActivityDetector.swift */; };
416417
777D6057273DA68300339D7E /* AttributeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777D6056273DA68300339D7E /* AttributeSpec.swift */; };
417418
777D605927421BB600339D7E /* InvalidEventFieldValueFilterRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777D605827421BB600339D7E /* InvalidEventFieldValueFilterRule.swift */; };
418419
777D605B2742217500339D7E /* InvalidEventNameFilterRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777D605A2742217500339D7E /* InvalidEventNameFilterRule.swift */; };
@@ -1007,6 +1008,7 @@
10071008
68C9FAD325C55C2F0069EA3D /* ActionProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionProtocol.swift; sourceTree = "<group>"; };
10081009
68E47D0125C7B6E0003C878F /* ActionFactorySpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionFactorySpec.swift; sourceTree = "<group>"; };
10091010
68E62711254036AA005148FC /* Karte-mock-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Karte-mock-Info.plist"; sourceTree = "<group>"; };
1011+
71F1F95E2C650FFA00CB7C17 /* ShareActivityDetector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareActivityDetector.swift; sourceTree = "<group>"; };
10101012
777D6056273DA68300339D7E /* AttributeSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributeSpec.swift; sourceTree = "<group>"; };
10111013
777D605827421BB600339D7E /* InvalidEventFieldValueFilterRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvalidEventFieldValueFilterRule.swift; sourceTree = "<group>"; };
10121014
777D605A2742217500339D7E /* InvalidEventNameFilterRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvalidEventNameFilterRule.swift; sourceTree = "<group>"; };
@@ -1394,6 +1396,7 @@
13941396
0C4B51B12492173B0075A67D /* ClassLoader.swift */,
13951397
0C4B51B32492173B0075A67D /* OpacityDetector.swift */,
13961398
0C4B51B22492173B0075A67D /* RemoteViewDetector.swift */,
1399+
71F1F95E2C650FFA00CB7C17 /* ShareActivityDetector.swift */,
13971400
);
13981401
path = Detectors;
13991402
sourceTree = "<group>";
@@ -3224,6 +3227,7 @@
32243227
0C4B51B52492173B0075A67D /* RemoteViewDetector.swift in Sources */,
32253228
0C9C6B08296E51AA00077D25 /* UINavigationControllerProxy.swift in Sources */,
32263229
0C897614237AE27D00098CD8 /* IAMState.swift in Sources */,
3230+
71F1F95F2C650FFA00CB7C17 /* ShareActivityDetector.swift in Sources */,
32273231
0C897621237AE27D00098CD8 /* JsMessageName.swift in Sources */,
32283232
0C9C6B09296E51AA00077D25 /* UIViewControllerProxy.swift in Sources */,
32293233
0C89761F237AE27D00098CD8 /* WidgetsState.swift in Sources */,
@@ -3848,7 +3852,7 @@
38483852
"@executable_path/Frameworks",
38493853
"@loader_path/Frameworks",
38503854
);
3851-
MARKETING_VERSION = 2.28.0;
3855+
MARKETING_VERSION = 2.29.0;
38523856
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteCore;
38533857
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
38543858
SKIP_INSTALL = YES;
@@ -3883,7 +3887,7 @@
38833887
"@executable_path/Frameworks",
38843888
"@loader_path/Frameworks",
38853889
);
3886-
MARKETING_VERSION = 2.28.0;
3890+
MARKETING_VERSION = 2.29.0;
38873891
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteCore;
38883892
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
38893893
SKIP_INSTALL = YES;
@@ -3916,7 +3920,7 @@
39163920
"@executable_path/Frameworks",
39173921
"@loader_path/Frameworks",
39183922
);
3919-
MARKETING_VERSION = 2.17.1;
3923+
MARKETING_VERSION = 2.18.0;
39203924
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteInAppMessaging;
39213925
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
39223926
SKIP_INSTALL = YES;
@@ -3949,7 +3953,7 @@
39493953
"@executable_path/Frameworks",
39503954
"@loader_path/Frameworks",
39513955
);
3952-
MARKETING_VERSION = 2.17.1;
3956+
MARKETING_VERSION = 2.18.0;
39533957
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteInAppMessaging;
39543958
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
39553959
SKIP_INSTALL = YES;

KarteCore.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'KarteCore'
11-
s.version = '2.28.0'
11+
s.version = '2.29.0'
1212
s.summary = 'KARTE Core SDK'
1313
s.homepage = 'https://karte.io'
1414
s.author = { 'PLAID' => '[email protected]' }

KarteCore/Tracking/Agent/APIClient/TrackClient.swift

+31-7
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,8 @@ private extension TrackClient {
111111
}
112112

113113
Logger.debug(tag: .track, message: "Request start. request_id=\(task.request.requestId) retry=\(task.request.isRetry)")
114-
for command in task.request.commands {
115-
let reqId = task.request.requestId
116-
let cmdId = command.identifier
117-
let name = command.event.eventName.rawValue
118114

119-
let message = "Event included in the request. request_id=\(reqId) command_id=\(cmdId) event_name=\(name)"
120-
Logger.verbose(tag: .track, message: message)
121-
}
115+
self?.logRequestDetails(of: task.request)
122116

123117
let session = Resolver.resolve(TrackClientSession.self)
124118
session.send(task.request, callbackQueue: .dispatchQueue(callbackQueue)) { result in
@@ -166,6 +160,36 @@ private extension TrackClient {
166160
ObjectIdentifier(observer)
167161
}.contains(ObjectIdentifier(observer))
168162
}
163+
164+
private func logRequestDetails(of request: TrackRequest) {
165+
for command in request.commands {
166+
let reqId = request.requestId
167+
let cmdId = command.identifier
168+
let visitorId = command.visitorId
169+
let eventName = command.event.eventName
170+
let keyValues = command.event.values.map { "\($0)=\($1.rawValue)" }.joined(separator: " ")
171+
172+
let message = "Event included in the request. request_id=\(reqId) command_id=\(cmdId) visitor_id=\(visitorId) event_name=\(eventName.rawValue) \(keyValues)"
173+
Logger.verbose(tag: .track, message: message)
174+
175+
switch eventName {
176+
case .view:
177+
let viewName = command.event.values.string(forKey: field(.viewName)) ?? ""
178+
let title = command.event.values.string(forKey: field(.title)) ?? ""
179+
Logger.info(tag: .track, message: "Event included in the request. request_id=\(reqId) command_id=\(cmdId) visitor_id=\(visitorId) view_name=\(viewName) title=\(title)")
180+
case .messageOpen,
181+
.messageClick,
182+
.messageClose,
183+
.messageReady,
184+
.messageSuppressed:
185+
let campaignId = command.event.values.string(forKeyPath: "message.campaign_id") ?? ""
186+
let shortenId = command.event.values.string(forKeyPath: "message.shorten_id") ?? ""
187+
Logger.info(tag: .track, message: "Event included in the request. request_id=\(reqId) command_id=\(cmdId) visitor_id=\(visitorId) campaign_id=\(campaignId) shorten_id=\(shortenId)")
188+
default:
189+
break
190+
}
191+
}
192+
}
169193
}
170194

171195
extension Resolver {

KarteInAppMessaging.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'KarteInAppMessaging'
11-
s.version = '2.17.1'
11+
s.version = '2.18.0'
1212
s.summary = 'KARTE In-app messaging SDK'
1313
s.homepage = 'https://karte.io'
1414
s.author = { 'PLAID' => '[email protected]' }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
//
2+
// Copyright 2024 PLAID, Inc.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
import KarteCore
18+
import UIKit
19+
20+
internal struct ShareActivityDetector {
21+
static func detect(lessThanWindowLevel windowLevel: UIWindow.Level, scenePersistentIdentifier: String? = nil) -> Bool {
22+
let windows = WindowDetector.retrieveRelatedWindows(from: scenePersistentIdentifier)
23+
let behindWindows = windows.filter { window -> Bool in
24+
window.windowLevel.rawValue < windowLevel.rawValue
25+
}
26+
27+
for behindWindow in behindWindows {
28+
guard var rootViewController = behindWindow.rootViewController else {
29+
continue
30+
}
31+
32+
while let viewController = rootViewController.presentedViewController {
33+
rootViewController = viewController
34+
}
35+
36+
if detect(rootViewController, lessThanWindowLevel: windowLevel) {
37+
return true
38+
}
39+
}
40+
return false
41+
}
42+
43+
static func detect(_ viewController: UIViewController, lessThanWindowLevel windowLevel: UIWindow.Level) -> Bool {
44+
guard let window = viewController.view.window else {
45+
// Normally, at the timing of viewDidAppear, ViewController will have "Window" attached to it.
46+
// However, only when input=file tag is selected in WKWebView of iOS9-11, the ViewController with no Window attached will be passed to the argument of this method.
47+
// Therefore, the windowLevel judgment will not be done correctly, and the RemoteView judgment will be determined to include RemoteView and the campaign will be reset.
48+
// In this case, we do not want the campaign reset to take place, so we treat the method as not including RemoteView.
49+
return false
50+
}
51+
52+
guard window.windowLevel.rawValue < windowLevel.rawValue else {
53+
return false
54+
}
55+
56+
return detect(viewController)
57+
}
58+
}
59+
60+
extension ShareActivityDetector {
61+
private static func detect(_ viewController: UIViewController) -> Bool {
62+
if viewController is UIActivityViewController ||
63+
viewController is UICloudSharingController ||
64+
viewController.presentedViewController is UIActivityViewController ||
65+
viewController.presentedViewController is UICloudSharingController {
66+
67+
return true
68+
}
69+
return false
70+
}
71+
}

KarteInAppMessaging/IAMProcess.swift

+10
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ extension IAMProcess {
105105
Logger.debug(tag: .inAppMessaging, message: "Detected the remote view: \(viewController)")
106106
webView?.reset(mode: .hard)
107107
}
108+
109+
if ShareActivityDetector.detect(viewController, lessThanWindowLevel: IAMWindow.windowLevel) {
110+
Logger.debug(tag: .inAppMessaging, message: "Detected the share activity: \(viewController)")
111+
webView?.reset(mode: .hard)
112+
}
108113
}
109114

110115
func presentViewController(_ viewController: UIViewController, in window: UIWindow?) {
@@ -320,6 +325,11 @@ extension IAMProcess: IAMWebViewDelegate {
320325
return false
321326
}
322327

328+
if ShareActivityDetector.detect(lessThanWindowLevel: IAMWindow.windowLevel, scenePersistentIdentifier: sceneId.identifier) {
329+
Logger.info(tag: .inAppMessaging, message: "Cancelled showing in-app messaging because detected share activity.")
330+
return false
331+
}
332+
323333
if let window = IAMWindow(sceneId: sceneId) {
324334
window.present(webView: webView, isFocus: isWindowFucus)
325335
self.window = window

KarteInAppMessaging/InAppMessaging.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,13 @@ public class InAppMessaging: NSObject {
142142
}
143143

144144
IAMProxy.shared.swizzleMethods()
145-
UINavigationControllerProxy.shared.swizzleMethods()
146-
UITabBarControllerProxy.shared.swizzleMethods()
147-
UIViewControllerProxy.shared.swizzleMethods()
145+
146+
let isAutoScreenBoundaryEnabled = config?.isAutoScreenBoundaryEnabled ?? true
147+
if isAutoScreenBoundaryEnabled {
148+
UINavigationControllerProxy.shared.swizzleMethods()
149+
UITabBarControllerProxy.shared.swizzleMethods()
150+
UIViewControllerProxy.shared.swizzleMethods()
151+
}
148152

149153
checkInfoPlist()
150154
}

KarteInAppMessaging/InAppMessagingConfiguration.swift

+7
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,12 @@ public class InAppMessagingConfiguration: NSObject, LibraryConfiguration {
1515
/// デフォルトは `false` です。
1616
@objc public var isSkipRemoteViewDetectionInWebView = false
1717

18+
/// SDK側で画面境界を自動で認識する機能<br>
19+
/// フラグを `true` にした場合は、SDK側で画面境界が自動で認識されます。<br>
20+
/// フラグを `false` にした場合は、viewイベントの発火以外では画面境界が認識されません。<br>
21+
/// 詳細は https://developers.karte.io/docs/concepts-boundary-transition-ios-sdk-v2 をご確認ください<br>
22+
/// デフォルトは `true` です。
23+
@objc public var isAutoScreenBoundaryEnabled = true
24+
1825
deinit {}
1926
}

KarteInAppMessaging/Tracker+InAppMessaging.swift

+12-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ internal extension Tracker {
2727
guard let shortenId = message.string(forKeyPath: "action.shorten_id") else {
2828
return
2929
}
30+
if message.string(forKeyPath: "campaign.service_action_type") == "remote_config" {
31+
return
32+
}
3033

3134
let values = [
3235
"reason": reason
@@ -37,9 +40,17 @@ internal extension Tracker {
3740
}
3841

3942
class func track(view: UIView?, data: JsMessage.EventData) {
43+
var values = data.values.mapValues { $0.rawValue }
44+
45+
let config = KarteApp.configuration.libraryConfigurations.first { $0 is InAppMessagingConfiguration } as? InAppMessagingConfiguration
46+
47+
if let isEnabled = config?.isAutoScreenBoundaryEnabled {
48+
values["_is_auto_screen_boundary_enabled"] = isEnabled
49+
}
50+
4051
let event = Event(
4152
eventName: data.eventName,
42-
values: data.values.mapValues { $0.rawValue },
53+
values: values,
4354
libraryName: InAppMessaging.name
4455
)
4556
Tracker(view: view).track(event: event)

Package.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ let package = Package(
5454
name: "KarteUtilities", url: "https://sdk.karte.io/ios/swiftpm/Utilities-3.12.0/KarteUtilities.xcframework.zip", checksum: "850abc71a8bc28e415f4b11e3072ff741a1d908c13b951a4676bc2e675eaf634"
5555
),
5656
.binaryTarget(
57-
name: "KarteCore", url: "https://sdk.karte.io/ios/swiftpm/Core-2.28.0/KarteCore.xcframework.zip", checksum: "535947825797d5f339c814e308a21b0ff2980b32f1a8fcba7c0ef1ad54413256"
57+
name: "KarteCore", url: "https://sdk.karte.io/ios/swiftpm/Core-2.29.0/KarteCore.xcframework.zip", checksum: "5b4c1f3e7157a95e9fa6ff2227854a1c5cec76fb4b1571db787b1345e7efde61"
5858
),
5959
.binaryTarget(
60-
name: "KarteInAppMessaging", url: "https://sdk.karte.io/ios/swiftpm/InAppMessaging-2.17.1/KarteInAppMessaging.xcframework.zip", checksum: "ece8b3cadb4956b2c8951486bb9e51c20f1a2abef6e3d3ccb8c548f42bcb724e"
60+
name: "KarteInAppMessaging", url: "https://sdk.karte.io/ios/swiftpm/InAppMessaging-2.18.0/KarteInAppMessaging.xcframework.zip", checksum: "d1625e74bac54bd63744c6297b742bb781ea1ab0bf4a4f652fd765245094ffcf"
6161
),
6262
.binaryTarget(
6363
name: "KarteVariables", url: "https://sdk.karte.io/ios/swiftpm/Variables-2.10.0/KarteVariables.xcframework.zip", checksum: "19665bf1c9eb5e04719b660839de4ca1145589a62669de6f12efb38fc39a4aad"

0 commit comments

Comments
 (0)