mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-22 11:35:21 +01:00
clear push token after logout
This commit is contained in:
parent
638b3288b4
commit
35da8dd4ed
@ -9,6 +9,6 @@ namespace Bit.App.Abstractions
|
||||
public interface IDeviceApiRepository : IApiRepository<DeviceRequest, DeviceResponse, string>
|
||||
{
|
||||
Task<ApiResult<DeviceResponse>> PutTokenAsync(string identifier, DeviceTokenRequest request);
|
||||
Task<ApiResult<DeviceResponse>> PutClearTokenAsync(string identifier);
|
||||
Task<ApiResult> PutClearTokenAsync(string identifier);
|
||||
}
|
||||
}
|
@ -184,13 +184,6 @@ namespace Bit.App
|
||||
|
||||
private async void Logout(string logoutMessage)
|
||||
{
|
||||
var deviceApiRepository = Resolver.Resolve<IDeviceApiRepository>();
|
||||
var appIdService = Resolver.Resolve<IAppIdService>();
|
||||
|
||||
_pushNotification.Unregister();
|
||||
_settings.Remove(Constants.PushLastRegistrationDate);
|
||||
await deviceApiRepository.PutClearTokenAsync(appIdService.AppId);
|
||||
|
||||
_authService.LogOut();
|
||||
|
||||
_googleAnalyticsService.TrackAppEvent("LoggedOut");
|
||||
@ -201,6 +194,12 @@ namespace Bit.App
|
||||
{
|
||||
_userDialogs.Toast(logoutMessage);
|
||||
}
|
||||
|
||||
var deviceApiRepository = Resolver.Resolve<IDeviceApiRepository>();
|
||||
var appIdService = Resolver.Resolve<IAppIdService>();
|
||||
_pushNotification.Unregister();
|
||||
_settings.Remove(Constants.PushLastRegistrationDate);
|
||||
await Task.Run(() => deviceApiRepository.PutClearTokenAsync(appIdService.AppId)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task CheckLockAsync(bool forceLock)
|
||||
|
@ -43,11 +43,11 @@ namespace Bit.App.Repositories
|
||||
}
|
||||
}
|
||||
|
||||
public virtual async Task<ApiResult<DeviceResponse>> PutClearTokenAsync(string identifier)
|
||||
public virtual async Task<ApiResult> PutClearTokenAsync(string identifier)
|
||||
{
|
||||
if(!Connectivity.IsConnected)
|
||||
{
|
||||
return HandledNotConnected<DeviceResponse>();
|
||||
return HandledNotConnected();
|
||||
}
|
||||
|
||||
using(var client = new ApiHttpClient())
|
||||
@ -59,14 +59,7 @@ namespace Bit.App.Repositories
|
||||
};
|
||||
|
||||
var response = await client.SendAsync(requestMessage);
|
||||
if(!response.IsSuccessStatusCode)
|
||||
{
|
||||
return await HandleErrorAsync<DeviceResponse>(response);
|
||||
}
|
||||
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
var responseObj = JsonConvert.DeserializeObject<DeviceResponse>(responseContent);
|
||||
return ApiResult<DeviceResponse>.Success(responseObj, response.StatusCode);
|
||||
return ApiResult.Success(response.StatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user