PM-3350 Removed MAUI Splash Screen. Fixed iOS Privacy Screen logo (hardcoded image to avoid it getting cropped)

This commit is contained in:
Dinis Vieira 2023-10-27 11:41:21 +01:00
parent aaf082faba
commit ca57948d9f
No known key found for this signature in database
GPG key ID: 9389160FF6C295F3
2 changed files with 32 additions and 31 deletions

View file

@ -186,11 +186,6 @@
<ItemGroup> <ItemGroup>
<!-- App Icon --> <!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<MauiSplashScreen Include="Resources\Splash\splash.svg">
<Color>#175DDC</Color>
<BaseSize>128,128</BaseSize>
</MauiSplashScreen>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiImage Include="Resources\cog_settings.svg"> <MauiImage Include="Resources\cog_settings.svg">
@ -229,6 +224,9 @@
<BaseSize>24,24</BaseSize> <BaseSize>24,24</BaseSize>
</MauiImage> </MauiImage>
<MauiImage Include="Resources\yubikey.png" /> <MauiImage Include="Resources\yubikey.png" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<InterfaceDefinition Include="Platforms\iOS\LaunchScreen.storyboard" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'"> <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<ProjectReference Include="..\iOS.Autofill\iOS.Autofill.csproj"> <ProjectReference Include="..\iOS.Autofill\iOS.Autofill.csproj">

View file

@ -1,7 +1,4 @@
using System; using AuthenticationServices;
using System.Collections.Generic;
using System.Threading.Tasks;
using AuthenticationServices;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Pages; using Bit.App.Pages;
using Bit.App.Services; using Bit.App.Services;
@ -11,12 +8,12 @@ using Bit.Core.Abstractions;
using Bit.Core.Enums; using Bit.Core.Enums;
using Bit.Core.Services; using Bit.Core.Services;
using Bit.Core.Utilities; using Bit.Core.Utilities;
using Bit.iOS.Core.Services;
using Bit.iOS.Core.Utilities; using Bit.iOS.Core.Utilities;
using Bit.iOS.Services; using Bit.iOS.Services;
using CoreGraphics;
using CoreNFC; using CoreNFC;
using Foundation; using Foundation;
using Microsoft.Maui.Controls.Compatibility.Platform.iOS; using Microsoft.Maui.Platform;
using UIKit; using UIKit;
using WatchConnectivity; using WatchConnectivity;
@ -77,7 +74,7 @@ namespace Bit.iOS
} }
else if (message.Command is ThemeManager.UPDATED_THEME_MESSAGE_KEY) else if (message.Command is ThemeManager.UPDATED_THEME_MESSAGE_KEY)
{ {
Device.BeginInvokeOnMainThread(() => MainThread.BeginInvokeOnMainThread(() =>
{ {
iOSCoreHelpers.AppearanceAdjustments(); iOSCoreHelpers.AppearanceAdjustments();
}); });
@ -97,7 +94,7 @@ namespace Bit.iOS
} }
else if (message.Command == "showAppExtension") else if (message.Command == "showAppExtension")
{ {
Device.BeginInvokeOnMainThread(() => ShowAppExtension((ExtensionPageViewModel)message.Data)); MainThread.BeginInvokeOnMainThread(() => ShowAppExtension((ExtensionPageViewModel)message.Data));
} }
else if (message.Command == "syncCompleted") else if (message.Command == "syncCompleted")
{ {
@ -193,24 +190,30 @@ namespace Bit.iOS
public override void OnResignActivation(UIApplication uiApplication) public override void OnResignActivation(UIApplication uiApplication)
{ {
var view = new UIView(UIApplication.SharedApplication.KeyWindow.Frame) if (UIApplication.SharedApplication.KeyWindow != null)
{ {
Tag = SPLASH_VIEW_TAG var view = new UIView(UIApplication.SharedApplication.KeyWindow.Frame)
}; {
var backgroundView = new UIView(UIApplication.SharedApplication.KeyWindow.Frame) Tag = SPLASH_VIEW_TAG
{ };
BackgroundColor = ThemeManager.GetResourceColor("SplashBackgroundColor").ToUIColor() var backgroundView = new UIView(UIApplication.SharedApplication.KeyWindow.Frame)
}; {
var logo = new UIImage(!ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png"); BackgroundColor = ThemeManager.GetResourceColor("SplashBackgroundColor").ToPlatform()
var imageView = new UIImageView(logo) };
{ var logo = new UIImage(!ThemeManager.UsingLightTheme ? "logo_white.png" : "logo.png");
Center = new CoreGraphics.CGPoint(view.Center.X, view.Center.Y - 30) var frame = new CGRect(0, 0, 280, 100); //Setting image width to avoid it being larger and getting cropped on smaller devices. This harcoded size should be good even for very small devices.
}; var imageView = new UIImageView(frame)
view.AddSubview(backgroundView); {
view.AddSubview(imageView); Image = logo,
UIApplication.SharedApplication.KeyWindow.AddSubview(view); Center = new CGPoint(view.Center.X, view.Center.Y - 30),
UIApplication.SharedApplication.KeyWindow.BringSubviewToFront(view); ContentMode = UIViewContentMode.ScaleAspectFit
UIApplication.SharedApplication.KeyWindow.EndEditing(true); };
view.AddSubview(backgroundView);
view.AddSubview(imageView);
UIApplication.SharedApplication.KeyWindow.AddSubview(view);
UIApplication.SharedApplication.KeyWindow.BringSubviewToFront(view);
UIApplication.SharedApplication.KeyWindow.EndEditing(true);
}
base.OnResignActivation(uiApplication); base.OnResignActivation(uiApplication);
} }
@ -368,7 +371,7 @@ namespace Bit.iOS
_eventTimer?.Invalidate(); _eventTimer?.Invalidate();
_eventTimer?.Dispose(); _eventTimer?.Dispose();
_eventTimer = null; _eventTimer = null;
Device.BeginInvokeOnMainThread(() => MainThread.BeginInvokeOnMainThread(() =>
{ {
_eventTimer = NSTimer.CreateScheduledTimer(60, true, timer => _eventTimer = NSTimer.CreateScheduledTimer(60, true, timer =>
{ {