mirror of
https://github.com/bitwarden/android.git
synced 2024-12-30 04:48:30 +03:00
implemented repository for device apis
This commit is contained in:
parent
8677e9e7ae
commit
3e91510868
7 changed files with 51 additions and 1 deletions
|
@ -84,7 +84,6 @@ namespace Bit.Android
|
||||||
public static void StartPushService()
|
public static void StartPushService()
|
||||||
{
|
{
|
||||||
AppContext.StartService(new Intent(AppContext, typeof(PushNotificationService)));
|
AppContext.StartService(new Intent(AppContext, typeof(PushNotificationService)));
|
||||||
|
|
||||||
if(global::Android.OS.Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.Kitkat)
|
if(global::Android.OS.Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.Kitkat)
|
||||||
{
|
{
|
||||||
PendingIntent pintent = PendingIntent.GetService(AppContext, 0, new Intent(AppContext, typeof(PushNotificationService)), 0);
|
PendingIntent pintent = PendingIntent.GetService(AppContext, 0, new Intent(AppContext, typeof(PushNotificationService)), 0);
|
||||||
|
@ -126,6 +125,7 @@ namespace Bit.Android
|
||||||
.RegisterType<ISiteRepository, SiteRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<ISiteRepository, SiteRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
|
.RegisterType<IDeviceApiRepository, DeviceApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
// Other
|
// Other
|
||||||
.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
|
||||||
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
|
||||||
|
|
10
src/App/Abstractions/Repositories/IDeviceApiRepository.cs
Normal file
10
src/App/Abstractions/Repositories/IDeviceApiRepository.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Bit.App.Models.Api;
|
||||||
|
|
||||||
|
namespace Bit.App.Abstractions
|
||||||
|
{
|
||||||
|
public interface IDeviceApiRepository : IApiRepository<DeviceRequest, DeviceResponse, string>
|
||||||
|
{ }
|
||||||
|
}
|
|
@ -35,6 +35,7 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Abstractions\Repositories\IDeviceApiRepository.cs" />
|
||||||
<Compile Include="Abstractions\Services\IClipboardService.cs" />
|
<Compile Include="Abstractions\Services\IClipboardService.cs" />
|
||||||
<Compile Include="Abstractions\Services\ISiteService.cs" />
|
<Compile Include="Abstractions\Services\ISiteService.cs" />
|
||||||
<Compile Include="Abstractions\Services\IFolderService.cs" />
|
<Compile Include="Abstractions\Services\IFolderService.cs" />
|
||||||
|
@ -65,12 +66,14 @@
|
||||||
<Compile Include="Models\Api\ApiError.cs" />
|
<Compile Include="Models\Api\ApiError.cs" />
|
||||||
<Compile Include="Models\Api\ApiResult.cs" />
|
<Compile Include="Models\Api\ApiResult.cs" />
|
||||||
<Compile Include="Models\Api\Request\FolderRequest.cs" />
|
<Compile Include="Models\Api\Request\FolderRequest.cs" />
|
||||||
|
<Compile Include="Models\Api\Request\DeviceRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\SiteRequest.cs" />
|
<Compile Include="Models\Api\Request\SiteRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\TokenRequest.cs" />
|
<Compile Include="Models\Api\Request\TokenRequest.cs" />
|
||||||
<Compile Include="Models\Api\Request\TokenTwoFactorRequest.cs" />
|
<Compile Include="Models\Api\Request\TokenTwoFactorRequest.cs" />
|
||||||
<Compile Include="Models\Api\Response\ErrorResponse.cs" />
|
<Compile Include="Models\Api\Response\ErrorResponse.cs" />
|
||||||
<Compile Include="Models\Api\Response\FolderResponse.cs" />
|
<Compile Include="Models\Api\Response\FolderResponse.cs" />
|
||||||
<Compile Include="Models\Api\Response\ListResponse.cs" />
|
<Compile Include="Models\Api\Response\ListResponse.cs" />
|
||||||
|
<Compile Include="Models\Api\Response\DeviceResponse.cs" />
|
||||||
<Compile Include="Models\Api\Response\SiteResponse.cs" />
|
<Compile Include="Models\Api\Response\SiteResponse.cs" />
|
||||||
<Compile Include="Models\Api\Response\TokenResponse.cs" />
|
<Compile Include="Models\Api\Response\TokenResponse.cs" />
|
||||||
<Compile Include="Models\Api\Response\ProfileResponse.cs" />
|
<Compile Include="Models\Api\Response\ProfileResponse.cs" />
|
||||||
|
@ -102,6 +105,7 @@
|
||||||
<Compile Include="Abstractions\Repositories\ISiteApiRepository.cs" />
|
<Compile Include="Abstractions\Repositories\ISiteApiRepository.cs" />
|
||||||
<Compile Include="Repositories\AuthApiRepository.cs" />
|
<Compile Include="Repositories\AuthApiRepository.cs" />
|
||||||
<Compile Include="Abstractions\Repositories\IAuthApiRepository.cs" />
|
<Compile Include="Abstractions\Repositories\IAuthApiRepository.cs" />
|
||||||
|
<Compile Include="Repositories\DeviceApiRepository.cs" />
|
||||||
<Compile Include="Repositories\SiteApiRepository.cs" />
|
<Compile Include="Repositories\SiteApiRepository.cs" />
|
||||||
<Compile Include="Repositories\FolderApiRepository.cs" />
|
<Compile Include="Repositories\FolderApiRepository.cs" />
|
||||||
<Compile Include="Repositories\SiteRepository.cs" />
|
<Compile Include="Repositories\SiteRepository.cs" />
|
||||||
|
|
11
src/App/Models/Api/Request/DeviceRequest.cs
Normal file
11
src/App/Models/Api/Request/DeviceRequest.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using PushNotification.Plugin.Abstractions;
|
||||||
|
|
||||||
|
namespace Bit.App.Models.Api
|
||||||
|
{
|
||||||
|
public class DeviceRequest
|
||||||
|
{
|
||||||
|
public DeviceType Type { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string PushToken { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
src/App/Models/Api/Response/DeviceResponse.cs
Normal file
13
src/App/Models/Api/Response/DeviceResponse.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using System;
|
||||||
|
using PushNotification.Plugin.Abstractions;
|
||||||
|
|
||||||
|
namespace Bit.App.Models.Api
|
||||||
|
{
|
||||||
|
public class DeviceResponse
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public DeviceType Type { get; set; }
|
||||||
|
public DateTime CreationDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
11
src/App/Repositories/DeviceApiRepository.cs
Normal file
11
src/App/Repositories/DeviceApiRepository.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
using Bit.App.Abstractions;
|
||||||
|
using Bit.App.Models.Api;
|
||||||
|
|
||||||
|
namespace Bit.App.Repositories
|
||||||
|
{
|
||||||
|
public class DeviceApiRepository : ApiRepository<DeviceRequest, DeviceResponse, string>, IDeviceApiRepository
|
||||||
|
{
|
||||||
|
protected override string ApiRoute => "devices";
|
||||||
|
}
|
||||||
|
}
|
|
@ -193,6 +193,7 @@ namespace Bit.iOS
|
||||||
.RegisterType<ISiteRepository, SiteRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<ISiteRepository, SiteRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<ISiteApiRepository, SiteApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
.RegisterType<IAuthApiRepository, AuthApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
|
.RegisterType<IDeviceApiRepository, DeviceApiRepository>(new ContainerControlledLifetimeManager())
|
||||||
// Other
|
// Other
|
||||||
.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossSettings.Current, new ContainerControlledLifetimeManager())
|
||||||
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
|
.RegisterInstance(CrossConnectivity.Current, new ContainerControlledLifetimeManager())
|
||||||
|
|
Loading…
Reference in a new issue