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:
commit
336dd094f0
@ -26,6 +26,11 @@
|
|||||||
case action
|
case action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
|
enableClipboardActions = false
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Codec
|
// MARK: - Codec
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -83,6 +83,9 @@ import Foundation
|
|||||||
case shouldMaskRecordedView
|
case shouldMaskRecordedView
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the default values. Should be called on init.
|
||||||
|
open func setDefaults() { }
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Validation Methods
|
// MARK: - Validation Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -119,6 +122,7 @@ import Foundation
|
|||||||
baseValue = text
|
baseValue = text
|
||||||
self.titleStateLabel = FormLabelModel(text: "")
|
self.titleStateLabel = FormLabelModel(text: "")
|
||||||
self.feedbackStateLabel = FormLabelModel(text: "")
|
self.feedbackStateLabel = FormLabelModel(text: "")
|
||||||
|
setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -157,6 +161,7 @@ import Foundation
|
|||||||
self.feedbackStateLabel = FormLabelModel(model: LabelModel(text: feedback ?? "",
|
self.feedbackStateLabel = FormLabelModel(model: LabelModel(text: feedback ?? "",
|
||||||
fontStyle: FormLabelModel.defaultFontStyle,
|
fontStyle: FormLabelModel.defaultFontStyle,
|
||||||
textColor: Color(uiColor: .mvmCoolGray6)))
|
textColor: Color(uiColor: .mvmCoolGray6)))
|
||||||
|
setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
|||||||
@ -338,6 +338,7 @@ import UIKit
|
|||||||
placeholder = model.placeholder
|
placeholder = model.placeholder
|
||||||
|
|
||||||
textField.shouldMaskWhileRecording = model.shouldMaskRecordedView ?? true
|
textField.shouldMaskWhileRecording = model.shouldMaskRecordedView ?? true
|
||||||
|
textField.enableClipboardActions = model.enableClipboardActions
|
||||||
|
|
||||||
switch model.type {
|
switch model.type {
|
||||||
case .password, .secure:
|
case .password, .secure:
|
||||||
|
|||||||
@ -37,6 +37,7 @@
|
|||||||
public var clearTextOnTap: Bool = false
|
public var clearTextOnTap: Bool = false
|
||||||
public var displayFormat: String?
|
public var displayFormat: String?
|
||||||
public var displayMask: String?
|
public var displayMask: String?
|
||||||
|
public var enableClipboardActions: Bool = true
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
@ -112,6 +113,7 @@
|
|||||||
case clearTextOnTap
|
case clearTextOnTap
|
||||||
case displayFormat
|
case displayFormat
|
||||||
case displayMask
|
case displayMask
|
||||||
|
case enableClipboardActions
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -143,6 +145,10 @@
|
|||||||
if let textAlignment = try typeContainer.decodeIfPresent(NSTextAlignment.self, forKey: .textAlignment) {
|
if let textAlignment = try typeContainer.decodeIfPresent(NSTextAlignment.self, forKey: .textAlignment) {
|
||||||
self.textAlignment = 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 {
|
open override func encode(to encoder: Encoder) throws {
|
||||||
@ -157,5 +163,6 @@
|
|||||||
try container.encode(enabledTextColor, forKey: .enabledTextColor)
|
try container.encode(enabledTextColor, forKey: .enabledTextColor)
|
||||||
try container.encode(disabledTextColor, forKey: .disabledTextColor)
|
try container.encode(disabledTextColor, forKey: .disabledTextColor)
|
||||||
try container.encode(clearTextOnTap, forKey: .clearTextOnTap)
|
try container.encode(clearTextOnTap, forKey: .clearTextOnTap)
|
||||||
|
try container.encode(enableClipboardActions, forKey: .enableClipboardActions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ public protocol TextInputDidDeleteProtocol: AnyObject {
|
|||||||
|
|
||||||
/// Set to true to hide the blinking textField cursor.
|
/// Set to true to hide the blinking textField cursor.
|
||||||
public var hideBlinkingCaret = false
|
public var hideBlinkingCaret = false
|
||||||
|
public var enableClipboardActions: Bool = true
|
||||||
public var shouldMaskWhileRecording: Bool = true
|
public var shouldMaskWhileRecording: Bool = true
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -74,6 +74,8 @@ public protocol TextInputDidDeleteProtocol: AnyObject {
|
|||||||
super.deleteBackward()
|
super.deleteBackward()
|
||||||
didDeleteDelegate?.textInputDidDelete()
|
didDeleteDelegate?.textInputDidDelete()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { enableClipboardActions }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// MARK:- MVMCoreViewProtocol
|
/// MARK:- MVMCoreViewProtocol
|
||||||
@ -91,7 +93,7 @@ extension TextField: MVMCoreViewProtocol {
|
|||||||
/// MARK:- MoleculeViewProtocol
|
/// MARK:- MoleculeViewProtocol
|
||||||
extension TextField: 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 {
|
if let color = model.backgroundColor?.uiColor {
|
||||||
backgroundColor = color
|
backgroundColor = color
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user