Merge branch 'bugfix/CXTDT-352289' into 'develop'

Disabled clipboard actions

### Summary
Disabled clipboard actions for textfield. can be controlled via using enableClipboardActions. And changed set(with model: MoleculeModelProtocol....) open to public. 

### JIRA Ticket
https://onejira.verizon.com/browse/CXTDT-352289

Co-authored-by: Krishna Kishore Bandaru <krishna.kishore.bandaru@verizon.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/918
This commit is contained in:
Pfeil, Scott Robert 2022-12-21 13:50:02 +00:00
commit 336dd094f0
5 changed files with 22 additions and 2 deletions

View File

@ -26,6 +26,11 @@
case action
}
open override func setDefaults() {
super.setDefaults()
enableClipboardActions = false
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------

View File

@ -83,6 +83,9 @@ import Foundation
case shouldMaskRecordedView
}
/// Sets the default values. Should be called on init.
open func setDefaults() { }
//--------------------------------------------------
// MARK: - Validation Methods
//--------------------------------------------------
@ -119,6 +122,7 @@ import Foundation
baseValue = text
self.titleStateLabel = FormLabelModel(text: "")
self.feedbackStateLabel = FormLabelModel(text: "")
setDefaults()
}
//--------------------------------------------------
@ -157,6 +161,7 @@ import Foundation
self.feedbackStateLabel = FormLabelModel(model: LabelModel(text: feedback ?? "",
fontStyle: FormLabelModel.defaultFontStyle,
textColor: Color(uiColor: .mvmCoolGray6)))
setDefaults()
}
public func encode(to encoder: Encoder) throws {

View File

@ -338,6 +338,7 @@ import UIKit
placeholder = model.placeholder
textField.shouldMaskWhileRecording = model.shouldMaskRecordedView ?? true
textField.enableClipboardActions = model.enableClipboardActions
switch model.type {
case .password, .secure:

View File

@ -37,6 +37,7 @@
public var clearTextOnTap: Bool = false
public var displayFormat: String?
public var displayMask: String?
public var enableClipboardActions: Bool = true
//--------------------------------------------------
// MARK: - Initializers
@ -112,6 +113,7 @@
case clearTextOnTap
case displayFormat
case displayMask
case enableClipboardActions
}
//--------------------------------------------------
@ -143,6 +145,10 @@
if let textAlignment = try typeContainer.decodeIfPresent(NSTextAlignment.self, forKey: .textAlignment) {
self.textAlignment = textAlignment
}
if let enableClipboardActions = try typeContainer.decodeIfPresent(Bool.self, forKey: .enableClipboardActions) {
self.enableClipboardActions = enableClipboardActions
}
}
open override func encode(to encoder: Encoder) throws {
@ -157,5 +163,6 @@
try container.encode(enabledTextColor, forKey: .enabledTextColor)
try container.encode(disabledTextColor, forKey: .disabledTextColor)
try container.encode(clearTextOnTap, forKey: .clearTextOnTap)
try container.encode(enableClipboardActions, forKey: .enableClipboardActions)
}
}

View File

@ -23,7 +23,7 @@ public protocol TextInputDidDeleteProtocol: AnyObject {
/// Set to true to hide the blinking textField cursor.
public var hideBlinkingCaret = false
public var enableClipboardActions: Bool = true
public var shouldMaskWhileRecording: Bool = true
//--------------------------------------------------
@ -74,6 +74,8 @@ public protocol TextInputDidDeleteProtocol: AnyObject {
super.deleteBackward()
didDeleteDelegate?.textInputDidDelete()
}
open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { enableClipboardActions }
}
/// MARK:- MVMCoreViewProtocol
@ -91,7 +93,7 @@ extension TextField: MVMCoreViewProtocol {
/// MARK:- MoleculeViewProtocol
extension TextField: MoleculeViewProtocol {
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
if let color = model.backgroundColor?.uiColor {
backgroundColor = color