Skip to content

Instantly share code, notes, and snippets.

@melikeeroglu
Created September 30, 2020 06:08
Show Gist options
  • Save melikeeroglu/46e9c5a77c791f18b1cffd90c93645d6 to your computer and use it in GitHub Desktop.
Save melikeeroglu/46e9c5a77c791f18b1cffd90c93645d6 to your computer and use it in GitHub Desktop.
HiAnimals InsertPhoto
public void insertPhoto(Photo photo) {
state = false;
if (mCloudDBZone == null) {
Log.w(Constant.DB_ZONE_WRAPPER, "INSERT Photo : CloudDBZone is null, try re-open it");
return;
}
CloudDBZoneTask<Integer> upsertTask = mCloudDBZone.executeUpsert(photo);
if (mUiCallBack == null) {
return;
}
upsertTask.addOnSuccessListener(cloudDBZoneResult -> {
state = true;
Log.w(Constant.DB_ZONE_WRAPPER, "INSERT USER : upsert " + cloudDBZoneResult + " records");
}).addOnFailureListener(e -> {
state = false;
mUiCallBack.updateUiOnError("INSERT photo : Insert photo info failed");
});
if (mUiCallBack != null) {
mUiCallBack.isDataUpsert(state);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment