Skip to content

Commit

Permalink
Merge pull request #476 from Kommunicate-io/dev
Browse files Browse the repository at this point in the history
Release 7.2.6
  • Loading branch information
AbhijeetRanjan308 authored Feb 3, 2025
2 parents 76359dc + e090b59 commit c28fab0
Show file tree
Hide file tree
Showing 32 changed files with 909 additions and 135 deletions.
6 changes: 4 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
## Motivation
<!-- Why are you making this change? -->

## Testing
<!-- How was the code tested? Be as specific as possible. -->
## Testing Branches
<!-- How was the code tested? Be as specific as possible. -->
KM_ChatUI_Branch : `dev`
KM_Core_Branch: `dev`
29 changes: 0 additions & 29 deletions .github/workflows/automerge.yml

This file was deleted.

179 changes: 179 additions & 0 deletions .github/workflows/ios-automation-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: iOS Automation Test Workflow

on:
pull_request: # Trigger this workflow on pull request events
types:
- opened

jobs:
build-and-test:
name: Build and Test
runs-on: macos-latest
timeout-minutes: 45 # Prevents the workflow from hanging indefinitely

steps:
# Step 1: Checkout the code
- name: Checkout Repository
uses: actions/checkout@v3

# Step 2: Fetch PR Branch Information
- name: Fetch PR Comments
id: fetch-branches
uses: actions/github-script@v6
with:
script: |
const prBody = context.payload.pull_request?.body;
if (!prBody) {
core.setFailed("No pull request body found.");
return;
}
console.log("Pull request body:", prBody); // Debugging: log the PR body
const kmChatUIBranchMatch = prBody.match(/KM_ChatUI_Branch\s*:\s*`([^`]+)`/);
const kmCoreBranchMatch = prBody.match(/KM_Core_Branch\s*:\s*`([^`]+)`/);
if (!kmChatUIBranchMatch || !kmCoreBranchMatch) {
core.setFailed("No branch information found in the pull request body.");
return;
}
core.setOutput("kmChatUIBranch", kmChatUIBranchMatch[1].trim());
core.setOutput("kmCoreBranch", kmCoreBranchMatch[1].trim());
# Step 3: Set up Xcode
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.1.0'

# Step 4: Set Environment Variables
- name: Set Environment Variables
run: |
echo "KM_CHATUI_BRANCH=${{ steps.fetch-branches.outputs.kmChatUIBranch }}" >> $GITHUB_ENV
echo "KM_CORE_BRANCH=${{ steps.fetch-branches.outputs.kmCoreBranch }}" >> $GITHUB_ENV
# Step 5: Install dependencies
- name: Install Dependencies
run: |
pod install --project-directory=Example
# Step 4: Install Certificates, Provisioning Profiles, and Set Up Keychain
- name: Install Apple Certificate, Provisioning Profile, and Set Up Keychain
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# Define file paths
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# Decode the certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# Create and configure a temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 3600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# Import the certificate into the keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# Copy the provisioning profile to the expected location
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
# Step 5: Update Info.plist Files with Secrets
- name: Append new key in Info.plist for Example
run: |
PLIST_PATH="Example/Kommunicate/Info.plist"
KEY="KOMMUNICATE_APP_ID"
VALUE="${{ secrets.KOMMUNICATE_APP_ID }}"
/usr/libexec/PlistBuddy -c "Set :$KEY $VALUE" "$PLIST_PATH" || \
/usr/libexec/PlistBuddy -c "Add :$KEY string $VALUE" "$PLIST_PATH"
cat "$PLIST_PATH"
- name: Append new key in Info.plist for Tests
run: |
PLIST_PATH="Example/Tests/Info.plist"
KEY="KOMMUNICATE_APP_ID"
VALUE="${{ secrets.KOMMUNICATE_APP_ID }}"
/usr/libexec/PlistBuddy -c "Set :$KEY $VALUE" "$PLIST_PATH" || \
/usr/libexec/PlistBuddy -c "Add :$KEY string $VALUE" "$PLIST_PATH"
cat "$PLIST_PATH"
- name: Append new key in Info.plist for UI Tests
run: |
PLIST_PATH="Example/Kommunicate_ExampleUITests/Info.plist"
KEY="KOMMUNICATE_APP_ID"
VALUE="${{ secrets.KOMMUNICATE_APP_ID }}"
/usr/libexec/PlistBuddy -c "Set :$KEY $VALUE" "$PLIST_PATH" || \
/usr/libexec/PlistBuddy -c "Add :$KEY string $VALUE" "$PLIST_PATH"
cat "$PLIST_PATH"
# Step 6: Run Tests with Keychain Management
- name: Run XCTest with Keychain
env:
KOMMUNICATE_APP_ID: ${{ secrets.KOMMUNICATE_APP_ID }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} # Keychain password
TEAM_ID: ${{ secrets.TEAM_ID }} # Apple Developer Team ID
run: |
# Unlock the keychain for signing during tests
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Run the tests, ensuring code signing is handled
xcodebuild test \
-workspace Example/Kommunicate.xcworkspace \
-scheme Kommunicate_Example \
-destination 'platform=iOS Simulator,name=iPhone 16 Pro Max,OS=18.1' \
-enableCodeCoverage YES \
-derivedDataPath ./DerivedData \
CODE_SIGN_IDENTITY="iPhone Developer" \
CODE_SIGNING_ALLOWED=YES \
CODE_SIGNING_REQUIRED=YES \
DEVELOPMENT_TEAM="$TEAM_ID" \
KEYCHAIN="$KEYCHAIN_PATH"
# Step 7: Print Test Results
- name: Print Test Results
run: |
cat ./DerivedData/Logs/Test/*.xcresult/TestSummaries.plist || echo "No test results found."
# Step 8: Debug Environment Variables (Optional)
- name: Debug Environment Variables
run: |
echo "Environment variables set successfully."
# Step 9: Post Test Results as a PR Comment
- name: Post Test Results to PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const path = './DerivedData/Logs/Test/*.xcresult/TestSummaries.plist';
let content = 'Test results not found.';
try {
content = fs.readFileSync(path, 'utf8');
} catch (err) {
console.log('Error reading test results:', err);
}
const comment = `
## iOS Automation Test Results
Congratulations All Tests Passed! 🎉
`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
});
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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.

## [7.2.6] 2025-02-03
- Added Waiting Queue UI and related functions.
- Synchronized Default configuration for Swift 6 support.
- AWS-ENCRYPTED- prefix removed from attachment upload in Conversation Screen.
- Fixed Restart Button not working.

## [7.2.5] 2024-12-24
- Fixed typo of registerUserAsVistor with registerUserAsVisitor.
- SSL pinning enable disable configuration added.
Expand Down
4 changes: 4 additions & 0 deletions Example/Kommunicate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
778B59CFD2A9AA01B2C8BB47 /* Pods_Kommunicate_ExampleUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C12430200CB714F7C6EC6DE /* Pods_Kommunicate_ExampleUITests.framework */; };
8213687C2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */; };
8213687E2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8213687D2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift */; };
8237AC4C2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */; };
8B33037F2226A494003BF306 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B33037E2226A494003BF306 /* LoginViewController.swift */; };
8B5BC12A22002FDC00F39956 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8B5BC12822002FDC00F39956 /* Localizable.strings */; };
8B8FFA9421D5171F00C8ED57 /* PaymentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B8FFA9321D5171F00C8ED57 /* PaymentTests.swift */; };
Expand Down Expand Up @@ -67,6 +68,7 @@
78226602544E9745BB6CB084 /* Pods_Kommunicate_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Kommunicate_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateConfigurationTesting.swift; sourceTree = "<group>"; };
8213687D2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateLoginAndWelcomeMessage.swift; sourceTree = "<group>"; };
8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateResolveAndAssignmentUITests.swift; sourceTree = "<group>"; };
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>"; };
8B33037E2226A494003BF306 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
8B5BC12422002C4000F39956 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -242,6 +244,7 @@
isa = PBXGroup;
children = (
8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */,
8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */,
C698B48F24AB76A5008BB4D9 /* KommunicateCreateConversationAndSendMessagesTests.swift */,
C698B48E24AB76A5008BB4D9 /* TestCaseInfo.swift */,
C698B49D24AB77D5008BB4D9 /* Info.plist */,
Expand Down Expand Up @@ -588,6 +591,7 @@
buildActionMask = 2147483647;
files = (
C698B4A424AB7803008BB4D9 /* KommunicateCreateConversationAndSendMessagesTests.swift in Sources */,
8237AC4C2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift in Sources */,
C67D56E824AE439A001BA419 /* KommunicateLoginAsVisitorUITests.swift in Sources */,
C698B4A324AB7803008BB4D9 /* TestCaseInfo.swift in Sources */,
8213687E2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift in Sources */,
Expand Down
11 changes: 8 additions & 3 deletions Example/Kommunicate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import UIKit
import UserNotifications

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
@main
class AppDelegate: UIResponder, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate {
var window: UIWindow?

// Pass your App Id here. You can get the App Id from install section in the dashboard.
Expand All @@ -22,6 +22,11 @@
if let regexPattern = ProcessInfo.processInfo.environment["restrictedMessageRegexPattern"] {
Kommunicate.defaultConfiguration.restrictedMessageRegexPattern = regexPattern
}

if let KMAppID = Bundle.main.object(forInfoDictionaryKey: "KOMMUNICATE_APP_ID") as? String {
appId = KMAppID
}

setUpNavigationBarAppearance()

UNUserNotificationCenter.current().delegate = self
Expand Down Expand Up @@ -85,7 +90,7 @@
}

func registerForNotification() {
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .alert, .sound]) { granted, _ in
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .alert, .sound]) { @Sendable granted, _ in

if granted {
DispatchQueue.main.async {
Expand Down
6 changes: 6 additions & 0 deletions Example/Kommunicate/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ noName = "No Name";
/* Navigation title for faq view controller */
FaqTitle = "FAQ";



/* Waiting Queue */
waitingQueueTitle = "In queue...";
waitingQueueMessage = "You are currently %@ in the waiting queue, our agents will get back to you shortly.";

/* ApplozicSwift framework's key-value pairs */

Back = "Back";
Expand Down
1 change: 0 additions & 1 deletion Example/Kommunicate/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<string>$(PRODUCT_NAME) photo use</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
Expand Down
4 changes: 4 additions & 0 deletions Example/Kommunicate_Example.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.Kommunicate.demo</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,19 @@ class KommunicateCreateConversationAndSendMessagesTests: XCTestCase {

private func beforeTest_Launch_NewConversation() -> (XCUIApplication) {
let app = XCUIApplication()
if app.buttons[InAppButton.LaunchScreen.logoutButton].exists {
app.buttons[InAppButton.LaunchScreen.logoutButton].tap()
let loginAsVisitorButton = app.buttons[InAppButton.LaunchScreen.loginAsVisitor]
waitFor(object: loginAsVisitorButton) { $0.exists }
loginAsVisitorButton.tap()
}
let launchConversationButton = app.buttons[InAppButton.EditGroup.launch]
waitFor(object: launchConversationButton) { $0.exists }
launchConversationButton.tap()
sleep(3)
// Check if the specific screen is on top
let isScreenOnTop = app.navigationBars[AppScreen.myChatScreen].exists

if isScreenOnTop {
// Perform actions only if the screen is not on top
let createConversationButton = app.navigationBars[AppScreen.myChatScreen]
Expand Down
Loading

0 comments on commit c28fab0

Please sign in to comment.