From f37481751bd547c619fab80f4e5912ee55738c15 Mon Sep 17 00:00:00 2001 From: jyyi1 Date: Mon, 4 Nov 2024 15:23:56 -0500 Subject: [PATCH] code review #1 --- .../plugin/apple/src/OutlinePlugin.swift | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/client/src/cordova/plugin/apple/src/OutlinePlugin.swift b/client/src/cordova/plugin/apple/src/OutlinePlugin.swift index 9f7978037b..ff72faa444 100644 --- a/client/src/cordova/plugin/apple/src/OutlinePlugin.swift +++ b/client/src/cordova/plugin/apple/src/OutlinePlugin.swift @@ -291,46 +291,46 @@ class OutlinePlugin: CDVPlugin { return; // Do not report transient or invalid states. } let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: ["id": tunnelId, "status": Int32(tunnelStatus)]) - send(pluginResult: result, callbackId: callbackId, keepCallback: true) + self.send(pluginResult: result, callbackId: callbackId, keepCallback: true) } // MARK: - Callback helpers private func sendSuccess(callbackId: String, keepCallback: Bool = false) { - let result = CDVPluginResult(status: CDVCommandStatus_OK) - send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) + let result = CDVPluginResult(status: CDVCommandStatus_OK) + self.send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) } private func sendSuccess(_ operationResult: String, callbackId: String, keepCallback: Bool = false) { let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: operationResult) - send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) + self.send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) } private func sendSuccess(_ operationResult: Bool, callbackId: String, keepCallback: Bool = false) { - let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: operationResult) - send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) + let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: operationResult) + self.send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) } private func sendError(_ message: String, callbackId: String, keepCallback: Bool = false) { DDLogWarn("plugin result error: \(message)") let result = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: message) - send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) + self.send(pluginResult: result, callbackId: callbackId, keepCallback: keepCallback) } private func send(pluginResult: CDVPluginResult?, callbackId: String, keepCallback: Bool) { - guard let result = pluginResult else { - return DDLogWarn("Missing plugin result"); - } - result.setKeepCallbackAs(keepCallback) - self.commandDelegate?.send(result, callbackId: callbackId) + guard let result = pluginResult else { + return DDLogWarn("Missing plugin result"); + } + result.setKeepCallbackAs(keepCallback) + self.commandDelegate?.send(result, callbackId: callbackId) } private func removeCallback(withId callbackId: String) { - guard let result = CDVPluginResult(status: CDVCommandStatus_NO_RESULT) else { - return DDLogWarn("Missing plugin result for callback \(callbackId)"); - } - result.setKeepCallbackAs(false) - self.commandDelegate?.send(result, callbackId: callbackId) + guard let result = CDVPluginResult(status: CDVCommandStatus_NO_RESULT) else { + return DDLogWarn("Missing plugin result for callback \(callbackId)"); + } + result.setKeepCallbackAs(false) + self.commandDelegate?.send(result, callbackId: callbackId) } // Migrates local storage files from UIWebView to WKWebView.