Skip to content

Commit c28fab0

Browse files
Merge pull request #476 from Kommunicate-io/dev
Release 7.2.6
2 parents 76359dc + e090b59 commit c28fab0

32 files changed

+909
-135
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
## Motivation
55
<!-- Why are you making this change? -->
66

7-
## Testing
8-
<!-- How was the code tested? Be as specific as possible. -->
7+
## Testing Branches
8+
<!-- How was the code tested? Be as specific as possible. -->
9+
KM_ChatUI_Branch : `dev`
10+
KM_Core_Branch: `dev`

.github/workflows/automerge.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: iOS Automation Test Workflow
2+
3+
on:
4+
pull_request: # Trigger this workflow on pull request events
5+
types:
6+
- opened
7+
8+
jobs:
9+
build-and-test:
10+
name: Build and Test
11+
runs-on: macos-latest
12+
timeout-minutes: 45 # Prevents the workflow from hanging indefinitely
13+
14+
steps:
15+
# Step 1: Checkout the code
16+
- name: Checkout Repository
17+
uses: actions/checkout@v3
18+
19+
# Step 2: Fetch PR Branch Information
20+
- name: Fetch PR Comments
21+
id: fetch-branches
22+
uses: actions/github-script@v6
23+
with:
24+
script: |
25+
const prBody = context.payload.pull_request?.body;
26+
if (!prBody) {
27+
core.setFailed("No pull request body found.");
28+
return;
29+
}
30+
31+
console.log("Pull request body:", prBody); // Debugging: log the PR body
32+
33+
const kmChatUIBranchMatch = prBody.match(/KM_ChatUI_Branch\s*:\s*`([^`]+)`/);
34+
const kmCoreBranchMatch = prBody.match(/KM_Core_Branch\s*:\s*`([^`]+)`/);
35+
36+
if (!kmChatUIBranchMatch || !kmCoreBranchMatch) {
37+
core.setFailed("No branch information found in the pull request body.");
38+
return;
39+
}
40+
41+
core.setOutput("kmChatUIBranch", kmChatUIBranchMatch[1].trim());
42+
core.setOutput("kmCoreBranch", kmCoreBranchMatch[1].trim());
43+
44+
# Step 3: Set up Xcode
45+
- name: Set up Xcode
46+
uses: maxim-lobanov/setup-xcode@v1
47+
with:
48+
xcode-version: '16.1.0'
49+
50+
# Step 4: Set Environment Variables
51+
- name: Set Environment Variables
52+
run: |
53+
echo "KM_CHATUI_BRANCH=${{ steps.fetch-branches.outputs.kmChatUIBranch }}" >> $GITHUB_ENV
54+
echo "KM_CORE_BRANCH=${{ steps.fetch-branches.outputs.kmCoreBranch }}" >> $GITHUB_ENV
55+
56+
# Step 5: Install dependencies
57+
- name: Install Dependencies
58+
run: |
59+
pod install --project-directory=Example
60+
61+
# Step 4: Install Certificates, Provisioning Profiles, and Set Up Keychain
62+
- name: Install Apple Certificate, Provisioning Profile, and Set Up Keychain
63+
env:
64+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
65+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
66+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
67+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
68+
run: |
69+
# Define file paths
70+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
71+
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
72+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
73+
74+
# Decode the certificate and provisioning profile from secrets
75+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
76+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
77+
78+
# Create and configure a temporary keychain
79+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
80+
security set-keychain-settings -lut 3600 $KEYCHAIN_PATH
81+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
82+
security list-keychain -d user -s $KEYCHAIN_PATH
83+
84+
# Import the certificate into the keychain
85+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
86+
87+
# Copy the provisioning profile to the expected location
88+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
89+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
90+
91+
# Step 5: Update Info.plist Files with Secrets
92+
- name: Append new key in Info.plist for Example
93+
run: |
94+
PLIST_PATH="Example/Kommunicate/Info.plist"
95+
KEY="KOMMUNICATE_APP_ID"
96+
VALUE="${{ secrets.KOMMUNICATE_APP_ID }}"
97+
/usr/libexec/PlistBuddy -c "Set :$KEY $VALUE" "$PLIST_PATH" || \
98+
/usr/libexec/PlistBuddy -c "Add :$KEY string $VALUE" "$PLIST_PATH"
99+
cat "$PLIST_PATH"
100+
101+
- name: Append new key in Info.plist for Tests
102+
run: |
103+
PLIST_PATH="Example/Tests/Info.plist"
104+
KEY="KOMMUNICATE_APP_ID"
105+
VALUE="${{ secrets.KOMMUNICATE_APP_ID }}"
106+
/usr/libexec/PlistBuddy -c "Set :$KEY $VALUE" "$PLIST_PATH" || \
107+
/usr/libexec/PlistBuddy -c "Add :$KEY string $VALUE" "$PLIST_PATH"
108+
cat "$PLIST_PATH"
109+
110+
- name: Append new key in Info.plist for UI Tests
111+
run: |
112+
PLIST_PATH="Example/Kommunicate_ExampleUITests/Info.plist"
113+
KEY="KOMMUNICATE_APP_ID"
114+
VALUE="${{ secrets.KOMMUNICATE_APP_ID }}"
115+
/usr/libexec/PlistBuddy -c "Set :$KEY $VALUE" "$PLIST_PATH" || \
116+
/usr/libexec/PlistBuddy -c "Add :$KEY string $VALUE" "$PLIST_PATH"
117+
cat "$PLIST_PATH"
118+
119+
# Step 6: Run Tests with Keychain Management
120+
- name: Run XCTest with Keychain
121+
env:
122+
KOMMUNICATE_APP_ID: ${{ secrets.KOMMUNICATE_APP_ID }}
123+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} # Keychain password
124+
TEAM_ID: ${{ secrets.TEAM_ID }} # Apple Developer Team ID
125+
run: |
126+
# Unlock the keychain for signing during tests
127+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
128+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
129+
130+
# Run the tests, ensuring code signing is handled
131+
xcodebuild test \
132+
-workspace Example/Kommunicate.xcworkspace \
133+
-scheme Kommunicate_Example \
134+
-destination 'platform=iOS Simulator,name=iPhone 16 Pro Max,OS=18.1' \
135+
-enableCodeCoverage YES \
136+
-derivedDataPath ./DerivedData \
137+
CODE_SIGN_IDENTITY="iPhone Developer" \
138+
CODE_SIGNING_ALLOWED=YES \
139+
CODE_SIGNING_REQUIRED=YES \
140+
DEVELOPMENT_TEAM="$TEAM_ID" \
141+
KEYCHAIN="$KEYCHAIN_PATH"
142+
143+
# Step 7: Print Test Results
144+
- name: Print Test Results
145+
run: |
146+
cat ./DerivedData/Logs/Test/*.xcresult/TestSummaries.plist || echo "No test results found."
147+
148+
# Step 8: Debug Environment Variables (Optional)
149+
- name: Debug Environment Variables
150+
run: |
151+
echo "Environment variables set successfully."
152+
153+
# Step 9: Post Test Results as a PR Comment
154+
- name: Post Test Results to PR
155+
if: github.event_name == 'pull_request'
156+
uses: actions/github-script@v6
157+
with:
158+
script: |
159+
const fs = require('fs');
160+
const path = './DerivedData/Logs/Test/*.xcresult/TestSummaries.plist';
161+
let content = 'Test results not found.';
162+
163+
try {
164+
content = fs.readFileSync(path, 'utf8');
165+
} catch (err) {
166+
console.log('Error reading test results:', err);
167+
}
168+
169+
const comment = `
170+
## iOS Automation Test Results
171+
Congratulations All Tests Passed! 🎉
172+
`;
173+
174+
await github.rest.issues.createComment({
175+
issue_number: context.issue.number,
176+
owner: context.repo.owner,
177+
repo: context.repo.repo,
178+
body: comment,
179+
});

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The changelog for [Kommunicate-iOS-SDK](https://github.com/Kommunicate-io/Kommunicate-iOS-SDK). Also see the [releases](https://github.com/Kommunicate-io/Kommunicate-iOS-SDK/releases) on Github.
44

5+
## [7.2.6] 2025-02-03
6+
- Added Waiting Queue UI and related functions.
7+
- Synchronized Default configuration for Swift 6 support.
8+
- AWS-ENCRYPTED- prefix removed from attachment upload in Conversation Screen.
9+
- Fixed Restart Button not working.
10+
511
## [7.2.5] 2024-12-24
612
- Fixed typo of registerUserAsVistor with registerUserAsVisitor.
713
- SSL pinning enable disable configuration added.

Example/Kommunicate.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
778B59CFD2A9AA01B2C8BB47 /* Pods_Kommunicate_ExampleUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C12430200CB714F7C6EC6DE /* Pods_Kommunicate_ExampleUITests.framework */; };
2121
8213687C2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */; };
2222
8213687E2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8213687D2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift */; };
23+
8237AC4C2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */; };
2324
8B33037F2226A494003BF306 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B33037E2226A494003BF306 /* LoginViewController.swift */; };
2425
8B5BC12A22002FDC00F39956 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8B5BC12822002FDC00F39956 /* Localizable.strings */; };
2526
8B8FFA9421D5171F00C8ED57 /* PaymentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B8FFA9321D5171F00C8ED57 /* PaymentTests.swift */; };
@@ -67,6 +68,7 @@
6768
78226602544E9745BB6CB084 /* Pods_Kommunicate_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Kommunicate_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6869
8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateConfigurationTesting.swift; sourceTree = "<group>"; };
6970
8213687D2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateLoginAndWelcomeMessage.swift; sourceTree = "<group>"; };
71+
8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateResolveAndAssignmentUITests.swift; sourceTree = "<group>"; };
7072
8AFCF2C4706B87B553819E20 /* Pods-Kommunicate_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kommunicate_Tests.debug.xcconfig"; path = "Target Support Files/Pods-Kommunicate_Tests/Pods-Kommunicate_Tests.debug.xcconfig"; sourceTree = "<group>"; };
7173
8B33037E2226A494003BF306 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
7274
8B5BC12422002C4000F39956 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -242,6 +244,7 @@
242244
isa = PBXGroup;
243245
children = (
244246
8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */,
247+
8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */,
245248
C698B48F24AB76A5008BB4D9 /* KommunicateCreateConversationAndSendMessagesTests.swift */,
246249
C698B48E24AB76A5008BB4D9 /* TestCaseInfo.swift */,
247250
C698B49D24AB77D5008BB4D9 /* Info.plist */,
@@ -588,6 +591,7 @@
588591
buildActionMask = 2147483647;
589592
files = (
590593
C698B4A424AB7803008BB4D9 /* KommunicateCreateConversationAndSendMessagesTests.swift in Sources */,
594+
8237AC4C2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift in Sources */,
591595
C67D56E824AE439A001BA419 /* KommunicateLoginAsVisitorUITests.swift in Sources */,
592596
C698B4A324AB7803008BB4D9 /* TestCaseInfo.swift in Sources */,
593597
8213687E2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift in Sources */,

Example/Kommunicate/AppDelegate.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import UIKit
1111
import UserNotifications
1212

13-
@UIApplicationMain
14-
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
13+
@main
14+
class AppDelegate: UIResponder, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate {
1515
var window: UIWindow?
1616

1717
// Pass your App Id here. You can get the App Id from install section in the dashboard.
@@ -22,6 +22,11 @@
2222
if let regexPattern = ProcessInfo.processInfo.environment["restrictedMessageRegexPattern"] {
2323
Kommunicate.defaultConfiguration.restrictedMessageRegexPattern = regexPattern
2424
}
25+
26+
if let KMAppID = Bundle.main.object(forInfoDictionaryKey: "KOMMUNICATE_APP_ID") as? String {
27+
appId = KMAppID
28+
}
29+
2530
setUpNavigationBarAppearance()
2631

2732
UNUserNotificationCenter.current().delegate = self
@@ -85,7 +90,7 @@
8590
}
8691

8792
func registerForNotification() {
88-
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .alert, .sound]) { granted, _ in
93+
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .alert, .sound]) { @Sendable granted, _ in
8994

9095
if granted {
9196
DispatchQueue.main.async {

Example/Kommunicate/Base.lproj/Localizable.strings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ noName = "No Name";
5454
/* Navigation title for faq view controller */
5555
FaqTitle = "FAQ";
5656

57+
58+
59+
/* Waiting Queue */
60+
waitingQueueTitle = "In queue...";
61+
waitingQueueMessage = "You are currently %@ in the waiting queue, our agents will get back to you shortly.";
62+
5763
/* ApplozicSwift framework's key-value pairs */
5864

5965
Back = "Back";

Example/Kommunicate/Info.plist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<string>$(PRODUCT_NAME) photo use</string>
3737
<key>UIBackgroundModes</key>
3838
<array>
39-
<string>fetch</string>
4039
<string>remote-notification</string>
4140
</array>
4241
<key>UILaunchStoryboardName</key>

Example/Kommunicate_Example.entitlements

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
<dict>
55
<key>aps-environment</key>
66
<string>development</string>
7+
<key>keychain-access-groups</key>
8+
<array>
9+
<string>$(AppIdentifierPrefix)com.Kommunicate.demo</string>
10+
</array>
711
</dict>
812
</plist>

Example/Kommunicate_ExampleUITests/KommunicateCreateConversationAndSendMessagesTests.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,19 @@ class KommunicateCreateConversationAndSendMessagesTests: XCTestCase {
125125

126126
private func beforeTest_Launch_NewConversation() -> (XCUIApplication) {
127127
let app = XCUIApplication()
128+
if app.buttons[InAppButton.LaunchScreen.logoutButton].exists {
129+
app.buttons[InAppButton.LaunchScreen.logoutButton].tap()
130+
let loginAsVisitorButton = app.buttons[InAppButton.LaunchScreen.loginAsVisitor]
131+
waitFor(object: loginAsVisitorButton) { $0.exists }
132+
loginAsVisitorButton.tap()
133+
}
128134
let launchConversationButton = app.buttons[InAppButton.EditGroup.launch]
129135
waitFor(object: launchConversationButton) { $0.exists }
130136
launchConversationButton.tap()
131137
sleep(3)
132138
// Check if the specific screen is on top
133139
let isScreenOnTop = app.navigationBars[AppScreen.myChatScreen].exists
134-
140+
135141
if isScreenOnTop {
136142
// Perform actions only if the screen is not on top
137143
let createConversationButton = app.navigationBars[AppScreen.myChatScreen]

0 commit comments

Comments
 (0)