async Task <bool> delete(DistributionGroup distribution) { var app = Database.Main.GetObject <AppClass>(distribution.AppId); await Api.Account.Delete3(app.Name, app.Owner.Name, distribution.Name); Database.Main.Delete(distribution); NotificationManager.Shared.ProcDistributionGroupsChanged(app.Id); return(true); }
async Task <bool> inviteDistributionGroup(DistributionGroup distribution, string email) { var app = Database.Main.GetObject <AppClass>(distribution.AppId); var response = (await Api.Account.AddUser(app.Owner.Name, app.Name, distribution.Name, new MobileCenterApi.Models.DistributionGroupUserRequest { UserEmails = new string[] { email } })).First(); return(true); }
async Task syncDistributionGroupReleases(DistributionGroup distributionGroup) { var app = Database.Main.GetObject <AppClass>(distributionGroup.AppId); var resp = await Api.Distribute.ListByDistributionGroup(distributionGroup.Name, app.Owner.Name, app.Name); var releases = resp.Select(x => x.ToRelease(app)).ToList(); var releaseGroups = releases.Select(x => new DistributionReleaseGroup { DistributionId = distributionGroup.Id, Release = x }); Database.Main.Execute("delete from Release where AppId = ? and ReleaseId in (select ReleaseId from DistributionReleaseGroup where DistributionId = ?)", distributionGroup.AppId, distributionGroup.Id); Database.Main.InsertOrReplaceAll(releases); //Remove all first to handle deletes await Database.Main.ExecuteAsync("delete from DistributionReleaseGroup where DistributionId = ?", distributionGroup.Id); Database.Main.InsertOrReplaceAll(releaseGroups); NotificationManager.Shared.ProcDistributionGroupReleasesChanged(distributionGroup.Id); }
async Task syncDistributionGroupMembers(DistributionGroup distributionGroup) { var app = Database.Main.GetObject <AppClass>(distributionGroup.AppId); var members = await Api.Account.ListUsers(app.Owner.Name, app.Name, distributionGroup.Name); var users = new List <User>(); var testers = new List <Tester>(); foreach (var resp in members) { var user = resp.ToUser(); testers.Add(resp.ToTester(distributionGroup, user)); users.Add(user); } Database.Main.InsertOrReplaceAll(users); //Handle deletes await Database.Main.ExecuteAsync("delete from Tester where DistributionId = ? and AppId = ?", distributionGroup.Id, distributionGroup.AppId); Database.Main.InsertOrReplaceAll(testers); NotificationManager.Shared.ProcDistributionGroupMembersChanged(distributionGroup.Id); }
public Task <bool> InviteDistributionGroup(DistributionGroup distributionGroup, string email) { return(RunSingularTask(() => inviteDistributionGroup(distributionGroup, email), email)); }
public Task SyncDistributionGroupReleases(DistributionGroup distributionGroup) { return(RunSingularTask(() => syncDistributionGroupReleases(distributionGroup), distributionGroup.Id)); }
public Task <bool> Delete(DistributionGroup distribution) { return(RunSingularTask(() => delete(distribution), distribution.Id)); }
public static Tester ToTester(this MobileCenterApi.Models.DistributionGroupUserGetResponse resp, DistributionGroup distribution, User user) { return(new Tester { DisplayName = user.DisplayName, DistributionId = distribution.Id, User = user, InvitePending = resp.InvitePending, AppId = distribution.AppId, }); }
public async void OnSelected(DistributionGroup item) { await NavigationService.PushAsync(new DistributionGroupDetailsViewModel { DistributionGroupId = item.Id }); }