1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-09-21 03:01:30 +02:00

fdroid builds without Google and Hockey services

This commit is contained in:
Kyle Spearrin 2018-01-10 09:28:30 -05:00
parent 5521892736
commit 98d4fef0ee
15 changed files with 122 additions and 8 deletions

View File

@ -9,6 +9,8 @@ after_build:
- IF DEFINED keystore_dec_secret secure-file\tools\secure-file -decrypt src\Android\8bit.keystore.enc -secret %keystore_dec_secret% - IF DEFINED keystore_dec_secret secure-file\tools\secure-file -decrypt src\Android\8bit.keystore.enc -secret %keystore_dec_secret%
- IF DEFINED keystore_password msbuild "/t:SignAndroidPackage" "/p:Configuration=Release" "/p:AndroidKeyStore=true" "/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=%keystore_password%" "/p:AndroidSigningKeyStore=8bit.keystore" "/p:AndroidSigningStorePass=%keystore_password%" "src\Android\Android.csproj" - IF DEFINED keystore_password msbuild "/t:SignAndroidPackage" "/p:Configuration=Release" "/p:AndroidKeyStore=true" "/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=%keystore_password%" "/p:AndroidSigningKeyStore=8bit.keystore" "/p:AndroidSigningStorePass=%keystore_password%" "src\Android\Android.csproj"
- ps: IF($env:keystore_dec_secret) { copy-item src\Android\bin\Release\com.x8bit.bitwarden-Signed.apk .\com.x8bit.bitwarden-$($env:APPVEYOR_BUILD_NUMBER).apk } - ps: IF($env:keystore_dec_secret) { copy-item src\Android\bin\Release\com.x8bit.bitwarden-Signed.apk .\com.x8bit.bitwarden-$($env:APPVEYOR_BUILD_NUMBER).apk }
- IF DEFINED keystore_password msbuild "/t:SignAndroidPackage" "/p:Configuration=FDroid" "/p:AndroidKeyStore=true" "/p:AndroidSigningKeyAlias=bitwarden" "/p:AndroidSigningKeyPass=%keystore_password%" "/p:AndroidSigningKeyStore=8bit.keystore" "/p:AndroidSigningStorePass=%keystore_password%" "src\Android\Android.csproj"
- ps: IF($env:keystore_dec_secret) { copy-item src\Android\bin\FDroid\com.x8bit.bitwarden-Signed.apk .\com.x8bit.bitwarden-FDroid-$($env:APPVEYOR_BUILD_NUMBER).apk }
on_success: on_success:
- IF DEFINED play_dec_secret secure-file\tools\secure-file -decrypt store\google\Publisher\play_creds.json.enc -secret %play_dec_secret% - IF DEFINED play_dec_secret secure-file\tools\secure-file -decrypt store\google\Publisher\play_creds.json.enc -secret %play_dec_secret%
- IF DEFINED play_dec_secret dotnet store\google\Publisher\bin\Debug\netcoreapp2.0\Publisher.dll %APPVEYOR_BUILD_FOLDER%\store\google\Publisher\play_creds.json %APPVEYOR_BUILD_FOLDER%\src\Android\bin\Release\com.x8bit.bitwarden-Signed.apk alpha - IF DEFINED play_dec_secret dotnet store\google\Publisher\bin\Debug\netcoreapp2.0\Publisher.dll %APPVEYOR_BUILD_FOLDER%\store\google\Publisher\play_creds.json %APPVEYOR_BUILD_FOLDER%\src\Android\bin\Release\com.x8bit.bitwarden-Signed.apk alpha

View File

@ -876,15 +876,17 @@
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat"> <PackageReference Include="Xamarin.Android.Support.v7.AppCompat">
<Version>25.4.0.2</Version> <Version>25.4.0.2</Version>
</PackageReference> </PackageReference>
<PackageReference Include="XLabs.IoC.SimpleInjector" Version="2.0.5782" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
<PackageReference Include="Plugin.CurrentActivity" Version="1.0.1" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)' != 'FDroid|AnyCPU'">
<PackageReference Include="Xamarin.Firebase.Messaging"> <PackageReference Include="Xamarin.Firebase.Messaging">
<Version>42.1021.1</Version> <Version>42.1021.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Analytics"> <PackageReference Include="Xamarin.GooglePlayServices.Analytics">
<Version>42.1021.1</Version> <Version>42.1021.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="XLabs.IoC.SimpleInjector" Version="2.0.5782" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.1.3" />
<PackageReference Include="Plugin.CurrentActivity" Version="1.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidResource Include="Resources\drawable\bottom_nav_bg.xml" /> <AndroidResource Include="Resources\drawable\bottom_nav_bg.xml" />

View File

@ -1,3 +1,4 @@
#if !FDROID
using System; using System;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
@ -21,3 +22,4 @@ namespace Bit.Android
} }
} }
} }
#endif

View File

@ -1,3 +1,4 @@
#if !FDROID
using System; using System;
using Android.App; using Android.App;
using Android.Content; using Android.Content;
@ -40,3 +41,4 @@ namespace Bit.Android
} }
} }
} }
#endif

View File

@ -1,3 +1,4 @@
#if !FDROID
using HockeyApp.Android; using HockeyApp.Android;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -52,3 +53,4 @@ namespace Bit.Android
} }
} }
} }
#endif

View File

@ -61,8 +61,10 @@ namespace Bit.Android
var appIdService = Resolver.Resolve<IAppIdService>(); var appIdService = Resolver.Resolve<IAppIdService>();
var authService = Resolver.Resolve<IAuthService>(); var authService = Resolver.Resolve<IAuthService>();
#if !FDROID
HockeyApp.Android.CrashManager.Register(this, HockeyAppId, HockeyApp.Android.CrashManager.Register(this, HockeyAppId,
new HockeyAppCrashManagerListener(appIdService, authService)); new HockeyAppCrashManagerListener(appIdService, authService));
#endif
Forms.Init(this, bundle); Forms.Init(this, bundle);

View File

@ -128,7 +128,11 @@ namespace Bit.Android
container.RegisterSingleton<IPasswordGenerationService, PasswordGenerationService>(); container.RegisterSingleton<IPasswordGenerationService, PasswordGenerationService>();
container.RegisterSingleton<ILockService, LockService>(); container.RegisterSingleton<ILockService, LockService>();
container.RegisterSingleton<IAppInfoService, AppInfoService>(); container.RegisterSingleton<IAppInfoService, AppInfoService>();
#if FDROID
container.RegisterSingleton<IGoogleAnalyticsService, NoopGoogleAnalyticsService>();
#else
container.RegisterSingleton<IGoogleAnalyticsService, GoogleAnalyticsService>(); container.RegisterSingleton<IGoogleAnalyticsService, GoogleAnalyticsService>();
#endif
container.RegisterSingleton<IDeviceInfoService, DeviceInfoService>(); container.RegisterSingleton<IDeviceInfoService, DeviceInfoService>();
container.RegisterSingleton<ILocalizeService, LocalizeService>(); container.RegisterSingleton<ILocalizeService, LocalizeService>();
container.RegisterSingleton<ILogService, LogService>(); container.RegisterSingleton<ILogService, LogService>();
@ -159,8 +163,13 @@ namespace Bit.Android
container.RegisterSingleton(CrossFingerprint.Current); container.RegisterSingleton(CrossFingerprint.Current);
// Push // Push
#if FDROID
container.RegisterSingleton<IPushNotificationListener, NoopPushNotificationListener>();
container.RegisterSingleton<IPushNotificationService, NoopPushNotificationService>();
#else
container.RegisterSingleton<IPushNotificationListener, PushNotificationListener>(); container.RegisterSingleton<IPushNotificationListener, PushNotificationListener>();
container.RegisterSingleton<IPushNotificationService, AndroidPushNotificationService>(); container.RegisterSingleton<IPushNotificationService, AndroidPushNotificationService>();
#endif
container.Verify(); container.Verify();
Resolver.SetResolver(new SimpleInjectorResolver(container)); Resolver.SetResolver(new SimpleInjectorResolver(container));

View File

@ -1,4 +1,5 @@
using System; #if !FDROID
using System;
using Bit.App; using Bit.App;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
@ -40,3 +41,4 @@ namespace Bit.Android.Services
} }
} }
} }
#endif

View File

@ -1,4 +1,5 @@
using System; #if !FDROID
using System;
using Bit.App; using Bit.App;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
@ -80,3 +81,4 @@ namespace Bit.Android.Services
} }
} }
} }
#endif

View File

@ -8,7 +8,7 @@
<Configurations>Debug;Release;FDroid</Configurations> <Configurations>Debug;Release;FDroid</Configurations>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='FDroid|netstandard2.0|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'FDroid|AnyCPU'">
<DefineConstants>TRACE;FDROID;NETSTANDARD2_0</DefineConstants> <DefineConstants>TRACE;FDROID;NETSTANDARD2_0</DefineConstants>
</PropertyGroup> </PropertyGroup>
@ -21,7 +21,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="HockeySDK.Xamarin" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="PCLCrypto" Version="2.0.147" /> <PackageReference Include="PCLCrypto" Version="2.0.147" />
<PackageReference Include="Plugin.Fingerprint" Version="1.4.6-beta4" /> <PackageReference Include="Plugin.Fingerprint" Version="1.4.6-beta4" />
@ -36,6 +35,10 @@
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.1.47" /> <PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.1.47" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(Configuration)|$(Platform)' != 'FDroid|AnyCPU'">
<PackageReference Include="HockeySDK.Xamarin" Version="5.0.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Resources\AppResources.cs.Designer.cs"> <Compile Update="Resources\AppResources.cs.Designer.cs">
<DependentUpon>AppResources.cs.resx</DependentUpon> <DependentUpon>AppResources.cs.resx</DependentUpon>

View File

@ -112,7 +112,9 @@ namespace Bit.App.Pages
{ {
websiteIconsTable, WebsiteIconsLabel, websiteIconsTable, WebsiteIconsLabel,
totpTable, CopyTotpLabel, totpTable, CopyTotpLabel,
#if !FDROID
analyticsTable, AnalyticsLabel analyticsTable, AnalyticsLabel
#endif
}, },
Spacing = 0 Spacing = 0
}; };

View File

@ -0,0 +1,36 @@
using System;
using Bit.App.Abstractions;
namespace Bit.Android.Services
{
public class NoopGoogleAnalyticsService : IGoogleAnalyticsService
{
public void TrackAppEvent(string eventName, string label = null)
{
}
public void TrackExtensionEvent(string eventName, string label = null)
{
}
public void TrackEvent(string category, string eventName, string label = null)
{
}
public void TrackException(string message, bool fatal)
{
}
public void TrackPage(string pageName)
{
}
public void Dispatch(Action completionHandler = null)
{
}
public void SetAppOptOut(bool optOut)
{
}
}
}

View File

@ -0,0 +1,29 @@
using Newtonsoft.Json.Linq;
using Bit.App.Abstractions;
namespace Bit.App.Services
{
public class NoopPushNotificationListener : IPushNotificationListener
{
public void OnMessage(JObject value, string deviceType)
{
}
public void OnRegistered(string token, string deviceType)
{
}
public void OnUnregistered(string deviceType)
{
}
public void OnError(string message, string deviceType)
{
}
public bool ShouldShowNotification()
{
return false;
}
}
}

View File

@ -0,0 +1,17 @@
using Bit.App.Abstractions;
namespace Bit.App.Services
{
public class NoopPushNotificationService : IPushNotificationService
{
public string Token => null;
public void Register()
{
}
public void Unregister()
{
}
}
}

View File

@ -1,3 +1,4 @@
#if !FDROID
using System.Diagnostics; using System.Diagnostics;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@ -195,3 +196,4 @@ namespace Bit.App.Services
} }
} }
} }
#endif