Skip to content

Commit 9bd0fae

Browse files
authored
Merge branch 'master' into fix/SDK-164-Revert-deeplinks-issue
2 parents 267db40 + faf43dc commit 9bd0fae

File tree

13 files changed

+1029
-562
lines changed

13 files changed

+1029
-562
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: BCIT Embedded Messages Integration Test
2+
permissions:
3+
contents: read
4+
5+
on:
6+
pull_request:
7+
types: [opened, synchronize, reopened, labeled]
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
description: 'Branch or commit to test (leave empty for current branch)'
12+
required: false
13+
type: string
14+
15+
jobs:
16+
embedded-messages-test:
17+
name: BCIT Embedded Messages Integration Test
18+
runs-on: macos-latest
19+
timeout-minutes: 30
20+
env:
21+
XCODE_VERSION: '16.4'
22+
if: >
23+
github.event_name == 'workflow_dispatch' ||
24+
(
25+
github.event_name == 'pull_request' && (
26+
contains(github.event.pull_request.labels.*.name, 'bcit') ||
27+
contains(github.event.pull_request.labels.*.name, 'BCIT') ||
28+
contains(github.event.pull_request.labels.*.name, 'bcit-embedded') ||
29+
contains(github.event.pull_request.labels.*.name, 'BCIT-EMBEDDED') ||
30+
contains(github.event.pull_request.labels.*.name, 'bcit-embedded-messages') ||
31+
contains(github.event.pull_request.labels.*.name, 'BCIT-EMBEDDED-MESSAGES') ||
32+
contains(github.event.pull_request.labels.*.name, 'Bcit') ||
33+
contains(github.event.pull_request.labels.*.name, 'Bcit-Embedded') ||
34+
startsWith(github.event.pull_request.head.ref, 'release/')
35+
)
36+
)
37+
38+
steps:
39+
- name: Checkout Repository
40+
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ github.event.inputs.ref || github.ref }}
43+
44+
- name: Setup Xcode
45+
uses: maxim-lobanov/setup-xcode@v1
46+
with:
47+
xcode-version: ${{ env.XCODE_VERSION }}
48+
49+
- name: Validate Xcode Version
50+
run: |
51+
echo "🔍 Validating Xcode version and environment..."
52+
echo "DEVELOPER_DIR: $DEVELOPER_DIR"
53+
54+
# Check xcodebuild version
55+
echo "🔍 Checking xcodebuild version..."
56+
ACTUAL_XCODE_VERSION=$(xcodebuild -version | head -n 1 | awk '{print $2}')
57+
echo "Xcode version: $ACTUAL_XCODE_VERSION"
58+
echo "Expected version: $XCODE_VERSION"
59+
60+
# Check xcodebuild path
61+
XCODEBUILD_PATH=$(which xcodebuild)
62+
echo "xcodebuild path: $XCODEBUILD_PATH"
63+
64+
# Verify we're using the correct Xcode version
65+
if echo "$ACTUAL_XCODE_VERSION" | grep -q "$XCODE_VERSION"; then
66+
echo "✅ Using correct Xcode version: $ACTUAL_XCODE_VERSION"
67+
else
68+
echo "❌ Incorrect Xcode version!"
69+
echo "Current: $ACTUAL_XCODE_VERSION"
70+
echo "Expected: $XCODE_VERSION"
71+
exit 1
72+
fi
73+
74+
- name: Setup Local Environment
75+
working-directory: tests/business-critical-integration
76+
run: |
77+
echo "🚀 Setting up local environment for integration tests..."
78+
79+
# Run setup script with parameters from repository secrets
80+
./scripts/setup-local-environment.sh \
81+
"${{ secrets.BCIT_TEST_PROJECT_ID }}" \
82+
"${{ secrets.BCIT_ITERABLE_SERVER_KEY }}" \
83+
"${{ secrets.BCIT_ITERABLE_API_KEY }}"
84+
85+
- name: Validate Setup
86+
working-directory: tests/business-critical-integration
87+
run: |
88+
echo "🔍 Validating environment setup..."
89+
./scripts/validate-setup.sh
90+
91+
- name: Run Embedded Messages Tests
92+
working-directory: tests/business-critical-integration
93+
run: |
94+
echo "🧪 Running embedded messages integration tests..."
95+
CI=true ./scripts/run-tests.sh embedded
96+
97+
- name: Upload Test Results
98+
if: always()
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: embedded-messages-test-results
102+
path: |
103+
tests/business-critical-integration/reports/
104+
tests/business-critical-integration/screenshots/
105+
tests/business-critical-integration/logs/
106+
retention-days: 7
107+

tests/business-critical-integration/integration-test-app/IterableSDK-Integration-Tester/App/AppDelegate+IntegrationTest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ extension AppDelegate {
8181
config.inAppDisplayInterval = 1
8282
config.autoPushRegistration = false // Disable automatic push registration for testing control
8383
config.allowedProtocols = ["tester"] // Allow our custom tester:// deep link scheme
84+
config.enableEmbeddedMessaging = true
8485

8586
let apiKey = loadApiKeyFromConfig()
8687
IterableAPI.initialize(apiKey: apiKey,

tests/business-critical-integration/integration-test-app/IterableSDK-Integration-Tester/App/AppDelegate.swift

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7474
if let isGhostPush = iterableData["isGhostPush"] as? Bool {
7575
print("👻 [APP] Ghost push flag: \(isGhostPush)")
7676
}
77+
78+
if let notificationType = iterableData["notificationType"] as? String {
79+
print("📝 [APP] Notification type: \(notificationType)")
80+
}
7781
}
7882

79-
// Call completion handler
80-
completionHandler(.newData)
83+
// Pass to Iterable SDK for processing
84+
// This enables automatic embedded message sync when silent push with "UpdateEmbedded" type is received
85+
print("📲 [APP] Passing silent push to Iterable SDK for processing...")
86+
IterableAppIntegration.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
8187
}
8288

8389
// MARK: - Deep link
@@ -242,6 +248,22 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
242248

243249
if let iterableData = notification.request.content.userInfo["itbl"] as? [String: Any] {
244250
print("🔔 [APP] Iterable-specific data: \(iterableData)")
251+
252+
// Check if this is a silent push for embedded messages
253+
if let notificationType = iterableData["notificationType"] as? String {
254+
print("📝 [APP] Notification type: \(notificationType)")
255+
if notificationType == "UpdateEmbedded" {
256+
print("🎯 [APP] Silent push for embedded messages detected in FOREGROUND")
257+
print("💡 [APP] Passing to SDK for embedded message sync...")
258+
259+
// Pass to SDK even when in foreground
260+
IterableAppIntegration.application(
261+
UIApplication.shared,
262+
didReceiveRemoteNotification: notification.request.content.userInfo,
263+
fetchCompletionHandler: { _ in }
264+
)
265+
}
266+
}
245267
}
246268

247269
print("🔔 Foreground notification received: \(notification.request.content.userInfo)")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// EmbeddedMessageTestHostingController.swift
3+
// IterableSDK-Integration-Tester
4+
//
5+
6+
import UIKit
7+
import SwiftUI
8+
9+
final class EmbeddedMessageTestHostingController: UIViewController {
10+
11+
override func viewDidLoad() {
12+
super.viewDidLoad()
13+
14+
// Create SwiftUI view
15+
let embeddedTestView = EmbeddedMessageTestView()
16+
let hostingController = UIHostingController(rootView: embeddedTestView)
17+
18+
// Add hosting controller as child
19+
addChild(hostingController)
20+
view.addSubview(hostingController.view)
21+
22+
// Setup constraints
23+
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
24+
NSLayoutConstraint.activate([
25+
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor),
26+
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
27+
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
28+
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor)
29+
])
30+
31+
hostingController.didMove(toParent: self)
32+
}
33+
}
34+

0 commit comments

Comments
 (0)