Skip to content

Commit

Permalink
refactor!: Remove redundant PluginCall methods success() and error()
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-horodyski authored Oct 7, 2024
1 parent b545938 commit d3bdeb4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 61 deletions.
46 changes: 0 additions & 46 deletions android/capacitor/src/main/java/com/getcapacitor/PluginCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,6 @@ public void successCallback(PluginResult successResult) {
this.msgHandler.sendResponseMessage(this, successResult, null);
}

/**
* @deprecated
* Use {@link #resolve(JSObject data)}
*/
@Deprecated
public void success(JSObject data) {
PluginResult result = new PluginResult(data);
this.msgHandler.sendResponseMessage(this, result, null);
}

/**
* @deprecated
* Use {@link #resolve()}
*/
@Deprecated
public void success() {
this.resolve(new JSObject());
}

public void resolve(JSObject data) {
PluginResult result = new PluginResult(data);
this.msgHandler.sendResponseMessage(this, result, null);
Expand All @@ -90,33 +71,6 @@ public void errorCallback(String msg) {
this.msgHandler.sendResponseMessage(this, null, errorResult);
}

/**
* @deprecated
* Use {@link #reject(String msg, Exception ex)}
*/
@Deprecated
public void error(String msg, Exception ex) {
reject(msg, ex);
}

/**
* @deprecated
* Use {@link #reject(String msg, String code, Exception ex)}
*/
@Deprecated
public void error(String msg, String code, Exception ex) {
reject(msg, code, ex);
}

/**
* @deprecated
* Use {@link #reject(String msg)}
*/
@Deprecated
public void error(String msg) {
reject(msg);
}

public void reject(String msg, String code, Exception ex, JSObject data) {
PluginResult errorResult = new PluginResult();

Expand Down
15 changes: 0 additions & 15 deletions ios/Capacitor/Capacitor/CAPPluginCall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ extension CAPPluginCall: JSValueContainer {
return !(value is NSNull)
}

@available(*, deprecated, renamed: "resolve()")
func success() {
successHandler(CAPPluginCallResult([:]), self)
}

@available(*, deprecated, renamed: "resolve")
func success(_ data: PluginCallResultData = [:]) {
successHandler(CAPPluginCallResult(data), self)
}

func resolve() {
successHandler(CAPPluginCallResult(nil), self)
}
Expand All @@ -52,11 +42,6 @@ extension CAPPluginCall: JSValueContainer {
successHandler(CAPPluginCallResult(data), self)
}

@available(*, deprecated, renamed: "reject")
func error(_ message: String, _ error: Error? = nil, _ data: PluginCallResultData = [:]) {
errorHandler(CAPPluginCallError(message: message, code: nil, error: error, data: data))
}

func reject(_ message: String, _ code: String? = nil, _ error: Error? = nil, _ data: PluginCallResultData? = nil) {
errorHandler(CAPPluginCallError(message: message, code: code, error: error, data: data))
}
Expand Down

0 comments on commit d3bdeb4

Please sign in to comment.