Search in sources :

Example 41 with JSObject

use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.

the class CapacitorMusicControls method updateMetadata.

@PluginMethod()
public void updateMetadata(PluginCall call) {
    JSObject options = call.getData();
    this.updateMetadata(options);
    call.resolve();
}
Also used : JSObject(com.getcapacitor.JSObject) PluginMethod(com.getcapacitor.PluginMethod)

Example 42 with JSObject

use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.

the class MediaSessionCallback method onSkipToPrevious.

@Override
public void onSkipToPrevious() {
    super.onSkipToPrevious();
    JSObject ret = new JSObject();
    ret.put("message", "music-controls-media-button-previous");
    this.musicControls.controlsNotification(ret);
// if(this.cb != null) {
// this.cb.success("{\"message\": \"music-controls-media-button-previous\"}");
// this.cb = null;
// }
}
Also used : JSObject(com.getcapacitor.JSObject)

Example 43 with JSObject

use of com.getcapacitor.JSObject in project capacitor-music-controls-plugin-new by gokadzev.

the class MediaSessionCallback method onPause.

@Override
public void onPause() {
    super.onPause();
    JSObject ret = new JSObject();
    ret.put("message", "music-controls-media-button-pause");
    this.musicControls.controlsNotification(ret);
// if(this.cb != null) {
// this.cb.success("{\"message\": \"music-controls-media-button-pause\"}");
// this.cb = null;
// }
}
Also used : JSObject(com.getcapacitor.JSObject)

Example 44 with JSObject

use of com.getcapacitor.JSObject in project portals-ecommerce-demo by ionic-team.

the class ShopAPIPluginTest method getCartShouldReturnCart.

@Test
public void getCartShouldReturnCart() {
    ShopAPIPlugin plugin = new ShopAPIPlugin();
    plugin.getCart(call);
    ArgumentCaptor<JSObject> argument = ArgumentCaptor.forClass(JSObject.class);
    verify(call).resolve(argument.capture());
    assertEquals("1", argument.getValue().getString("id"));
}
Also used : ShopAPIPlugin(io.ionic.demo.ecommerce.plugins.ShopAPIPlugin) JSObject(com.getcapacitor.JSObject) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 45 with JSObject

use of com.getcapacitor.JSObject in project portals-ecommerce-demo by ionic-team.

the class ShopAPIPlugin method getUserDetails.

@PluginMethod
public void getUserDetails(PluginCall call) {
    try {
        User user = dataService.getUser();
        String userJson = new Gson().toJson(user);
        JSObject userJSObject = JSObject.fromJSONObject(new JSONObject(userJson));
        call.resolve(userJSObject);
    } catch (JSONException e) {
        call.reject("error decoding user object");
    }
}
Also used : User(io.ionic.demo.ecommerce.data.model.User) JSONObject(org.json.JSONObject) Gson(com.google.gson.Gson) JSObject(com.getcapacitor.JSObject) JSONException(org.json.JSONException) PluginMethod(com.getcapacitor.PluginMethod)

Aggregations

JSObject (com.getcapacitor.JSObject)169 PluginMethod (com.getcapacitor.PluginMethod)93 JSONException (org.json.JSONException)28 JSONObject (org.json.JSONObject)20 MyRunnable (com.jeep.plugin.capacitor.capacitorvideoplayer.Notifications.MyRunnable)16 JSArray (com.getcapacitor.JSArray)14 Radar (io.radar.sdk.Radar)12 Uri (android.net.Uri)11 Location (android.location.Location)9 JSONArray (org.json.JSONArray)7 ArrayList (java.util.ArrayList)6 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 ParseException (java.text.ParseException)5 Intent (android.content.Intent)4 FirebaseUser (com.google.firebase.auth.FirebaseUser)4 Gson (com.google.gson.Gson)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4