JLChen
2021-05-18 a869383e163a18cdedcf587383c1eca043129754
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
//  Copyright © 2018年 dahua. All rights reserved.
//
 
import Foundation
 
enum DHAddBaseLeftAction {
    case back        //返回上一级
    case backToScan    //返回到扫描界面
    case quit        //退出
}
 
enum DHAddBaseRightAction: Int {
    case restart                //重新开始
    case switchToWireless        //切换到无线
    case switchToWired            //切换到有线
    case switchToSoftAp
    case showHelp                //显示帮助页面h5
    
    func title(isWifiConfig: Bool = false) -> String {
        switch self {
        case .switchToWireless:
            return isWifiConfig ? "add_device_switch_wireless_to_config".lc_T : "add_device_switch_to_wireless_add".lc_T
        case .switchToWired:
            return isWifiConfig ? "add_device_switch_wired_to_config".lc_T : "add_device_switch_to_wired_add".lc_T
        case .switchToSoftAp:
            return "add_device_switch_to_softAP_add".lc_T
        case .showHelp:
            return "common_help".lc_T
        default:
            return "add_device_restart".lc_T
        }
    }
}
 
protocol DHAddBaseVCProtocol: NSObjectProtocol {
    
    // MARK: 配置
    /// 返回键点击触发事件类型
    ///
    /// - Returns: 事件类型
    func leftActionType() -> DHAddBaseLeftAction
    
    /// 左键返回操作是否需要提示框
    ///
    /// - Returns: true/false
    func isLeftActionShowAlert() -> Bool
    
    /// 左键返回操作配置的提示文字
    ///
    /// - Returns: String
    func leftActionAlertText() -> String?
    
    /// 右键点击触发事件类型
    ///
    /// - Returns: [事件类型]
    func rightActionType() -> [DHAddBaseRightAction]
    
    /// 右键是否隐藏
    ///
    /// - Returns: true/false
    func isRightActionHidden() -> Bool
    
    /// 是否启用右键
    ///
    /// - Parameter enable: true/false
    func enableRightAction(enable: Bool)
    
    // MARK: 事件
    /// 右键点击事件
    ///
    /// - Parameter button: UIButton
    func onRightAction(button: UIButton)
    
    // MARK: OMS更新
    func needUpdateCurrentOMSIntroduction()
    
    // MARK: 其他基本操作
    /// 退出添加流程:返回到进入添加流程的入口界面,需要区分国内、海外
    ///
    /// - Parameters:
    ///   - showAlert: 是否显示提示框,默认为false
    ///   - backToMain: 是否需要返回到首页,默认为false
    func baseExitAddDevice(showAlert: Bool, backToMain: Bool)
}