public List <Dictionary <string, object> > DisplayByTime() { mListOfCommentsByTime = new List <Dictionary <string, object> >(); mFirebaseHelper.CommentOnLocationRef().OrderByChild(StringValues.TIME_STAMP) .ValueChanged += (object sender, ValueChangedEventArgs args) => { if (args.DatabaseError != null) { Debug.LogError("Databse Error"); } else { if (args.Snapshot != null && args.Snapshot.ChildrenCount > 0) { foreach (var childSnapshot in args.Snapshot.Children) { mCommentHelper = new CommentHelper( childSnapshot.Child(StringValues.USER_NAME).Value.ToString(), childSnapshot.Child(StringValues.COMMENT).Value.ToString(), childSnapshot.Child(StringValues.TIME_STAMP).Value.ToString(), childSnapshot.Child(StringValues.LIKES).Value.ToString()); mListOfCommentsByTime.Add(mCommentHelper.CommentRS()); } } } }; Debug.Log("Displayed By Time"); return(mListOfCommentsByTime); }
public void AddComment(string location, string username, string comment) { //Need to get comment string here from comment post //Get user name from Facebook mLocationInfo = location; string key = mFirebaseHelper.UserRef().Push().Key; mCommentHelper = new CommentHelper(username, comment, TimeStamp(), "0"); Dictionary <string, object> childUpdates = new Dictionary <string, object>(); childUpdates[key] = mCommentHelper.CommentRS(); mFirebaseHelper.CommentOnLocationRef().UpdateChildrenAsync(childUpdates); }