Exemplo n.º 1
0
        public static void Remove(InvitationClass inpInvite)
        {
            if (AppData.auth.CurrentUser == null)
            {
                return;
            }

            string name = inpInvite.Name;
            string uid  = inpInvite.Owner.Uid;

            string invitationTitle = uid + "|" + name;

            var invitationNode = AppData.usersNode
                                 .Child(AppData.currentUser.Uid).Child("Invitations").Child(invitationTitle);

            invitationNode.DeleteAsync();
        }
Exemplo n.º 2
0
        public static async Task Invite(Activity thisActivity, GroceryListClass toList, string inputEmailAddress)
        {
            UserClass inviteeUser = null;
            UserClass ownerUser   = toList.Owner;

            var allUserData = await AppData.usersNode.OnceAsync <UserClass>();

            foreach (FirebaseObject <UserClass> any in allUserData)
            {
                if (inputEmailAddress == any.Object.Email)
                {
                    inviteeUser = any.Object;
                    goto UserExists;
                }
            }

            AlertShow.Show(thisActivity, "No Such User", "The email address you have provided, does not have an account");

            return;

UserExists:

            InvitationClass thisInvite = new InvitationClass()
            {
                Name  = toList.Name,
                Owner = ownerUser
            };

            //unique userID and the name of the list
            string invitationTitle = ownerUser.Uid + "|" + toList.Name;

            await AppData.usersNode.Child(inviteeUser.Uid)
            .Child("Invitations")
            .Child(invitationTitle)
            .PutAsync(thisInvite);

            AlertShow.Show(thisActivity, "Success", "You have successfully invited " + inviteeUser.Name + " to this List");
        }