From 768a58666e316af7178055f9c915f85b22abd79b Mon Sep 17 00:00:00 2001 From: cimenmus Date: Mon, 27 Aug 2018 00:53:08 +0300 Subject: [PATCH] app publish --- .idea/caches/build_file_checksums.ser | Bin 538 -> 538 bytes app/build.gradle | 4 +- app/release/output.json | 2 +- .../android/fragment/ProfileFragment.java | 45 ++++++++++++++++-- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index a2db3e880b555b7618094b127d39a0cb4d74cbd3..62e5d29ed2bf3ed2b6657d0dbfa6941d3355b709 100644 GIT binary patch delta 33 pcmbQmGK*!x43-MZUYU(^av25Ji*E@zR)4x{$ypnXn>QJBDgfcY4k7>m delta 33 pcmbQmGK*!x43={1t%e)trefbTVXoJ6#(MH4d?&> diff --git a/app/build.gradle b/app/build.gradle index cafceb7..74ae402 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,8 +23,8 @@ android { applicationId "ch.pizzapp.capri" minSdkVersion 16 targetSdkVersion 27 - versionCode 13 // play store'daki version --> canlı: 12 - dahili test: 12 - versionName "2.15" // play store'daki version --> canlı: 2.14 - dahili test: 2.14 + versionCode 14 // play store'daki version --> canlı: 12 - dahili test: 13 + versionName "2.16" // play store'daki version --> canlı: 2.14 - dahili test: 2.15 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true manifestPlaceholders = [ diff --git a/app/release/output.json b/app/release/output.json index 35add69..36e406b 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":12,"versionName":"2.14","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":13,"versionName":"2.15","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/ch/pizzapp/android/fragment/ProfileFragment.java b/app/src/main/java/ch/pizzapp/android/fragment/ProfileFragment.java index 7db420d..90f9c5f 100644 --- a/app/src/main/java/ch/pizzapp/android/fragment/ProfileFragment.java +++ b/app/src/main/java/ch/pizzapp/android/fragment/ProfileFragment.java @@ -14,6 +14,7 @@ import com.afollestad.materialdialogs.DialogAction; import com.afollestad.materialdialogs.MaterialDialog; import com.onesignal.OneSignal; +import org.json.JSONException; import org.json.JSONObject; import butterknife.BindString; @@ -58,6 +59,7 @@ public class ProfileFragment extends BaseFragment { @BindString(R.string.bottom_nav_menu_item_profile) String fragmentTitle; @BindString(R.string.alert_logout) String logoutAlertText; + @BindString(R.string.something_went_wrong) String genericErrorText; public static final java.lang.String FRAGMENT_NAME = "profileFragment"; private int REQUEST_CODE_UPDATE_PROFILE = 2563; @@ -173,13 +175,48 @@ public class ProfileFragment extends BaseFragment { return; } + DialogHelper.showLoadingDialog(); + if(enableNotificationsSwitch.isChecked()) { - OneSignal.sendTag( - ApiConstants.ONESIGNAL_NOTIFICATION_TAG_KEY, - ApiConstants.ONESIGNAL_NOTIFICATION_TAG_VALUE); + + JSONObject tags = new JSONObject(); + try { + tags.put(ApiConstants.ONESIGNAL_NOTIFICATION_TAG_KEY, ApiConstants.ONESIGNAL_NOTIFICATION_TAG_VALUE); + OneSignal.sendTags(tags, new OneSignal.ChangeTagsUpdateHandler() { + @Override + public void onSuccess(JSONObject tags) { + DialogHelper.hideLoadingDialog(); + } + + @Override + public void onFailure(OneSignal.SendTagsError error) { + DialogHelper.hideLoadingDialog(); + DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText); + } + }); + } + catch (JSONException e){ + e.printStackTrace(); + DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText); + } + } else { - OneSignal.deleteTag(ApiConstants.ONESIGNAL_NOTIFICATION_TAG_KEY); + OneSignal.deleteTag( + ApiConstants.ONESIGNAL_NOTIFICATION_TAG_KEY, + new OneSignal.ChangeTagsUpdateHandler() { + @Override + public void onSuccess(JSONObject tags) { + DialogHelper.hideLoadingDialog(); + } + + @Override + public void onFailure(OneSignal.SendTagsError error) { + DialogHelper.hideLoadingDialog(); + DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText); + } + } + ); } }