Exemple #1
0
		public static void PassPostToAllNotificationsFeedsIfExists (Notification notification, FeedTypeEnum.FeedType key)
		{
			if (notification == null)
			{
				return;
			}

			if (notification.post != null && notification.post.IsExpired () && key == FeedTypeEnum.FeedType.StatusFeed){
				return;
			}

			foreach (KeyValuePair<string, List<Notification>> currentDict in Globe.SharedInstance.NotificationFeeds) { 
				bool foundIt = false;	
				for (int i = 0; i < currentDict.Value.Count; i++) {
					if (currentDict.Value [i].idNotification == notification.idNotification) {
						currentDict.Value [i] = notification;
						foundIt = true;
					}

					if (key == FeedTypeEnum.FeedType.StatusFeed && currentDict.Value [i].post != null && notification.post != null && currentDict.Value [i].post.idPost == notification.post.idPost) {
						currentDict.Value [i] = notification;
						foundIt = true;
					}
				}

				if (!foundIt && currentDict.Key == key.ToString ()) {
					currentDict.Value.Add (notification);
				}

				currentDict.Value.Sort ((x, y) => y.datestamp.Value.CompareTo (x.datestamp.Value));

			}
		}
		public static async Task<bool> MarkNotificationAsRead (Notification notification)
		{

			List<string> appendString = new List<string> () { "notification", notification.idNotification.ToString() };

			RESTResult data = await RESTHelper.Async ("marknotificationasread", null, appendString);
			if (data.ReturnedData != null) {
				return ParseForBool (data.ReturnedData);
			}
			throw data.Error;
		}