Skip to content

Commit

Permalink
fix(functions): callByUrl method on Android (#673)
Browse files Browse the repository at this point in the history
* fix callByUrl method

* fix format
  • Loading branch information
mamillastre authored Jul 5, 2024
1 parent 3aec743 commit 5d918e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.capawesome.capacitorjs.plugins.firebase.functions.classes.options.CallByUrlOptions;
import io.capawesome.capacitorjs.plugins.firebase.functions.classes.results.CallResult;
import io.capawesome.capacitorjs.plugins.firebase.functions.interfaces.NonEmptyResultCallback;
import java.net.URL;

public class FirebaseFunctions {

Expand Down Expand Up @@ -37,11 +38,11 @@ public void callByName(@NonNull CallByNameOptions options, @NonNull NonEmptyResu
}

public void callByUrl(@NonNull CallByUrlOptions options, @NonNull NonEmptyResultCallback callback) {
String url = options.getUrl();
URL url = options.getUrl();
Object data = options.getData();

getFirebaseFunctionsInstance(null)
.getHttpsCallable(url)
.getHttpsCallableFromUrl(url)
.call(data)
.addOnSuccessListener(
task -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package io.capawesome.capacitorjs.plugins.firebase.functions.classes.options;

import androidx.annotation.NonNull;
import java.net.MalformedURLException;
import java.net.URL;

public class CallByUrlOptions extends CallOptions {

@NonNull
private String url;
private URL url;

public CallByUrlOptions(@NonNull String url, Object data) {
public CallByUrlOptions(@NonNull String url, Object data) throws MalformedURLException {
super(data);
this.url = url;
this.url = new URL(url);
}

@NonNull
public String getUrl() {
public URL getUrl() {
return url;
}
}

0 comments on commit 5d918e4

Please sign in to comment.