mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
adjusted put token by identifier to not have a response
This commit is contained in:
parent
35da8dd4ed
commit
a267bf9cf7
3 changed files with 6 additions and 8 deletions
|
@ -8,7 +8,7 @@ namespace Bit.App.Abstractions
|
||||||
{
|
{
|
||||||
public interface IDeviceApiRepository : IApiRepository<DeviceRequest, DeviceResponse, string>
|
public interface IDeviceApiRepository : IApiRepository<DeviceRequest, DeviceResponse, string>
|
||||||
{
|
{
|
||||||
Task<ApiResult<DeviceResponse>> PutTokenAsync(string identifier, DeviceTokenRequest request);
|
Task<ApiResult> PutTokenAsync(string identifier, DeviceTokenRequest request);
|
||||||
Task<ApiResult> PutClearTokenAsync(string identifier);
|
Task<ApiResult> PutClearTokenAsync(string identifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,11 +16,11 @@ namespace Bit.App.Repositories
|
||||||
|
|
||||||
protected override string ApiRoute => "devices";
|
protected override string ApiRoute => "devices";
|
||||||
|
|
||||||
public virtual async Task<ApiResult<DeviceResponse>> PutTokenAsync(string identifier, DeviceTokenRequest request)
|
public virtual async Task<ApiResult> PutTokenAsync(string identifier, DeviceTokenRequest request)
|
||||||
{
|
{
|
||||||
if(!Connectivity.IsConnected)
|
if(!Connectivity.IsConnected)
|
||||||
{
|
{
|
||||||
return HandledNotConnected<DeviceResponse>();
|
return HandledNotConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
using(var client = new ApiHttpClient())
|
using(var client = new ApiHttpClient())
|
||||||
|
@ -34,12 +34,10 @@ namespace Bit.App.Repositories
|
||||||
var response = await client.SendAsync(requestMessage);
|
var response = await client.SendAsync(requestMessage);
|
||||||
if(!response.IsSuccessStatusCode)
|
if(!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
return await HandleErrorAsync<DeviceResponse>(response);
|
return await HandleErrorAsync(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
var responseContent = await response.Content.ReadAsStringAsync();
|
return ApiResult.Success(response.StatusCode);
|
||||||
var responseObj = JsonConvert.DeserializeObject<DeviceResponse>(responseContent);
|
|
||||||
return ApiResult<DeviceResponse>.Success(responseObj, response.StatusCode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace Bit.App.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void OnUnregistered(DeviceType deviceType)
|
public void OnUnregistered(DeviceType deviceType)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Push Notification - Device Unnregistered");
|
Debug.WriteLine("Push Notification - Device Unnregistered");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue