Merge branch 'feature/action_sheet' into 'develop'
Action sheet See merge request BPHV_MIPS/mvm_core!94
This commit is contained in:
commit
8c8a7771e9
@ -34,6 +34,7 @@
|
|||||||
01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */; };
|
01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */; };
|
||||||
01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A05123A8325100D954D8 /* ModelMapping.swift */; };
|
01F2A05223A8325100D954D8 /* ModelMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F2A05123A8325100D954D8 /* ModelMapping.swift */; };
|
||||||
0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A42538E23F3414800554656 /* Codable+Helpers.swift */; };
|
0A42538F23F3414800554656 /* Codable+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A42538E23F3414800554656 /* Codable+Helpers.swift */; };
|
||||||
|
0A62624824C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A62624724C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift */; };
|
||||||
0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */; };
|
0AFF597A23FC6E60005C24E8 /* ActionShareModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */; };
|
||||||
30349BF11FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
30349BF11FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */; };
|
30349BF21FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */; };
|
||||||
@ -188,6 +189,7 @@
|
|||||||
0A11030B20864F94008ADD90 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
0A11030B20864F94008ADD90 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
0A11030C20864F9A008ADD90 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
0A11030C20864F9A008ADD90 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||||
0A42538E23F3414800554656 /* Codable+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Codable+Helpers.swift"; sourceTree = "<group>"; };
|
0A42538E23F3414800554656 /* Codable+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Codable+Helpers.swift"; sourceTree = "<group>"; };
|
||||||
|
0A62624724C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertControllerStyle+Extension.swift"; sourceTree = "<group>"; };
|
||||||
0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionShareModel.swift; sourceTree = "<group>"; };
|
0AFF597923FC6E60005C24E8 /* ActionShareModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionShareModel.swift; sourceTree = "<group>"; };
|
||||||
30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreSessionTimeHandler.h; sourceTree = "<group>"; };
|
30349BEF1FCCA78A00546A1E /* MVMCoreSessionTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreSessionTimeHandler.h; sourceTree = "<group>"; };
|
||||||
30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreSessionTimeHandler.m; sourceTree = "<group>"; };
|
30349BF01FCCA78A00546A1E /* MVMCoreSessionTimeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreSessionTimeHandler.m; sourceTree = "<group>"; };
|
||||||
@ -344,6 +346,15 @@
|
|||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
0A62624624C1DFB700C316B9 /* Alert Extensions */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
0184D3FC24BE54A300A05369 /* UIAlertActionStyle+Codable.swift */,
|
||||||
|
0A62624724C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift */,
|
||||||
|
);
|
||||||
|
path = "Alert Extensions";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
8876D5BF1FB50A9E00EB2E3D = {
|
8876D5BF1FB50A9E00EB2E3D = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -463,11 +474,11 @@
|
|||||||
946EE1B6237B66630036751F /* ActionType */ = {
|
946EE1B6237B66630036751F /* ActionType */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
0A62624624C1DFB700C316B9 /* Alert Extensions */,
|
||||||
01F2A03523A80A7300D954D8 /* ActionModelProtocol.swift */,
|
01F2A03523A80A7300D954D8 /* ActionModelProtocol.swift */,
|
||||||
946EE1BB237B691A0036751F /* ActionOpenPageModel.swift */,
|
946EE1BB237B691A0036751F /* ActionOpenPageModel.swift */,
|
||||||
01F2A03823A812DD00D954D8 /* ActionOpenUrlModel.swift */,
|
01F2A03823A812DD00D954D8 /* ActionOpenUrlModel.swift */,
|
||||||
0184D3DA24B7D5A600A05369 /* ActionAlertModel.swift */,
|
0184D3DA24B7D5A600A05369 /* ActionAlertModel.swift */,
|
||||||
0184D3FC24BE54A300A05369 /* UIAlertActionStyle+Codable.swift */,
|
|
||||||
01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */,
|
01F2A04B23A82B1B00D954D8 /* ActionCallModel.swift */,
|
||||||
01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */,
|
01F2A04D23A82CF500D954D8 /* ActionPopupModel.swift */,
|
||||||
01C851D023CF97FE0021F976 /* ActionBackModel.swift */,
|
01C851D023CF97FE0021F976 /* ActionBackModel.swift */,
|
||||||
@ -933,6 +944,7 @@
|
|||||||
AFBB96971FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m in Sources */,
|
AFBB96971FBA3A9A0008D868 /* MVMCorePresentViewControllerOperation.m in Sources */,
|
||||||
AFBB96581FBA3A570008D868 /* FreeBeeAuthObject.m in Sources */,
|
AFBB96581FBA3A570008D868 /* FreeBeeAuthObject.m in Sources */,
|
||||||
01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */,
|
01F2A04E23A82CF500D954D8 /* ActionPopupModel.swift in Sources */,
|
||||||
|
0A62624824C1DFDC00C316B9 /* UIAlertControllerStyle+Extension.swift in Sources */,
|
||||||
AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */,
|
AF43A5781FBA5B7C008E9347 /* MVMCoreJSONConstants.m in Sources */,
|
||||||
AFBB96691FBA3A570008D868 /* MVMCoreRequestParameters.m in Sources */,
|
AFBB96691FBA3A570008D868 /* MVMCoreRequestParameters.m in Sources */,
|
||||||
AFED77A31FCCA29400BAE689 /* MVMCoreViewControllerNibMappingObject.m in Sources */,
|
AFED77A31FCCA29400BAE689 /* MVMCoreViewControllerNibMappingObject.m in Sources */,
|
||||||
|
|||||||
@ -70,7 +70,7 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
|||||||
|
|
||||||
} else if ([actionType isEqualToString:KeyActionTypeShare]) {
|
} else if ([actionType isEqualToString:KeyActionTypeShare]) {
|
||||||
[self shareAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
[self shareAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||||
|
|
||||||
} else if ([actionType isEqualToString:KeyActionTypePreviousSubmit]) {
|
} else if ([actionType isEqualToString:KeyActionTypePreviousSubmit]) {
|
||||||
[self previousSubmitAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
[self previousSubmitAction:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||||
|
|
||||||
@ -314,21 +314,20 @@ NSString * const KeyActionTypeOpen = @"openPage";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)showAlert:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
- (void)showAlert:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||||
|
|
||||||
MVMCoreErrorObject *error = nil;
|
MVMCoreErrorObject *error = nil;
|
||||||
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectWithAction:actionInformation additionalData:additionalData delegateObject:delegateObject error:&error];
|
MVMCoreAlertObject *alertObject = [MVMCoreAlertObject alertObjectWithAction:actionInformation additionalData:additionalData delegateObject:delegateObject error:&error];
|
||||||
if ([delegateObject.actionDelegate respondsToSelector:@selector(willShowPopupWithAlertObject:alertJson:)]) {
|
if ([delegateObject.actionDelegate respondsToSelector:@selector(willShowPopupWithAlertObject:alertJson:)]) {
|
||||||
[delegateObject.actionDelegate willShowPopupWithAlertObject:alertObject alertJson:actionInformation];
|
[delegateObject.actionDelegate willShowPopupWithAlertObject:alertObject alertJson:actionInformation];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alertObject) {
|
if (alertObject) {
|
||||||
[[MVMCoreAlertHandler sharedAlertHandler] showAlertWithAlertObject:alertObject];
|
[[MVMCoreAlertHandler sharedAlertHandler] showAlertWithAlertObject:alertObject];
|
||||||
} else {
|
} else {
|
||||||
[self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
[self handleActionError:error actionInformation:actionInformation additionalData:additionalData delegateObject:delegateObject];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)handleOtherActions:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
- (BOOL)handleOtherActions:(nullable NSString *)actionType actionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,32 +6,40 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
public extension MVMCoreAlertObject {
|
public extension MVMCoreAlertObject {
|
||||||
|
|
||||||
@objc static func alertObjectWith(action actionJson: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?, delegateObject: DelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> MVMCoreAlertObject? {
|
@objc static func alertObjectWith(action actionJson: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> MVMCoreAlertObject? {
|
||||||
|
|
||||||
guard let alertJson = actionJson?.optionalDictionaryForKey("alert"),
|
guard let alertJson = actionJson?.optionalDictionaryForKey("alert"),
|
||||||
(alertJson.optionalStringForKey(KeyTitle) != nil || alertJson.optionalStringForKey(KeyMessage) != nil),
|
(alertJson.optionalStringForKey(KeyTitle) != nil || alertJson.optionalStringForKey(KeyMessage) != nil),
|
||||||
let actionsList = alertJson.optionalArrayForKey("alertActions") as? [[AnyHashable : Any]] else {
|
let actionsList = alertJson.optionalArrayForKey("alertActions") as? [[AnyHashable: Any]]
|
||||||
|
else {
|
||||||
error?.pointee = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: ErrorCode.popupFailed.rawValue, domain: ErrorDomainNative, location: String(describing: self))
|
error?.pointee = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: ErrorCode.popupFailed.rawValue, domain: ErrorDomainNative, location: String(describing: self))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var actionsForAlert: [UIAlertAction] = []
|
var actionsForAlert: [UIAlertAction] = []
|
||||||
|
|
||||||
for actionJson in actionsList {
|
for actionJson in actionsList {
|
||||||
let style = UIAlertAction.Style(rawValue: actionJson.stringForkey("style"))
|
let style = UIAlertAction.Style(rawValue: actionJson.stringForkey("style"))
|
||||||
let alertAction = UIAlertAction(title: actionJson.optionalStringForKey(KeyTitle), style: style) { (action) in
|
let alertAction = UIAlertAction(title: actionJson.optionalStringForKey(KeyTitle), style: style) { action in
|
||||||
MVMCoreActionHandler.shared()?.handleAction(with: actionJson.optionalDictionaryForKey("action"), additionalData: additionalData, delegateObject: delegateObject)
|
MVMCoreActionHandler.shared()?.handleAction(with: actionJson.optionalDictionaryForKey("action"),
|
||||||
|
additionalData: additionalData,
|
||||||
|
delegateObject: delegateObject)
|
||||||
}
|
}
|
||||||
actionsForAlert.append(alertAction)
|
actionsForAlert.append(alertAction)
|
||||||
}
|
}
|
||||||
|
|
||||||
let alert = MVMCoreAlertObject(popupAlertWithTitle: alertJson.optionalStringForKey(KeyTitle),
|
let alertObject = MVMCoreAlertObject(popupAlertWithTitle: alertJson.optionalStringForKey(KeyTitle),
|
||||||
message: alertJson.optionalStringForKey(KeyMessage),
|
message: alertJson.optionalStringForKey(KeyMessage),
|
||||||
actions: actionsForAlert,
|
actions: actionsForAlert,
|
||||||
isGreedy: false)
|
isGreedy: false)
|
||||||
return alert
|
|
||||||
|
if let alertStyle = alertJson.optionalStringForKey("style") {
|
||||||
|
alertObject?.alertStyle = UIAlertController.Style(rawValue: alertStyle)
|
||||||
|
}
|
||||||
|
|
||||||
|
return alertObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,10 +6,12 @@
|
|||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objcMembers public class ActionAlertModel: ActionModelProtocol {
|
@objcMembers public class ActionAlertModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "alert"
|
public static var identifier: String = "alert"
|
||||||
public var actionType: String = ActionAlertModel.identifier
|
public var actionType: String = ActionAlertModel.identifier
|
||||||
public var alert: AlertModel
|
public var alert: AlertModel
|
||||||
|
|||||||
@ -1,19 +1,26 @@
|
|||||||
//
|
//
|
||||||
// File.swift
|
// ActionBackModel.swift
|
||||||
// MVMCore
|
// MVMCore
|
||||||
//
|
//
|
||||||
// Created by Suresh, Kamlesh on 1/15/20.
|
// Created by Suresh, Kamlesh on 1/15/20.
|
||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
@objcMembers public class ActionBackModel: ActionModelProtocol {
|
@objcMembers public class ActionBackModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "back"
|
public static var identifier: String = "back"
|
||||||
public var actionType: String = ActionBackModel.identifier
|
public var actionType: String = ActionBackModel.identifier
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
self.analyticsData = analyticsData
|
self.analyticsData = analyticsData
|
||||||
|
|||||||
@ -6,9 +6,12 @@
|
|||||||
// Copyright © 2019 myverizon. All rights reserved.
|
// Copyright © 2019 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
@objcMembers public class ActionCallModel: ActionModelProtocol {
|
@objcMembers public class ActionCallModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "call"
|
public static var identifier: String = "call"
|
||||||
public var actionType: String = ActionCallModel.identifier
|
public var actionType: String = ActionCallModel.identifier
|
||||||
// TODO: decode into phone number once action handler is re-written
|
// TODO: decode into phone number once action handler is re-written
|
||||||
@ -16,6 +19,10 @@ import Foundation
|
|||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(callNumber: String, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(callNumber: String, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.callNumber = callNumber
|
self.callNumber = callNumber
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
|
|||||||
@ -6,14 +6,21 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objcMembers public class ActionCancelModel: ActionModelProtocol {
|
@objcMembers public class ActionCancelModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "cancel"
|
public static var identifier: String = "cancel"
|
||||||
public var actionType: String = ActionCancelModel.identifier
|
public var actionType: String = ActionCancelModel.identifier
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
self.analyticsData = analyticsData
|
self.analyticsData = analyticsData
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
// Copyright © 2019 myverizon. All rights reserved.
|
// Copyright © 2019 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
public protocol ActionModelProtocol: ModelProtocol {
|
public protocol ActionModelProtocol: ModelProtocol {
|
||||||
|
|
||||||
|
|||||||
@ -6,9 +6,12 @@
|
|||||||
// Copyright © 2019 Suresh, Kamlesh. All rights reserved.
|
// Copyright © 2019 Suresh, Kamlesh. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
@objcMembers open class ActionOpenPageModel: ActionModelProtocol {
|
@objcMembers open class ActionOpenPageModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "openPage"
|
public static var identifier: String = "openPage"
|
||||||
public var actionType: String = ActionOpenPageModel.identifier
|
public var actionType: String = ActionOpenPageModel.identifier
|
||||||
public var pageType: String
|
public var pageType: String
|
||||||
@ -17,6 +20,10 @@ import Foundation
|
|||||||
public var presentationStyle: String?
|
public var presentationStyle: String?
|
||||||
public var tabBarIndex: Int?
|
public var tabBarIndex: Int?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initialzier
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(pageType: String, presentationStyle: String? = nil, extraParameters: JSONValueDictionary? = nil, analyticsData: JSONValueDictionary? = nil, tabBarIndex: Int? = nil) {
|
public init(pageType: String, presentationStyle: String? = nil, extraParameters: JSONValueDictionary? = nil, analyticsData: JSONValueDictionary? = nil, tabBarIndex: Int? = nil) {
|
||||||
self.pageType = pageType
|
self.pageType = pageType
|
||||||
self.presentationStyle = presentationStyle
|
self.presentationStyle = presentationStyle
|
||||||
|
|||||||
@ -6,9 +6,12 @@
|
|||||||
// Copyright © 2019 myverizon. All rights reserved.
|
// Copyright © 2019 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
@objcMembers public class ActionOpenUrlModel: ActionModelProtocol {
|
@objcMembers public class ActionOpenUrlModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "openURL"
|
public static var identifier: String = "openURL"
|
||||||
public var actionType: String = ActionOpenUrlModel.identifier
|
public var actionType: String = ActionOpenUrlModel.identifier
|
||||||
// TODO: decode into url once action handler is re-written
|
// TODO: decode into url once action handler is re-written
|
||||||
@ -27,6 +30,10 @@ import Foundation
|
|||||||
public var dontShowProgress: Bool?
|
public var dontShowProgress: Bool?
|
||||||
public var headerParameters: JSONValueDictionary?
|
public var headerParameters: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initialzier
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(browserUrl: String) {
|
public init(browserUrl: String) {
|
||||||
self.browserUrl = browserUrl
|
self.browserUrl = browserUrl
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,15 +6,22 @@
|
|||||||
// Copyright © 2019 myverizon. All rights reserved.
|
// Copyright © 2019 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
@objcMembers public class ActionPopupModel: ActionModelProtocol {
|
@objcMembers public class ActionPopupModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "popup"
|
public static var identifier: String = "popup"
|
||||||
public var actionType: String = ActionPopupModel.identifier
|
public var actionType: String = ActionPopupModel.identifier
|
||||||
public var pageType: String
|
public var pageType: String
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(pageType: String, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(pageType: String, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.pageType = pageType
|
self.pageType = pageType
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
|
|||||||
@ -6,14 +6,21 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objcMembers public class ActionPreviousSubmitModel: ActionModelProtocol {
|
@objcMembers public class ActionPreviousSubmitModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "previousSubmit"
|
public static var identifier: String = "previousSubmit"
|
||||||
public var actionType: String = ActionPreviousSubmitModel.identifier
|
public var actionType: String = ActionPreviousSubmitModel.identifier
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initialzier
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
self.analyticsData = analyticsData
|
self.analyticsData = analyticsData
|
||||||
|
|||||||
@ -6,9 +6,12 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objcMembers public class ActionRestartModel: ActionModelProtocol {
|
@objcMembers public class ActionRestartModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "restart"
|
public static var identifier: String = "restart"
|
||||||
public var actionType: String = ActionRestartModel.identifier
|
public var actionType: String = ActionRestartModel.identifier
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
@ -17,6 +20,10 @@ import UIKit
|
|||||||
///Optional pageType, if pageType is nil, will start with pageType launchApp
|
///Optional pageType, if pageType is nil, will start with pageType launchApp
|
||||||
public var pageType: String?
|
public var pageType: String?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ pageType: String? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(_ pageType: String? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.pageType = pageType
|
self.pageType = pageType
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
|
|||||||
@ -6,14 +6,21 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objcMembers public class ActionSettingModel: ActionModelProtocol {
|
@objcMembers public class ActionSettingModel: ActionModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "openSettings"
|
public static var identifier: String = "openSettings"
|
||||||
public var actionType: String = ActionSettingModel.identifier
|
public var actionType: String = ActionSettingModel.identifier
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(_ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
self.analyticsData = analyticsData
|
self.analyticsData = analyticsData
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
@objcMembers public class ActionShareModel: ActionModelProtocol {
|
@objcMembers public class ActionShareModel: ActionModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
// Copyright © 2020 myverizon. All rights reserved.
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
extension UIAlertAction.Style: Codable {
|
extension UIAlertAction.Style: Codable {
|
||||||
|
|
||||||
@ -14,10 +13,13 @@ extension UIAlertAction.Style: Codable {
|
|||||||
switch rawValue {
|
switch rawValue {
|
||||||
case "default":
|
case "default":
|
||||||
self = .default
|
self = .default
|
||||||
|
|
||||||
case "cancel":
|
case "cancel":
|
||||||
self = .cancel
|
self = .cancel
|
||||||
|
|
||||||
case "destructive":
|
case "destructive":
|
||||||
self = .destructive
|
self = .destructive
|
||||||
|
|
||||||
default:
|
default:
|
||||||
self = .default
|
self = .default
|
||||||
}
|
}
|
||||||
@ -27,10 +29,13 @@ extension UIAlertAction.Style: Codable {
|
|||||||
switch self {
|
switch self {
|
||||||
case .default:
|
case .default:
|
||||||
return "default"
|
return "default"
|
||||||
|
|
||||||
case .cancel:
|
case .cancel:
|
||||||
return "cancel"
|
return "cancel"
|
||||||
|
|
||||||
case .destructive:
|
case .destructive:
|
||||||
return "destructive"
|
return "destructive"
|
||||||
|
|
||||||
@unknown default:
|
@unknown default:
|
||||||
return "default"
|
return "default"
|
||||||
}
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// UIAlertControllerStyle+Extension.swift
|
||||||
|
// MVMCore
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 7/17/20.
|
||||||
|
// Copyright © 2020 myverizon. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
extension UIAlertController.Style: Codable {
|
||||||
|
|
||||||
|
init(rawValue: String) {
|
||||||
|
switch rawValue {
|
||||||
|
case "alert":
|
||||||
|
self = .alert
|
||||||
|
|
||||||
|
case "actionSheet":
|
||||||
|
self = .actionSheet
|
||||||
|
|
||||||
|
default:
|
||||||
|
self = .alert
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var rawValueString: String {
|
||||||
|
switch self {
|
||||||
|
case .alert:
|
||||||
|
return "alert"
|
||||||
|
|
||||||
|
case .actionSheet:
|
||||||
|
return "actionSheet"
|
||||||
|
|
||||||
|
@unknown default:
|
||||||
|
return "alert"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,26 +10,43 @@ import UIKit
|
|||||||
|
|
||||||
|
|
||||||
public class AlertButtonModel: Codable {
|
public class AlertButtonModel: Codable {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var title: String
|
public var title: String
|
||||||
public var action: ActionModelProtocol
|
public var action: ActionModelProtocol
|
||||||
public var style: UIAlertAction.Style = .default
|
public var style: UIAlertAction.Style = .default
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ title: String,_ action: ActionModelProtocol,_ style: UIAlertAction.Style = .default) {
|
public init(_ title: String,_ action: ActionModelProtocol,_ style: UIAlertAction.Style = .default) {
|
||||||
self.title = title
|
self.title = title
|
||||||
self.action = action
|
self.action = action
|
||||||
self.style = style
|
self.style = style
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case title
|
case title
|
||||||
case action
|
case action
|
||||||
case style
|
case style
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
|
|
||||||
if let style = try? typeContainer.decodeIfPresent(String.self, forKey: .style) {
|
if let style = try typeContainer.decodeIfPresent(String.self, forKey: .style) {
|
||||||
self.style = UIAlertAction.Style(rawValue: style)
|
self.style = UIAlertAction.Style(rawValue: style)
|
||||||
}
|
}
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
@ -44,26 +61,49 @@ public class AlertButtonModel: Codable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class AlertModel: Codable {
|
public class AlertModel: Codable {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var title: String
|
public var title: String
|
||||||
public var message: String
|
public var message: String
|
||||||
|
public var style: UIAlertController.Style = .alert
|
||||||
public var alertActions: [AlertButtonModel]
|
public var alertActions: [AlertButtonModel]
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ title: String,_ message: String,_ alertActions: [AlertButtonModel]) {
|
public init(_ title: String,_ message: String,_ alertActions: [AlertButtonModel]) {
|
||||||
self.title = title
|
self.title = title
|
||||||
self.message = message
|
self.message = message
|
||||||
self.alertActions = alertActions
|
self.alertActions = alertActions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case title
|
case title
|
||||||
case message
|
case message
|
||||||
case alertActions
|
case alertActions
|
||||||
|
case style
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
message = try typeContainer.decode(String.self, forKey: .message)
|
message = try typeContainer.decode(String.self, forKey: .message)
|
||||||
alertActions = try typeContainer.decode([AlertButtonModel].self, forKey: .alertActions)
|
alertActions = try typeContainer.decode([AlertButtonModel].self, forKey: .alertActions)
|
||||||
|
|
||||||
|
if let style = try typeContainer.decodeIfPresent(String.self, forKey: .style) {
|
||||||
|
self.style = UIAlertController.Style(rawValue: style)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
@ -71,5 +111,6 @@ public class AlertModel: Codable {
|
|||||||
try container.encode(title, forKey: .title)
|
try container.encode(title, forKey: .title)
|
||||||
try container.encode(message, forKey: .message)
|
try container.encode(message, forKey: .message)
|
||||||
try container.encode(alertActions, forKey: .alertActions)
|
try container.encode(alertActions, forKey: .alertActions)
|
||||||
|
try container.encode(style.rawValueString, forKey: .style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user