Skip to content

Commit b2abd04

Browse files
Merge pull request #486 from Kommunicate-io/dev
Release 7.2.8
2 parents 5f70d37 + ad3e6ba commit b2abd04

File tree

59 files changed

+906
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+906
-383
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
## Summary
22
<!-- Simple summary of what was changed. -->
33

4-
## Motivation
5-
<!-- Why are you making this change? -->
6-
74
## Testing Branches
8-
<!-- How was the code tested? Be as specific as possible. -->
5+
<!-- Which branch the code should be tested? Add the code in `<BRANCH_NAME>`. -->
96
KM_ChatUI_Branch : `dev`
107
KM_Core_Branch: `dev`

.github/workflows/ios-automation-test.yaml

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,72 @@
11
name: iOS Automation Test Workflow
22

33
on:
4-
pull_request: # Trigger this workflow on pull request events
4+
pull_request:
55
types:
66
- opened
7+
- synchronize # Triggers when a new commit is pushed to the PR
8+
9+
concurrency:
10+
group: pr-${{ github.event.pull_request.number }}
11+
cancel-in-progress: true
712

813
jobs:
14+
# Build and Lint Job
15+
build-and-lint:
16+
name: Build and Lint
17+
# Only run this job when the base branch is master
18+
if: github.event.pull_request.base.ref == 'master'
19+
runs-on: macos-latest
20+
timeout-minutes: 10
21+
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v3
25+
26+
- name: Set up Xcode
27+
uses: maxim-lobanov/setup-xcode@v1
28+
with:
29+
xcode-version: '16.1.0'
30+
31+
- name: Run Linter Check
32+
run: |
33+
pod lib lint --allow-warnings
34+
35+
- name: Debug Environment Variables (Optional)
36+
run: echo "Environment variables set successfully."
37+
38+
- name: Post Lint Test Results to PR
39+
if: github.event_name == 'pull_request' && success()
40+
uses: actions/github-script@v6
41+
with:
42+
script: |
43+
const comment = `✅ **iOS Lint Test Result**\nCongratulations! Linter Check Passed Successfully 🎉`;
44+
await github.rest.issues.createComment({
45+
issue_number: context.issue.number,
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
body: comment,
49+
});
50+
51+
- name: Post Lint Failure Result to PR
52+
if: github.event_name == 'pull_request' && failure()
53+
uses: actions/github-script@v6
54+
with:
55+
script: |
56+
const comment = `❌ **iOS Lint Test Result**\nOops! Linter Check Failed. Please fix the issues.`;
57+
await github.rest.issues.createComment({
58+
issue_number: context.issue.number,
59+
owner: context.repo.owner,
60+
repo: context.repo.repo,
61+
body: comment,
62+
});
63+
64+
# Build and Test Job
965
build-and-test:
1066
name: Build and Test
1167
runs-on: macos-latest
12-
timeout-minutes: 45 # Prevents the workflow from hanging indefinitely
13-
68+
timeout-minutes: 45
69+
1470
steps:
1571
# Step 1: Checkout the code
1672
- name: Checkout Repository

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.8] 2025-03-18
6+
- Internal Code Refactor.
7+
- Typing indicator For bot message delay.
8+
- Updated TableView Update function.
9+
- Updated depricated Code and resolved Warnings.
10+
511
## [7.2.7] 2025-02-14
612
- Updated Kingfisher from 7.6.2 to 7.10.0 to align with Privacy Manifest requirements.
713

Example/.swiftlint.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji)
3+
4+
included:
5+
- ../sources
6+
- ../../KommunicateChatUI-iOS-SDK/sources
7+
- ../../KommunicateCore-iOS-SDK/sources
8+
9+
excluded: # paths to ignore during linting. Takes precedence over `included`.
10+
- .
11+
- Carthage
12+
- Pods
13+
- SwiftLint/Common/3rdPartyLib
14+
15+
# Disable specific rules that may be unnecessary or too strict
16+
disabled_rules:
17+
- trailing_whitespace # Allows trailing whitespace (not recommended but sometimes needed)
18+
- empty_count # Disables warning for using `.count == 0` instead of `.isEmpty`
19+
20+
# Enable additional rules for stricter linting
21+
opt_in_rules:
22+
- empty_parameters # Ensures function parameters are not left empty
23+
- explicit_init # Requires explicit initializers to avoid ambiguity
24+
- vertical_parameter_alignment # Aligns function parameters for better readability
25+
26+
# Enforce maximum line length to keep code readable
27+
line_length: 120 # Maximum allowed characters per line
28+
29+
cyclomatic_complexity:
30+
warning: 50 # Increase the limit from 10 to 50
31+
error: 60
32+
33+
# Function and type length restrictions to encourage modular code
34+
function_body_length: 40 # Limits function body length to 40 lines
35+
type_body_length: 200 # Limits classes/structs to 200 lines
36+
file_length: 400 # Restricts each file to a maximum of 400 lines
37+
38+
# Naming conventions for better readability
39+
identifier_name:
40+
min_length: 3 # Ensures variables have meaningful names (e.g., `id` is too short)
41+
max_length: 40 # Prevents excessively long variable names
42+
allowed_symbols: ["_"] # Allows underscores in variable names
43+
validates_start_with_lowercase: false # Allows uppercase identifiers
44+
45+
# Prevent forced unwrapping and casting to improve safety
46+
force_unwrapping: warning # Warns against using `!`, which can cause crashes
47+
force_cast: warning # Discourages forced type casting using `as!`
48+
49+
# Optimize code by avoiding redundant initializations
50+
redundant_optional_initialization: warning # Detects unnecessary `= nil` assignments
51+
redundant_setter_value: warning # Avoids redundant property setter assignments
52+
redundant_string_enum_value: warning # Removes unnecessary explicit raw
53+
54+
# Allow Todo Comments (if enabled above)
55+
todo:
56+
severity: warning

Example/Kommunicate.xcodeproj/project.pbxproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
8213687C2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */; };
2222
8213687E2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8213687D2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift */; };
2323
8237AC4C2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */; };
24+
82881F2A2D65B82300D3A1C1 /* KommunicateCSATUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82881F292D65B82300D3A1C1 /* KommunicateCSATUITests.swift */; };
25+
82881F2F2D684CA900D3A1C1 /* KommunicatePreChatUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82881F2E2D684CA900D3A1C1 /* KommunicatePreChatUITests.swift */; };
2426
8B33037F2226A494003BF306 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B33037E2226A494003BF306 /* LoginViewController.swift */; };
2527
8B5BC12A22002FDC00F39956 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8B5BC12822002FDC00F39956 /* Localizable.strings */; };
2628
8B8FFA9421D5171F00C8ED57 /* PaymentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B8FFA9321D5171F00C8ED57 /* PaymentTests.swift */; };
@@ -66,9 +68,12 @@
6668
6C12430200CB714F7C6EC6DE /* Pods_Kommunicate_ExampleUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Kommunicate_ExampleUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6769
707E7F0040A81A7354816747 /* Pods-Kommunicate_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kommunicate_Example.debug.xcconfig"; path = "Target Support Files/Pods-Kommunicate_Example/Pods-Kommunicate_Example.debug.xcconfig"; sourceTree = "<group>"; };
6870
78226602544E9745BB6CB084 /* Pods_Kommunicate_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Kommunicate_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
71+
8206968B2D7ACB8400D006DA /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
6972
8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateConfigurationTesting.swift; sourceTree = "<group>"; };
7073
8213687D2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateLoginAndWelcomeMessage.swift; sourceTree = "<group>"; };
7174
8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateResolveAndAssignmentUITests.swift; sourceTree = "<group>"; };
75+
82881F292D65B82300D3A1C1 /* KommunicateCSATUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicateCSATUITests.swift; sourceTree = "<group>"; };
76+
82881F2E2D684CA900D3A1C1 /* KommunicatePreChatUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KommunicatePreChatUITests.swift; sourceTree = "<group>"; };
7277
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>"; };
7378
8B33037E2226A494003BF306 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
7479
8B5BC12422002C4000F39956 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -142,6 +147,7 @@
142147
607FACC71AFB9204008FA782 = {
143148
isa = PBXGroup;
144149
children = (
150+
8206968B2D7ACB8400D006DA /* .swiftlint.yml */,
145151
8B68A6F72051551F00BF6C22 /* Kommunicate_Example.entitlements */,
146152
607FACF51AFB993E008FA782 /* Podspec Metadata */,
147153
607FACD21AFB9204008FA782 /* Example for Kommunicate */,
@@ -245,7 +251,9 @@
245251
children = (
246252
8213687B2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift */,
247253
8237AC4B2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift */,
254+
82881F292D65B82300D3A1C1 /* KommunicateCSATUITests.swift */,
248255
C698B48F24AB76A5008BB4D9 /* KommunicateCreateConversationAndSendMessagesTests.swift */,
256+
82881F2E2D684CA900D3A1C1 /* KommunicatePreChatUITests.swift */,
249257
C698B48E24AB76A5008BB4D9 /* TestCaseInfo.swift */,
250258
C698B49D24AB77D5008BB4D9 /* Info.plist */,
251259
C67D56E724AE439A001BA419 /* KommunicateLoginAsVisitorUITests.swift */,
@@ -268,6 +276,7 @@
268276
607FACCD1AFB9204008FA782 /* Frameworks */,
269277
607FACCE1AFB9204008FA782 /* Resources */,
270278
1D7D9C8FADF87FDBB71B7A4E /* [CP] Embed Pods Frameworks */,
279+
820696862D7ABB0D00D006DA /* ShellScript */,
271280
);
272281
buildRules = (
273282
);
@@ -538,6 +547,23 @@
538547
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Kommunicate_ExampleUITests/Pods-Kommunicate_ExampleUITests-frameworks.sh\"\n";
539548
showEnvVarsInLog = 0;
540549
};
550+
820696862D7ABB0D00D006DA /* ShellScript */ = {
551+
isa = PBXShellScriptBuildPhase;
552+
buildActionMask = 2147483647;
553+
files = (
554+
);
555+
inputFileListPaths = (
556+
);
557+
inputPaths = (
558+
);
559+
outputFileListPaths = (
560+
);
561+
outputPaths = (
562+
);
563+
runOnlyForDeploymentPostprocessing = 0;
564+
shellPath = /bin/sh;
565+
shellScript = "#!/bin/bash\n\n# Set Homebrew path for Apple Silicon Macs\nif [[ \"$(uname -m)\" == arm64 ]]; then\n export PATH=\"/opt/homebrew/bin:$PATH\"\nfi\n\n# Define valid paths for SwiftLint\nVALID_PATHS=(\n \"../sources\"\n \"../../KommunicateChatUI-iOS-SDK/sources\"\n \"../../KommunicateCore-iOS-SDK/sources\"\n)\n\n# Check if at least one path exists before running SwiftLint\nFOUND_VALID_PATH=false\n\nfor path in \"${VALID_PATHS[@]}\"; do\n if [ -d \"$path\" ]; then\n FOUND_VALID_PATH=true\n break\n fi\ndone\n\nif [ \"$FOUND_VALID_PATH\" = false ]; then\n echo \"No valid SwiftLint paths found. Skipping linting.\"\n exit 0\nfi\n\n# Run SwiftLint if installed\nif command -v swiftlint >/dev/null 2>&1; then\n swiftlint --fix\n swiftlint\nelse\n echo \"warning: 'swiftlint' command not found - See https://github.com/realm/SwiftLint#installation for installation instructions.\"\nfi\n";
566+
};
541567
F47AF37523481C3B162F3C1B /* [CP] Check Pods Manifest.lock */ = {
542568
isa = PBXShellScriptBuildPhase;
543569
buildActionMask = 2147483647;
@@ -592,7 +618,9 @@
592618
files = (
593619
C698B4A424AB7803008BB4D9 /* KommunicateCreateConversationAndSendMessagesTests.swift in Sources */,
594620
8237AC4C2D4A5DF8008BC1AC /* KommunicateResolveAndAssignmentUITests.swift in Sources */,
621+
82881F2F2D684CA900D3A1C1 /* KommunicatePreChatUITests.swift in Sources */,
595622
C67D56E824AE439A001BA419 /* KommunicateLoginAsVisitorUITests.swift in Sources */,
623+
82881F2A2D65B82300D3A1C1 /* KommunicateCSATUITests.swift in Sources */,
596624
C698B4A324AB7803008BB4D9 /* TestCaseInfo.swift in Sources */,
597625
8213687E2CDA332100B09F37 /* KommunicateLoginAndWelcomeMessage.swift in Sources */,
598626
8213687C2CDA2CEE00B09F37 /* KommunicateConfigurationTesting.swift in Sources */,

Example/Kommunicate/AppDelegate.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
Kommunicate.defaultConfiguration.restrictedMessageRegexPattern = regexPattern
2424
}
2525

26+
if ProcessInfo.processInfo.environment["isCSATRatingButtonEnabled"] != nil {
27+
Kommunicate.defaultConfiguration.rateConversationMenuOption = true
28+
}
29+
2630
if let KMAppID = Bundle.main.object(forInfoDictionaryKey: "KOMMUNICATE_APP_ID") as? String {
2731
appId = KMAppID
2832
}

Example/Kommunicate/LoginViewController.swift

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import Kommunicate
1111
import UIKit
1212

13-
class LoginViewController: UIViewController {
13+
class LoginViewController: UIViewController, KMPreChatFormViewControllerDelegate {
1414
@IBOutlet var scrollView: UIScrollView!
1515
@IBOutlet var userName: UITextField!
1616
@IBOutlet var password: UITextField!
@@ -89,8 +89,25 @@
8989
registerUser(kmUser)
9090
}
9191

92-
@IBAction func loginAsVisitor(_: Any) {
93-
resignFields()
92+
@IBAction func loginAsVisitor(_: Any) {
93+
resignFields()
94+
95+
if ProcessInfo.processInfo.environment["isFaqUIFromDashboardTestEnabled"] != nil {
96+
let applicationId = (UIApplication.shared.delegate as! AppDelegate).appId
97+
setupApplicationKey(applicationId)
98+
let conversation = KMConversation(userId: Kommunicate.randomId())
99+
Kommunicate.createConversationWithPreChat(appID: applicationId, conversation: conversation, viewController: self) { error in
100+
if error != nil {
101+
return
102+
}
103+
}
104+
} else if ProcessInfo.processInfo.environment["isFaqUITestEnabled"] != nil {
105+
let preChatVC = KMPreChatFormViewController(configuration: Kommunicate.defaultConfiguration)
106+
preChatVC.delegate = self // Set the delegate to self to receive callbacks
107+
preChatVC.preChatConfiguration.optionsToShow = [.email, .name, .phoneNumber] // Configure options to be visible in pre-chat
108+
preChatVC.preChatConfiguration.mandatoryOptions = [.email, .name, .phoneNumber] // Configure mandatory options
109+
self.present(preChatVC, animated: false, completion: nil) // Present the pre-chat view
110+
} else {
94111
let applicationId = (UIApplication.shared.delegate as! AppDelegate).appId
95112
setupApplicationKey(applicationId)
96113
let kmUser = userWithUserId(Kommunicate.randomId(), andApplicationId: applicationId)
@@ -111,7 +128,25 @@
111128
}
112129
})
113130
}
114-
131+
}
132+
133+
func userSubmittedResponse(name: String, email: String, phoneNumber: String, password: String) {
134+
dismiss(animated: true)
135+
let applicationId = (UIApplication.shared.delegate as! AppDelegate).appId
136+
setupApplicationKey(applicationId)
137+
let kmUser = userWithUserId(Kommunicate.randomId(), andApplicationId: applicationId)
138+
kmUser.displayName = name
139+
kmUser.email = email
140+
kmUser.contactNumber = phoneNumber
141+
kmUser.password = password
142+
activityIndicator.startAnimating()
143+
registerUser(kmUser)
144+
}
145+
146+
func closeButtonTapped() {
147+
dismiss(animated: true)
148+
}
149+
115150
@objc func keyboardWillHide(notification: NSNotification) {
116151
guard isKeyboardVisible,
117152
let duration = notification.userInfo?[UIResponder.keyboardAnimationDurationUserInfoKey] as? TimeInterval

Example/Kommunicate/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import UIKit
1212

1313
class ViewController: UIViewController {
14-
let activityIndicator = UIActivityIndicatorView(style: .gray)
14+
let activityIndicator = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.medium)
1515

1616
override func viewDidLoad() {
1717
super.viewDidLoad()

0 commit comments

Comments
 (0)