Ibm mobilefirst IBM MFP-自定义管理员消息

Ibm mobilefirst IBM MFP-自定义管理员消息,ibm-mobilefirst,Ibm Mobilefirst,请参阅所附图片。目前,我们使用ff创建系统管理员消息提示 我们收到的系统维护信息是ff: 现在,我们要做的是定制这个消息提示。这能做到吗?自定义含义有我们自己的标题措词(替换“应用程序禁用”),也有我们自己的提示外观 我们已经使用WL.Client.init中的钩子OnErrorRemoteDisableDenication定制了应用程序强制更新消息。是否也可以这样做?是的,您可以这样做,并使用wl\u remoteDisableRealm安全检查的质询处理程序更改应用程序禁用弹出通知的用户界

请参阅所附图片。目前,我们使用ff创建系统管理员消息提示

我们收到的系统维护信息是ff:

现在,我们要做的是定制这个消息提示。这能做到吗?自定义含义有我们自己的标题措词(替换“应用程序禁用”),也有我们自己的提示外观


我们已经使用WL.Client.init中的钩子OnErrorRemoteDisableDenication定制了应用程序强制更新消息。是否也可以这样做?

是的,您可以这样做,并使用
wl\u remoteDisableRealm
安全检查的质询处理程序更改应用程序禁用弹出通知的用户界面

以下是我用swift编写的
wl_remoteDisableRealm
挑战处理程序的示例代码

//
//  RemoteDisable.swift
//  PinCodeSwift
//
//  Created by Vittal Pai on 11/21/17.
//  Copyright © 2017 Sample. All rights reserved.
//

import Foundation
import IBMMobileFirstPlatformFoundation

class RemoteDisable : SecurityCheckChallengeHandler {

    //SecurityCheck name
    static let securityCheck = "wl_remoteDisableRealm"

    //Register this class as a challenge handler
    static func registerSelf() {
        WLClient.sharedInstance().registerChallengeHandler(RemoteDisable(securityCheck: securityCheck))
    }

    override func handleChallenge(_ challenge: [AnyHashable: Any]!) {
        NSLog("%@",challenge)

        guard let challangeInfo = challenge as? [String: Any] else {
            self.cancel()
            return
        }

        guard let messageId = challengeInfo["messageId"] as? String else {
            self.cancel()
            return
        }
        var message = challengeInfo["message"]

        if  message == nil {
            message = "Your own message"
        }

        self.submitChallengeAnswer(["messageId": messageId])
        showPopup(messageId,remainingAttempts: 1)
    }

    override func handleFailure(_ failure: [AnyHashable: Any]!) {

    }

    func showPopup(_ errorMsg: String, remainingAttempts: Int){
        let message = errorMsg + "\nRemaining attempts: " + String(remainingAttempts)

        let alert = UIAlertController(title: "Protected",
                                      message: message,
                                      preferredStyle: .alert)
        alert.addTextField { (textField) -> Void in
            textField.placeholder = "PIN CODE"
            textField.keyboardType = .numberPad
        }
        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void in
            let pinTextField = alert.textFields![0] as UITextField
           // self.submitChallengeAnswer(["pin": pinTextField.text!])
        }))
        alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) -> Void in
          //  self.cancel()
        }))

        DispatchQueue.main.async {
            let topController = UIApplication.shared.keyWindow!.rootViewController! as UIViewController
            topController.present(alert,
                                  animated: true,
                                  completion: nil)
        }


    }

    func showError(_ errorMsg: String){
        let alert = UIAlertController(title: "Error",
                                      message: errorMsg,
                                      preferredStyle: .alert)
        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))

        DispatchQueue.main.async {
            let topController = UIApplication.shared.keyWindow!.rootViewController! as UIViewController
            topController.present(alert,
                                  animated: true,
                                  completion: nil)
        }
    }

    override func handleSuccess(_ success: [AnyHashable: Any]!) {
        NSLog("ha1ndleSuccess: %@",success)
    }

}