dropping GCM support
This commit is contained in:
@ -708,9 +708,13 @@ namespace Yavsc.Controllers
|
||||
async Task<IdentityResult> DeleteUser(string userId)
|
||||
{
|
||||
ApplicationUser user = await _userManager.FindByIdAsync(userId);
|
||||
_dbContext.GCMDevices.RemoveRange( _dbContext.GCMDevices.Where(g => g.DeviceOwnerId == userId ));
|
||||
// TODO add an owner to maillings
|
||||
_dbContext.MailingTemplate.RemoveRange(_dbContext.MailingTemplate.Where( t=>t.ManagerId == userId ));
|
||||
|
||||
_dbContext.DeviceDeclaration.RemoveRange( _dbContext.DeviceDeclaration.Where(g => g.DeviceOwnerId == userId ));
|
||||
|
||||
foreach (var template in _dbContext.MailingTemplate.Where( t=>t.ManagerId == userId ))
|
||||
{
|
||||
template.ManagerId = template.SuccessorId;
|
||||
}
|
||||
|
||||
return await _userManager.DeleteAsync(user);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Yavsc.Models.Workflow;
|
||||
using Yavsc.Models.Identity;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -39,7 +38,7 @@ namespace Yavsc.Controllers
|
||||
private GoogleAuthSettings _googleSettings;
|
||||
|
||||
private PayPalSettings _payPalSettings;
|
||||
private IGoogleCloudMessageSender _GCMSender;
|
||||
private IYavscMessageSender _GCMSender;
|
||||
private SIRENChecker _cchecker;
|
||||
private IStringLocalizer _SR;
|
||||
private CompanyInfoSettings _cinfoSettings;
|
||||
@ -51,7 +50,7 @@ namespace Yavsc.Controllers
|
||||
UserManager<ApplicationUser> userManager,
|
||||
SignInManager<ApplicationUser> signInManager,
|
||||
IEmailSender emailSender,
|
||||
IGoogleCloudMessageSender GCMSender,
|
||||
IYavscMessageSender GCMSender,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IOptions<PayPalSettings> paypalSettings,
|
||||
@ -292,11 +291,6 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult AddMobileApp(GoogleCloudMobileDeclaration model)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> SetGoogleCalendar(string returnUrl, string pageToken)
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -10,12 +10,11 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
using Models;
|
||||
using Models.Identity;
|
||||
|
||||
public class GCMDevicesController : Controller
|
||||
public class DevicesController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
||||
public GCMDevicesController(ApplicationDbContext context)
|
||||
public DevicesController(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
@ -25,7 +24,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
var uid = User.GetUserId();
|
||||
|
||||
var applicationDbContext = _context.GCMDevices.Include(g => g.DeviceOwner).Where(d=>d.DeviceOwnerId == uid);
|
||||
var applicationDbContext = _context.DeviceDeclaration.Include(g => g.DeviceOwner).Where(d=>d.DeviceOwnerId == uid);
|
||||
return View(await applicationDbContext.ToListAsync());
|
||||
}
|
||||
|
||||
@ -37,7 +36,7 @@ namespace Yavsc.Controllers
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GoogleCloudMobileDeclaration googleCloudMobileDeclaration = await _context.GCMDevices.SingleAsync(m => m.DeviceId == id);
|
||||
DeviceDeclaration googleCloudMobileDeclaration = await _context.DeviceDeclaration.SingleAsync(m => m.DeviceId == id);
|
||||
if (googleCloudMobileDeclaration == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
@ -55,7 +54,7 @@ namespace Yavsc.Controllers
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
GoogleCloudMobileDeclaration googleCloudMobileDeclaration = await _context.GCMDevices.SingleAsync(m => m.DeviceId == id);
|
||||
DeviceDeclaration googleCloudMobileDeclaration = await _context.DeviceDeclaration.SingleAsync(m => m.DeviceId == id);
|
||||
if (googleCloudMobileDeclaration == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
@ -69,8 +68,8 @@ namespace Yavsc.Controllers
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(string id)
|
||||
{
|
||||
GoogleCloudMobileDeclaration googleCloudMobileDeclaration = await _context.GCMDevices.SingleAsync(m => m.DeviceId == id);
|
||||
_context.GCMDevices.Remove(googleCloudMobileDeclaration);
|
||||
DeviceDeclaration googleCloudMobileDeclaration = await _context.DeviceDeclaration.SingleAsync(m => m.DeviceId == id);
|
||||
_context.DeviceDeclaration.Remove(googleCloudMobileDeclaration);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
@ -24,7 +24,7 @@ namespace Yavsc.Controllers
|
||||
protected UserManager<ApplicationUser> _userManager;
|
||||
protected ApplicationDbContext _context;
|
||||
protected GoogleAuthSettings _googleSettings;
|
||||
protected IGoogleCloudMessageSender _GCMSender;
|
||||
protected IYavscMessageSender _GCMSender;
|
||||
protected IEmailSender _emailSender;
|
||||
protected IStringLocalizer _localizer;
|
||||
protected SiteSettings _siteSettings;
|
||||
@ -34,7 +34,7 @@ namespace Yavsc.Controllers
|
||||
|
||||
protected readonly ILogger _logger;
|
||||
public CommandController(ApplicationDbContext context, IOptions<GoogleAuthSettings> googleSettings,
|
||||
IGoogleCloudMessageSender GCMSender,
|
||||
IYavscMessageSender GCMSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
ICalendarManager calendarManager,
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
|
||||
@ -136,7 +136,7 @@ namespace Yavsc.Controllers
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include(u => u.Performer.Devices)
|
||||
).Include(u => u.Performer.DeviceDeclarations)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == command.PerformerId
|
||||
);
|
||||
@ -174,10 +174,10 @@ namespace Yavsc.Controllers
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("sending GCM");
|
||||
if (pro.Performer.Devices.Count > 0)
|
||||
if (pro.Performer.DeviceDeclarations.Count > 0)
|
||||
{
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
.DeviceDeclarations.Select(d => d.DeviceId);
|
||||
grep = await _GCMSender.NotifyBookQueryAsync(regids, yaev);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Yavsc.Controllers
|
||||
public HairCutCommandController(ApplicationDbContext context,
|
||||
IOptions<PayPalSettings> payPalSettings,
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
IGoogleCloudMessageSender GCMSender,
|
||||
IYavscMessageSender GCMSender,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IStringLocalizer<Yavsc.Resources.YavscLocalisation> localizer,
|
||||
IEmailSender emailSender,
|
||||
@ -53,7 +53,7 @@ namespace Yavsc.Controllers
|
||||
.Include(x => x.PerformerProfile)
|
||||
.Include(x => x.Prestation)
|
||||
.Include(x => x.PerformerProfile.Performer)
|
||||
.Include(x => x.PerformerProfile.Performer.Devices)
|
||||
.Include(x => x.PerformerProfile.Performer.DeviceDeclarations)
|
||||
.Include(x => x.Regularisation)
|
||||
.SingleAsync(m => m.Id == id);
|
||||
query.SelectedProfile = await _context.BrusherProfile.SingleAsync(b => b.UserId == query.PerformerId);
|
||||
@ -100,11 +100,10 @@ namespace Yavsc.Controllers
|
||||
var yaev = command.CreatePaymentEvent(paymentInfo, _localizer);
|
||||
if (command.PerformerProfile.AcceptNotifications)
|
||||
{
|
||||
if (command.PerformerProfile.Performer.Devices.Count > 0)
|
||||
if (command.PerformerProfile.Performer.DeviceDeclarations.Count > 0)
|
||||
{
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
|
||||
.DeviceDeclarations.Select(d => d.DeviceId);
|
||||
grep = await _GCMSender.NotifyAsync(regids, yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
@ -218,7 +217,7 @@ namespace Yavsc.Controllers
|
||||
_logger.LogInformation("le Model _est_ valide.");
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include(u => u.Performer.Devices)
|
||||
).Include(u => u.Performer.DeviceDeclarations)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == model.PerformerId
|
||||
);
|
||||
@ -269,9 +268,9 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
if (pro.AcceptNotifications)
|
||||
{
|
||||
if (pro.Performer.Devices.Count > 0)
|
||||
if (pro.Performer.DeviceDeclarations.Count > 0)
|
||||
{
|
||||
var regids = pro.Performer.Devices.Select(d => d.GCMRegistrationId);
|
||||
var regids = pro.Performer.DeviceDeclarations.Select(d => d.DeviceId);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(regids, yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
@ -391,7 +390,7 @@ namespace Yavsc.Controllers
|
||||
);
|
||||
var pro = _context.Performers.Include(
|
||||
u => u.Performer
|
||||
).Include(u => u.Performer.Devices)
|
||||
).Include(u => u.Performer.DeviceDeclarations)
|
||||
.FirstOrDefault(
|
||||
x => x.PerformerId == command.PerformerId
|
||||
);
|
||||
@ -428,10 +427,10 @@ namespace Yavsc.Controllers
|
||||
if (pro.AcceptNotifications
|
||||
&& pro.AcceptPublicContact)
|
||||
{
|
||||
if (pro.Performer.Devices?.Count > 0)
|
||||
if (pro.Performer.DeviceDeclarations?.Count > 0)
|
||||
{
|
||||
var regids = command.PerformerProfile.Performer
|
||||
.Devices.Select(d => d.GCMRegistrationId);
|
||||
.DeviceDeclarations.Select(d => d.DeviceId);
|
||||
grep = await _GCMSender.NotifyHairCutQueryAsync(regids, yaev);
|
||||
}
|
||||
// TODO setup a profile choice to allow notifications
|
||||
|
@ -5,7 +5,6 @@ using Microsoft.AspNet.Diagnostics;
|
||||
using Microsoft.AspNet.Authorization;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.Data.Entity;
|
||||
@ -93,7 +92,7 @@ namespace Yavsc.Controllers
|
||||
if (User.Identity.IsAuthenticated) {
|
||||
ViewBag.IsAuthenticated=true;
|
||||
string uid = User.GetUserId();
|
||||
ViewBag.Contacts = _dbContext.Contacts.Where(c=>c.OwnerId == uid)
|
||||
ViewBag.Contacts = _dbContext.Contact.Where(c=>c.OwnerId == uid)
|
||||
;
|
||||
} else ViewBag.IsAuthenticated=false;
|
||||
return View();
|
||||
|
Reference in New Issue
Block a user