From b21b159b95ec28731525d6585ea0b941f4683270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 12 Nov 2018 15:58:59 +0100 Subject: [PATCH] fix user_key reset in promode --- .../simplecloudnotifier/SCNApp.java | 2 +- .../model/ServerCommunication.java | 1 - .../service/FBMService.java | 2 +- web/upgrade.php | 34 +++++++++---------- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java index a655762..a089cd5 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/SCNApp.java @@ -116,7 +116,7 @@ public class SCNApp extends Application implements LifecycleObserver [X] - perhaps response codes in api (?) -[ ] - verify recieve +[X] - verify recieve [ ] - test notification channels diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java index 1ee5702..18d7dc2 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/model/ServerCommunication.java @@ -333,7 +333,6 @@ public class ServerCommunication } SCNSettings.inst().user_id = json_int(json, "user_id"); - SCNSettings.inst().user_key = json_str(json, "user_key"); SCNSettings.inst().quota_curr = json_int(json, "quota"); SCNSettings.inst().quota_max = json_int(json, "quota_max"); SCNSettings.inst().promode_server = json_bool(json, "is_pro"); diff --git a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java index a230bf5..434a31d 100644 --- a/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java +++ b/android/app/src/main/java/com/blackforestbytes/simplecloudnotifier/service/FBMService.java @@ -50,7 +50,7 @@ public class FBMService extends FirebaseMessagingService NotificationService.inst().showForeground(msg); } - ServerCommunication.ack(msg); + ServerCommunication.ack(SCNSettings.inst().user_id, SCNSettings.inst().user_key, msg); } catch (Exception e) { diff --git a/web/upgrade.php b/web/upgrade.php index 4bc83f2..091679c 100644 --- a/web/upgrade.php +++ b/web/upgrade.php @@ -46,15 +46,14 @@ if ($ispro) $stmt->execute(['uid' => $user_id, 'ptk' => $pro_token]); echo json_encode( - [ - 'success' => true, - 'user_id' => $user_id, - 'user_key' => $new_userkey, - 'quota' => $data['quota_today'], - 'quota_max'=> Statics::quota_max(true), - 'is_pro' => true, - 'message' => 'user updated' - ]); + [ + 'success' => true, + 'user_id' => $user_id, + 'quota' => $data['quota_today'], + 'quota_max'=> Statics::quota_max(true), + 'is_pro' => true, + 'message' => 'user updated' + ]); return 0; } else @@ -65,14 +64,13 @@ else $stmt->execute(['uid' => $user_id]); echo json_encode( - [ - 'success' => true, - 'user_id' => $user_id, - 'user_key' => $new_userkey, - 'quota' => $data['quota_today'], - 'quota_max'=> Statics::quota_max(false), - 'is_pro' => false, - 'message' => 'user updated' - ]); + [ + 'success' => true, + 'user_id' => $user_id, + 'quota' => $data['quota_today'], + 'quota_max'=> Statics::quota_max(false), + 'is_pro' => false, + 'message' => 'user updated' + ]); return 0; }