aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcinzelent <zelent.marcin@gmail.com>2018-04-25 13:34:54 +0200
committermarcinzelent <zelent.marcin@gmail.com>2018-04-25 13:34:54 +0200
commit4de306375a33b2abd067e65658a46d45cba5e56e (patch)
tree00a734df4dcd1d94d0916eee6a6cc1cd98aafa7d /app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java
parent3812f6ccf9d5796f25f81aeea942c25b58296d01 (diff)
Added Firebase authentication
Diffstat (limited to 'app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java')
-rw-r--r--app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java b/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java
index 5fa975b..172713d 100644
--- a/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java
+++ b/app/src/main/java/org/marcinzelent/liberavem/DataKeeper.java
@@ -9,6 +9,7 @@ import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
+import com.google.firebase.auth.FirebaseAuth;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -50,7 +51,7 @@ public class DataKeeper {
}
public void downloadData(final Activity activity) {
- downloadBirds(activity);
+ if (birds == null) downloadBirds(activity);
downloadObservations(activity);
}
@@ -115,9 +116,10 @@ public class DataKeeper {
((AllObservationsFragment) fragment).populateList(observations, birds);
else {
List<Observation> myObservationsList = new ArrayList<>();
- for (Observation o : observations)
- if (o.getUserId().equals("Sminem")) myObservationsList.add(o);
-
+ for (Observation o : observations) {
+ String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
+ if (o.getUserId().equals(uid)) myObservationsList.add(o);
+ }
Observation[] myObservations = new Observation[myObservationsList.size()];
myObservations = myObservationsList.toArray(myObservations);
((MyObservationsFragment) fragment).populateList(myObservations, birds);