public void onCompleted()

in facebook-gamingservices/src/main/java/com/facebook/gamingservices/OpenGamingMediaDialog.java [53:89]


  public void onCompleted(GraphResponse response) {
    if (this.nestedCallback != null) {
      this.nestedCallback.onCompleted(response);
    }

    if (response == null || response.getError() != null) {
      return;
    }

    String id = response.getJSONObject().optString("id", null);
    String video_id = response.getJSONObject().optString("video_id", null);
    if (id == null && video_id == null) {
      return;
    }

    id = id != null ? id : video_id;

    boolean isRunningInCloud = CloudGameLoginHandler.isRunningInCloud();

    if (isRunningInCloud) {
      JSONObject parameters = new JSONObject();
      try {
        parameters.put(SDKConstants.PARAM_DEEP_LINK_ID, id);
        parameters.put(SDKConstants.PARAM_DEEP_LINK, "MEDIA_ASSET");
        DaemonRequest.executeAsync(
            this.context, parameters, null, SDKMessageEnum.OPEN_GAMING_SERVICES_DEEP_LINK);
      } catch (JSONException e) {
        // we would get a JSONException if we try to put something that can't be JSON encoded
        // into the parameters object. However we know this is not going to happen since both our
        // parameters are strings. This empty catch block is just here to make the compiler happy.
      }
    } else {
      String dialog_uri = "https://fb.gg/me/media_asset/" + id;
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(dialog_uri));
      this.context.startActivity(intent);
    }
  }