mirror of
https://github.com/bitwarden/mobile
synced 2026-01-03 17:13:50 +00:00
[PM-3349] [PM-3350] MAUI Migration Initial (#2806)
* PM-3349 PM-3350 MAUI Migration Initial * PM-3349 PM-3350 MAUI Migration fix nullable exception bindings and AsyncCommand canExecute null exception * PM-3349 PM-3350 MAUI Migration fix nullable bindings and fallbacks * PM-3349: Android Added CustomTabbedPageHandler for Android to handle the tab "reselection" for PopToRoot. Commented support for Windows in App.csproj Disabled Interpreter on Android to avoid very slow app in Debug (during Login for example) Added some null checks that were causing crashes (on GeneratorPageVM and PickerVM) Minor TabsPage cleanup * TabBarEffect removed and it's behavior is now taken care of by CustomTabbedPageHandler * PM-3349 PM-3350 Add null checks on CipherDetailsPageVM to avoid crash opening Secure Notes. * PM-3349 PM-3350 MAUI Migration Start iOS extensions * Changes to solution to hopefully fix Config Mappings * PM-3349 Removed Deploy from iOS.Autofill to allow running Android Changed MainApplication SpecialFolder.Personal to SpecialFolder.LocalApplicationData * PM-3350 MAUI Migration Fix iOS Autofill extension * PM-3349 Changed UseMauiApp init so that Android Handlers still get added * PM-3349 Implemented HybridWebViewHandler for Android which enables 2nd factor auth flows Ensured CustomTabbedPageHandler had it's DisconnectHandler called Some minor code upgrades of older obsolete Xamarin Forms code. * PM-3349 Implemented HybridWebViewHandler for iOS * hardcoded AccountViewCell Avatar image to 40x40 to avoid current iOS/Android bugs where they fill much larger space. * PM-3349 PM-3350 Added (migrated) CustomNavigationHandler (which should partially fix the AvatarIcon in the NavBar in iOS) Added (migrated) CustomContentPageHandler (which should mostly place the AvatarIcon in the navBar in the correct place for iOS) Added Task.Delay (workaround) to allow the Avatar to load in iOS on the LoginPage Added workaround for iOS bug with the toolbar size (more info in comment in AvatarImageSource.cs) Went through the AccountViewCell MAUI-Migration comments. (and deleted/added more comments as needed) Migrated some Device calls to DeviceInfo and MainThread Added (migrated) CustomTabbedHandler (for managing the iOS TabBar) * PM-3349 Replaced the FabShadowEffect with the new MAUI Shadow to fix the buggy shadows on the Android Fab Button. * PM-3349 ToolbarHandler created for setting text on Android go back buttons. * PM-3350 Migrated the CustomViewCellRenderer for iOS * PM-3350 Removed ButtonHandlerMappings and some other code related with fonts as MAUI is taking care of Accessibility and no custom code should be needed Migrated SelectableLabelRenderer to Handler Cleaned LabelHandlerMappings and added logic to migrate the CustomLabelRenderer * Enabled argon2Id for iOS * PM-3349 Added Argon libraries for Android minor change to gitignore so that the Argon x86 lib is not ignored on the Android platform * PM-3350 Migrated some Device to DeviceInfo and added temporary workaround with some comments to be able to see the Generated Password on iOS * PM-3350 Added some missing images in iOS * PM-3349 PRM-3350 Replaced XZing with Camera.MAUI for QRCodes * Checked some [MAUI-Migration] and deleted when it's working as intended. SearchBarHandlerMapping: IME options working as intended SliderHandlerMappings: The MAUI "replacement" for Color.Default seems to be White so the old use case doesn't seem to be needed anymore. * PM-3350 Checked some [MAUI-Migration] and changed as needed. TimePickerHandlerMappings: Remove old code for forcing the Wheel. After testing without it wheel picker is still used so this code shouldn't be needed anymore. AppDelegate.ContinueUserActivity: Uncommented and changed the iOS ContinueUserActivity. It needs to call Platform.ContinueUserActivity according with Xamarin Essentials migration docs. * PM-3349 Fixed white tint color not appearing on images added as MAU IImage SVG PM-3349 PM-3350 Fix for Avatar text not adjusting to white/black color correctly * PM-3350 Removed MAUI Splash Screen. Fixed iOS Privacy Screen logo (hardcoded image to avoid it getting cropped) * PM-3350 Quick workaround to allow 2nd factor auth to not get stuck in iOS in modals. Updated some older "Device" code to the newer MAUI code. * PM-3350 Removed duplicate reference to LaunchScreen.storyboard * PM-3349 PM-3350 Minor change to HomePage to set fixed Image height otherwise it takes more space than it did in the old Xamarin Forms app. Added HIdeSoftInputOnTapped on several pages (the ones with Entry controls) to allow hiding the keyboard when tapping "outside" of it. (just like we did in Xamarin Forms app) * PM-3350 Added Scrollview on HomePage so that the "Create account" button can be accessed in smaller devices like iPhone SE. * PM-3349 Added Handler that enables the ExtendedDatePicker to get IsFocused events in Android. This is a workaround for fixing the current bug where it's not possible to select the "current day" in the expiration date of a Send. Fix for TimePicker not displaying default Time Value Updated some "Device" code to the new MAUI "DeviceInfo" * PM-3349 PM-3350 Migrated IconLabelButton Frames to Borders to fix issue with TapGestureRecognizer in Android Also fixed some minor "styles" for normal Button and IconLabelButton (both Android and iOS) * PM-3349 Fix for TabGestureRecognizer not working inside the StackLayout area of IconLabelButton * PM-3349 Fix for Android buttons having all letters in Caps * PM-3349 PM-3350 Started using OnNavigatedTo/From instead of On(Dis)Appearing for LoginPage and LoginSSOPage to avoid the "Modal loading" issues in iOS Also had to add IsInitialized logic to these pages because OnNavigatedTo can be called twice in some scenario. Some minor migrations of Device to DeviceInfo was also done * PM-3350 Fixed iOS extensions (iOS.Extension and iOS.ShareExtension) to load and commented argon2id from debug configuration until we have the .a compiled again with the new platform/arch * PM-3350 Added configurations for Release mode (no FDroid yet) * PM-3349 PM-3350 Migrated remaining AutomationProperties to SemanticProperties. All 'IsInAccessibleTree="True"' were deleted. 'IsInAccessibleTree="False"' were kept and stayed in code. * PM-3349 PM-3350 Changed binding set for CipherViewCell so it updates accordingly * PM-3349 PM-3350 Changed AccountViewCell and its binding to be directly against the ViewModel * PM-3349 Fix for HTML Label on Android. Color hex doesn't need to be cropped anymore. * PM-3350 Fix for colored html text on iOS * PM-3349 PM-3350 Added the partial MAUI Community Toolkit implementation for TouchEffect. This is a temporary solution until they finalize this and add it to their nuget package. This allows implementing the LongPressCommand in AccountSwitchingOverlay and also have the "Ripple effect" animation when touching an item in Android * PM-3349 PM-3350 Changed SendViewCell and its binding to be directly against the ViewModel * PM-3350 Fixed iOS Share extension lazy views loading and an issue with the avatar loading. Also discovered issue with TapGestureRecognizer not working on MAUI Embedding * PM-3350 Fixed iOS Extensions navigation to several pages and improved avoiding duplicate calls to OnNavigatedTo * PM-3350 Updated PCL Crypto to latest alpha version to fix "Dll not found NCrypt" issue * PM-3350 Removed workaround for iOS issue with Avatar icon as it's now fixed in latest .Net8 release. * PM-3349 PM-3350 Removed AsyncCommand "wrapper" and added AsyncRelayCommand directly in all ViewModels that were using the other one. * PM-3350 Added watchOS app to main project and fixed some csproj conditions for runtime identifiers on iOS. * PM-3350 Fixed/Updated all MAUI-Migration TODOs * PM-3350 Fixed account toolbar item and TitleView on SendAddOnlyPage, also removed comments on AvatarImageSource given the workaround is not needed anymore to draw the image successfully. * PM-3350 Updated AppCenter package to latest version 5.0.3 and updated some things into MAUI style * PM-3350 Added workaround for iOS Avatar icon again. * PM-3349 Added workaround for Android to avoid issues with setting MainPage when app is in background. They are now kept on a Queue to be executed after the app has resumed. Updated some things on App.xaml.cs to the new MAUI style * PM-3349 PM-3350 Fixed issue where creating an account with weak/exposed password would get stuck after the Captcha (if a captcha is shown) Changed App.xaml.cs NavigateImpl to be private * PM-3349 Started to configure build.yml for MAUI Android * PM-3349 build.yml update paths for MAUI Android * PM-3349 build.yml commented verify format and just set qa as variant on MAUI Android for faster checks on CI * PM-3349 PM-3350 build.cake updated paths * PM-3349 build.yml updated env helpers variables and set specific csproj to build on Android so not to build iOS extensions * PM-3349 build.yml add Android "prod" variant * PM-3350 build.yml updated iOS build and ignore Android build to try the CI faster * PM-3350 build.yml changed nuget restore for dotnet restore on iOS build to fix issue on restoring due to msbuild * PM-3350 build.yml Upgraded iOS build to run on macos-13 image which has XCode 15, and set the XCode 15 version as currently the default one is 14.x * PM-3350 build.yml try to fix ILLINK warnings and changed image to be macos-13-arm64 to see if the build is faster * PM-3350 build.yml changed image back to be macos-13 to see if the build is faster * PM-3350 Added Document.Build.props to disable trimming on publish * PM-3350 build.yml disable trimming on publish so it's faster * PM-3350 added linkskip for iOS csprojs * PM-3350 iOS projs disable linking and set Newstandkit as weak framework * Update build.yml disabling iOS job to avoid long running process of publish until we can fix that * PM-3349 PM-3350 Workaround to fix issues with text getting cropped/truncated when a Label has both Multiline and LinebreakMode set * PM-3349 build.yml enabled android build workflow * PM-3349 build.yml configured FDROID job for MAUI * PM-3350 iOS extensions TapGestureRecognizer try Window workaround * PM-3350 iOS applied workaround on the iOS Autofill and Share extension to maui embed the navigation page with its content page in the Window * PM-3349 PM-3350 Added workaround for More Options to work on Search and Groupings Page Updated some code to MAUI Style also * PM-3349 PM-3350 Added the ability for users to press "Continue" button as a fallback when using the Yubikey if the "SubmitCommand" doesn't trigger automatically. * PM-3349 PM-3350 Fix for text getting cut/truncated in both account switcher and ciphers/search lists Issue is due to MAUI but can be avoided by using slightly different layout * PM-3350 iOS updated CFBundlerShortVersionString to latest one 2023.10.1 * PM-3350 fix build.yml Bitwarden.ipa AppStore exported file * PM-3350 build.yml added step to validate app for submitting into App Store and have better logs of it * PM-3350 build.yml Added several fixes like not using MtouchUseLLVM on the iOS builds to fix they taking forever to build and some changes on the automation CI to do a debug build for the moment * PM-3350 Improved MTouch linking and extra args on iOS related csprojs * PM-3349 PM-3350 Added MAUI label on self-host settings and on about settings to differentiate from XF app * PM-3349 PM-3350 build.yml uncommented jobs so we have a more complete workflow * PM-3349 PM-3350 Minor change: removed unneeded HorizontalTextAlignment from Label. * PM-3349 Replaced CrossCurrentActivity plugin with MAUI internal CurrentActivity * PM-3350 Fix iOS extensions navigation and Window/RootViewController handling for TapGestureRecognizer to work * PM-3350 Cleared left ClipLogger from the iOS extensions debug logging. * PM-3349 PM-3350 Refactored cipher bindings to have a simpler approach reusing a new CipherItemViewModel to avoid unwanted issues in the app * PM-3349 Added base structure for avoiding Android Autofill crash. This workaround works but it's not complete as it can't handle the entire workflow when showing CipherSelectionPAge (like checking if it should show LockPage) * PM-3350 Bumped iOS version * PM-3350 Changed linker to use default mode given that "Full" is presenting some problems as the linker is stripping things it shouldn't and we're trying to solve it. So for now we will use the mode "Link SDK assemblies only" so QA can test. * PM-3349 Fix for app crashing on Android when Dark mode is enabled Removed unused button style for android * Proof of concept for having multiple window in Android for autofill support and navigating with the help of an Extended splash page. * PM-3350 Fix crash on Release by adding Interpreter on iOS and also adding System.Security.Cryptography to be ignored by the linker * PM-3350 Apply Cryptography TrimmerRootAssembly only to iOS * PM-3350 Updated Plugin.Fingerprint so biometrics work * Update .github/workflows/build.yml setup-xcode commit hash Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * PM-3349 PM-3350 Enabled argon2id and fixed one issue with the Uris when getting the icon image * PM-3349 Upgraded Android targetSdkVersion to 34 * minor change (public to private fields) * minor improvemments on autofill-redirect * PM-3349 Commented the Deploy step for Android job given that we're using the hotfix-rc branch for testing iOS on TestFlight * PM-3349 Uncommented the Deploy step for Android job * PM-3349 Ensure "_isResumed=true" is set on App.xaml.cs:Bootstrap * Reusing App.xaml.cs Navigation for the Android RedirectPage Some other cleanup and changes * Improved autofill workaround to better handle switching between windows. * PM-3349 minor fix to add space in HomePage between the region picker labels. * Added some comments and improvemments. * PM-3349 Added Window events unsubscription of events. Also changed code to avoid potentially having multiple autofillwindow * PM-3349 Minor ui fix (space between buttons in delete account page) * initial commit of android credential provider service (wip) * Revert "initial commit of android credential provider service (wip)" This reverts commit6011b63958. * PM-3350 Fix for Delete Account buttons on iOS * PM-3349 PM-3350 Changed search icon used in app to avoid issue with icon size on iOS * PM-3349 Added custom window so that we can always get the current Active Window. This is used to support the Android Autofil and multi-window scenarios. * PM-3349 Fix for icon and text spacing in some list items * PM-3349 Minor aligment improvemment for region selection in HomePage * PM-3349 Changed the "track color" for the Android switch so that the color is different from the "thumb" * PM-3350 Updated version to 2024.1.0 on iOS * PM-3349 Fix Picker selection style by doing a custom PickerHandler for Android which uses SetSingleChoiceItems(...) to provide with the appropriate UI * PM-3350 Updated MauiVersion to 8.0.4-nightly.* to have the TapGestureRecognizer fix applied. This is done on the Directory.Build.props so we don't have to change it on every csproj. Also removed the workaround of TapGestureHack and fix the Show environment picker to work on the extensions as well. * PM-3350 Added nuget.config so we add the nuget package source for MAUI Nightly builds * Bump main iOS version * PM-3350 Removed "iOS" old folder project that has been moved into the MAUI Single app project. * PM-3350 Improved code safety adding a lot of try...catch and logging throughout the app. Also made the invoking on main thread safer on several places of the app. Additionally, on the GroupingsPageViewModel changed the code removing the old Xamarin hack and just using Replace directly instead of Clearing first to see if that fixes the crash we're having sometimes on the app. * PM-3350 PM-3349 Updated Unit Test projects to NET 8.0 and fixed it to work with Core project reference. Also fixed a test that was breaking due to CIpherKey creation being wrong. Added "UT" as a constant to add when building/running Core.Test project so we have something on the context that tells us that is for a UT. With this I had to remove FFImageLoading on UT context because it doesn't support NET 8.0 * PM-3350 PM-3349 Updated Readme with MAUI and main branch * PM-3350 PM-3349 Enable running Core tests * PM-3350 Fix build.yml format * PM-3349 Fix navigation when coming from autofill with Accessibility Services enabled. The user was getting into Home page instead of where they were, with this workaround the app navigates as if the account has been switched, leaving the user as closely as possible to where they were, basically on the first screen for the current state of the user. * PM-3350 PM-3349 Added property to Directory.Build.props to enable Unit Testing globally so Test runners work * Improve TOTP scan performance on Android * Move Android camera/scan changes to xaml * PM-3350 Testing UseInterpreter false on CI build * PM-3350 Enabled back UseInterpreter on iOS Release given that it crashes on startup without it. * PM-3349 PM-3350 Improved code safety with try...catch, better invoke on main thread and better null handling. * PM-3349 PM-3350 Updated XCode version on build.yml to 15.1 * PM-3350 Removed TapGesture Window MAUI hack from iOS.Extension and iOS.ShareExtension * PM-3350 Fixed CancellationTokenSource proper disposal * PM-3350 Fix Avatar toolbar icon on extensions to load properly and to take advantage of using directly SkiaSharp to do the native conversion to UIImage. Also improved the toolbar item so that size is set appropriately. * PM-3349 PM-3350 Fix external link icon * PM-3350 Added new style to prevent spell check and text prediction * Fix merge from main * PM-3350 Commented event collection upload on the timer and when sending the app to background to see if that prevents the app from crashing on release mode. * PM-3350 Added check for state migration version before trying to migrate LiteDB values into Prefs when there's no need to and that may be inducing crashes on backgrounded iOS apps. * PM-3350 Try to disable Interpreter to have better crash knowledge. This time testing if avoiding loading the argon2id lib we're able to not use the interpreter. * PM-5928 Fix circle animation to be shown on verification codes list on each item * PM-3350 Go back to use Interpreter and added some Directory.Build.props to easily change Codesign properties and also include/exclude iOS extensions / WatchOS from the build. * PM-3350 Enabled iOS extensions and WatchOS app to be included based on the Directory.Build.props * PM-3350 Go back to include argon2id and interpreter * Removing error/loading placeholders of icons on the cells to see if that is causing the background crash on iOS; so we can test this in TestFlight * [PM-5910] Workaround for for sliding elements in Duo 2FA flow (#2967) * workaround for sliding elements in duo 2fa flow * restrict workaround to Android * restrict workaround to Android * Revert "restrict workaround to Android" This reverts commitc2753d5dc4. * Revert "restrict workaround to Android" This reverts commit69688cfb98. * PM-5902 fix for account switcher not dismissing when tapping outside (#2974) * PM-3350 Fix iossimulator-x64 argon2id load so we can test on simulators and also made easier to maintain loading the argon2id library on the iOS projects by setting a general Directory.Build.props that is shared. * PM-5903 Changed App.xaml.cs SetOption to only update the needed properties instead of replacing the existing Options object which would cause the AccountSwitcher button bug (#2973) * [PM-5896] Fix MAUI iOS Background crash due to lock files on suspension (#2969) * PM-5896 Fix background crash on iOS due to lock files when app gets suspended. Changed loading and error placeholders of the CachedImage to not be used and use default icon of IconLabel instead changing visibility. * PM-5896 Changed methods to be protected so that they don't get removed by the linker. * PM-5896 Added stub class and references to it so to have stronger references to Icon_Success and Icon_Error so the linker doesn't remove them. * PM-3349 Removed commented code from build.yml regarding FDroid that is not needed anymore. * PM-6077 Separated Android and iOS HybridWebViewHandler so that it can be used on iOS.Core (#2983) * [PM-5907] Fix for incorrect TOTP white text color on label when using light theme on iOS (#2982) * PM-5907 workaround for incorrect textcolor when programmatically changing text on Entry * Update src/Core/Pages/Vault/CipherAddEditPage.xaml.cs Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * [PM-5906] Fix for incorrect Send MaxAccess white text color on label when using light theme on iOS (#2981) * PM-5906 workaround for incorrect textcolor when programmatically changing text on Entry * Update src/Core/Pages/Send/SendAddEditPage.xaml.cs Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> --------- Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> * PM-3349 PM-3350 Fixed Unit tests because of referencing FFImageLoading when it's not possible --------- Co-authored-by: Dinis Vieira <dinisvieira@outlook.com> Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> Co-authored-by: mpbw2 <59324545+mpbw2@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f30158adf5
commit
39a34bd8c4
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
@@ -15,8 +15,7 @@ using Bit.iOS.Core.Utilities;
|
||||
using Bit.iOS.Core.Views;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using Xamarin.Essentials;
|
||||
using Xamarin.Forms;
|
||||
using Microsoft.Maui.Controls.Compatibility;
|
||||
|
||||
namespace Bit.iOS.Core.Controllers
|
||||
{
|
||||
@@ -205,7 +204,18 @@ namespace Bit.iOS.Core.Controllers
|
||||
var tasks = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(500);
|
||||
NSRunLoop.Main.BeginInvokeOnMainThread(async () => await PromptBiometricAsync());
|
||||
NSRunLoop.Main.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await PromptBiometricAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(ex);
|
||||
throw;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
||||
using AuthenticationServices;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Abstractions;
|
||||
@@ -17,7 +17,7 @@ using Bit.iOS.Core.Utilities;
|
||||
using Bit.iOS.Core.Views;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Microsoft.Maui.Controls.Compatibility;
|
||||
|
||||
namespace Bit.iOS.Core.Controllers
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ using Foundation;
|
||||
using UIKit;
|
||||
using CoreGraphics;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using Bit.iOS.Core.Effects;
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportEffect(typeof(NoEmojiKeyboardEffect), nameof(NoEmojiKeyboardEffect))]
|
||||
namespace Bit.iOS.Core.Effects
|
||||
{
|
||||
public class NoEmojiKeyboardEffect : PlatformEffect
|
||||
@@ -22,4 +18,3 @@ namespace Bit.iOS.Core.Effects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
using Bit.iOS.Core.Effects;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ResolutionGroupName("Bitwarden")]
|
||||
[assembly: ExportEffect(typeof(ScrollEnabledEffect), "ScrollEnabledEffect")]
|
||||
namespace Bit.iOS.Core.Effects
|
||||
{
|
||||
public class ScrollEnabledEffect : PlatformEffect
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
// this can be for any view that inherits from UIScrollView like UITextView.
|
||||
if (Element != null && Control is UIScrollView scrollView)
|
||||
{
|
||||
scrollView.ScrollEnabled = App.Effects.ScrollEnabledEffect.GetIsScrollEnabled(Element);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetached()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Bit.iOS.Core.Effects;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportEffect(typeof(ScrollViewContentInsetAdjustmentBehaviorEffect), nameof(ScrollViewContentInsetAdjustmentBehaviorEffect))]
|
||||
namespace Bit.iOS.Core.Effects
|
||||
{
|
||||
public class ScrollViewContentInsetAdjustmentBehaviorEffect : PlatformEffect
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
if (Element != null && Control is UIScrollView scrollView)
|
||||
{
|
||||
switch (App.Effects.ScrollViewContentInsetAdjustmentBehaviorEffect.GetContentInsetAdjustmentBehavior(Element))
|
||||
{
|
||||
case App.Effects.ScrollContentInsetAdjustmentBehavior.Automatic:
|
||||
scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Automatic;
|
||||
break;
|
||||
case App.Effects.ScrollContentInsetAdjustmentBehavior.ScrollableAxes:
|
||||
scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.ScrollableAxes;
|
||||
break;
|
||||
case App.Effects.ScrollContentInsetAdjustmentBehavior.Never:
|
||||
scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Never;
|
||||
break;
|
||||
case App.Effects.ScrollContentInsetAdjustmentBehavior.Always:
|
||||
scrollView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Always;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetached()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using System.Reflection;
|
||||
using Foundation;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
using ContentView = Microsoft.Maui.Platform.ContentView;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ContentPage), typeof(CustomContentPageRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class CustomContentPageRenderer : PageRenderer
|
||||
public partial class CustomContentPageHandler : PageHandler
|
||||
{
|
||||
public override void ViewWillAppear(bool animated)
|
||||
private Page? _page;
|
||||
|
||||
protected override void ConnectHandler(ContentView platformView)
|
||||
{
|
||||
base.ViewWillAppear(animated);
|
||||
if (!(Element is ContentPage contentPage) || NavigationController == null)
|
||||
if (VirtualView is Page page)
|
||||
{
|
||||
return;
|
||||
_page = page;
|
||||
_page.Loaded += Page_Loaded;
|
||||
}
|
||||
|
||||
base.ConnectHandler(platformView);
|
||||
}
|
||||
|
||||
private void Page_Loaded(object? sender, EventArgs e)
|
||||
{
|
||||
//Workaround: We can't use DisconnectHandler to dispose as we would have to call it manually from "outside" this class. So we unregister the event and set the page to null here. (it's very unlikely it would be called anyway)
|
||||
if (_page != null)
|
||||
{
|
||||
_page.Loaded -= Page_Loaded;
|
||||
_page = null;
|
||||
|
||||
var navController = ViewController?.NavigationController;
|
||||
if (navController?.NavigationBar != null)
|
||||
{
|
||||
CustomizeNavBar(navController);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CustomizeNavBar(UINavigationController navigationController)
|
||||
{
|
||||
// Hide bottom line under nav bar
|
||||
var navBar = NavigationController.NavigationBar;
|
||||
if (navBar != null)
|
||||
{
|
||||
navBar.SetValueForKey(FromObject(true), new Foundation.NSString("hidesShadow"));
|
||||
}
|
||||
var navBar = navigationController.NavigationBar;
|
||||
navBar.SetValueForKey(NSObject.FromObject(true), new Foundation.NSString("hidesShadow"));
|
||||
|
||||
var navigationItem = NavigationController.TopViewController.NavigationItem;
|
||||
var navigationItem = navigationController.TopViewController.NavigationItem;
|
||||
var leftNativeButtons = (navigationItem.LeftBarButtonItems ?? new UIBarButtonItem[] { }).ToList();
|
||||
var rightNativeButtons = (navigationItem.RightBarButtonItems ?? new UIBarButtonItem[] { }).ToList();
|
||||
var newLeftButtons = new List<UIBarButtonItem>();
|
||||
@@ -60,4 +77,4 @@ namespace Bit.iOS.Core.Renderers
|
||||
navigationItem.LeftBarButtonItems = newLeftButtons.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,12 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using Bit.App.Controls;
|
||||
using CoreFoundation;
|
||||
using System.ComponentModel;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class CustomNavigationRenderer : NavigationRenderer
|
||||
//This is a Compatibility version of the NavigationRenderer. Eventually we should see if there's a better way to implement this behavior.
|
||||
public class CustomNavigationHandler : Microsoft.Maui.Controls.Handlers.Compatibility.NavigationRenderer
|
||||
{
|
||||
public override void PushViewController(UIViewController viewController, bool animated)
|
||||
{
|
||||
@@ -39,7 +34,7 @@ namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
foreach (ExtendedToolbarItem toolbarItem in toolbarItems.Where(t => t is ExtendedToolbarItem eti
|
||||
&&
|
||||
eti.UseOriginalImage))
|
||||
@@ -84,4 +79,4 @@ namespace Bit.iOS.Core.Renderers
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,27 @@
|
||||
using System;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Microsoft.Maui.Controls.Handlers.Compatibility;
|
||||
using Microsoft.Maui.Controls.Platform;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(TabbedPage), typeof(CustomTabbedRenderer))]
|
||||
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class CustomTabbedRenderer : TabbedRenderer
|
||||
public partial class CustomTabbedHandler : TabbedRenderer
|
||||
{
|
||||
private IBroadcasterService _broadcasterService;
|
||||
private UITabBarItem _previousSelectedItem;
|
||||
private UITabBarItem? _previousSelectedItem;
|
||||
|
||||
public CustomTabbedRenderer()
|
||||
public CustomTabbedHandler()
|
||||
{
|
||||
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
|
||||
_broadcasterService.Subscribe(nameof(CustomTabbedRenderer), (message) =>
|
||||
_broadcasterService.Subscribe(nameof(CustomTabbedHandler), (message) =>
|
||||
{
|
||||
if (message.Command is ThemeManager.UPDATED_THEME_MESSAGE_KEY)
|
||||
{
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
MainThread.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
iOSCoreHelpers.AppearanceAdjustments();
|
||||
UpdateTabBarAppearance();
|
||||
@@ -47,9 +42,12 @@ namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
base.ViewDidAppear(animated);
|
||||
|
||||
if (SelectedIndex < TabBar.Items.Length)
|
||||
if(TabBar?.Items != null)
|
||||
{
|
||||
_previousSelectedItem = TabBar.Items[SelectedIndex];
|
||||
if (SelectedIndex < TabBar.Items.Length)
|
||||
{
|
||||
_previousSelectedItem = TabBar.Items[SelectedIndex];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +64,7 @@ namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_broadcasterService.Unsubscribe(nameof(CustomTabbedRenderer));
|
||||
_broadcasterService.Unsubscribe(nameof(CustomTabbedHandler));
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
@@ -74,8 +72,7 @@ namespace Bit.iOS.Core.Renderers
|
||||
private void UpdateTabBarAppearance()
|
||||
{
|
||||
// https://developer.apple.com/forums/thread/682420
|
||||
var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
|
||||
if (deviceActionService.SystemMajorVersion() >= 15)
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion(15,0))
|
||||
{
|
||||
var appearance = new UITabBarAppearance();
|
||||
appearance.ConfigureWithOpaqueBackground();
|
||||
@@ -1,19 +1,16 @@
|
||||
using Bit.App.Utilities;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ViewCell), typeof(CustomViewCellRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class CustomViewCellRenderer : ViewCellRenderer
|
||||
//This is a Compatibility version of the ViewCellRenderer. Eventually we should see if there's a better way to implement this behavior.
|
||||
public class CustomViewCellHandler : Microsoft.Maui.Controls.Handlers.Compatibility.ViewCellRenderer
|
||||
{
|
||||
private bool _noSelectionStyle = false;
|
||||
|
||||
public CustomViewCellRenderer()
|
||||
public CustomViewCellHandler()
|
||||
{
|
||||
_noSelectionStyle = ThemeManager.GetResourceColor("BackgroundColor") != Color.White;
|
||||
_noSelectionStyle = !(ThemeManager.GetResourceColor("BackgroundColor").Equals(Colors.White));
|
||||
}
|
||||
|
||||
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
|
||||
39
src/iOS.Core/Handlers/DatePickerHandlerMappings.cs
Normal file
39
src/iOS.Core/Handlers/DatePickerHandlerMappings.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Bit.App.Controls;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class DatePickerHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
DatePickerHandler.Mapper.AppendToMapping("CustomDatePickerHandler", (handler, datePicker) =>
|
||||
{
|
||||
if (datePicker is ExtendedDatePicker extDatePicker)
|
||||
{
|
||||
// center text
|
||||
handler.PlatformView.TextAlignment = UITextAlignment.Center;
|
||||
|
||||
// use placeholder until NullableDate set
|
||||
if (!extDatePicker.NullableDate.HasValue)
|
||||
{
|
||||
handler.PlatformView.Text = extDatePicker.PlaceHolder;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
DatePickerHandler.Mapper.AppendToMapping(nameof(IDatePicker.Date), UpdateTextPlaceholderOnFormatLikePlacholder);
|
||||
|
||||
DatePickerHandler.Mapper.AppendToMapping(nameof(IDatePicker.Format), UpdateTextPlaceholderOnFormatLikePlacholder);
|
||||
}
|
||||
|
||||
private static void UpdateTextPlaceholderOnFormatLikePlacholder(IDatePickerHandler handler, IDatePicker datePicker)
|
||||
{
|
||||
if (datePicker is ExtendedDatePicker extDatePicker && extDatePicker.Format == extDatePicker.PlaceHolder)
|
||||
{
|
||||
handler.PlatformView.Text = extDatePicker.PlaceHolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/iOS.Core/Handlers/EditorHandlerMappings.cs
Normal file
35
src/iOS.Core/Handlers/EditorHandlerMappings.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class EditorHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
EditorHandler.Mapper.AppendToMapping("CustomEditorHandler", (handler, editor) =>
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
handler.PlatformView.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||
// Remove padding
|
||||
handler.PlatformView.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
|
||||
handler.PlatformView.TextContainer.LineFragmentPadding = 0;
|
||||
UpdateTintColor(handler, editor);
|
||||
|
||||
if (!Utilities.ThemeHelpers.LightTheme)
|
||||
{
|
||||
handler.PlatformView.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
});
|
||||
|
||||
EditorHandler.Mapper.AppendToMapping(nameof(IEditor.TextColor), UpdateTintColor);
|
||||
}
|
||||
|
||||
private static void UpdateTintColor(IEditorHandler handler, IEditor editor)
|
||||
{
|
||||
// Note: the default black value is to avoid an error on the iOS extensions while lazy loading a view
|
||||
handler.PlatformView.TintColor = editor.TextColor.ToPlatform(Colors.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/iOS.Core/Handlers/EntryHandlerMappings.cs
Normal file
34
src/iOS.Core/Handlers/EntryHandlerMappings.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class EntryHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
EntryHandler.Mapper.AppendToMapping("CustomEntryHandler", (handler, entry) =>
|
||||
{
|
||||
handler.PlatformView.ClearButtonMode = UITextFieldViewMode.WhileEditing;
|
||||
UpdateTintColor(handler, entry);
|
||||
iOSHelpers.SetBottomBorder(handler.PlatformView);
|
||||
|
||||
if (!ThemeHelpers.LightTheme)
|
||||
{
|
||||
handler.PlatformView.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
});
|
||||
|
||||
EntryHandler.Mapper.AppendToMapping(nameof(IEntry.TextColor), UpdateTintColor);
|
||||
}
|
||||
|
||||
private static void UpdateTintColor(IEntryHandler handler, IEntry entry)
|
||||
{
|
||||
// Note: the default black value is to avoid an error on the iOS extensions while lazy loading a view
|
||||
handler.PlatformView.TintColor = entry.TextColor.ToPlatform(Colors.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
93
src/iOS.Core/Handlers/HybridWebViewHandler.cs
Normal file
93
src/iOS.Core/Handlers/HybridWebViewHandler.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Bit.App.Controls;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using WebKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class HybridWebViewHandler : ViewHandler<HybridWebView, WebKit.WKWebView>
|
||||
{
|
||||
private const string JSFunction =
|
||||
"function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}";
|
||||
|
||||
private WKUserContentController _userController;
|
||||
|
||||
public static PropertyMapper<HybridWebView, HybridWebViewHandler> PropertyMapper = new PropertyMapper<HybridWebView, HybridWebViewHandler>(ViewHandler.ViewMapper)
|
||||
{
|
||||
[nameof(HybridWebView.Uri)] = MapUri
|
||||
};
|
||||
|
||||
public HybridWebViewHandler() : base(PropertyMapper)
|
||||
{
|
||||
}
|
||||
|
||||
public HybridWebViewHandler([NotNull] IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override WKWebView CreatePlatformView()
|
||||
{
|
||||
_userController = new WKUserContentController();
|
||||
var script = new WKUserScript(new NSString(JSFunction), WKUserScriptInjectionTime.AtDocumentEnd, false);
|
||||
_userController.AddUserScript(script);
|
||||
_userController.AddScriptMessageHandler(new WebViewScriptMessageHandler(InvokeAction), "invokeAction");
|
||||
|
||||
var config = new WKWebViewConfiguration { UserContentController = _userController };
|
||||
var webView = new WKWebView(CGRect.Empty, config);
|
||||
return webView;
|
||||
}
|
||||
|
||||
public static void MapUri(HybridWebViewHandler handler, HybridWebView view)
|
||||
{
|
||||
if (handler != null && view?.Uri != null)
|
||||
{
|
||||
handler?.PlatformView?.LoadRequest(new NSUrlRequest(new NSUrl(view.Uri)));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ConnectHandler(WKWebView platformView)
|
||||
{
|
||||
if (VirtualView?.Uri != null)
|
||||
{
|
||||
platformView?.LoadRequest(new NSUrlRequest(new NSUrl(VirtualView?.Uri)));
|
||||
}
|
||||
base.ConnectHandler(platformView);
|
||||
}
|
||||
|
||||
protected override void DisconnectHandler(WKWebView platformView)
|
||||
{
|
||||
_userController.RemoveAllUserScripts();
|
||||
_userController.RemoveScriptMessageHandler("invokeAction");
|
||||
platformView?.Dispose();
|
||||
VirtualView?.Cleanup();
|
||||
_userController = null;
|
||||
|
||||
base.DisconnectHandler(platformView);
|
||||
}
|
||||
|
||||
private void InvokeAction(WKScriptMessage message)
|
||||
{
|
||||
if(message?.Body != null)
|
||||
{
|
||||
VirtualView?.InvokeAction(message.Body.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class WebViewScriptMessageHandler : NSObject, IWKScriptMessageHandler
|
||||
{
|
||||
private Action<WKScriptMessage> _messageReceivedAction;
|
||||
|
||||
public WebViewScriptMessageHandler(Action<WKScriptMessage> messageReceivedAction)
|
||||
{
|
||||
_messageReceivedAction = messageReceivedAction ?? throw new ArgumentNullException(nameof(messageReceivedAction));
|
||||
}
|
||||
|
||||
public void DidReceiveScriptMessage(WKUserContentController userContentController, WKScriptMessage message)
|
||||
{
|
||||
_messageReceivedAction(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
37
src/iOS.Core/Handlers/LabelHandlerMappings.cs
Normal file
37
src/iOS.Core/Handlers/LabelHandlerMappings.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Bit.App.Controls;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class LabelHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(ILabel.AutomationId), (handler, label) =>
|
||||
{
|
||||
if (label is CustomLabel customLabel)
|
||||
{
|
||||
handler.PlatformView.AccessibilityIdentifier = customLabel.AutomationId;
|
||||
}
|
||||
});
|
||||
|
||||
// WORKAROUND: There is an issue causing Multiline Labels that also have a LineBreakMode to not display text properly. (it truncates text on first line even with space available)
|
||||
// MAUI Github Issue: https://github.com/dotnet/maui/issues/14125 and https://github.com/dotnet/maui/pull/14918
|
||||
// When this gets fixed by MAUI these two Mapping below can be deleted, same for the UpdateMaxLines, TruncatedMultilineCustomLabel class and the equivalent Mappings on Android
|
||||
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(Label.LineBreakMode), UpdateMaxLines);
|
||||
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(Label.MaxLines), UpdateMaxLines);
|
||||
}
|
||||
|
||||
private static void UpdateMaxLines(ILabelHandler handler, ILabel label)
|
||||
{
|
||||
var textView = handler.PlatformView;
|
||||
if(label is TruncatedMultilineCustomLabel controlsLabel
|
||||
&& textView.LineBreakMode == UILineBreakMode.TailTruncation
|
||||
&& controlsLabel.MaxLines != -1)
|
||||
{
|
||||
textView.Lines = controlsLabel.MaxLines;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/iOS.Core/Handlers/PickerHandlerMappings.cs
Normal file
24
src/iOS.Core/Handlers/PickerHandlerMappings.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class PickerHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
PickerHandler.Mapper.AppendToMapping("CustomPickerHandler", (handler, picker) =>
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
handler.PlatformView.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||
iOSHelpers.SetBottomBorder(handler.PlatformView);
|
||||
|
||||
if (!ThemeHelpers.LightTheme)
|
||||
{
|
||||
handler.PlatformView.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
20
src/iOS.Core/Handlers/SearchBarHandlerMappings.cs
Normal file
20
src/iOS.Core/Handlers/SearchBarHandlerMappings.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class SearchBarHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
SearchBarHandler.Mapper.AppendToMapping("CustomSearchBarHandler", (handler, searchBar) =>
|
||||
{
|
||||
if (!ThemeHelpers.LightTheme)
|
||||
{
|
||||
handler.PlatformView.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
62
src/iOS.Core/Handlers/SelectableLabelHandler.cs
Normal file
62
src/iOS.Core/Handlers/SelectableLabelHandler.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Bit.App.Controls;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public partial class SelectableLabelHandler : ViewHandler<SelectableLabel, UITextView>
|
||||
{
|
||||
public static PropertyMapper<SelectableLabel, SelectableLabelHandler> PropertyMapper = new PropertyMapper<SelectableLabel, SelectableLabelHandler>(ViewHandler.ViewMapper)
|
||||
{
|
||||
[nameof(SelectableLabel.Text)] = MapText,
|
||||
[nameof(SelectableLabel.TextColor)] = MapTextColor,
|
||||
[nameof(SelectableLabel.FontAttributes)] = MapFontAttributes,
|
||||
};
|
||||
|
||||
public SelectableLabelHandler() : base(PropertyMapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override UITextView CreatePlatformView()
|
||||
{
|
||||
var uiTextView = new UITextView();
|
||||
uiTextView.Selectable = true;
|
||||
uiTextView.Editable = false;
|
||||
uiTextView.ScrollEnabled = false;
|
||||
uiTextView.TextContainerInset = UIEdgeInsets.Zero;
|
||||
uiTextView.TextContainer.LineFragmentPadding = 0;
|
||||
uiTextView.BackgroundColor = UIColor.Clear;
|
||||
return uiTextView;
|
||||
}
|
||||
|
||||
private static void MapText(SelectableLabelHandler handler, SelectableLabel label)
|
||||
{
|
||||
handler.PlatformView.Text = label.Text;
|
||||
}
|
||||
|
||||
private static void MapTextColor(SelectableLabelHandler handler, SelectableLabel label)
|
||||
{
|
||||
handler.PlatformView.TextColor = label.TextColor.ToPlatform();
|
||||
}
|
||||
|
||||
private static void MapFontAttributes(SelectableLabelHandler handler, SelectableLabel label)
|
||||
{
|
||||
switch (label.FontAttributes)
|
||||
{
|
||||
case FontAttributes.None:
|
||||
handler.PlatformView.Font = UIFont.SystemFontOfSize(new nfloat(label.FontSize));
|
||||
break;
|
||||
case FontAttributes.Bold:
|
||||
handler.PlatformView.Font = UIFont.BoldSystemFontOfSize(new nfloat(label.FontSize));
|
||||
break;
|
||||
case FontAttributes.Italic:
|
||||
handler.PlatformView.Font = UIFont.ItalicSystemFontOfSize(new nfloat(label.FontSize));
|
||||
break;
|
||||
default:
|
||||
handler.PlatformView.Font = UIFont.BoldSystemFontOfSize(new nfloat(label.FontSize));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/iOS.Core/Handlers/StepperHandlerMappings.cs
Normal file
31
src/iOS.Core/Handlers/StepperHandlerMappings.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Bit.App.Controls;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class StepperHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
StepperHandler.Mapper.AppendToMapping("CustomStepperHandler", UpdateFgColor);
|
||||
|
||||
StepperHandler.Mapper.AppendToMapping(nameof(ExtendedStepper.StepperForegroundColor), UpdateFgColor);
|
||||
}
|
||||
|
||||
private static void UpdateFgColor(IStepperHandler handler, IStepper stepper)
|
||||
{
|
||||
if (stepper is ExtendedStepper extStepper)
|
||||
{
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
|
||||
{
|
||||
// https://developer.apple.com/forums/thread/121495
|
||||
handler.PlatformView.SetIncrementImage(handler.PlatformView.GetIncrementImage(UIControlState.Normal), UIControlState.Normal);
|
||||
handler.PlatformView.SetDecrementImage(handler.PlatformView.GetDecrementImage(UIControlState.Normal), UIControlState.Normal);
|
||||
}
|
||||
handler.PlatformView.TintColor = extStepper.StepperForegroundColor.ToPlatform();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/iOS.Core/Handlers/TimePickerHandlerMappings.cs
Normal file
40
src/iOS.Core/Handlers/TimePickerHandlerMappings.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Bit.App.Controls;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Handlers
|
||||
{
|
||||
public class TimePickerHandlerMappings
|
||||
{
|
||||
public static void Setup()
|
||||
{
|
||||
TimePickerHandler.Mapper.AppendToMapping("CustomDatePickerHandler", (handler, datePicker) =>
|
||||
{
|
||||
if (datePicker is ExtendedTimePicker extTimePicker)
|
||||
{
|
||||
// center text
|
||||
handler.PlatformView.TextAlignment = UITextAlignment.Center;
|
||||
|
||||
// use placeholder until NullableDate set
|
||||
if (!extTimePicker.NullableTime.HasValue)
|
||||
{
|
||||
handler.PlatformView.Text = extTimePicker.PlaceHolder;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TimePickerHandler.Mapper.AppendToMapping(nameof(ITimePicker.Time), UpdateTextPlaceholderOnFormatLikePlacholder);
|
||||
|
||||
TimePickerHandler.Mapper.AppendToMapping(nameof(ITimePicker.Format), UpdateTextPlaceholderOnFormatLikePlacholder);
|
||||
}
|
||||
|
||||
private static void UpdateTextPlaceholderOnFormatLikePlacholder(ITimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (timePicker is ExtendedTimePicker extDatePicker && extDatePicker.Format == extDatePicker.PlaceHolder)
|
||||
{
|
||||
handler.PlatformView.Text = extDatePicker.PlaceHolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("BitwardeniOSCore")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Bitwarden Inc.")]
|
||||
[assembly: AssemblyProduct("Bitwarden")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("50c7b8c9-e664-45af-b88e-0c9b8b9c1be1")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
{
|
||||
public class CollectionException : Exception
|
||||
{
|
||||
public CollectionException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public CollectionException(string message, Exception innerEx)
|
||||
: base(message, innerEx)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers.CollectionView;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ExtendedCollectionView), typeof(ExtendedCollectionViewRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
{
|
||||
public class ExtendedCollectionViewRenderer : GroupableItemsViewRenderer<ExtendedCollectionView, GroupableItemsViewController<ExtendedCollectionView>>
|
||||
{
|
||||
protected override GroupableItemsViewController<ExtendedCollectionView> CreateController(ExtendedCollectionView itemsView, ItemsViewLayout layout)
|
||||
{
|
||||
return new ExtendedGroupableItemsViewController<ExtendedCollectionView>(itemsView, layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Bit.Core.Services;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
{
|
||||
public class ExtendedGroupableItemsViewController<TItemsView> : GroupableItemsViewController<TItemsView>
|
||||
where TItemsView : ExtendedCollectionView
|
||||
{
|
||||
public ExtendedGroupableItemsViewController(TItemsView groupableItemsView, ItemsViewLayout layout)
|
||||
: base(groupableItemsView, layout)
|
||||
{
|
||||
}
|
||||
|
||||
protected override UICollectionViewDelegateFlowLayout CreateDelegator()
|
||||
{
|
||||
return new ExtendedGroupableItemsViewDelegator<TItemsView, ExtendedGroupableItemsViewController<TItemsView>>(ItemsViewLayout, this);
|
||||
}
|
||||
|
||||
protected override void UpdateTemplatedCell(TemplatedCell cell, NSIndexPath indexPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.UpdateTemplatedCell(cell, indexPath);
|
||||
}
|
||||
catch (Exception ex) when (ItemsView?.ExtraDataForLogging != null)
|
||||
{
|
||||
var colEx = new CollectionException("Error in ExtendedCollectionView -> ExtendedGroupableItemsViewController, extra data: " + ItemsView.ExtraDataForLogging, ex);
|
||||
try
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(colEx);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Do nothing in here, this is temporary to get more info about the crash, if the logger fails, we want to get the info
|
||||
// by crashing with the original exception and not the logger one
|
||||
}
|
||||
if (ex is IndexOutOfRangeException || ex is ArgumentOutOfRangeException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
throw colEx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Bit.Core.Services;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
{
|
||||
public class ExtendedGroupableItemsViewDelegator<TItemsView, TViewController> : GroupableItemsViewDelegator<TItemsView, TViewController>
|
||||
where TItemsView : ExtendedCollectionView
|
||||
where TViewController : GroupableItemsViewController<TItemsView>
|
||||
{
|
||||
public ExtendedGroupableItemsViewDelegator(ItemsViewLayout itemsViewLayout, TViewController itemsViewController)
|
||||
: base(itemsViewLayout, itemsViewController)
|
||||
{
|
||||
}
|
||||
|
||||
public override CGSize GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath)
|
||||
{
|
||||
// Added this to get extra information on a crash when getting the size for an item.
|
||||
try
|
||||
{
|
||||
return base.GetSizeForItem(collectionView, layout, indexPath);
|
||||
}
|
||||
catch (Exception ex) when (ViewController?.ItemsView?.ExtraDataForLogging != null)
|
||||
{
|
||||
var colEx = new CollectionException("Error in ExtendedCollectionView -> ExtendedGroupableItemsViewDelegator, extra data: " + ViewController.ItemsView.ExtraDataForLogging, ex);
|
||||
try
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(colEx);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Do nothing in here, this is temporary to get more info about the crash, if the logger fails, we want to get the info
|
||||
// by crashing with the original exception and not the logger one
|
||||
}
|
||||
throw colEx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(Button), typeof(CustomButtonRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class CustomButtonRenderer : ButtonRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (Control != null && e.NewElement is Button)
|
||||
{
|
||||
UpdateFont();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
if (e.PropertyName == Button.FontProperty.PropertyName)
|
||||
{
|
||||
UpdateFont();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFont()
|
||||
{
|
||||
var pointSize = iOSHelpers.GetAccessibleFont<Button>(Element.FontSize);
|
||||
if (pointSize != null)
|
||||
{
|
||||
Control.Font = UIFont.FromDescriptor(Element.Font.ToUIFont().FontDescriptor, pointSize.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using System.ComponentModel;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(Editor), typeof(CustomEditorRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class CustomEditorRenderer : EditorRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (e.NewElement is Editor)
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||
// Remove padding
|
||||
Control.TextContainerInset = new UIEdgeInsets(0, 0, 0, 0);
|
||||
Control.TextContainer.LineFragmentPadding = 0;
|
||||
UpdateTintColor();
|
||||
UpdateKeyboardAppearance();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
if (e.PropertyName == Editor.TextColorProperty.PropertyName)
|
||||
{
|
||||
UpdateTintColor();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTintColor()
|
||||
{
|
||||
Control.TintColor = Element.TextColor.ToUIColor();
|
||||
}
|
||||
|
||||
private void UpdateKeyboardAppearance()
|
||||
{
|
||||
if (!Utilities.ThemeHelpers.LightTheme)
|
||||
{
|
||||
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(Entry), typeof(CustomEntryRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class CustomEntryRenderer : EntryRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (Control != null && e.NewElement is Entry)
|
||||
{
|
||||
Control.ClearButtonMode = UITextFieldViewMode.WhileEditing;
|
||||
UpdateTintColor();
|
||||
UpdateFontSize();
|
||||
UpdateKeyboardAppearance();
|
||||
iOSHelpers.SetBottomBorder(Control);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
if (e.PropertyName == Entry.FontAttributesProperty.PropertyName ||
|
||||
e.PropertyName == Entry.FontFamilyProperty.PropertyName ||
|
||||
e.PropertyName == Entry.FontSizeProperty.PropertyName)
|
||||
{
|
||||
UpdateFontSize();
|
||||
}
|
||||
else if (e.PropertyName == Entry.TextColorProperty.PropertyName)
|
||||
{
|
||||
UpdateTintColor();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFontSize()
|
||||
{
|
||||
var pointSize = iOSHelpers.GetAccessibleFont<Entry>(Element.FontSize);
|
||||
if (pointSize != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(Element.FontFamily))
|
||||
{
|
||||
Control.Font = UIFont.FromName(Element.FontFamily, pointSize.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
Control.Font = UIFont.FromDescriptor(UIFontDescriptor.PreferredBody, pointSize.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTintColor()
|
||||
{
|
||||
Control.TintColor = Element.TextColor.ToUIColor();
|
||||
}
|
||||
|
||||
private void UpdateKeyboardAppearance()
|
||||
{
|
||||
if (!ThemeHelpers.LightTheme)
|
||||
{
|
||||
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(Label), typeof(CustomLabelRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class CustomLabelRenderer : LabelRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (Control != null && e.NewElement is Label)
|
||||
{
|
||||
UpdateFont();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
var label = sender as CustomLabel;
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case nameof(CustomLabel.AutomationId):
|
||||
Control.AccessibilityIdentifier = label.AutomationId;
|
||||
break;
|
||||
}
|
||||
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
|
||||
if (e.PropertyName == Label.FontProperty.PropertyName ||
|
||||
e.PropertyName == Label.TextProperty.PropertyName ||
|
||||
e.PropertyName == Label.FormattedTextProperty.PropertyName)
|
||||
{
|
||||
UpdateFont();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFont()
|
||||
{
|
||||
if (Element is null || Control is null)
|
||||
return;
|
||||
|
||||
var pointSize = iOSHelpers.GetAccessibleFont<Label>(Element.FontSize);
|
||||
if (pointSize != null)
|
||||
{
|
||||
Control.Font = UIFont.FromDescriptor(Element.ToUIFont().FontDescriptor, pointSize.Value);
|
||||
}
|
||||
// TODO: For now, I'm only doing this for IconLabel with setup just in case I break the whole app labels.
|
||||
// We need to revisit this when we address Accessibility Large Font issues across the app
|
||||
// to check if we can left it more generic like
|
||||
// else if (Element.FontFamily != null)
|
||||
else if (Element is IconLabel iconLabel && iconLabel.ShouldUpdateFontSizeDynamicallyForAccesibility)
|
||||
{
|
||||
var customFont = Element.ToUIFont();
|
||||
Control.Font = new UIFontMetrics(UIFontTextStyle.Body.GetConstant()).GetScaledFont(customFont);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(Picker), typeof(CustomPickerRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class CustomPickerRenderer : PickerRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (e.NewElement is Picker)
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
Control.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
|
||||
iOSHelpers.SetBottomBorder(Control);
|
||||
UpdateKeyboardAppearance();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateKeyboardAppearance()
|
||||
{
|
||||
if (!ThemeHelpers.LightTheme)
|
||||
{
|
||||
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(SearchBar), typeof(CustomSearchBarRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class CustomSearchBarRenderer : SearchBarRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<SearchBar> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (e.NewElement is SearchBar)
|
||||
{
|
||||
UpdateKeyboardAppearance();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateKeyboardAppearance()
|
||||
{
|
||||
if (!Utilities.ThemeHelpers.LightTheme)
|
||||
{
|
||||
Control.KeyboardAppearance = UIKeyboardAppearance.Dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ExtendedDatePicker), typeof(ExtendedDatePickerRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class ExtendedDatePickerRenderer : DatePickerRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (Control != null && Element is ExtendedDatePicker element)
|
||||
{
|
||||
// center text
|
||||
Control.TextAlignment = UITextAlignment.Center;
|
||||
|
||||
// use placeholder until NullableDate set
|
||||
if (!element.NullableDate.HasValue)
|
||||
{
|
||||
Control.Text = element.PlaceHolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == DatePicker.DateProperty.PropertyName ||
|
||||
e.PropertyName == DatePicker.FormatProperty.PropertyName)
|
||||
{
|
||||
if (Control != null && Element is ExtendedDatePicker element)
|
||||
{
|
||||
if (Element.Format == element.PlaceHolder)
|
||||
{
|
||||
Control.Text = element.PlaceHolder;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ExtendedStepper), typeof(ExtendedStepperRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class ExtendedStepperRenderer : StepperRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Stepper> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
UpdateFgColor();
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == ExtendedStepper.StepperForegroundColorProperty.PropertyName)
|
||||
{
|
||||
UpdateFgColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFgColor()
|
||||
{
|
||||
if (Control != null && Element is ExtendedStepper view)
|
||||
{
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
|
||||
{
|
||||
// https://developer.apple.com/forums/thread/121495
|
||||
Control.SetIncrementImage(Control.GetIncrementImage(UIControlState.Normal), UIControlState.Normal);
|
||||
Control.SetDecrementImage(Control.GetDecrementImage(UIControlState.Normal), UIControlState.Normal);
|
||||
}
|
||||
Control.TintColor = view.StepperForegroundColor.ToUIColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(ExtendedTimePicker), typeof(ExtendedTimePickerRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class ExtendedTimePickerRenderer : TimePickerRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<TimePicker> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
if (Control != null && Element is ExtendedTimePicker element)
|
||||
{
|
||||
// center text
|
||||
Control.TextAlignment = UITextAlignment.Center;
|
||||
|
||||
// use placeholder until NullableTime set
|
||||
if (!element.NullableTime.HasValue)
|
||||
{
|
||||
Control.Text = element.PlaceHolder;
|
||||
}
|
||||
|
||||
// force use of wheel picker on iOS 14+
|
||||
// TODO remove this when we upgrade to X.F 5 SR-1
|
||||
// https://github.com/xamarin/Xamarin.Forms/issues/12258#issuecomment-700168665
|
||||
try
|
||||
{
|
||||
if (UIDevice.CurrentDevice.CheckSystemVersion(13, 2))
|
||||
{
|
||||
var picker = (UIDatePicker)Control.InputView;
|
||||
picker.PreferredDatePickerStyle = UIDatePickerStyle.Wheels;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == TimePicker.TimeProperty.PropertyName ||
|
||||
e.PropertyName == TimePicker.FormatProperty.PropertyName)
|
||||
{
|
||||
if (Control != null && Element is ExtendedTimePicker element)
|
||||
{
|
||||
if (Element.Format == element.PlaceHolder)
|
||||
{
|
||||
Control.Text = element.PlaceHolder;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
using Foundation;
|
||||
using WebKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using System.ComponentModel;
|
||||
|
||||
[assembly: ExportRenderer(typeof(HybridWebView), typeof(HybridWebViewRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class HybridWebViewRenderer : ViewRenderer<HybridWebView, WKWebView>, IWKScriptMessageHandler
|
||||
{
|
||||
private const string JSFunction =
|
||||
"function invokeCSharpAction(data){window.webkit.messageHandlers.invokeAction.postMessage(data);}";
|
||||
|
||||
private WKUserContentController _userController;
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<HybridWebView> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
if (Control == null)
|
||||
{
|
||||
_userController = new WKUserContentController();
|
||||
var script = new WKUserScript(new NSString(JSFunction), WKUserScriptInjectionTime.AtDocumentEnd, false);
|
||||
_userController.AddUserScript(script);
|
||||
_userController.AddScriptMessageHandler(this, "invokeAction");
|
||||
|
||||
var config = new WKWebViewConfiguration { UserContentController = _userController };
|
||||
var webView = new WKWebView(Frame, config);
|
||||
SetNativeControl(webView);
|
||||
}
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
_userController.RemoveAllUserScripts();
|
||||
_userController.RemoveScriptMessageHandler("invokeAction");
|
||||
var hybridWebView = e.OldElement as HybridWebView;
|
||||
hybridWebView.Cleanup();
|
||||
}
|
||||
if (e.NewElement != null)
|
||||
{
|
||||
if (Element.Uri != null)
|
||||
{
|
||||
Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.Uri)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
if (e.PropertyName == HybridWebView.UriProperty.PropertyName && Element.Uri != null)
|
||||
{
|
||||
Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.Uri)));
|
||||
}
|
||||
}
|
||||
|
||||
public void DidReceiveScriptMessage(WKUserContentController userContentController, WKScriptMessage message)
|
||||
{
|
||||
Element.InvokeAction(message.Body.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Bit.App.Controls;
|
||||
using Bit.iOS.Core.Renderers;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(SelectableLabel), typeof(SelectableLabelRenderer))]
|
||||
namespace Bit.iOS.Core.Renderers
|
||||
{
|
||||
public class SelectableLabelRenderer : ViewRenderer<Label, UITextView>
|
||||
{
|
||||
UITextView uiTextView;
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
if (e.OldElement != null || Element == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Control == null)
|
||||
{
|
||||
uiTextView = new UITextView();
|
||||
}
|
||||
|
||||
uiTextView.Selectable = true;
|
||||
uiTextView.Editable = false;
|
||||
uiTextView.ScrollEnabled = false;
|
||||
uiTextView.TextContainerInset = UIEdgeInsets.Zero;
|
||||
uiTextView.TextContainer.LineFragmentPadding = 0;
|
||||
uiTextView.BackgroundColor = UIColor.Clear;
|
||||
|
||||
uiTextView.Text = Element.Text;
|
||||
uiTextView.TextColor = Element.TextColor.ToUIColor();
|
||||
switch (Element.FontAttributes)
|
||||
{
|
||||
case FontAttributes.None:
|
||||
uiTextView.Font = UIFont.SystemFontOfSize(new nfloat(Element.FontSize));
|
||||
break;
|
||||
case FontAttributes.Bold:
|
||||
uiTextView.Font = UIFont.BoldSystemFontOfSize(new nfloat(Element.FontSize));
|
||||
break;
|
||||
case FontAttributes.Italic:
|
||||
uiTextView.Font = UIFont.ItalicSystemFontOfSize(new nfloat(Element.FontSize));
|
||||
break;
|
||||
default:
|
||||
uiTextView.Font = UIFont.BoldSystemFontOfSize(new nfloat(Element.FontSize));
|
||||
break;
|
||||
}
|
||||
|
||||
SetNativeControl(uiTextView);
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
|
||||
if (e.PropertyName == Label.TextProperty.PropertyName)
|
||||
{
|
||||
if (Control != null && Element != null && !string.IsNullOrWhiteSpace(Element.Text))
|
||||
{
|
||||
uiTextView.Text = Element.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using Bit.Core.Abstractions;
|
||||
using Foundation;
|
||||
using MobileCoreServices;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.iOS.Core.Services
|
||||
{
|
||||
@@ -32,7 +31,7 @@ namespace Bit.iOS.Core.Services
|
||||
|
||||
var dictArr = new NSDictionary<NSString, NSObject>[1];
|
||||
dictArr[0] = new NSDictionary<NSString, NSObject>(new NSString(UTType.UTF8PlainText), new NSString(text));
|
||||
Device.BeginInvokeOnMainThread(() => UIPasteboard.General.SetItems(dictArr, new UIPasteboardOptions
|
||||
MainThread.BeginInvokeOnMainThread(() => UIPasteboard.General.SetItems(dictArr, new UIPasteboardOptions
|
||||
{
|
||||
LocalOnly = true,
|
||||
ExpirationDate = clearSeconds > 0 ? NSDate.FromTimeIntervalSinceNow(clearSeconds) : null
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using Bit.Core.Abstractions;
|
||||
using System.Runtime.InteropServices;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
using Foundation;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Bit.iOS.Core.Services
|
||||
{
|
||||
@@ -49,8 +48,8 @@ namespace Bit.iOS.Core.Services
|
||||
var saltData = NSData.FromArray(salt);
|
||||
|
||||
argon2id_hash_raw(iterations, memory, parallelism, passwordData.Bytes, passwordData.Length,
|
||||
saltData.Bytes, saltData.Length, keyData.MutableBytes, keyData.Length);
|
||||
|
||||
saltData.Bytes, saltData.Length, keyData.MutableBytes, keyData.Length);
|
||||
|
||||
var keyBytes = new byte[keyData.Length];
|
||||
Marshal.Copy(keyData.Bytes, keyBytes, 0, Convert.ToInt32(keyData.Length));
|
||||
return keyBytes;
|
||||
@@ -58,11 +57,11 @@ namespace Bit.iOS.Core.Services
|
||||
|
||||
// ref: http://opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/CommonCrypto/CommonKeyDerivation.h
|
||||
[DllImport(ObjCRuntime.Constants.libSystemLibrary, EntryPoint = "CCKeyDerivationPBKDF")]
|
||||
private extern static int CCKeyCerivationPBKDF(uint algorithm, IntPtr password, nuint passwordLen,
|
||||
private static extern int CCKeyCerivationPBKDF(uint algorithm, IntPtr password, nuint passwordLen,
|
||||
IntPtr salt, nuint saltLen, uint prf, nuint rounds, IntPtr derivedKey, nuint derivedKeyLength);
|
||||
|
||||
[DllImport("__Internal", EntryPoint = "argon2id_hash_raw")]
|
||||
private static extern int argon2id_hash_raw(int timeCost, int memoryCost, int parallelism, IntPtr pwd,
|
||||
nuint pwdlen, IntPtr salt, nuint saltlen, IntPtr hash, nuint hashlen);
|
||||
nuint pwdlen, IntPtr salt, nuint saltlen, IntPtr hash, nuint hashlen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.App.Utilities.Prompts;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
@@ -11,7 +11,7 @@ using CoreGraphics;
|
||||
using Foundation;
|
||||
using LocalAuthentication;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.iOS.Core.Services
|
||||
{
|
||||
@@ -27,14 +27,14 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_userAgent))
|
||||
{
|
||||
_userAgent = $"Bitwarden_Mobile/{Xamarin.Essentials.AppInfo.VersionString} " +
|
||||
_userAgent = $"Bitwarden_Mobile/{AppInfo.VersionString} " +
|
||||
$"(iOS {UIDevice.CurrentDevice.SystemVersion}; Model {UIDevice.CurrentDevice.Model})";
|
||||
}
|
||||
return _userAgent;
|
||||
}
|
||||
}
|
||||
|
||||
public DeviceType DeviceType => DeviceType.iOS;
|
||||
public Bit.Core.Enums.DeviceType DeviceType => Bit.Core.Enums.DeviceType.iOS;
|
||||
|
||||
public bool LaunchApp(string appName)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
uri = "itms-apps://itunes.apple.com/us/app/id1137397744?action=write-review";
|
||||
}
|
||||
Device.OpenUri(new Uri(uri));
|
||||
Launcher.OpenAsync(uri).FireAndForget();
|
||||
}
|
||||
|
||||
public bool SupportsFaceBiometric()
|
||||
@@ -252,7 +252,7 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
if (Application.Current is App.App app && app.Options != null && !app.Options.IosExtension)
|
||||
{
|
||||
return app.MainPage.DisplayActionSheet(title, cancel, destruction, buttons);
|
||||
return Bit.App.App.MainPage.DisplayActionSheet(title, cancel, destruction, buttons);
|
||||
}
|
||||
var vc = GetPresentedViewController();
|
||||
if (vc is null)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Foundation;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Models;
|
||||
@@ -20,7 +19,7 @@ namespace Bit.iOS.Core.Services
|
||||
}
|
||||
|
||||
// This gets called a lot - try/catch can be expensive so consider caching or something
|
||||
CultureInfo ci = null;
|
||||
CultureInfo? ci;
|
||||
try
|
||||
{
|
||||
ci = new CultureInfo(netLanguage);
|
||||
@@ -108,7 +107,7 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
df.Locale = NSLocale.CurrentLocale;
|
||||
df.DateStyle = NSDateFormatterStyle.Short;
|
||||
return df.StringFor((NSDate)date);
|
||||
return df.StringFor((NSDate?)date);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +117,7 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
df.Locale = NSLocale.CurrentLocale;
|
||||
df.TimeStyle = NSDateFormatterStyle.Short;
|
||||
return df.StringFor((NSDate)time);
|
||||
return df.StringFor((NSDate?)time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Controls;
|
||||
using Bit.App.Controls;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Utilities;
|
||||
using CoreGraphics;
|
||||
using Microsoft.Maui.Platform;
|
||||
using SkiaSharp.Views.iOS;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
@@ -24,7 +23,7 @@ namespace Bit.iOS.Core.Utilities
|
||||
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
||||
}
|
||||
|
||||
public async Task<UIImage> CreateAvatarImageAsync()
|
||||
public async Task<UIImage?> CreateAvatarImageAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -33,12 +32,19 @@ namespace Bit.iOS.Core.Utilities
|
||||
throw new NullReferenceException(nameof(_stateService));
|
||||
}
|
||||
|
||||
var avatarImageSource = new AvatarImageSource(await _stateService.GetActiveUserIdAsync(),
|
||||
await _stateService.GetNameAsync(), await _stateService.GetEmailAsync(),
|
||||
await _stateService.GetAvatarColorAsync());
|
||||
using (var avatarUIImage = await avatarImageSource.GetNativeImageAsync())
|
||||
var avatarInfo = await _stateService.GetActiveUserCustomDataAsync<AvatarInfo?>(a => a?.Profile is null
|
||||
? null
|
||||
: new AvatarInfo(a.Profile.UserId, a.Profile.Name, a.Profile.Email, a.Profile.AvatarColor));
|
||||
|
||||
if (!avatarInfo.HasValue)
|
||||
{
|
||||
return avatarUIImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal) ?? UIImage.GetSystemImage(DEFAULT_SYSTEM_AVATAR_IMAGE);
|
||||
return UIImage.GetSystemImage(DEFAULT_SYSTEM_AVATAR_IMAGE);
|
||||
}
|
||||
|
||||
using (var avatarUIImage = SKAvatarImageHelper.Draw(avatarInfo.Value))
|
||||
{
|
||||
return avatarUIImage?.ToUIImage()?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
|
||||
?? UIImage.GetSystemImage(DEFAULT_SYSTEM_AVATAR_IMAGE);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -69,10 +75,12 @@ namespace Bit.iOS.Core.Utilities
|
||||
overlay.BindingContext = vm;
|
||||
overlay.IsVisible = false;
|
||||
|
||||
var renderer = Platform.CreateRenderer(overlay.Content);
|
||||
renderer.SetElementSize(new Size(containerView.Frame.Size.Width, containerView.Frame.Size.Height));
|
||||
if (MauiContextSingleton.Instance.MauiContext is null)
|
||||
{
|
||||
throw new ArgumentNullException("Maui context should be set to create the account switching overlay view");
|
||||
}
|
||||
|
||||
var view = renderer.NativeView;
|
||||
var view = overlay.ToPlatform(MauiContextSingleton.Instance.MauiContext);
|
||||
view.TranslatesAutoresizingMaskIntoConstraints = false;
|
||||
|
||||
containerView.AddSubview(view);
|
||||
@@ -101,5 +109,32 @@ namespace Bit.iOS.Core.Utilities
|
||||
containerView.UserInteractionEnabled = !overlayVisible;
|
||||
containerView.Subviews[0].UserInteractionEnabled = !overlayVisible;
|
||||
}
|
||||
|
||||
public async Task<UIControl> CreateAccountSwitchToolbarButtonItemCustomViewAsync()
|
||||
{
|
||||
const float size = 40f;
|
||||
var image = await CreateAvatarImageAsync();
|
||||
var accountSwitchButton = new UIControl(new CGRect(0, 0, size, size));
|
||||
if (image != null)
|
||||
{
|
||||
var accountSwitchAvatarImageView = new UIImageView(new CGRect(0, 0, size, size))
|
||||
{
|
||||
Image = image
|
||||
};
|
||||
accountSwitchButton.AddSubview(accountSwitchAvatarImageView);
|
||||
}
|
||||
|
||||
return accountSwitchButton;
|
||||
}
|
||||
|
||||
public void DisposeAccountSwitchToolbarButtonItemImage(UIControl accountSwitchButton)
|
||||
{
|
||||
if (accountSwitchButton?.Subviews?.FirstOrDefault() is UIImageView accountSwitchImageView && accountSwitchImageView.Image != null)
|
||||
{
|
||||
var img = accountSwitchImageView.Image;
|
||||
accountSwitchImageView.Image = null;
|
||||
img.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Bit.Core.Models.Domain;
|
||||
using Foundation;
|
||||
using Foundation;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
@@ -15,6 +11,7 @@ namespace Bit.iOS.Core.Utilities
|
||||
}
|
||||
|
||||
public static NSDictionary<KTo,VTo> ToNSDictionary<KFrom,VFrom,KTo,VTo>(this Dictionary<KFrom, VFrom> dict, Func<KFrom, KTo> keyConverter, Func<VFrom, VTo> valueConverter)
|
||||
where KFrom : notnull
|
||||
where KTo : NSObject
|
||||
where VTo : NSObject
|
||||
{
|
||||
@@ -23,19 +20,20 @@ namespace Bit.iOS.Core.Utilities
|
||||
return NSDictionary<KTo, VTo>.FromObjectsAndKeys(NSValues, NSKeys, NSKeys.Count());
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> ToDictionary(this NSDictionary<NSString, NSObject> nsDict)
|
||||
public static Dictionary<string, object?> ToDictionary(this NSDictionary<NSString, NSObject> nsDict)
|
||||
{
|
||||
return nsDict.ToDictionary(v => v?.ToString() as object);
|
||||
return nsDict.ToDictionary(v => v?.ToString());
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> ToDictionary(this NSDictionary<NSString, NSObject> nsDict, Func<NSObject, object> valueTransformer)
|
||||
public static Dictionary<string, object?> ToDictionary(this NSDictionary<NSString, NSObject> nsDict, Func<NSObject, object?> valueTransformer)
|
||||
{
|
||||
return nsDict.ToDictionary(k => k.ToString(), v => valueTransformer(v));
|
||||
}
|
||||
|
||||
public static Dictionary<KTo, VTo> ToDictionary<KFrom, VFrom, KTo, VTo>(this NSDictionary<KFrom, VFrom> nsDict, Func<KFrom, KTo> keyConverter, Func<VFrom, VTo> valueConverter)
|
||||
public static Dictionary<KTo, VTo?> ToDictionary<KFrom, VFrom, KTo, VTo>(this NSDictionary<KFrom, VFrom> nsDict, Func<KFrom, KTo> keyConverter, Func<VFrom, VTo?> valueConverter)
|
||||
where KFrom : NSObject
|
||||
where VFrom : NSObject
|
||||
where KTo : notnull
|
||||
{
|
||||
var keys = nsDict.Keys.Select(k => keyConverter(k)).ToArray();
|
||||
var values = nsDict.Values.Select(v => valueConverter(v)).ToArray();
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Internals;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
public static class FontElementExtensions
|
||||
{
|
||||
public static UIFont ToUIFont(this IFontElement fontElement)
|
||||
public static UIFont ToUIFont(this Microsoft.Maui.Font font)
|
||||
{
|
||||
var fontSize = fontElement.FontSize;
|
||||
var fontAttributes = fontElement.FontAttributes;
|
||||
var fontFamily = fontElement.FontFamily;
|
||||
var fontSize = font.Size;
|
||||
var fontAttributes = font.GetFontAttributes();
|
||||
var fontFamily = font.Family;
|
||||
var fontWeight = fontAttributes == FontAttributes.Bold ? UIFontWeight.Bold : UIFontWeight.Regular;
|
||||
|
||||
return fontFamily is null
|
||||
? Font.SystemFontOfSize(fontSize, fontAttributes).ToUIFont()
|
||||
: Font.OfSize(fontFamily, fontSize).WithAttributes(fontAttributes).ToUIFont();
|
||||
? UIFont.SystemFontOfSize((nfloat)fontSize, fontWeight)
|
||||
: UIFont.FromName(fontFamily, (nfloat)fontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Services;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
public static class ImageSourceExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the native image from the ImageSource.
|
||||
/// Taken from https://github.com/xamarin/Xamarin.Forms/blob/02dee20dfa1365d0104758e534581d1fa5958990/Xamarin.Forms.Platform.iOS/Renderers/ImageElementManager.cs#L264
|
||||
/// </summary>
|
||||
public static async Task<UIImage> GetNativeImageAsync(this ImageSource source, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
if (source == null || source.IsEmpty)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var handler = Xamarin.Forms.Internals.Registrar.Registered.GetHandlerForObject<IImageSourceHandler>(source);
|
||||
if (handler == null)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(new InvalidOperationException("GetNativeImageAsync failed cause IImageSourceHandler couldn't be found"));
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
float scale = (float)UIScreen.MainScreen.Scale;
|
||||
return await handler.LoadImageAsync(source, scale: scale, cancelationToken: cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(new OperationCanceledException("GetNativeImageAsync was cancelled"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(new InvalidOperationException("GetNativeImageAsync failed", ex));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/iOS.Core/Utilities/MauiContextSingleton.cs
Normal file
15
src/iOS.Core/Utilities/MauiContextSingleton.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
public class MauiContextSingleton
|
||||
{
|
||||
private static readonly Lazy<MauiContextSingleton> _instance = new Lazy<MauiContextSingleton>(() => new MauiContextSingleton());
|
||||
|
||||
public static MauiContextSingleton Instance => _instance.Value;
|
||||
|
||||
private MauiContextSingleton() { }
|
||||
|
||||
public MauiContext? MauiContext { get; private set; }
|
||||
|
||||
public void Init(MauiContext mauiContext) => MauiContext = mauiContext;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +1,64 @@
|
||||
using Bit.App.Utilities;
|
||||
using Microsoft.Maui.Platform;
|
||||
using UIKit;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
public static class ThemeHelpers
|
||||
{
|
||||
public static bool LightTheme = true;
|
||||
public static bool LightTheme { get; private set; } = true;
|
||||
|
||||
public static UIColor SplashBackgroundColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("SplashBackgroundColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("SplashBackgroundColor").ToPlatform();
|
||||
}
|
||||
public static UIColor BackgroundColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("BackgroundColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("BackgroundColor").ToPlatform();
|
||||
}
|
||||
public static UIColor MutedColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("MutedColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("MutedColor").ToPlatform();
|
||||
}
|
||||
public static UIColor SuccessColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("SuccessColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("SuccessColor").ToPlatform();
|
||||
}
|
||||
public static UIColor DangerColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("DangerColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("DangerColor").ToPlatform();
|
||||
}
|
||||
public static UIColor PrimaryColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("PrimaryColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("PrimaryColor").ToPlatform();
|
||||
}
|
||||
public static UIColor TextColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("TextColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("TextColor").ToPlatform();
|
||||
}
|
||||
public static UIColor SeparatorColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("SeparatorColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("SeparatorColor").ToPlatform();
|
||||
}
|
||||
public static UIColor ListHeaderBackgroundColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("ListHeaderBackgroundColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("ListHeaderBackgroundColor").ToPlatform();
|
||||
}
|
||||
public static UIColor NavBarBackgroundColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("NavigationBarBackgroundColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("NavigationBarBackgroundColor").ToPlatform();
|
||||
}
|
||||
public static UIColor NavBarTextColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("NavigationBarTextColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("NavigationBarTextColor").ToPlatform();
|
||||
}
|
||||
public static UIColor TabBarBackgroundColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("TabBarBackgroundColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("TabBarBackgroundColor").ToPlatform();
|
||||
}
|
||||
public static UIColor TabBarItemColor
|
||||
{
|
||||
get => ThemeManager.GetResourceColor("TabBarItemColor").ToUIColor();
|
||||
get => ThemeManager.GetResourceColor("TabBarItemColor").ToPlatform();
|
||||
}
|
||||
|
||||
public static void SetAppearance(string theme, bool osDarkModeEnabled)
|
||||
@@ -75,8 +75,7 @@ namespace Bit.iOS.Core.Utilities
|
||||
|
||||
public static UIFont GetDangerFont()
|
||||
{
|
||||
return Xamarin.Forms.Font.SystemFontOfSize(Xamarin.Forms.NamedSize.Small,
|
||||
Xamarin.Forms.FontAttributes.Bold).ToUIFont();
|
||||
return Microsoft.Maui.Font.SystemFontOfSize(14, FontWeight.Bold).ToUIFont();
|
||||
}
|
||||
|
||||
private static void SetThemeVariables(string theme, bool osDarkModeEnabled)
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Domain;
|
||||
using System.Diagnostics;
|
||||
using Bit.Core.Services;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
using Foundation;
|
||||
using Newtonsoft.Json;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace WatchConnectivity
|
||||
{
|
||||
@@ -17,35 +11,45 @@ namespace WatchConnectivity
|
||||
// Setup is converted from https://www.natashatherobot.com/watchconnectivity-say-hello-to-wcsession/
|
||||
// with some extra bits
|
||||
private static readonly WCSessionManager sharedManager = new WCSessionManager();
|
||||
private static WCSession session = WCSession.IsSupported ? WCSession.DefaultSession : null;
|
||||
private static WCSession? session = WCSession.IsSupported ? WCSession.DefaultSession : null;
|
||||
|
||||
public event WCSessionReceiveDataHandler OnApplicationContextUpdated;
|
||||
public event WCSessionReceiveDataHandler OnMessagedReceived;
|
||||
public delegate void WCSessionReceiveDataHandler(WCSession session, Dictionary<string, object> data);
|
||||
public event WCSessionReceiveDataHandler? OnApplicationContextUpdated;
|
||||
public event WCSessionReceiveDataHandler? OnMessagedReceived;
|
||||
public delegate void WCSessionReceiveDataHandler(WCSession session, Dictionary<string, object?> data);
|
||||
|
||||
WCSessionUserInfoTransfer _transf;
|
||||
WCSessionUserInfoTransfer? _transf;
|
||||
|
||||
private WCSession validSession
|
||||
private WCSession? validSession
|
||||
{
|
||||
get
|
||||
{
|
||||
if (session is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Debug.WriteLine($"Paired status:{(session.Paired ? '✓' : '✗')}\n");
|
||||
Debug.WriteLine($"Watch App Installed status:{(session.WatchAppInstalled ? '✓' : '✗')}\n");
|
||||
return (session.Paired && session.WatchAppInstalled) ? session : null;
|
||||
}
|
||||
}
|
||||
|
||||
private WCSession validReachableSession
|
||||
private WCSession? validReachableSession
|
||||
{
|
||||
get
|
||||
{
|
||||
if (session is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return session.Reachable ? validSession : null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsValidSession => validSession != null;
|
||||
|
||||
public bool IsSessionReachable => session.Reachable;
|
||||
public bool IsSessionReachable => session?.Reachable ?? false;
|
||||
|
||||
public bool IsSessionActivated => validSession?.ActivationState == WCSessionActivationState.Activated;
|
||||
|
||||
@@ -71,7 +75,7 @@ namespace WatchConnectivity
|
||||
|
||||
public override void SessionReachabilityDidChange(WCSession session)
|
||||
{
|
||||
Debug.WriteLine($"Watch connectivity Reachable:{(session.Reachable ? '✓' : '✗')}");
|
||||
Debug.WriteLine($"Watch connectivity Reachable:{(session?.Reachable == true ? '✓' : '✗')}");
|
||||
}
|
||||
|
||||
public void SendBackgroundHighPriorityMessage(NSDictionary<NSString, NSObject> applicationContext)
|
||||
@@ -102,7 +106,7 @@ namespace WatchConnectivity
|
||||
|
||||
public void SendBackgroundFifoHighPriorityMessage(Dictionary<string, object> message)
|
||||
{
|
||||
if(validSession is null || validSession.ActivationState != WCSessionActivationState.Activated)
|
||||
if (session is null || validSession is null || validSession.ActivationState != WCSessionActivationState.Activated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -112,6 +116,10 @@ namespace WatchConnectivity
|
||||
Debug.WriteLine("Started transferring user info");
|
||||
|
||||
_transf = session.TransferUserInfo(message.ToNSDictionary());
|
||||
if (_transf is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@@ -136,7 +144,7 @@ namespace WatchConnectivity
|
||||
if (OnApplicationContextUpdated != null)
|
||||
{
|
||||
var keys = applicationContext.Keys.Select(k => k.ToString()).ToArray();
|
||||
var values = applicationContext.Values.Select(v => JsonConvert.DeserializeObject(v.ToString())).ToArray();
|
||||
var values = applicationContext.Values.Select(v => v != null ? JsonConvert.DeserializeObject(v.ToString()) : null).ToArray();
|
||||
var dictionary = keys.Zip(values, (k, v) => new { Key = k, Value = v })
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Controls;
|
||||
using Bit.App.Models;
|
||||
using Bit.App.Pages;
|
||||
using Bit.App.Resources;
|
||||
using Bit.App.Services;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.App.Utilities.AccountManagement;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.iOS.Core.Services;
|
||||
using CoreNFC;
|
||||
using Foundation;
|
||||
using Microsoft.Maui.Embedding;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
@@ -29,6 +25,45 @@ namespace Bit.iOS.Core.Utilities
|
||||
public static string AppGroupId = "group.com.8bit.bitwarden";
|
||||
public static string AccessGroup = "LTZ2PFU5D6.com.8bit.bitwarden";
|
||||
|
||||
public static void SetupMaui()
|
||||
{
|
||||
var builder = Bit.Core.MauiProgram.ConfigureMauiAppBuilder(ConfigureMAUIEffects, handlers =>
|
||||
{
|
||||
ConfigureMAUIHandlers(handlers);
|
||||
})
|
||||
.UseMauiEmbedding<Application>();
|
||||
// Register the Window
|
||||
builder.Services.Add(new ServiceDescriptor(typeof(UIWindow), _ => UIApplication.SharedApplication.KeyWindow, ServiceLifetime.Singleton));
|
||||
var mauiApp = builder.Build();
|
||||
|
||||
MauiContextSingleton.Instance.Init(new MauiContext(mauiApp.Services));
|
||||
}
|
||||
|
||||
public static void ConfigureMAUIEffects(IEffectsBuilder effects)
|
||||
{
|
||||
effects.Add<App.Effects.NoEmojiKeyboardEffect, Bit.iOS.Core.Effects.NoEmojiKeyboardEffect>();
|
||||
effects.Add<App.Effects.ScrollEnabledEffect, App.Effects.ScrollEnabledPlatformEffect>();
|
||||
effects.Add<App.Effects.ScrollViewContentInsetAdjustmentBehaviorEffect, Bit.App.Effects.ScrollViewContentInsetAdjustmentBehaviorPlatformEffect>();
|
||||
}
|
||||
|
||||
public static void ConfigureMAUIHandlers(IMauiHandlersCollection handlers)
|
||||
{
|
||||
handlers.AddHandler(typeof(HybridWebView), typeof(Handlers.HybridWebViewHandler));
|
||||
handlers.AddHandler(typeof(TabsPage), typeof(Handlers.CustomTabbedHandler));
|
||||
handlers.AddHandler(typeof(NavigationPage), typeof(Handlers.CustomNavigationHandler));
|
||||
handlers.AddHandler(typeof(ViewCell), typeof(Handlers.CustomViewCellHandler));
|
||||
handlers.AddHandler(typeof(ContentPage), typeof(Handlers.CustomContentPageHandler));
|
||||
handlers.AddHandler(typeof(SelectableLabel), typeof(Handlers.SelectableLabelHandler));
|
||||
Handlers.DatePickerHandlerMappings.Setup();
|
||||
Handlers.EditorHandlerMappings.Setup();
|
||||
Handlers.EntryHandlerMappings.Setup();
|
||||
Handlers.LabelHandlerMappings.Setup();
|
||||
Handlers.PickerHandlerMappings.Setup();
|
||||
Handlers.SearchBarHandlerMappings.Setup();
|
||||
Handlers.StepperHandlerMappings.Setup();
|
||||
Handlers.TimePickerHandlerMappings.Setup();
|
||||
}
|
||||
|
||||
public static void InitApp<T>(T rootController,
|
||||
string clearCipherCacheKey,
|
||||
NFCNdefReaderSession nfcSession,
|
||||
@@ -36,7 +71,7 @@ namespace Bit.iOS.Core.Utilities
|
||||
out IAccountsManager accountsManager)
|
||||
where T : UIViewController, IAccountsManagerHost
|
||||
{
|
||||
Forms.Init();
|
||||
SetupMaui();
|
||||
|
||||
if (ServiceContainer.RegisteredServices.Count > 0)
|
||||
{
|
||||
@@ -80,9 +115,13 @@ namespace Bit.iOS.Core.Utilities
|
||||
ServiceContainer.Register<INativeLogService>("nativeLogService", new ConsoleLogService());
|
||||
}
|
||||
|
||||
ILogger logger = null;
|
||||
if (ServiceContainer.Resolve<ILogger>("logger", true) == null)
|
||||
ILogger? logger = null;
|
||||
if (ServiceContainer.TryResolve<ILogger>(out var resolvedLogger))
|
||||
{
|
||||
logger = resolvedLogger;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
logger = DebugLogger.Instance;
|
||||
#else
|
||||
@@ -93,6 +132,12 @@ namespace Bit.iOS.Core.Utilities
|
||||
|
||||
var preferencesStorage = new PreferencesStorageService(AppGroupId);
|
||||
var appGroupContainer = new NSFileManager().GetContainerUrl(AppGroupId);
|
||||
if (appGroupContainer?.Path is null)
|
||||
{
|
||||
var nreAppGroupContainer = new NullReferenceException("appGroupContainer or its Path is null when registering local services");
|
||||
logger!.Exception(nreAppGroupContainer);
|
||||
throw nreAppGroupContainer;
|
||||
}
|
||||
var liteDbStorage = new LiteDbStorageService(
|
||||
Path.Combine(appGroupContainer.Path, "Library", "bitwarden.db"));
|
||||
var localizeService = new LocalizeService();
|
||||
@@ -106,7 +151,7 @@ namespace Bit.iOS.Core.Utilities
|
||||
var storageMediatorService = new StorageMediatorService(mobileStorageService, secureStorageService, preferencesStorage);
|
||||
var stateService = new StateService(mobileStorageService, secureStorageService, storageMediatorService, messagingService);
|
||||
var stateMigrationService =
|
||||
new StateMigrationService(DeviceType.iOS, liteDbStorage, preferencesStorage, secureStorageService);
|
||||
new StateMigrationService(Bit.Core.Enums.DeviceType.iOS, liteDbStorage, preferencesStorage, secureStorageService);
|
||||
var deviceActionService = new DeviceActionService();
|
||||
var fileService = new FileService(stateService, messagingService);
|
||||
var clipboardService = new ClipboardService(stateService);
|
||||
@@ -151,14 +196,14 @@ namespace Bit.iOS.Core.Utilities
|
||||
ServiceContainer.Resolve<ILogger>()));
|
||||
}
|
||||
|
||||
public static void Bootstrap(Func<Task> postBootstrapFunc = null)
|
||||
public static void Bootstrap(Func<Task>? postBootstrapFunc = null)
|
||||
{
|
||||
var locale = ServiceContainer.Resolve<IStateService>().GetLocale();
|
||||
(ServiceContainer.Resolve<II18nService>("i18nService") as MobileI18nService)
|
||||
.Init(locale != null ? new System.Globalization.CultureInfo(locale) : null);
|
||||
?.Init(locale != null ? new System.Globalization.CultureInfo(locale) : null);
|
||||
ServiceContainer.Resolve<IAuthService>("authService").Init();
|
||||
(ServiceContainer.
|
||||
Resolve<IPlatformUtilsService>("platformUtilsService") as MobilePlatformUtilsService).Init();
|
||||
Resolve<IPlatformUtilsService>("platformUtilsService") as MobilePlatformUtilsService)?.Init();
|
||||
|
||||
var accountsManager = new AccountsManager(
|
||||
ServiceContainer.Resolve<IBroadcasterService>("broadcasterService"),
|
||||
@@ -195,20 +240,31 @@ namespace Bit.iOS.Core.Utilities
|
||||
if (message.Command == "showDialog")
|
||||
{
|
||||
var details = message.Data as DialogDetails;
|
||||
if (details is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
|
||||
AppResources.Ok : details.ConfirmText;
|
||||
|
||||
NSRunLoop.Main.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
var result = await deviceActionService.DisplayAlertAsync(details.Title, details.Text,
|
||||
details.CancelText, confirmText);
|
||||
var confirmed = result == details.ConfirmText;
|
||||
messagingService.Send("showDialogResolve", new Tuple<int, bool>(details.DialogId, confirmed));
|
||||
try
|
||||
{
|
||||
var result = await deviceActionService.DisplayAlertAsync(details.Title, details.Text,
|
||||
details.CancelText, confirmText);
|
||||
var confirmed = result == details.ConfirmText;
|
||||
messagingService.Send("showDialogResolve", new Tuple<int, bool>(details.DialogId, confirmed));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (message.Command == "listenYubiKeyOTP")
|
||||
else if (message.Command == "listenYubiKeyOTP" && message.Data is bool listen)
|
||||
{
|
||||
ListenYubiKey((bool)message.Data, deviceActionService, nfcSession, nfcDelegate);
|
||||
ListenYubiKey(listen, deviceActionService, nfcSession, nfcDelegate);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -232,29 +288,36 @@ namespace Bit.iOS.Core.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task BootstrapAsync(Func<Task> postBootstrapFunc = null)
|
||||
private static async Task BootstrapAsync(Func<Task>? postBootstrapFunc = null)
|
||||
{
|
||||
await ServiceContainer.Resolve<IEnvironmentService>("environmentService").SetUrlsFromStorageAsync();
|
||||
|
||||
InitializeAppSetup();
|
||||
// TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged
|
||||
var deleteAccountActionFlowExecutioner = new DeleteAccountActionFlowExecutioner(
|
||||
ServiceContainer.Resolve<IApiService>("apiService"),
|
||||
ServiceContainer.Resolve<IMessagingService>("messagingService"),
|
||||
ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService"),
|
||||
ServiceContainer.Resolve<IDeviceActionService>("deviceActionService"),
|
||||
ServiceContainer.Resolve<ILogger>("logger"));
|
||||
ServiceContainer.Register<IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);
|
||||
|
||||
var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
|
||||
ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService"),
|
||||
ServiceContainer.Resolve<ICryptoService>("cryptoService"),
|
||||
ServiceContainer.Resolve<IUserVerificationService>());
|
||||
ServiceContainer.Register<IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);
|
||||
|
||||
if (postBootstrapFunc != null)
|
||||
try
|
||||
{
|
||||
await postBootstrapFunc.Invoke();
|
||||
await ServiceContainer.Resolve<IEnvironmentService>("environmentService").SetUrlsFromStorageAsync();
|
||||
|
||||
InitializeAppSetup();
|
||||
// TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged
|
||||
var deleteAccountActionFlowExecutioner = new DeleteAccountActionFlowExecutioner(
|
||||
ServiceContainer.Resolve<IApiService>("apiService"),
|
||||
ServiceContainer.Resolve<IMessagingService>("messagingService"),
|
||||
ServiceContainer.Resolve<IPlatformUtilsService>("platformUtilsService"),
|
||||
ServiceContainer.Resolve<IDeviceActionService>("deviceActionService"),
|
||||
ServiceContainer.Resolve<ILogger>("logger"));
|
||||
ServiceContainer.Register<IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);
|
||||
|
||||
var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
|
||||
ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService"),
|
||||
ServiceContainer.Resolve<ICryptoService>("cryptoService"),
|
||||
ServiceContainer.Resolve<IUserVerificationService>());
|
||||
ServiceContainer.Register<IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);
|
||||
|
||||
if (postBootstrapFunc != null)
|
||||
{
|
||||
await postBootstrapFunc.Invoke();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Bit.App.Utilities;
|
||||
using Bit.Core.Services;
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Utilities
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Services;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
@@ -9,7 +7,7 @@ namespace Bit.iOS.Core.Views
|
||||
public class ExtensionSearchDelegate : UISearchBarDelegate
|
||||
{
|
||||
private readonly UITableView _tableView;
|
||||
private CancellationTokenSource _filterResultsCancellationTokenSource;
|
||||
private CancellationTokenSource? _filterResultsCancellationTokenSource;
|
||||
|
||||
public ExtensionSearchDelegate(UITableView tableView)
|
||||
{
|
||||
@@ -23,25 +21,34 @@ namespace Bit.iOS.Core.Views
|
||||
{
|
||||
NSRunLoop.Main.BeginInvokeOnMainThread(async () =>
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
await Task.Delay(300);
|
||||
if (searchText != searchBar.Text)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_filterResultsCancellationTokenSource?.Cancel();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
((ExtensionTableSource)_tableView.Source).FilterResults(searchText, cts.Token);
|
||||
_tableView.ReloadData();
|
||||
if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
await Task.Delay(300);
|
||||
if (searchText != searchBar.Text)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_filterResultsCancellationTokenSource?.Cancel();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
((ExtensionTableSource)_tableView.Source).FilterResults(searchText, cts.Token);
|
||||
_tableView.ReloadData();
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
_filterResultsCancellationTokenSource = cts;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(ex);
|
||||
_filterResultsCancellationTokenSource?.Cancel();
|
||||
cts?.Cancel();
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
_filterResultsCancellationTokenSource = cts;
|
||||
});
|
||||
}, cts.Token);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core.Abstractions;
|
||||
using Bit.Core.Models.View;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Bit.App.Resources;
|
||||
using Bit.Core.Resources.Localization;
|
||||
using Bit.Core;
|
||||
using Bit.iOS.Core.Controllers;
|
||||
using Bit.iOS.Core.Utilities;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Bit.App.Utilities;
|
||||
using Foundation;
|
||||
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Views
|
||||
{
|
||||
|
||||
@@ -1,240 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E71F3053-056C-4381-9638-048ED73BDFF6}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{a52b8a63-bc84-4b47-910d-692533484892}</TemplateGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFrameworks>net8.0-ios;net8.0-android</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseMaui>true</UseMaui>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
|
||||
<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
|
||||
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>-->
|
||||
<RootNamespace>Bit.iOS.Core</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>BitwardeniOSCore</AssemblyName>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CreatePackage>false</CreatePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CreatePackage>false</CreatePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<OutputPath>bin\iPhoneSimulator\Release\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'FDroid|AnyCPU'">
|
||||
<OutputPath>bin\FDroid\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'">
|
||||
<OutputPath>bin\AppStore\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<OutputPath>bin\iPhone\AppStore\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhoneSimulator' ">
|
||||
<OutputPath>bin\iPhoneSimulator\AppStore\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Ad-Hoc|AnyCPU'">
|
||||
<OutputPath>bin\Ad-Hoc\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<OutputPath>bin\iPhone\Ad-Hoc\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhoneSimulator' ">
|
||||
<OutputPath>bin\iPhoneSimulator\Ad-Hoc\</OutputPath>
|
||||
<DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;VSX1000</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
|
||||
<Content Remove="**" />
|
||||
<Compile Remove="**" />
|
||||
<EmbeddedResource Remove="**" />
|
||||
<None Remove="**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
<Folder Include="Effects\" />
|
||||
<Folder Include="Renderers\CollectionView\" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Controllers\ExtendedUITableViewController.cs" />
|
||||
<Compile Include="Controllers\ExtendedUITableViewCell.cs" />
|
||||
<Compile Include="Controllers\ExtendedUIViewController.cs" />
|
||||
<Compile Include="Controllers\ExtendedUITableViewSource.cs" />
|
||||
<Compile Include="Controllers\LoginAddViewController.cs" />
|
||||
<Compile Include="Controllers\PasswordGeneratorViewController.cs" />
|
||||
<Compile Include="Models\AppExtensionContext.cs" />
|
||||
<Compile Include="Models\CipherViewModel.cs" />
|
||||
<Compile Include="Models\FillScript.cs" />
|
||||
<Compile Include="Models\PageDetails.cs" />
|
||||
<Compile Include="Models\PasswordGenerationOptions.cs" />
|
||||
<Compile Include="NFCReaderDelegate.cs" />
|
||||
<Compile Include="Renderers\CustomButtonRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomContentPageRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomNavigationRenderer.cs" />
|
||||
<Compile Include="Renderers\ExtendedDatePickerRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomEditorRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomEntryRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomLabelRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomPickerRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomSearchBarRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomTabbedRenderer.cs" />
|
||||
<Compile Include="Renderers\ExtendedStepperRenderer.cs" />
|
||||
<Compile Include="Renderers\ExtendedTimePickerRenderer.cs" />
|
||||
<Compile Include="Renderers\CustomViewCellRenderer.cs" />
|
||||
<Compile Include="Renderers\HybridWebViewRenderer.cs" />
|
||||
<Compile Include="Services\BiometricService.cs" />
|
||||
<Compile Include="Services\DeviceActionService.cs" />
|
||||
<Compile Include="Utilities\ASHelpers.cs" />
|
||||
<Compile Include="Utilities\Dialogs.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\CryptoPrimitiveService.cs" />
|
||||
<Compile Include="Services\KeyChainStorageService.cs" />
|
||||
<Compile Include="Services\LocalizeService.cs" />
|
||||
<Compile Include="Utilities\iOSCoreHelpers.cs" />
|
||||
<Compile Include="Utilities\iOSHelpers.cs" />
|
||||
<Compile Include="Utilities\ThemeHelpers.cs" />
|
||||
<Compile Include="Views\CustomPresentationControllerDelegate.cs" />
|
||||
<Compile Include="Views\ExtensionSearchDelegate.cs" />
|
||||
<Compile Include="Views\ExtensionTableSource.cs" />
|
||||
<Compile Include="Views\FormEntryTableViewCell.cs" />
|
||||
<Compile Include="Views\ISelectable.cs" />
|
||||
<Compile Include="Views\PickerTableViewCell.cs" />
|
||||
<Compile Include="Views\SliderTableViewCell.cs" />
|
||||
<Compile Include="Views\StepperTableViewCell.cs" />
|
||||
<Compile Include="Views\SwitchTableViewCell.cs" />
|
||||
<Compile Include="Views\Toast.cs" />
|
||||
<Compile Include="Renderers\SelectableLabelRenderer.cs" />
|
||||
<Compile Include="Effects\ScrollEnabledEffect.cs" />
|
||||
<Compile Include="Services\ClipboardService.cs" />
|
||||
<Compile Include="Utilities\FontElementExtensions.cs" />
|
||||
<Compile Include="Effects\ScrollViewContentInsetAdjustmentBehaviorEffect.cs" />
|
||||
<Compile Include="Utilities\AccountSwitchingOverlayHelper.cs" />
|
||||
<Compile Include="Utilities\ImageSourceExtensions.cs" />
|
||||
<Compile Include="Controllers\BaseLockPasswordViewController.cs" />
|
||||
<Compile Include="Renderers\CollectionView\ExtendedCollectionViewRenderer.cs" />
|
||||
<Compile Include="Renderers\CollectionView\ExtendedGroupableItemsViewController.cs" />
|
||||
<Compile Include="Utilities\UISearchBarExtensions.cs" />
|
||||
<Compile Include="Renderers\CollectionView\CollectionException.cs" />
|
||||
<Compile Include="Renderers\CollectionView\ExtendedGroupableItemsViewDelegator.cs" />
|
||||
<Compile Include="Effects\NoEmojiKeyboardEffect.cs" />
|
||||
<Compile Include="Utilities\WCSessionManager.cs" />
|
||||
<Compile Include="Services\FileService.cs" />
|
||||
<Compile Include="Utilities\UIViewControllerExtensions.cs" />
|
||||
<Compile Include="Services\AutofillHandler.cs" />
|
||||
<Compile Include="Utilities\DictionaryExtensions.cs" />
|
||||
<Compile Include="Services\WatchDeviceService.cs" />
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\App\App.csproj">
|
||||
<Project>{ee44c6a1-2a85-45fe-8d9b-bf1d5f88809c}</Project>
|
||||
<Name>App</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Core\Core.csproj">
|
||||
<Project>{4b8a8c41-9820-4341-974c-41e65b7f4366}</Project>
|
||||
<Name>Core</Name>
|
||||
</ProjectReference>
|
||||
<None Remove="Handlers\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NETStandard.Library">
|
||||
<Version>2.0.3</Version>
|
||||
</PackageReference>
|
||||
<Folder Include="Handlers\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user