Skip to content

Commit 5312ac7

Browse files
committed
CU-8687aj3gt Trying to fix User Push reg issue.
1 parent 2da2fb9 commit 5312ac7

File tree

3 files changed

+10
-19
lines changed

3 files changed

+10
-19
lines changed

Core/Resgrid.Model/PushUri.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ namespace Resgrid.Model
1212
[Table("PushUris")]
1313
public class PushUri : IEntity
1414
{
15-
private string _pushLocation;
16-
1715
[Key]
1816
[Required]
1917
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -36,20 +34,8 @@ public class PushUri : IEntity
3634
public string DeviceId { get; set; }
3735

3836
[Required]
39-
public string PushLocation
40-
{
41-
get { return _pushLocation; }
42-
set
43-
{
44-
if (_pushLocation != value)
45-
{
46-
_pushLocation = value;
47-
48-
//if (((Platforms)PlatformType) == Platforms.Windows8 || ((Platforms)PlatformType) == Platforms.WindowsPhone7 || ((Platforms)PlatformType) == Platforms.WindowsPhone8 || ((Platforms)PlatformType) == Platforms.UnitWin)
49-
// ChannelUri = new Uri(_pushLocation, UriKind.Absolute);
50-
}
51-
}
52-
}
37+
[ProtoMember(9)]
38+
public string PushLocation { get; set; }
5339

5440
[ProtoMember(5)]
5541
public int? UnitId { get; set; }

Core/Resgrid.Services/PushService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public PushService(IPushLogsService pushLogsService, INotificationProvider notif
3535

3636
public async Task<bool> Register(PushUri pushUri)
3737
{
38-
if (pushUri == null || String.IsNullOrWhiteSpace(pushUri.DeviceId))
38+
if (pushUri == null || String.IsNullOrWhiteSpace(pushUri.DeviceId) || string.IsNullOrWhiteSpace(pushUri.PushLocation))
3939
return false;
4040

4141
var code = pushUri.PushLocation;

Web/Resgrid.Web.Services/Controllers/v4/DevicesController.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ public async Task<ActionResult<PushRegistrationResult>> RegisterDevice([FromBody
154154
push.UserId = UserId;
155155
push.PlatformType = registrationInput.Platform;
156156

157-
var department = await _departmentsService.GetDepartmentByIdAsync(DepartmentId, false);
158-
push.PushLocation = department.Code;
157+
if (!string.IsNullOrWhiteSpace(registrationInput.Prefix))
158+
push.PushLocation = registrationInput.Prefix;
159+
else
160+
{
161+
var department = await _departmentsService.GetDepartmentByIdAsync(DepartmentId, false);
162+
push.PushLocation = department.Code;
163+
}
159164

160165
push.DeviceId = registrationInput.Token;
161166
push.Uuid = registrationInput.DeviceUuid;

0 commit comments

Comments
 (0)