Relax model handling to allow handlers to decide what to do when server doesn't specify masking.

Leverage introduced legacy behavior handling over customized direct recording manager calls.
Bring in RemoteView molecular masking handling.
Fix ImageViewModel decoding requirement.
This commit is contained in:
Kyle Matthew Hedden 2022-06-29 16:16:33 -04:00
parent 83c0503d18
commit 044a103665
11 changed files with 30 additions and 18 deletions

View File

@ -130,6 +130,7 @@
1D6D258826899B0C00DEBB08 /* ImageButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6D258626899B0B00DEBB08 /* ImageButtonModel.swift */; };
1D6D258926899B0C00DEBB08 /* ImageButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6D258726899B0B00DEBB08 /* ImageButton.swift */; };
27559EFC27D691D3000836C1 /* ViewMaskingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */; };
27577DCD286CA959001EC47E /* MoleculeMaskingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */; };
279B1569242BBC2F00921D6C /* ActionModelAdapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */; };
27F6B08826051831008529AA /* MoleculeTreeTraversalProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27F6B08726051831008529AA /* MoleculeTreeTraversalProtocol.swift */; };
27F6B08C26052AFF008529AA /* ParentMoleculeModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27F6B08B26052AFF008529AA /* ParentMoleculeModelProtocol.swift */; };
@ -722,6 +723,7 @@
1D6D258626899B0B00DEBB08 /* ImageButtonModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ImageButtonModel.swift; path = MVMCoreUI/Atomic/Atoms/Buttons/ImageButtonModel.swift; sourceTree = SOURCE_ROOT; };
1D6D258726899B0B00DEBB08 /* ImageButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ImageButton.swift; path = MVMCoreUI/Atomic/Atoms/Buttons/ImageButton.swift; sourceTree = SOURCE_ROOT; };
27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewMaskingProtocol.swift; sourceTree = "<group>"; };
27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeMaskingProtocol.swift; sourceTree = "<group>"; };
279B1568242BBC2F00921D6C /* ActionModelAdapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionModelAdapter.swift; sourceTree = "<group>"; };
27F6B08726051831008529AA /* MoleculeTreeTraversalProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeTreeTraversalProtocol.swift; sourceTree = "<group>"; };
27F6B08B26052AFF008529AA /* ParentMoleculeModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParentMoleculeModelProtocol.swift; sourceTree = "<group>"; };
@ -1223,6 +1225,7 @@
D2509ED02472ED9B001BFB9D /* NavigationItemModelProtocol.swift */,
D28BA74C248589C800B75CB8 /* TabPageModelProtocol.swift */,
27F6B08B26052AFF008529AA /* ParentMoleculeModelProtocol.swift */,
27577DCC286CA959001EC47E /* MoleculeMaskingProtocol.swift */,
);
path = ModelProtocols;
sourceTree = "<group>";
@ -3072,6 +3075,7 @@
D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */,
EA41F4AC2787927100F5B377 /* DynamicRuleFormFieldEffectModel.swift in Sources */,
011D95892404249B000E3791 /* FormHolderModelProtocol.swift in Sources */,
27577DCD286CA959001EC47E /* MoleculeMaskingProtocol.swift in Sources */,
BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */,
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */,
013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */,

View File

@ -42,7 +42,7 @@ import Foundation
public var wasInitiallySelected: Bool = false
public var title: String?
public var feedback: String?
public var shouldMaskRecordedView: Bool = true
public var shouldMaskRecordedView: Bool? = true
//used to drive the EntryFieldView UI
public var titleStateLabel: FormLabelModel

View File

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

View File

@ -26,7 +26,7 @@
public var localBundle: Bundle?
public var cornerRadius: CGFloat?
public var clipsImage: Bool?
public var shouldMaskRecordedView: Bool = false
public var shouldMaskRecordedView: Bool? = false
//--------------------------------------------------
// MARK: - Initializer

View File

@ -247,7 +247,7 @@ public typealias ActionBlock = () -> ()
text = nil
attributedText = nil
originalAttributedString = nil
shouldMaskWhileRecording = model.shouldMaskRecordedView
shouldMaskWhileRecording = model.shouldMaskRecordedView ?? false
guard let labelModel = model as? LabelModel else { return }

View File

@ -0,0 +1,17 @@
//
// MaskedMoleculeProtocol.swift
// MVMCoreUI
//
// Created by Kyle on 6/29/22.
// Copyright © 2022 Verizon Wireless. All rights reserved.
//
import Foundation
public protocol MoleculeMaskingProtocol {
var shouldMaskRecordedView: Bool? { get }
}
public extension MoleculeMaskingProtocol {
var shouldMaskRecordedView: Bool? { return false }
}

View File

@ -5,10 +5,9 @@ public enum MolecularError: Swift.Error {
}
public protocol MoleculeModelProtocol: ModelProtocol, AccessibilityModelProtocol, MoleculeTreeTraversalProtocol {
public protocol MoleculeModelProtocol: ModelProtocol, AccessibilityModelProtocol, MoleculeTreeTraversalProtocol, MoleculeMaskingProtocol {
var moleculeName: String { get }
var backgroundColor: Color? { get set }
var shouldMaskRecordedView: Bool { get }
}
public extension MoleculeModelProtocol {
@ -18,8 +17,6 @@ public extension MoleculeModelProtocol {
static var categoryName: String { "\(MoleculeModelProtocol.self)" }
static var categoryCodingKey: String { "moleculeName" }
var shouldMaskRecordedView: Bool { return false }
}

View File

@ -13,5 +13,5 @@ public protocol PageModelProtocol {
var screenHeading: String? { get set }
var backgroundColor: Color? { get set }
var navigationBar: (NavigationItemModelProtocol & MoleculeModelProtocol)? { get set }
var shouldMaskScreenWhileRecording: Bool { get }
var shouldMaskScreenWhileRecording: Bool? { get }
}

View File

@ -13,9 +13,3 @@ public protocol ViewMaskingProtocol: UIView {
var shouldMaskWhileRecording: Bool { get }
}
public protocol ViewMaskingContainerProtocol {
var maskedViewsWhileRecording: [UIView] { get }
}

View File

@ -32,7 +32,7 @@ import Foundation
public var tabBarIndex: Int?
// By default we mask until the server unlocks the page.
public var shouldMaskScreenWhileRecording: Bool = true
public var shouldMaskScreenWhileRecording: Bool?
//--------------------------------------------------
// MARK: - Initializer
@ -81,7 +81,7 @@ import Foundation
self.tabBarHidden = tabBarHidden
}
tabBarIndex = try typeContainer.decodeIfPresent(Int.self, forKey: .tabBarIndex)
shouldMaskScreenWhileRecording = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskScreenWhileRecording) ?? shouldMaskScreenWhileRecording
shouldMaskScreenWhileRecording = try typeContainer.decodeIfPresent(Bool.self, forKey: .shouldMaskScreenWhileRecording)
}
open func encode(to encoder: Encoder) throws {

View File

@ -101,7 +101,7 @@ extension TextField: MoleculeViewProtocol {
self.accessibilityIdentifier = accessibilityIdentifier
}
shouldMaskWhileRecording = model.shouldMaskRecordedView
shouldMaskWhileRecording = model.shouldMaskRecordedView ?? true
}
open func reset() {