public void DeleteReward() { Debug.Log(CLASSNAME + "Delete confirmed - initiating Delete request"); //Hide delete confirm popup confirmModal.SetActive(false); // Request Controller to initiate delete and return if successful if (controller.RequestToDeleteReward(keyToDelete)) { controller.RequestToDeletePhoto(keyToDelete); //was successful resultModalText.text = keyToDelete + MODAL_SUCCESS_TEXT; resultModal.SetActive(true); Destroy(objToDelete); currentEntries--; AlterContentBoxSizing(currentEntries); } else { //did not delete / error resultModalText.text = MODAL_ERROR_TEXT; resultModal.SetActive(true); } }
public void RequestToSaveReward() { Debug.Log(CLASSNAME + "***** Request to save reward sent, reward name: " + rewardName); //If reward exists, you are editing a current reward if (controller.CheckForExistingReward(rewardName)) { Debug.Log("edit pic = " + editPic + ", edit url = " + editUrl); //Resave the reward picture if ((editPic == true) && (editUrl == false)) { Debug.Log("attempting to edit reward pic"); controller.RequestToSavePhoto(rewardName); DisplayModal(ModalType.UPDATE, rewardName + MODAL_UPDATE_TEXT); } else if (editPic == true && (editUrl = true)) { Debug.Log("attempting to edit reward pic and reward url"); // controller.RequestToDeleteReward(rewardName); // controller.RequestToSaveReward(rewardName, rewardType, rewardUrl); controller.RequestToDeletePhoto(rewardName); controller.RequestToSavePhoto(rewardName); controller.RequestToSaveUrl(rewardName, rewardUrl); DisplayModal(ModalType.UPDATE, rewardName + MODAL_UPDATE_TEXT); } else if ((editPic == false) && (editUrl == true)) { Debug.Log("attempting to edit reward url"); controller.RequestToSaveUrl(rewardName, rewardUrl); DisplayModal(ModalType.UPDATE, rewardName + MODAL_UPDATE_TEXT); } else { Debug.Log("something went wring when attempting to edit"); DisplayModal(ModalType.ERROR, MODAL_ERROR_TEXT); } } //else this is a new reward else { rewardName = wordFieldText.text; //If request to save to DB was successful if (controller.RequestToSaveReward(rewardName, rewardType, rewardUrl)) { if (controller.IsThereACurrentPhoto()) { //If request to save photo was successful if (controller.RequestToSavePhoto(rewardName)) { DisplayModal(ModalType.SAVE, rewardName + MODAL_SAVE_TEXT); } else { DisplayModal(ModalType.ERROR, MODAL_ERROR_TEXT); } } else { DisplayModal(ModalType.SAVE, rewardName + MODAL_SAVE_TEXT); } } else { DisplayModal(ModalType.ERROR, MODAL_ERROR_TEXT); } } editUrl = false; editPic = false; }