Skip to content

Commit

Permalink
Merge release/2024.08.26T08.56.08 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
TakayukiCho committed Aug 26, 2024
2 parents 5afc90d + 2ddf211 commit 395d5f3
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .spm-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.16.0
2.17.0
25 changes: 20 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

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

# Releases - 2024.08.26
## Version 2.17.0

### Core 2.29.0
** 🔨CHANGED**
- イベント送信のログにイベント内容を付与しました。

### InAppMessaging 2.18.0
** 🔨CHANGED**
- InAppMessagingの画面境界の自動判定のOn/Offを切り替え可能にしました

** 💊FIXED**
- suppressed状態で設定値配信を取得した場合に_message_suppressedが発生しないように変更しました。
- UIActivityViewControllerなどのシェア機能と接客の同時表示時にタップできない領域が発生していたため、当該状況では接客を非表示にするよう修正しました。

# Releases - 2024.06.25
## Version 2.16.0

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

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

Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.6)
strscan
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -344,13 +344,13 @@ GEM
word_wrap (1.0.0)
xcinvoke (0.3.0)
liferaft (~> 0.0.6)
xcodeproj (1.24.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
rexml (>= 3.3.2, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
Expand Down
12 changes: 8 additions & 4 deletions Karte.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@
68C9FAD425C55C2F0069EA3D /* ActionProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68C9FAD325C55C2F0069EA3D /* ActionProtocol.swift */; };
68E47D0225C7B6E0003C878F /* ActionFactorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68E47D0125C7B6E0003C878F /* ActionFactorySpec.swift */; };
68E62712254036AA005148FC /* Karte-mock-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 68E62711254036AA005148FC /* Karte-mock-Info.plist */; };
71F1F95F2C650FFA00CB7C17 /* ShareActivityDetector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71F1F95E2C650FFA00CB7C17 /* ShareActivityDetector.swift */; };
777D6057273DA68300339D7E /* AttributeSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777D6056273DA68300339D7E /* AttributeSpec.swift */; };
777D605927421BB600339D7E /* InvalidEventFieldValueFilterRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777D605827421BB600339D7E /* InvalidEventFieldValueFilterRule.swift */; };
777D605B2742217500339D7E /* InvalidEventNameFilterRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 777D605A2742217500339D7E /* InvalidEventNameFilterRule.swift */; };
Expand Down Expand Up @@ -1007,6 +1008,7 @@
68C9FAD325C55C2F0069EA3D /* ActionProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionProtocol.swift; sourceTree = "<group>"; };
68E47D0125C7B6E0003C878F /* ActionFactorySpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionFactorySpec.swift; sourceTree = "<group>"; };
68E62711254036AA005148FC /* Karte-mock-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Karte-mock-Info.plist"; sourceTree = "<group>"; };
71F1F95E2C650FFA00CB7C17 /* ShareActivityDetector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareActivityDetector.swift; sourceTree = "<group>"; };
777D6056273DA68300339D7E /* AttributeSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributeSpec.swift; sourceTree = "<group>"; };
777D605827421BB600339D7E /* InvalidEventFieldValueFilterRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvalidEventFieldValueFilterRule.swift; sourceTree = "<group>"; };
777D605A2742217500339D7E /* InvalidEventNameFilterRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvalidEventNameFilterRule.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1394,6 +1396,7 @@
0C4B51B12492173B0075A67D /* ClassLoader.swift */,
0C4B51B32492173B0075A67D /* OpacityDetector.swift */,
0C4B51B22492173B0075A67D /* RemoteViewDetector.swift */,
71F1F95E2C650FFA00CB7C17 /* ShareActivityDetector.swift */,
);
path = Detectors;
sourceTree = "<group>";
Expand Down Expand Up @@ -3224,6 +3227,7 @@
0C4B51B52492173B0075A67D /* RemoteViewDetector.swift in Sources */,
0C9C6B08296E51AA00077D25 /* UINavigationControllerProxy.swift in Sources */,
0C897614237AE27D00098CD8 /* IAMState.swift in Sources */,
71F1F95F2C650FFA00CB7C17 /* ShareActivityDetector.swift in Sources */,
0C897621237AE27D00098CD8 /* JsMessageName.swift in Sources */,
0C9C6B09296E51AA00077D25 /* UIViewControllerProxy.swift in Sources */,
0C89761F237AE27D00098CD8 /* WidgetsState.swift in Sources */,
Expand Down Expand Up @@ -3848,7 +3852,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.28.0;
MARKETING_VERSION = 2.29.0;
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteCore;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3883,7 +3887,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.28.0;
MARKETING_VERSION = 2.29.0;
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteCore;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3916,7 +3920,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.17.1;
MARKETING_VERSION = 2.18.0;
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteInAppMessaging;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3949,7 +3953,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 2.17.1;
MARKETING_VERSION = 2.18.0;
PRODUCT_BUNDLE_IDENTIFIER = io.karte.KarteInAppMessaging;
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.28.0'
s.version = '2.29.0'
s.summary = 'KARTE Core SDK'
s.homepage = 'https://karte.io'
s.author = { 'PLAID' => '[email protected]' }
Expand Down
38 changes: 31 additions & 7 deletions KarteCore/Tracking/Agent/APIClient/TrackClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,8 @@ private extension TrackClient {
}

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

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

let session = Resolver.resolve(TrackClientSession.self)
session.send(task.request, callbackQueue: .dispatchQueue(callbackQueue)) { result in
Expand Down Expand Up @@ -166,6 +160,36 @@ private extension TrackClient {
ObjectIdentifier(observer)
}.contains(ObjectIdentifier(observer))
}

private func logRequestDetails(of request: TrackRequest) {
for command in request.commands {
let reqId = request.requestId
let cmdId = command.identifier
let visitorId = command.visitorId
let eventName = command.event.eventName
let keyValues = command.event.values.map { "\($0)=\($1.rawValue)" }.joined(separator: " ")

let message = "Event included in the request. request_id=\(reqId) command_id=\(cmdId) visitor_id=\(visitorId) event_name=\(eventName.rawValue) \(keyValues)"
Logger.verbose(tag: .track, message: message)

switch eventName {
case .view:
let viewName = command.event.values.string(forKey: field(.viewName)) ?? ""
let title = command.event.values.string(forKey: field(.title)) ?? ""
Logger.info(tag: .track, message: "Event included in the request. request_id=\(reqId) command_id=\(cmdId) visitor_id=\(visitorId) view_name=\(viewName) title=\(title)")
case .messageOpen,
.messageClick,
.messageClose,
.messageReady,
.messageSuppressed:
let campaignId = command.event.values.string(forKeyPath: "message.campaign_id") ?? ""
let shortenId = command.event.values.string(forKeyPath: "message.shorten_id") ?? ""
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)")
default:
break
}
}
}
}

extension Resolver {
Expand Down
2 changes: 1 addition & 1 deletion KarteInAppMessaging.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'KarteInAppMessaging'
s.version = '2.17.1'
s.version = '2.18.0'
s.summary = 'KARTE In-app messaging SDK'
s.homepage = 'https://karte.io'
s.author = { 'PLAID' => '[email protected]' }
Expand Down
71 changes: 71 additions & 0 deletions KarteInAppMessaging/Detectors/ShareActivityDetector.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// 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 KarteCore
import UIKit

internal struct ShareActivityDetector {
static func detect(lessThanWindowLevel windowLevel: UIWindow.Level, scenePersistentIdentifier: String? = nil) -> Bool {
let windows = WindowDetector.retrieveRelatedWindows(from: scenePersistentIdentifier)
let behindWindows = windows.filter { window -> Bool in
window.windowLevel.rawValue < windowLevel.rawValue
}

for behindWindow in behindWindows {
guard var rootViewController = behindWindow.rootViewController else {
continue
}

while let viewController = rootViewController.presentedViewController {
rootViewController = viewController
}

if detect(rootViewController, lessThanWindowLevel: windowLevel) {
return true
}
}
return false
}

static func detect(_ viewController: UIViewController, lessThanWindowLevel windowLevel: UIWindow.Level) -> Bool {
guard let window = viewController.view.window else {
// Normally, at the timing of viewDidAppear, ViewController will have "Window" attached to it.
// 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.
// 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.
// In this case, we do not want the campaign reset to take place, so we treat the method as not including RemoteView.
return false
}

guard window.windowLevel.rawValue < windowLevel.rawValue else {
return false
}

return detect(viewController)
}
}

extension ShareActivityDetector {
private static func detect(_ viewController: UIViewController) -> Bool {
if viewController is UIActivityViewController ||
viewController is UICloudSharingController ||
viewController.presentedViewController is UIActivityViewController ||
viewController.presentedViewController is UICloudSharingController {

return true
}
return false
}
}
10 changes: 10 additions & 0 deletions KarteInAppMessaging/IAMProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ extension IAMProcess {
Logger.debug(tag: .inAppMessaging, message: "Detected the remote view: \(viewController)")
webView?.reset(mode: .hard)
}

if ShareActivityDetector.detect(viewController, lessThanWindowLevel: IAMWindow.windowLevel) {
Logger.debug(tag: .inAppMessaging, message: "Detected the share activity: \(viewController)")
webView?.reset(mode: .hard)
}
}

func presentViewController(_ viewController: UIViewController, in window: UIWindow?) {
Expand Down Expand Up @@ -320,6 +325,11 @@ extension IAMProcess: IAMWebViewDelegate {
return false
}

if ShareActivityDetector.detect(lessThanWindowLevel: IAMWindow.windowLevel, scenePersistentIdentifier: sceneId.identifier) {
Logger.info(tag: .inAppMessaging, message: "Cancelled showing in-app messaging because detected share activity.")
return false
}

if let window = IAMWindow(sceneId: sceneId) {
window.present(webView: webView, isFocus: isWindowFucus)
self.window = window
Expand Down
10 changes: 7 additions & 3 deletions KarteInAppMessaging/InAppMessaging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,13 @@ public class InAppMessaging: NSObject {
}

IAMProxy.shared.swizzleMethods()
UINavigationControllerProxy.shared.swizzleMethods()
UITabBarControllerProxy.shared.swizzleMethods()
UIViewControllerProxy.shared.swizzleMethods()

let isAutoScreenBoundaryEnabled = config?.isAutoScreenBoundaryEnabled ?? true
if isAutoScreenBoundaryEnabled {
UINavigationControllerProxy.shared.swizzleMethods()
UITabBarControllerProxy.shared.swizzleMethods()
UIViewControllerProxy.shared.swizzleMethods()
}

checkInfoPlist()
}
Expand Down
7 changes: 7 additions & 0 deletions KarteInAppMessaging/InAppMessagingConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ public class InAppMessagingConfiguration: NSObject, LibraryConfiguration {
/// デフォルトは `false` です。
@objc public var isSkipRemoteViewDetectionInWebView = false

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

deinit {}
}
13 changes: 12 additions & 1 deletion KarteInAppMessaging/Tracker+InAppMessaging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ internal extension Tracker {
guard let shortenId = message.string(forKeyPath: "action.shorten_id") else {
return
}
if message.string(forKeyPath: "campaign.service_action_type") == "remote_config" {
return
}

let values = [
"reason": reason
Expand All @@ -37,9 +40,17 @@ internal extension Tracker {
}

class func track(view: UIView?, data: JsMessage.EventData) {
var values = data.values.mapValues { $0.rawValue }

let config = KarteApp.configuration.libraryConfigurations.first { $0 is InAppMessagingConfiguration } as? InAppMessagingConfiguration

if let isEnabled = config?.isAutoScreenBoundaryEnabled {
values["_is_auto_screen_boundary_enabled"] = isEnabled
}

let event = Event(
eventName: data.eventName,
values: data.values.mapValues { $0.rawValue },
values: values,
libraryName: InAppMessaging.name
)
Tracker(view: view).track(event: event)
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ let package = Package(
name: "KarteUtilities", url: "https://sdk.karte.io/ios/swiftpm/Utilities-3.12.0/KarteUtilities.xcframework.zip", checksum: "850abc71a8bc28e415f4b11e3072ff741a1d908c13b951a4676bc2e675eaf634"
),
.binaryTarget(
name: "KarteCore", url: "https://sdk.karte.io/ios/swiftpm/Core-2.28.0/KarteCore.xcframework.zip", checksum: "535947825797d5f339c814e308a21b0ff2980b32f1a8fcba7c0ef1ad54413256"
name: "KarteCore", url: "https://sdk.karte.io/ios/swiftpm/Core-2.29.0/KarteCore.xcframework.zip", checksum: "5b4c1f3e7157a95e9fa6ff2227854a1c5cec76fb4b1571db787b1345e7efde61"
),
.binaryTarget(
name: "KarteInAppMessaging", url: "https://sdk.karte.io/ios/swiftpm/InAppMessaging-2.17.1/KarteInAppMessaging.xcframework.zip", checksum: "ece8b3cadb4956b2c8951486bb9e51c20f1a2abef6e3d3ccb8c548f42bcb724e"
name: "KarteInAppMessaging", url: "https://sdk.karte.io/ios/swiftpm/InAppMessaging-2.18.0/KarteInAppMessaging.xcframework.zip", checksum: "d1625e74bac54bd63744c6297b742bb781ea1ab0bf4a4f652fd765245094ffcf"
),
.binaryTarget(
name: "KarteVariables", url: "https://sdk.karte.io/ios/swiftpm/Variables-2.10.0/KarteVariables.xcframework.zip", checksum: "19665bf1c9eb5e04719b660839de4ca1145589a62669de6f12efb38fc39a4aad"
Expand Down

0 comments on commit 395d5f3

Please sign in to comment.