Merge branch 'marijn-appje' into 'master'
Option to get own posts. See merge request !24
This commit was merged in pull request #24.
This commit is contained in:
@@ -3,6 +3,7 @@ package nl.myhyvesbookplus.tagram.controller;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.google.firebase.database.DataSnapshot;
|
||||
import com.google.firebase.database.DatabaseError;
|
||||
import com.google.firebase.database.DatabaseReference;
|
||||
@@ -36,7 +37,6 @@ public class DownloadClass {
|
||||
}
|
||||
|
||||
public void getPostsFromServer() {
|
||||
Log.d(TAG, "getPostsFromServer: Begin of function");
|
||||
mDataRef.child("posts").addListenerForSingleValueEvent(new ValueEventListener() {
|
||||
@Override
|
||||
public void onDataChange(DataSnapshot dataSnapshot) {
|
||||
@@ -58,6 +58,18 @@ public class DownloadClass {
|
||||
return mList;
|
||||
}
|
||||
|
||||
public ArrayList<UriPost> getOwnPosts() {
|
||||
String currentUid = FirebaseAuth.getInstance().getCurrentUser().getUid();
|
||||
ArrayList<UriPost> posts = new ArrayList<UriPost>();
|
||||
|
||||
for (UriPost post : mList) {
|
||||
if (post.getPoster().equals(currentUid)) {
|
||||
posts.add(post);
|
||||
}
|
||||
}
|
||||
return posts;
|
||||
}
|
||||
|
||||
public interface PostDownloadListener {
|
||||
void PostDownloaded();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user