Да, вы можете сделать это и изменить пользовательский интерфейс всплывающего уведомления «Отключено приложение» с помощью обработчика вызова для проверки безопасности wl_remoteDisableRealm
.
Ниже приведен пример кода обработчика запроса * 1004.* который я написал в быстром.
//
// 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)
}
}