[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake-mobile/master] Updated user_served in MyPersistentService



commit 18a2285e3bda7ca8ac606e2377e92cb72b476aea
Author: Hashik Donthineni <HashikDonthineni@xxxxxxxxx>
Date:   Sat Jul 11 02:08:11 2020 +0530

    Updated user_served in MyPersistentService
---
 .../java/org/torproject/snowflake/MyPersistentService.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
index 8d7da11..20f0a47 100644
--- a/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
+++ b/app/src/main/java/org/torproject/snowflake/MyPersistentService.java
@@ -139,6 +139,18 @@ public class MyPersistentService extends Service {
         }
         editor.apply();
     }
+
+    /**
+     * users_served++
+     */
+    private void updateServedCount() {
+        SharedPreferences sp = GlobalApplication.getAppPreferences();
+        sp.edit()
+                .putInt(getString(R.string.users_served),
+                        sp.getInt(getString(R.string.users_served), 0) + 1)
+                .apply();
+    }
+
     /////////////// Notifications ////////////////////////
 
     /**
@@ -308,6 +320,7 @@ public class MyPersistentService extends Service {
 
                 if (STATE == DataChannel.State.OPEN) {
                     updateNotification("Connection Established. Serving one client.");
+                    updateServedCount();
                 } else if (STATE == DataChannel.State.CLOSED) {
                     updateNotification("Connection is closed. Resending offer...");
                     closeConnections(true);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits