diff --git a/appveyor.yml b/appveyor.yml index cdf1dd44e..0297823c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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_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 } + - 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: - 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 diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 7474e6fec..3b464ba98 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -876,15 +876,17 @@ 25.4.0.2 + + + + + 42.1021.1 42.1021.1 - - - diff --git a/src/Android/FirebaseInstanceIdService.cs b/src/Android/FirebaseInstanceIdService.cs index 544e6014b..61028add2 100644 --- a/src/Android/FirebaseInstanceIdService.cs +++ b/src/Android/FirebaseInstanceIdService.cs @@ -1,3 +1,4 @@ +#if !FDROID using System; using Android.App; using Android.Content; @@ -21,3 +22,4 @@ namespace Bit.Android } } } +#endif diff --git a/src/Android/FirebaseMessagingService.cs b/src/Android/FirebaseMessagingService.cs index 1b940e06f..60e3195f6 100644 --- a/src/Android/FirebaseMessagingService.cs +++ b/src/Android/FirebaseMessagingService.cs @@ -1,3 +1,4 @@ +#if !FDROID using System; using Android.App; using Android.Content; @@ -40,3 +41,4 @@ namespace Bit.Android } } } +#endif diff --git a/src/Android/HockeyAppCrashManagerListener.cs b/src/Android/HockeyAppCrashManagerListener.cs index e4b6a6b30..557e02eaa 100644 --- a/src/Android/HockeyAppCrashManagerListener.cs +++ b/src/Android/HockeyAppCrashManagerListener.cs @@ -1,3 +1,4 @@ +#if !FDROID using HockeyApp.Android; using Bit.App.Abstractions; using Newtonsoft.Json; @@ -51,4 +52,5 @@ namespace Bit.Android return true; } } -} \ No newline at end of file +} +#endif diff --git a/src/Android/MainActivity.cs b/src/Android/MainActivity.cs index be2d84886..30a4acd1e 100644 --- a/src/Android/MainActivity.cs +++ b/src/Android/MainActivity.cs @@ -61,8 +61,10 @@ namespace Bit.Android var appIdService = Resolver.Resolve(); var authService = Resolver.Resolve(); +#if !FDROID HockeyApp.Android.CrashManager.Register(this, HockeyAppId, new HockeyAppCrashManagerListener(appIdService, authService)); +#endif Forms.Init(this, bundle); diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs index 067d0bf2b..1d5d68a10 100644 --- a/src/Android/MainApplication.cs +++ b/src/Android/MainApplication.cs @@ -128,7 +128,11 @@ namespace Bit.Android container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); +#if FDROID + container.RegisterSingleton(); +#else container.RegisterSingleton(); +#endif container.RegisterSingleton(); container.RegisterSingleton(); container.RegisterSingleton(); @@ -159,8 +163,13 @@ namespace Bit.Android container.RegisterSingleton(CrossFingerprint.Current); // Push +#if FDROID + container.RegisterSingleton(); + container.RegisterSingleton(); +#else container.RegisterSingleton(); container.RegisterSingleton(); +#endif container.Verify(); Resolver.SetResolver(new SimpleInjectorResolver(container)); diff --git a/src/Android/Services/AndroidPushNotificationService.cs b/src/Android/Services/AndroidPushNotificationService.cs index b6c286cb8..b6f63507f 100644 --- a/src/Android/Services/AndroidPushNotificationService.cs +++ b/src/Android/Services/AndroidPushNotificationService.cs @@ -1,4 +1,5 @@ -using System; +#if !FDROID +using System; using Bit.App; using Bit.App.Abstractions; using Plugin.Settings.Abstractions; @@ -40,3 +41,4 @@ namespace Bit.Android.Services } } } +#endif diff --git a/src/Android/Services/GoogleAnalyticsService.cs b/src/Android/Services/GoogleAnalyticsService.cs index 309551717..8627d0c35 100644 --- a/src/Android/Services/GoogleAnalyticsService.cs +++ b/src/Android/Services/GoogleAnalyticsService.cs @@ -1,4 +1,5 @@ -using System; +#if !FDROID +using System; using Bit.App; using Bit.App.Abstractions; using Plugin.Settings.Abstractions; @@ -80,3 +81,4 @@ namespace Bit.Android.Services } } } +#endif diff --git a/src/App/App.csproj b/src/App/App.csproj index d831cb14b..74a5b445a 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -8,7 +8,7 @@ Debug;Release;FDroid - + TRACE;FDROID;NETSTANDARD2_0 @@ -21,7 +21,6 @@ - @@ -36,6 +35,10 @@ + + + + AppResources.cs.resx diff --git a/src/App/Pages/Settings/SettingsOptionsPage.cs b/src/App/Pages/Settings/SettingsOptionsPage.cs index bf8ed9e3d..1ec087f59 100644 --- a/src/App/Pages/Settings/SettingsOptionsPage.cs +++ b/src/App/Pages/Settings/SettingsOptionsPage.cs @@ -112,7 +112,9 @@ namespace Bit.App.Pages { websiteIconsTable, WebsiteIconsLabel, totpTable, CopyTotpLabel, +#if !FDROID analyticsTable, AnalyticsLabel +#endif }, Spacing = 0 }; diff --git a/src/App/Services/NoopGoogleAnalyticsService.cs b/src/App/Services/NoopGoogleAnalyticsService.cs new file mode 100644 index 000000000..ae00d6d97 --- /dev/null +++ b/src/App/Services/NoopGoogleAnalyticsService.cs @@ -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) + { + } + } +} diff --git a/src/App/Services/NoopPushNotificationListener.cs b/src/App/Services/NoopPushNotificationListener.cs new file mode 100644 index 000000000..793263dfe --- /dev/null +++ b/src/App/Services/NoopPushNotificationListener.cs @@ -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; + } + } +} diff --git a/src/App/Services/NoopPushNotificationService.cs b/src/App/Services/NoopPushNotificationService.cs new file mode 100644 index 000000000..5f9119614 --- /dev/null +++ b/src/App/Services/NoopPushNotificationService.cs @@ -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() + { + } + } +} diff --git a/src/App/Services/PushNotificationListener.cs b/src/App/Services/PushNotificationListener.cs index f7a032fab..ba40a5074 100644 --- a/src/App/Services/PushNotificationListener.cs +++ b/src/App/Services/PushNotificationListener.cs @@ -1,3 +1,4 @@ +#if !FDROID using System.Diagnostics; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -195,3 +196,4 @@ namespace Bit.App.Services } } } +#endif