public async Task <bool> NotificationRegistrationAsync(ProfileRealm profile) { try { if (!this._pushNotificationPlatformSpecificService.IsPushNotificationEnabledByDevice()) { throw new DisabledPushByDeviceException().SetErrorCode <DisabledPushByDeviceException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 168); } string platform = this._pushNotificationHandler.Platform.ToString(); NotificationMessageType notificationType = NotificationMessageType.All; string handle = this._pushNotificationHandler.Token; NotificationMessageSource notificationSource = NotificationMessageSource.Kreta; TokenData tokenData = this._secureStore.GetTokenData(profile.Id); if (tokenData.ExpiresAt <= DateTime.Now) { tokenData = await((IAuthDbDataService)Mvx.get_IoCProvider().Resolve <IAuthDbDataService>()).RefreshToken(profile); } if (tokenData == null) { return(false); } this._tokenInfoRepository.AddOrUpdate(new TokenInfoRealmMapper().To((Ekreta.Mobile.Core.Models.TokenInfo)JsonConvert.DeserializeObject <Ekreta.Mobile.Core.Models.TokenInfo>(TokenDecoder.Decode(tokenData.AccessToken))), (Action <TokenInfoRealm>)null); Ekreta.Mobile.Core.Models.PushNotification.PushSettings pushSettings = await this._globalMobileApi.NotificationRegistrationAsync(profile.TokenInfo.InstituteCode, profile.TokenInfo.InstituteUserId, profile.TokenInfo.TutelaryId, platform, handle, (UserRoles)profile.TokenInfo.Role, notificationSource, (int)notificationType, profile.Id); PushSettingsRealm pushSettingsRealm = new PushSettingsRealmMapper().To(pushSettings); if (pushSettingsRealm != null) { this._pushSettingsRepository.AddOrUpdate(pushSettingsRealm, (Action <PushSettingsRealm>)(ps => { ps.NotificationTypes = (int)notificationType; ps.FirstTimePushRun = true; ps.UpdateEugyintezes = true; ps.Token = handle; })); this.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = pushSettingsRealm)); } else if (profile.PushSettings != null) { this.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings.FirstTimePushRun = true)); } else { this.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = new PushSettingsRealm() { FirstTimePushRun = true })); } return(pushSettings != null); } catch (DisabledPushByDeviceException ex) { ex.SetErrorCode <DisabledPushByDeviceException>("/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 243); throw; } catch (Exception ex) { CrossMobileAnalytics.Current.TrackException(ex, (IDictionary <string, string>)null, "ProfileDataService.NotificationRegistrationAsync", "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile.Core.Standard/Repository/DataServices/ProfileDbDataService.cs", 75); return(false); } }
public async Task <bool> NotificationDeleteAsync( ProfileRealm profile, bool useGlobalMobileApiV1 = false) { bool result; try { if (profile == null) { throw new ArgumentNullException(nameof(profile)); } PushSettingsRealm pushSettingsRealm = (PushSettingsRealm)null; try { TaskAwaiter <Ekreta.Mobile.Core.Models.PushNotification.PushSettings> awaiter = this._globalMobileApi.NotificationDeleteAsync(profile?.PushSettings?.RegistrationId, NotificationMessageSource.Kreta, useGlobalMobileApiV1).GetAwaiter(); if (!awaiter.IsCompleted) { int num; // ISSUE: explicit reference operation // ISSUE: reference to a compiler-generated field (^ this).\u003C\u003E1__state = num = 0; TaskAwaiter <Ekreta.Mobile.Core.Models.PushNotification.PushSettings> taskAwaiter = awaiter; // ISSUE: explicit reference operation // ISSUE: reference to a compiler-generated field (^ this).\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <Ekreta.Mobile.Core.Models.PushNotification.PushSettings>, ProfileDbDataService.\u003CNotificationDeleteAsync\u003Ed__23>(ref awaiter, this); return; } pushSettingsRealm = new PushSettingsRealmMapper().To(awaiter.GetResult()); } catch (KeyNotFoundException ex) { this._profileRepository.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = (PushSettingsRealm)null)); pushSettingsRealm = new PushSettingsRealm(); } if (pushSettingsRealm != null) { this._pushSettingsRepository.AddOrUpdate(pushSettingsRealm, (Action <PushSettingsRealm>)(ps => { ps.FirstTimePushRun = true; ps.UpdateEugyintezes = true; })); this._profileRepository.AddOrUpdate(profile, (Action <ProfileRealm>)(p => p.PushSettings = pushSettingsRealm)); } result = pushSettingsRealm != null; } catch (Exception ex) { // ISSUE: explicit reference operation // ISSUE: reference to a compiler-generated field (^ this).\u003C\u003E1__state = -2; // ISSUE: explicit reference operation // ISSUE: reference to a compiler-generated field (^ this).\u003C\u003Et__builder.SetException(ex); return; } // ISSUE: explicit reference operation // ISSUE: reference to a compiler-generated field (^ this).\u003C\u003E1__state = -2; // ISSUE: explicit reference operation // ISSUE: reference to a compiler-generated field (^ this).\u003C\u003Et__builder.SetResult(result); }