Java Code Examples for com.getcapacitor.JSObject#getJSObject()

The following examples show how to use com.getcapacitor.JSObject#getJSObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigUtils.java    From capacitor-oauth2 with MIT License 5 votes vote down vote up
public static JSObject getDeepestObject(JSObject o, String key) {
    // Split on periods
    String[] parts = key.split("\\.");
    // Search until the second to last part of the key
    for (int i = 0; i < parts.length - 1; i++) {
        String k = parts[i];
        o = o.getJSObject(k);
    }
    return o;
}
 
Example 2
Source File: LocalNotificationSchedule.java    From OsmGo with MIT License 5 votes vote down vote up
public LocalNotificationSchedule(JSObject jsonNotification) throws ParseException {
  JSObject schedule = jsonNotification.getJSObject("schedule");
  if (schedule != null) {
    // Every specific unit of time (always constant)
    buildEveryElement(schedule);
    // At specific moment of time (with repeating option)
    buildAtElement(schedule);
    // Build on - recurring times. For e.g. every 1st day of the month at 8:30.
    buildOnElement(schedule);
  }
}
 
Example 3
Source File: LocalNotificationSchedule.java    From OsmGo with MIT License 5 votes vote down vote up
private void buildOnElement(JSObject schedule) {
  JSObject onJson = schedule.getJSObject("on");
  if (onJson != null) {
    this.on = new DateMatch();
    on.setYear(onJson.getInteger("year"));
    on.setMonth(onJson.getInteger("month"));
    on.setDay(onJson.getInteger("day"));
    on.setHour(onJson.getInteger("hour"));
    on.setMinute(onJson.getInteger("minute"));
  }
}