Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Commit e4444b4

Browse files
authored
Merge pull request #137 from Unabashed-Development/bugfixing
Fixed #136
2 parents 9887989 + 0aed631 commit e4444b4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

ViewModel/Authentication/HomePageAfterLoginViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ private void Logout()
1616
{
1717
Account.Email = null;
1818
Account.UserID = null;
19+
Account.NotifiedChatMessages = null;
1920
ViewModelMediators.Authenticated = false;
2021
}
2122

ViewModel/Helpers/NotificationHelper.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,20 @@ private static void MatchOrLikeNotification(object matchOrLike)
9393
List<Profile> profileList;
9494

9595
// Prepares data depending on the match or like handling
96-
if ((MatchOrLike)matchOrLike == MatchOrLike.Matched)
96+
if ((MatchOrLike)matchOrLike == MatchOrLike.Matched && Account.UserID != null)
9797
{
9898
current = new HashSet<int>(MatchDataAccess.GetAllMatchesFromUser(Account.UserID.Value, MatchOrLike.Matched));
9999
profileList = ViewModelMediators.Matches;
100100
}
101-
else
101+
else if ((MatchOrLike)matchOrLike == MatchOrLike.Liked && Account.UserID != null)
102102
{
103103
current = new HashSet<int>(MatchDataAccess.GetReceivedLikesFromUser(Account.UserID.Value));
104104
profileList = ViewModelMediators.Likes;
105105
}
106+
else
107+
{
108+
throw new Exception("Match or like notification MatchOrLike enum not set correctly");
109+
}
106110

107111
// Add the user ID's to the HashSet
108112
foreach (Profile p in profileList)
@@ -120,15 +124,21 @@ private static void MatchOrLikeNotification(object matchOrLike)
120124
// ...reload the profiles
121125
if ((MatchOrLike)matchOrLike == MatchOrLike.Matched)
122126
{
123-
ViewModelMediators.Matches = MatchHelper.LoadProfilesOfMatches(Account.UserID.Value);
127+
if (Account.UserID != null)
128+
{
129+
ViewModelMediators.Matches = MatchHelper.LoadProfilesOfMatches(Account.UserID.Value);
130+
}
124131
if (Account.NotificationSettings != null)
125132
{
126133
notificationsOn = Account.NotificationSettings.Matches;
127134
}
128135
}
129136
else
130137
{
131-
ViewModelMediators.Likes = MatchHelper.LoadProfilesOfLikes(Account.UserID.Value);
138+
if (Account.UserID != null)
139+
{
140+
ViewModelMediators.Likes = MatchHelper.LoadProfilesOfLikes(Account.UserID.Value);
141+
}
132142
if (Account.NotificationSettings != null)
133143
{
134144
notificationsOn = Account.NotificationSettings.Likes;

0 commit comments

Comments
 (0)