Conversation
… restart button is disabled.
…in information cell.
[CM-1835] Feedback overRiding when one time rating is disabled | iOS SDK
[CM-2398] BUG: Form Text Area Placeholder not visible after clearing text | iOS SDK
[CM-2395] Form Data Persist in Local Cache| iOS SDK
Added the fix for collectEmailUI bug
Updated Podfile to 1.5.0
WalkthroughThis update introduces version 1.5.0 of the KommunicateChatUI-iOS-SDK, adding a Business Hours feature with a new UI component, persistent local caching for form data, and improvements to form dropdown handling. The codebase undergoes a comprehensive refactor, replacing references to Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ALKConversationViewController
participant KMBusinessHoursView
User->>ALKConversationViewController: Opens conversation
ALKConversationViewController->>KMBusinessHoursView: prepareBusinessHoursInfoView(message, isVisible)
KMBusinessHoursView-->>ALKConversationViewController: Displays business hours message
ALKConversationViewController->>User: Shows/hides reply options based on business hours and restart button state
sequenceDiagram
participant User
participant ALKFormCell
participant ALKFormDataCache
participant UserDefaults
User->>ALKFormCell: Fills form fields
ALKFormCell->>ALKFormDataCache: set(formData)
ALKFormDataCache->>UserDefaults: Persist formData
User->>ALKFormCell: Returns to form later
ALKFormCell->>ALKFormDataCache: getFormData(formId)
ALKFormDataCache->>UserDefaults: Retrieve formData if not in memory
ALKFormDataCache-->>ALKFormCell: Returns formData
ALKFormCell-->>User: Displays previously entered data
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (7)
Sources/Utilities/ALKFormDataCache.swift (2)
19-27: Proper implementation of persistent data storage.The implementation correctly stores data both in memory and UserDefaults. Consider adding error handling for encoding failures and making this method thread-safe with a dispatch queue or synchronization mechanism for concurrent access.
func set(_ formDataSubmit: FormDataSubmit, for key: String) { let cacheKey = key as NSString cache.setObject(formDataSubmit, forKey: cacheKey) // Persist to UserDefaults + do { if let encodedData = try? JSONEncoder().encode(formDataSubmit) { UserDefaults.standard.set(encodedData, forKey: userDefaultsKeyPrefix + key) } + } catch { + print("Error encoding form data: \(error.localizedDescription)") + } }
51-64: Complete cache clearing implementation.The method effectively clears both in-memory and UserDefaults-based cache. The use of
hasPrefixto target only relevant keys is a good practice. However, consider ifsynchronize()is necessary, as it's deprecated in newer iOS versions.public func clearCache() { cache.removeAllObjects() // Clear in-memory cache let userDefaults = UserDefaults.standard let allKeys = userDefaults.dictionaryRepresentation().keys // Remove only keys related to FormDataCache for key in allKeys where key.hasPrefix(userDefaultsKeyPrefix) { userDefaults.removeObject(forKey: key) } - - userDefaults.synchronize() // Ensure changes are applied }Sources/Views/KMBusinessHoursView.swift (2)
32-47: Good constraint setup with clear organization.The constraints are well-organized and properly establish the hierarchy and spacing between elements. Consider adding a bottom constraint for the message label to ensure proper vertical sizing.
NSLayoutConstraint.activate([ lineImageView.topAnchor.constraint(equalTo: view.topAnchor), lineImageView.heightAnchor.constraint(equalToConstant: 2), lineImageView.leadingAnchor.constraint(equalTo: view.leadingAnchor), lineImageView.trailingAnchor.constraint(equalTo: view.trailingAnchor), // Title Label businessHourMessageLabel.topAnchor.constraint(equalTo: lineImageView.topAnchor), businessHourMessageLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 15), businessHourMessageLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -15), businessHourMessageLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor), + businessHourMessageLabel.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor, constant: -10) ])
49-54: Simple and effective message configuration.The configuration method is straightforward and handles all necessary styling. Consider adding dynamic color support for better dark mode adaptation.
public func configureMessage(message: String) { businessHourMessageLabel.text = message businessHourMessageLabel.font = Font.bold(size: 16.0).font() - businessHourMessageLabel.textColor = .white - lineImageView.backgroundColor = .white + businessHourMessageLabel.textColor = UIColor.dynamicColor(light: .white, dark: .white) + lineImageView.backgroundColor = UIColor.dynamicColor(light: .white, dark: .white) }Sources/Views/ALKFormTextItemCell.swift (2)
249-256: Placeholder label setup looks good.Consider updating the font when the text view’s font changes so that the placeholder always matches the current text style.
func setCustomFont(_ newFont: UIFont) { self.font = newFont + placeholderLabel.font = newFont updatePlaceholderVisibility() }
276-299: Internal delegate usage and observer registration.
- Assigning
delegate = selfcan conflict if consuming code also wants to implement a delegate for the text view. Consider exposing a forwarding delegate.- Good job removing the observer in
deinit, preventing memory leaks.Sources/Controllers/ALKConversationViewController.swift (1)
3174-3174: Identical file-size check for videos.
Same note about confirming MB vs. 1024 approach to ensure consistent upload limits.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Demo/Podfile.lockis excluded by!**/*.lock
📒 Files selected for processing (35)
CHANGELOG.md(1 hunks)KommunicateChatUI-iOS-SDK.podspec(2 hunks)Package.resolved(1 hunks)Package.swift(1 hunks)Sources/Controllers/ALKConversationListTableViewController.swift(2 hunks)Sources/Controllers/ALKConversationListViewController.swift(2 hunks)Sources/Controllers/ALKConversationViewController+DocumentManager.swift(1 hunks)Sources/Controllers/ALKConversationViewController.swift(21 hunks)Sources/Controllers/ALKCreateGroupViewController.swift(1 hunks)Sources/Controllers/ALKNewChatViewController.swift(3 hunks)Sources/Controllers/ALKParticipantSelectionViewContoller.swift(3 hunks)Sources/Models/ALKChatBarConfiguration.swift(1 hunks)Sources/Utilities/ALKAppSettingsUserDefaults.swift(1 hunks)Sources/Utilities/ALKFormDataCache.swift(1 hunks)Sources/Utilities/ALKHTTPManager.swift(4 hunks)Sources/Utilities/ALKMessageViewModel+Extension.swift(1 hunks)Sources/Utilities/ALKVideoUploadManager.swift(4 hunks)Sources/Utilities/ALMessage+Extension.swift(3 hunks)Sources/Utilities/KMZendeskChatHandler.swift(9 hunks)Sources/ViewModels/ALKConversationListViewModel.swift(2 hunks)Sources/ViewModels/ALKConversationViewModel.swift(13 hunks)Sources/ViewModels/ALKCreateGroupViewModel.swift(4 hunks)Sources/ViewModels/ALKNewChatViewModel.swift(4 hunks)Sources/Views/ALKAttatchmentView.swift(1 hunks)Sources/Views/ALKFormCell.swift(4 hunks)Sources/Views/ALKFormTextItemCell.swift(3 hunks)Sources/Views/ALKInformationCell.swift(2 hunks)Sources/Views/ALKLocationCell.swift(1 hunks)Sources/Views/ALKMessageBaseCell.swift(1 hunks)Sources/Views/ALKPhotoCell.swift(1 hunks)Sources/Views/ALKReplyMessageView.swift(1 hunks)Sources/Views/ALKVideoCell.swift(1 hunks)Sources/Views/KMBusinessHoursView.swift(1 hunks)Sources/Views/KMLanguageView.swift(2 hunks)Sources/Views/SpeechToTextButton.swift(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
Sources/Views/KMBusinessHoursView.swift (1)
Learnt from: AbhijeetRanjan308
PR: Kommunicate-io/KommunicateChatUI-iOS-SDK#354
File: Sources/Controllers/ALKConversationViewController.swift:700-710
Timestamp: 2025-03-20T11:34:05.504Z
Learning: The `KMBusinessHoursView.estimateHeightForMessage()` method already returns zero for empty messages, making additional empty string checks redundant when setting the view's height constraint.
🧬 Code Graph Analysis (4)
Sources/Controllers/ALKConversationViewController+DocumentManager.swift (1)
Sources/Utilities/ALKFileUtils.swift (1)
sizeOfFile(120-125)
Sources/Views/KMBusinessHoursView.swift (1)
Sources/Controllers/ALKConversationViewController.swift (1)
setupConstraints(725-831)
Sources/Utilities/ALKFormDataCache.swift (1)
Sources/Utilities/ALKHTTPManager.swift (1)
hasPrefix(24-26)
Sources/Controllers/ALKConversationListViewController.swift (1)
Sources/Controllers/ALKConversationViewController.swift (1)
updateLastSeen(3058-3065)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and Lint
🔇 Additional comments (103)
Sources/Models/ALKChatBarConfiguration.swift (1)
21-21: Documentation update aligns with codebase migration.The comment now correctly references
KMCoreUserDefaultsHandler, ensuring consistency with the updated settings/user defaults handler throughout the codebase.Sources/Controllers/ALKConversationViewController+DocumentManager.swift (1)
14-14: Appropriate namespace migration for configuration settings.The change from
ALApplozicSettingstoKMCoreSettingsfor retrieving the maximum image upload size aligns with the broader SDK refactoring effort. This maintains the same functionality while moving to the more appropriate namespace.Package.swift (1)
19-19: Version update looks good!The dependency version for KommunicateCore_iOS_SDK has been updated from 1.2.6 to 1.3.0, which correctly aligns with the corresponding updates in other package management files (Package.resolved and podspec).
KommunicateChatUI-iOS-SDK.podspec (2)
3-3: Appropriate version bump for new featuresThe SDK version increase to 1.5.0 properly reflects the significant new features being added (Business Hours, form data persistence, etc.).
32-32: Dependency version synchronized correctlyThe KommunicateCore-iOS-SDK dependency version has been updated to 1.3.0, maintaining consistency with the Swift Package Manager configuration.
Package.resolved (1)
36-37: Package resolution correctly updatedThe revision hash and version update for KommunicateCore_iOS_SDK are consistent with the package specification changes.
Sources/Views/ALKReplyMessageView.swift (1)
276-278: Refactoring to new API handlers looks goodThe migration from
ALUserDefaultsHandlertoKMCoreUserDefaultsHandlerfor Google Maps API key retrieval is correctly implemented. This is part of a broader refactoring to standardize on theKMCorenamespace for settings and user defaults.Sources/Views/SpeechToTextButton.swift (1)
105-105: Consistent refactoring to new settings handlersThis change correctly replaces
ALApplozicSettingswithKMCoreSettingsfor retrieving speech-to-text language settings, consistent with the broader refactoring pattern across the codebase.Sources/Views/ALKLocationCell.swift (1)
141-142: Updates API key retrieval source to KMCoreUserDefaultsHandlerThis change aligns with the broader codebase refactoring from ALUserDefaultsHandler to KMCoreUserDefaultsHandler.
Sources/Views/ALKPhotoCell.swift (1)
332-332: Updates storage service checks to use KMCoreSettingsThis change is part of the broader refactoring from ALApplozicSettings to KMCoreSettings.
Sources/Utilities/ALKAppSettingsUserDefaults.swift (1)
169-170: Updates default upload override methods to use KMCoreSettingsThis change maintains the same functionality while updating to use the new KMCoreSettings class.
Sources/Controllers/ALKCreateGroupViewController.swift (1)
160-160: Updates base URL retrieval to use KMCoreUserDefaultsHandlerThis change is consistent with the broader refactoring to use KMCore classes.
Sources/ViewModels/ALKCreateGroupViewModel.swift (5)
80-80: Consistent reference update to KM Core moduleThe code updates the reference from
ALUserDefaultsHandler.getUserId()toKMCoreUserDefaultsHandler.getUserId(), which aligns with the broader SDK refactoring effort to use the newer Core module.
118-118: Appropriate handler migrationUpdated user ID filtering to use the new handler, maintaining the same functionality while modernizing the codebase.
163-163: Consistent handler migrationAdmin check updated to use
KMCoreUserDefaultsHandler, continuing the pattern of migrating to the new Core module.
182-182: Successful migration to new defaults handlerContact loading now uses the updated UserDefaults handler, consistent with the other changes in this file.
188-188: Completed handler migrationFinal instance of the handler updated, ensuring all references now use the new
KMCoreUserDefaultsHandler.CHANGELOG.md (1)
5-10: Clear and informative release notesThe changelog for version 1.5.0 clearly documents the new features and bug fixes, providing good visibility into what's changing in this release.
Key additions include:
- Business Hours feature
- Form data persistence
- Multiple bug fixes
These align with the code changes seen in the pull request.
Sources/Views/ALKAttatchmentView.swift (1)
81-82: Settings class migration completedSuccessfully updated references from
ALApplozicSettingstoKMCoreSettingsfor storage service checks. This change is part of the broader effort to migrate to the new Core module.Sources/Utilities/ALKMessageViewModel+Extension.swift (1)
44-46: Settings class migration for bot customizationUpdated the bot configuration retrieval to use
KMCoreSettingsinstead ofALApplozicSettings, maintaining consistent usage of the new Core module across the codebase.Sources/Views/ALKMessageBaseCell.swift (1)
509-513: Consistent handler migration for Google Map API key accessThe update to
KMCoreUserDefaultsHandlerfor retrieving and setting the Google Map API key aligns with the broader refactoring effort across the codebase, ensuring a standardized approach to configuration management.Sources/Views/ALKVideoCell.swift (1)
306-306: Storage service check migrated to KMCoreSettingsThe migration from
ALApplozicSettingstoKMCoreSettingsfor checking storage service enablement maintains the same functionality while standardizing the configuration source.Sources/Utilities/ALKHTTPManager.swift (5)
119-119: Storage service check migrated to KMCoreSettingsThe migration from
ALApplozicSettingstoKMCoreSettingsfor checking storage service enablement is consistent with the broader refactoring approach.
159-161: S3 storage and upload URL checks migrated to KMCoreSettingsThe configuration source has been updated while maintaining the same conditional logic for S3 storage and file naming.
164-168: Upload headers retrieval migrated to KMCoreSettingsCustom headers retrieval is now using the standardized KMCoreSettings class.
183-183: S3 parameter selection logic migrated to KMCoreSettingsFile parameter constant selection based on storage type now uses KMCoreSettings.
196-201: Override upload URL check migrated to KMCoreSettingsThe conditional block for handling custom upload URLs now uses KMCoreSettings while maintaining the same functionality.
Sources/Views/KMLanguageView.swift (2)
64-65: Language setting retrieval migrated to KMCoreSettingsThe saved language code check now uses KMCoreSettings, consistent with the codebase-wide refactoring.
93-93: Language setting storage migrated to KMCoreSettingsLanguage code storage for speech-to-text now uses KMCoreSettings, maintaining functionality while standardizing the configuration approach.
Sources/Controllers/ALKConversationListTableViewController.swift (2)
486-487: Consistent refactoring of user ID retrievalThe change from
ALUserDefaultsHandler.getUserId()toKMCoreUserDefaultsHandler.getUserId()aligns with the broader refactoring effort to standardize onKMCorevariants for settings and user defaults throughout the SDK.
544-545: Consistent refactoring of user ID retrievalThis is another instance of the same refactoring pattern, replacing
ALUserDefaultsHandler.getUserId()withKMCoreUserDefaultsHandler.getUserId()to maintain consistency across the codebase.Sources/Utilities/ALKVideoUploadManager.swift (4)
83-87: Consistent replacement of settings handlerThe change from
ALApplozicSettingstoKMCoreSettingsfor upload headers is part of the broader refactoring to standardize onKMCorevariants for settings management.
120-121: Standardized settings check for S3 storageReplacing
ALApplozicSettings.isS3StorageServiceEnabled()withKMCoreSettings.isS3StorageServiceEnabled()maintains consistency with the refactoring approach across the codebase.
133-134: Consistent settings override URL checkChanging from
ALApplozicSettings.getDefaultOverrideuploadUrl()toKMCoreSettings.getDefaultOverrideuploadUrl()follows the same refactoring pattern to useKMCorevariants for settings.
162-167: Standardized S3 storage check for file metadataThe replacement of
ALApplozicSettings.isS3StorageServiceEnabled()withKMCoreSettings.isS3StorageServiceEnabled()maintains consistency with the refactoring effort.Sources/ViewModels/ALKConversationListViewModel.swift (2)
195-200: Updated parameter type for user detailsThe parameter type change from
ALUserDetailtoKMCoreUserDetailis part of the broader refactoring to standardize onKMCoredata models. This ensures consistency with the updated SDK structure.
209-209: Standardized fetch flag checkReplacing
ALUserDefaultsHandler.getFlagForAllConversationFetched()withKMCoreUserDefaultsHandler.getFlagForAllConversationFetched()aligns with the broader refactoring effort for user defaults handling.Sources/Utilities/ALMessage+Extension.swift (3)
17-17: Updated file URL source for image base URLThe change from
ALUserDefaultsHandler.getFILEURL()toKMCoreUserDefaultsHandler.getFILEURL()maintains consistency with the refactoring to useKMCorevariants for user defaults.
71-74: Standardized bot name and ID retrievalReplacing
ALApplozicSettingswithKMCoreSettingsfor custom bot ID and name follows the consistent refactoring pattern across the codebase.
273-275: Updated override URL check in messageType propertyChanging from
ALApplozicSettings.getDefaultOverrideuploadUrl()toKMCoreSettings.getDefaultOverrideuploadUrl()aligns with the broader refactoring effort for settings management.Sources/ViewModels/ALKConversationViewModel.swift (14)
208-214: Good replacement of ALUserDefaultsHandler with KMCoreUserDefaultsHandler.The code now uses KMCoreUserDefaultsHandler for checking if the server call is done for a chat ID. This is part of a systematic update across the codebase to use the KMCore classes instead of the AL classes.
287-289: LGTM! Consistent update to use KMCoreUserDefaultsHandler.The filter condition for user ID now correctly uses the new KMCoreUserDefaultsHandler class. This maintains functionality while aligning with the refactoring approach.
588-590: Correctly updated comment and condition to use KMCoreSettings.The comment and condition now properly refer to KMCoreSettings instead of ALApplozicSettings when checking for storage service configuration.
1190-1197: Good refactoring to use KMCoreSettings for upload handling.The code now correctly uses KMCoreSettings for checking upload URL override and S3 storage service settings.
1221-1225: Successfully updated upload URL check to use KMCoreSettings.This condition now correctly uses KMCoreSettings.getDefaultOverrideuploadUrl() to check for a custom upload URL override setting.
1242-1243: Proper update for typing status API call.The code now uses KMCoreUserDefaultsHandler.getApplicationKey() for sending typing status, maintaining functionality while using the new class.
1255-1256: Good update for keyboard done typing method.The typing status update when keyboard finishes typing is now correctly using KMCoreUserDefaultsHandler for the application key.
1262-1267: Updated device key comparison correctly.The check for whether a message is from a different device now uses KMCoreUserDefaultsHandler for getting the device key string.
1279-1287: Successfully updated user defaults handler reference in refresh method.The call to get latest messages now uses KMCoreUserDefaultsHandler.getDeviceKeyString() instead of the AL version.
1556-1558: Updated configuration check for agent app settings.Now using KMCoreSettings to check if agent app configuration is enabled, maintaining functionality while using the new KMCore class.
1792-1797: Updated load earlier messages option check.The code now uses KMCoreUserDefaultsHandler for checking the "show load earlier option" setting.
1808-1810: Consistent update for agent app configuration check.Similar to the earlier instance, this code now uses KMCoreSettings to check if agent app configuration is enabled.
1870-1873: Updated user filtering to use KMCoreUserDefaultsHandler.The filter condition now uses KMCoreUserDefaultsHandler.getUserId() to exclude the current user from the group members list.
2042-2052: Updated device key assignment in message creation.The code now correctly uses KMCoreUserDefaultsHandler.getDeviceKeyString() when setting the device key on a new message.
Sources/Controllers/ALKParticipantSelectionViewContoller.swift (3)
145-147: Properly updated contacts group settings check.Now using KMCoreSettings.isContactsGroupEnabled() and KMCoreSettings.getContactsGroupId() for contacts group handling.
163-165: Successfully updated user visibility and ID checks.The predicate for fetching contacts now uses KMCoreUserDefaultsHandler for login user contact visibility and user ID.
201-202: Updated login user ID retrieval.Now properly using KMCoreUserDefaultsHandler.getUserId() to get the current user's ID when filtering contacts.
Sources/Controllers/ALKNewChatViewController.swift (2)
54-55: Updated contact server call flag setting.Now using KMCoreUserDefaultsHandler to set the contact server call status when the view loads.
179-193: Updated contact group check and server call flag.The code now uses KMCoreSettings.isContactsGroupEnabled() for the contacts group check and KMCoreUserDefaultsHandler.setContactServerCallIsDone() to update the server call status.
Sources/Utilities/KMZendeskChatHandler.swift (10)
86-87: Successfully updated chat transcript setting check.Now using KMCoreSettings to check if a chat transcript has been sent for the current group.
113-117: Updated Zendesk SDK account key retrieval.Now using KMCoreSettings to get the Zendesk SDK account key, maintaining the same functionality.
153-154: Updated Zendesk last sync time retrieval.The code now uses KMCoreSettings to get the last sync time for Zendesk interactions.
162-164: Updated user ID retrieval.Now using KMCoreUserDefaultsHandler to get the current user's ID.
167-176: User handler reference updated.The user handler reference is now correctly using KMCoreUserDefaultsHandler.
290-292: Updated user details type.The code now uses KMCoreUserDetail instead of ALUserDetail when casting user array values, aligning with the KMCore class refactoring approach.
335-336: Updated transcript sent flag setting.Now using KMCoreSettings to set the chat transcript sent flag.
348-355: Updated user detail type in bot name method parameter.The getBotNameById function now correctly accepts an array of KMCoreUserDetail instead of ALUserDetail.
🧰 Tools
🪛 SwiftLint (0.57.0)
[Warning] 350-350:
whereclauses are preferred over a singleifinside afor(for_where)
379-380: Updated Zendesk last sync time saving.The code now uses KMCoreSettings to save the Zendesk last sync time.
484-485: Updated auth token retrieval.Now using KMCoreUserDefaultsHandler to get the auth token for attachment message processing.
Sources/Controllers/ALKConversationListViewController.swift (2)
510-519: Correct type update to KMCoreUserDetail.The change from
ALUserDetailtoKMCoreUserDetailaligns with the broader migration pattern across the codebase. The proper implementation maintains functionality while updating to the new type system.
521-528: Type change implemented consistently.The update of the parameter type to
KMCoreUserDetailis consistent with the change in thereloadDatamethod above. This maintains compatibility with the corresponding method inALKConversationViewControllerwhich also uses this type.Sources/Utilities/ALKFormDataCache.swift (3)
10-13: Good addition of public access and key prefix.Making the class and singleton public improves reusability across the application. The key prefix follows best practices for UserDefaults namespacing to avoid conflicts with other stored values.
29-45: Effective caching strategy with fallback mechanism.The implementation correctly checks in-memory cache first before falling back to UserDefaults, which is an efficient approach. The code also wisely stores retrieved data back into the memory cache for faster future access.
47-49: Good simplification of default object retrieval.The refactoring simplifies the method by leveraging the existing
getFormDatamethod with the nil coalescing operator, improving code reuse and maintainability.Sources/ViewModels/ALKNewChatViewModel.swift (4)
21-21: Correct migration to KMCoreSettings.The type change is aligned with the SDK-wide migration from ALApplozicSettings to KMCoreSettings.
40-42: Settings access updated consistently.The migration to use KMCoreSettings methods for feature flags and configuration values is implemented correctly.
72-72: User ID retrieval updated appropriately.The use of KMCoreUserDefaultsHandler for user ID retrieval is consistent with the codebase migration pattern.
93-95: Complete update of user defaults handler references.All user defaults handler references in the predicate creation have been updated, maintaining consistent usage of the KMCore variants throughout the codebase.
Sources/Views/KMBusinessHoursView.swift (2)
11-31: Well-structured Business Hours view implementation.The view setup follows good UIKit practices with proper initialization and disabled Interface Builder integration. The subviews are created with appropriate configurations, particularly the multi-line support for the label.
56-67: Good height calculation implementation.The height estimation method correctly handles empty messages and calculates appropriate height based on text content and device width. The explicit handling of empty messages aligns with the learning from PR #354, avoiding redundant checks when setting the view's height constraint.
Sources/Views/ALKFormCell.swift (4)
235-240: Good handling of text area data.The approach of conditionally setting the text from
formDataSubmit.textViewsor defaulting to""is consistent and maintains data integrity.
513-520: Struct-based dropdown storage is well-structured.Rewriting the dropdown logic with
DropDownFieldtidies up data handling and readability. This is a clean improvement from the previous tuple approach.
627-640: New form data containers look good.Defining
DropDownFieldand centralizing all form field dictionaries underFormDataSubmitclarifies the form's data model. Making themCodableis also beneficial for persistence.
433-436:Details
❓ Verification inconclusive
Check for out-of-range indexes in dropdown options.
When assigning
selectedIndex = fields.idand usingcell.options?[fields.id], ensurefields.idis valid for the size ofcell.optionsto avoid issues if the index is out of range.To confirm safety, you can scan for where
cell.optionsis populated:
🏁 Script executed:
#!/bin/bash # Verify the usage and length checks of cell.options rg -A 5 "cell\.options ="Length of output: 27
Validate dropdown options index range
The current code at
Sources/Views/ALKFormCell.swift(lines 433–436) assignsselectedIndex = fields.idand immediately uses it to accesscell.options?[fields.id].labelwithout checking whetherfields.idis within the bounds of thecell.optionsarray. Although the grep command forcell.options =didn’t return any output, this absence of evidence suggests that there isn’t any obvious length check in place. It is therefore recommended to add a boundary check before accessing the dropdown options.For example, you might consider an update like this:
if let options = cell.options, fields.id < options.count { cell.menu.selectedIndex = fields.id cell.menu.text = options[fields.id].label } else { // Handle the out-of-range scenario, e.g., log an error or set a default value }Please perform manual verification or further code review to ensure that:
cell.optionsis populated correctly elsewhere in the codebase.- Adding this boundary check aligns with the overall data flow and error handling strategy.
Sources/Views/ALKInformationCell.swift (3)
153-158: Switch toKMCoreSettingsis consistent.Checking
KMCoreSettings.isAgentAppConfigurationEnabled()keeps agent app configuration logic aligned with the rest of the refactor.
160-195: Reconsider string replacement for boundingRect.Replacing spaces with
'd'might cause slightly inaccurate text measurements. Confirm if this is truly needed, or add a comment clarifying the rationale. Without a solid reason, removing this replacement may yield more accurate boundingRect calculations.
213-213: Agent configuration check updated correctly.This aligns with the overall switch from
ALApplozicSettingstoKMCoreSettings.Sources/Views/ALKFormTextItemCell.swift (3)
101-102: Placeholder assignment is clear and consistent.Assigning the placeholder from
item.placeholdermaintains consistency with the approach used for other form fields.
242-247: Dynamic placeholder assignment is appropriate.Updating the placeholder label’s text and visibility upon assignment is straightforward and maintains clarity for users when the field is empty.
258-262: Placeholder visibility update upon text change is optimal.This ensures accurate placeholder display under various editing scenarios.
Sources/Controllers/ALKConversationViewController.swift (13)
197-200: NewbusinessHourViewproperty looks consistent.
A straightforward lazy-like property initialization with a closure. It effectively creates an instance ofKMBusinessHoursView.
201-201: No review needed.
Blank line introduced; no functional changes.
545-545: Proper migration toKMCoreSettings.
Switching toKMCoreSettingsis aligned with the broader migration effort. Looks good.
669-669: Check for potential nil user ID.
EnsureKMCoreUserDefaultsHandler.getUserId()cannot benil. If it can, this conditional might cause unintended behavior.
677-677: Guard against potential missing user ID.
Same concern as above; confirm thatKMCoreUserDefaultsHandler.getUserId()never returnsnil.
698-699: Height constraint property is consistent.
Keeping the constraint private is a good practice to avoid exposure. No changes required.
700-710: Animated layout update for business hours info is well-structured.
This function nicely estimates the view height and animates height changes. Consider ensuring calls happen on the main thread if invoked from background contexts.
711-711: No review needed.
Blank line introduced; no functional changes.
1251-1256: Verify default return oftruewhen channel is missing.
Consider whether allowing replies whenchannelisnilis intended. Otherwise, looks correct for resolved vs. restart button checks.
1823-1823: Guard statement strengthens reply restriction logic.
Early return if the conversation is disabled, which is consistent withisConversationResolvedAndReplyEnabled().
2021-2024: Ensure fallback handling foroption.text.
Assigningoption.textdirectly is fine, but confirm the.textis never nil or empty.
3123-3123: Upload size check added for images.
Helps prevent oversized uploads. Including an alert for user feedback is good.
3150-3150: Confirm MB vs. 1024 multiplier for GIF size check.
Using* 1024might be correct, but verify thatgetMaxImageSizeForUploadInMB()aligns with base-2 or base-10 expectations.
|
✅ iOS Lint Test Result |
Summary
Summary by CodeRabbit