Skip to content

Commit

Permalink
[main][Tizen] Replace Tizen Backend engine (dotnet#9619)
Browse files Browse the repository at this point in the history
* Remove comment

* Remove image resource on Tizen project

* Remove space

* Fix compatibility issue (#41)

* Fix compatibility issue

* Fix Compatibility Resource path

* Bump to latest

- Modal Navigation Manager (dotnet#1563)
- Implement the basic WindowHandler (dotnet#1468)
- Don't extract native defaults, meaning users can no longer reset a color back to a platform theme (dotnet#1485)
- Implement Alerts (Alert, Prompt and ActionSheet) (dotnet#1328)
- And so on.

* [SingleProject] Fix Issues (#50)

* Bumt to latest

- Effects (dotnet#1574)
- Improve Window and AnimationManager (dotnet#1653)
- and so on

* Add Microsoft.Maui.Graphics.Skia as PackageReference

* Add Essentials.Samples.Tizen (#24)

* Add Essentials.Samples.Tizen

* Add guard for null exception

* Fix Essentials.Samples for Tizen

* Fix csproj for net6

* Remove Forms.Init

* Fix build error (#60)

* Update referenced Tizen.UIExtensions version (#61)

* Add BlazorWebView skeleton code (#62)

* Bump to latest (#71)

- Window lifecycle (dotnet#1754)
- Move New Navigation Handler to Core and make it internal (dotnet#1800)
- Scrollview handler (dotnet#1669)
- ScrollView Resize + Window Handler Resize (dotnet#1676)
- Font AutoScalingEnabled (dotnet#1774)
- Rename Font Properties (dotnet#1755)
- Update layout system to ensure native measure/arrange are called for all controls, even from Page subclasses (dotnet#1819)
- IContainer as IList<IView> (dotnet#1724)
- Implement Layout padding for new StackLayouts and GridLayout (dotnet#1749)
- Delete all the TabIndex, TabStop, Focusable things! (dotnet#1777)
- Introduce SetSemanticFocus API via SemanticExtensions (dotnet#1829)
- Improve Window and AnimationManager (dotnet#1653)
- And so on

* Remove IPage on Tizen (#72)

- Merge IFrameworkElement and IView and Remove IPage (dotnet#1875)

* Add Blazor webview (#67)

* Add Blazor webview

* Replace space to tab

* remove space

* Fix entry cursor error (#68)

* Fix entry cursor error

* Update code referring to android extension

* Remove duplicate code & Add exception cases

* Code fixes for consistency

* Fix nullable issue (#77)

* Fix Image loading (#78)

* Fix nested layout issue (#79)

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 <[email protected]>

* Fix issues caused by bump up (#75)

* Fix issues caused by bump up

* Update Tizen file provider

* Update file provider with proper path

* Fix unmatched partial method (#84)

* Fixes incorrect parameter type for ILayoutManager.ArrangeChildren (Rectangle -> Size). (#91)

* Make the HandlerToRendererShim simple

* Revert "Fixes incorrect parameter type for ILayoutManager.ArrangeChildren (Rectangle -> Size). (#91)" (#97)

This reverts commit c54ac83.

* Refactor the LayoutHandler (#99)

* Fix layout measure issue (#100)

* Fix LayoutHandler Update issue (#103)

* Fix LayoutHandler Update issue

* Implement InvalidateMeasure propagation

* Update MapBackground

* Add InitializationOptions (#107)

* Add InitializationOptions

* Set UseSkiaSharp true as default

* Apply DP as default

* Fix SKClipperView to have proper size (#115)

* Fix Essentials sample (#108)

* Fix Essentials sample for Tizen

* Remove UseSkiaSharp flag

* Remove MaterialComponents

* Fix Tizen flag

* Remove CustomRenderer

* Add ShellHandler (#64)

* Add ShellHandler

* Move ShellView into Platform/Tizen

* Update ShellView

* Move the code for embedded tizen resources to csproj

* Add UIExtenstions for shell

* MAUI workload for Tizen (#66)

* Fix build and runtime error after bumping to latest code

* Fix HandlerToRendererShim dispose (#127)

* Add ShellSearchView (#121)

* Add ShellSearchView

* Fix the layout issue in ShellSearchResultList

* Enable nullable

* Fix maximum height of ShellSearchResultList

* Fix scaling issue on Clip (#130)

* Fix DisplayResolutionUnit sync issue (#134)

* Fix build error (#137)

* Replace SkiaGraphicsView with local patch (#135)

This commit will be revert when upstream code is updated

* Support Min/Max Height/Width on IView and applying MauiApp/MauiAppBuilder pattern

- Support Min/Max Height/Width on IView (dotnet#2265)
- Updating .NET MAUI to use MauiApp/MauiAppBuilder pattern and use MS.Extensions.DependencyInjection (dotnet#2137)

* Fix Tizen Templates (#144)

* Fix webview break caused by updated dependency (#143)

* Update the Tizen.UIExtension.ElmSharp version (#145)

* Reomve internal UIExtensions compoments for Shell (#147)

* Adds missing implementation after bumping to latest main

* [Tizen] Adds BoxView Handler

* [Tizen] Implement ProgressColor property in ProgressBarHandlers

- Implement ProgressColor property in ProgressBarHandlers (dotnet#600)

* [Tizen] Handle ContentViews and templated content in new layout system

* Bump to latest (rc1)

- ImageButtonHandler and Handler Re-usability (dotnet#2352)
- Remove IBoxView (dotnet#2619)
- Add SupportedOSPlatformVersion (dotnet#2565)
- Merge all the .NET 6 projects/solutions (dotnet#2505)
- Shadow Support (dotnet#570)
- Add IndicatorView handler(dotnet#2038)

* [Tizen] Apply graphics related code review feedback

* [Tizen] Port H/V TextAlignment to Editor/Picker Handler

* [Tizen] Add TVShellView (#183)

* [Tizen] Add TVShellView

* [Tizen] Update TVShellView

* [Tizen] Update NativeView for Shell

* [Tizen] Update ShellView

* [Tizen] Change default FlyoutBackgroundColor for TV

* [Tizen] Enable nullable

* Refactor WrapperView to draw drawable features (#186)

* Refactor WrapperView to draw drawable features

* Update class names and devide files

* Override NeesContainer to remove duplicated code

* Update class names

* [Tizen] Adds ApplicationHandler

* Fix Background issue of Frame (#193)

* Fix UpdateBackground (#194)

* Fix UpdateBackground

* Add ContentView Background mapper

* Fix Editor/Entry/Label/Layout Background

* Add IWrapperViewCanvas.Content

* Add PageHandler Background mapper

* Restore WrapperView

* Remove unnecessary namespace

* [Tizen] Fix build error on PageHandler

* [Tizen] Apply ITextButton related changes

* [Tizen] Add Shadows (dotnet#233)

* [Tizen] Add Shadows

* [Tizen] Apply review comments

* [Tizen] Move updating shape in proper position

* [Tizen] Update BackgroundDrawable

* [Tizen] Apply review comments

* [Tizen] Add BorderDrawable (dotnet#224)

* Move to platform specific

* Fix border handler for Tizen

* Rename ToDrawable method

* Fix border content layout

* Fix BorderView

* Apply rebase

* [Tizen] Fix entry cursor issue (dotnet#222)

* Fix entry cursor issue

* Fix UpdateSelectionLength method

* [Tizen] Remove TVNavigationDrawer TVNavigationView (dotnet#223)

* [Tizen] Remove TVNavigationDrawer TVNavigationView

* [Elmsharp] Update Tizen.UIExtensions version

* [Tizen] Initial Multi Window support

* [Tizen] Fix MauiContext

* [Tizen] Refactor Border by defining MauiDrawable (dotnet#248)

* [Tizen] Refactor Border by defining MauiDrawable

* [Tizen] Apply review comments

* [Tizen] Remove unnecessary type casting

* [Tizen] Move getting path logic to drawable

* [Tizen] Obsolete AndExpand & Remove IsolatedStorage

* Fix tizen solution (.sln) correctly

* [Tizen] Add VerticalTextAlignment

* [Tizen] Fix Scoping of MauiContext

* [Tizen] Use CoreApplication as native app type

* [Tizen] Applying upstream changes

* [Tizen] Add ContainerView to Layout if it's present

* [Tizen] Initial Reloadyfy support

* [Tizen] Initial IVisualDiagnosticOveraly support

* [Tizen] Move types in the Platform folder into the Platform namespaces

* Fix CollectionView layout issue (dotnet#288)

* Fix CollectionView layout issue

* Remove unnecessary code

* [Tizen] ZIndex proof-of-concept

* Fix ScrollView ContentSize and Padding margin (dotnet#291)

* Fix ScrollView ContentSize and Padding margin

* Fix MapRequestScrollTo

* Update src/Core/src/Handlers/ScrollView/ScrollViewHandler.Tizen.cs

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 <[email protected]>

* Update src/Core/src/Handlers/ScrollView/ScrollViewHandler.Tizen.cs

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 <[email protected]>

* Remove MapContentSize

Co-authored-by: 허강호/Common Platform Lab(SR)/Principal Engineer/삼성전자 <[email protected]>

* Implements WindowOverlay and VisualDiagnosticsOverlay (dotnet#294)

* Implements WindowOverlay and VisualDiagnosticsOverlay

* Apply code review

* [Tizen] Fix Image Handler

* Remove GetDesiredSize (dotnet#295)

* [Tizen] Fix ButtonHandler

* [Tizen] Organize and centralize HandlerExtensions

* Refactor WrapperView and Fix Issue (dotnet#302)

* Refactor WrapperView

* Use Thickness type for Shadow margin

* Update variable name

* Update class name to GraphicsExtensions

* Fix essentials sample for Tizen (dotnet#305)

* [Tizen] Fix NativeView casting issue

* Fix BlazorWebview binary resource issue (dotnet#317)

* [Tizen] Handle query strings in Blazor static assets by trimming them out

* Refactor MauiContext (dotnet#330)

* [Tizen] Adds PaintExtensions

* [Tizen] Implement CursorPosition in IEditor/ITextInput Handlers

* [Tizen] Remove GetNative

* [Tizen] Update Microsoft.NET.Sdk.Maui/WorkloadManifest

* [Tizen] Bump to latest

* [Tizen] Use legacy compat renderers temporarily

* [Tizen] Implement IPlatformApplication.Current

* [Tizen] Fix INativeViewHandler to return more expected NativeView

* [Tizen] Remove legacy TFMs

* [Tizen] Remove `IPlatformInvalidate` and `Device.Invalidate()

* [Tizen] Fix Essential sample build error

* [Tizen] Refactor Essential's implementations

* [Tizen] Renaming public APIs Native -> Platform

* [Tizen] Interfaced Handler for Label, Page, NavigationView, Picker,
ProgressBar, SwipeView

* [Tizen] Moved GetPlatformSize logic into a new service

* [Tizen] Interfaced handler for Switch, TimePicker, WebView, Slider,
SearchBar, RefreshView, RadioButton

* [Tizen] Fix build error after rebasing

* [Tizen] Move TabbedPageHandler to TabbedViewHandler

* [Tizen] Backport p14 changes

* [Tizen] Loaded/Unloaded events and propagate Window

* [Tizen] Implement FillRule property in Polygon/PolylineHandler

* [Tizen] Add install tizen to provision.yml

* [Tizen] Move package version into Versions.props

* Adds the Tizen backend

* [Tizen] Add Resizetizer Tizen Implementation

* Bump to latest and fix build error

* Bump to latest

- Apply to start adding in APIs for adding legacy renderers via assembly scanning (dotnet#1333)
- Update to IMauiContext (dotnet#1357)
- and so on

* Bump to latest

- Apply to patch related to Animation (dotnet#1436)
- Apply to register Microsoft.Maui.Graphics Platforms (dotnet#1441)
- and so on.

* Bump to latest

- Modal Navigation Manager (dotnet#1563)
- Implement the basic WindowHandler (dotnet#1468)
- Don't extract native defaults, meaning users can no longer reset a color back to a platform theme (dotnet#1485)
- Implement Alerts (Alert, Prompt and ActionSheet) (dotnet#1328)
- And so on.

* Bumt to latest

- Effects (dotnet#1574)
- Improve Window and AnimationManager (dotnet#1653)
- and so on

* Fix build error (#60)

* Bump to latest (#71)

- Window lifecycle (dotnet#1754)
- Move New Navigation Handler to Core and make it internal (dotnet#1800)
- Scrollview handler (dotnet#1669)
- ScrollView Resize + Window Handler Resize (dotnet#1676)
- Font AutoScalingEnabled (dotnet#1774)
- Rename Font Properties (dotnet#1755)
- Update layout system to ensure native measure/arrange are called for all controls, even from Page subclasses (dotnet#1819)
- IContainer as IList<IView> (dotnet#1724)
- Implement Layout padding for new StackLayouts and GridLayout (dotnet#1749)
- Delete all the TabIndex, TabStop, Focusable things! (dotnet#1777)
- Introduce SetSemanticFocus API via SemanticExtensions (dotnet#1829)
- Improve Window and AnimationManager (dotnet#1653)
- And so on

* Bump to latest

* Fix Essentials sample (#108)

* Fix Essentials sample for Tizen

* Remove UseSkiaSharp flag

* Remove MaterialComponents

* Fix Tizen flag

* Remove CustomRenderer

* Add ShellHandler (#64)

* Add ShellHandler

* Move ShellView into Platform/Tizen

* Update ShellView

* Move the code for embedded tizen resources to csproj

* Add UIExtenstions for shell

* MAUI workload for Tizen (#66)

* Fix build and runtime error after bumping to latest code

* Fix Essentials (#146)

* Fix Essentials sample for tizen

* Add SemanticScreenReader for Tizen

* Fix Startup

* Adds missing implementation after bumping to latest main

* Bump to latest (rc1)

- ImageButtonHandler and Handler Re-usability (dotnet#2352)
- Remove IBoxView (dotnet#2619)
- Add SupportedOSPlatformVersion (dotnet#2565)
- Merge all the .NET 6 projects/solutions (dotnet#2505)
- Shadow Support (dotnet#570)
- Add IndicatorView handler(dotnet#2038)

* Refactor WrapperView to draw drawable features (#186)

* Refactor WrapperView to draw drawable features

* Update class names and devide files

* Override NeesContainer to remove duplicated code

* Update class names

* [Tizen] Adds ApplicationHandler

* Fix UpdateBackground (#194)

* Fix UpdateBackground

* Add ContentView Background mapper

* Fix Editor/Entry/Label/Layout Background

* Add IWrapperViewCanvas.Content

* Add PageHandler Background mapper

* Restore WrapperView

* Remove unnecessary namespace

* [Tizen] Add BorderDrawable (dotnet#224)

* Move to platform specific

* Fix border handler for Tizen

* Rename ToDrawable method

* Fix border content layout

* Fix BorderView

* Apply rebase

* [Tizen] Refactor Border by defining MauiDrawable (dotnet#248)

* [Tizen] Refactor Border by defining MauiDrawable

* [Tizen] Apply review comments

* [Tizen] Remove unnecessary type casting

* [Tizen] Move getting path logic to drawable

* [Tizen] Fix Scoping of MauiContext

* [Tizen] Applying upstream changes

* [Tizen] Move types in the Platform folder into the Platform namespaces

* [Tizen] Fix ButtonHandler

* [Tizen] Organize and centralize HandlerExtensions

* Refactor MauiContext (dotnet#330)

* Add NUI handler

* [Tizen] Refactor MauiApplication and MauiContext (#216)

* Add AlertManager (#214)

* Code clean up (#218)

* Fix build error on Controls.Sample (dotnet#225)

* [Tizen] Initail CollectionViewHandler for NUI

* Fix PlatformEffect NativeView type (dotnet#231)

* Fix Control.Sample correctly (dotnet#234)

* Fix NamedSize (dotnet#242)

* Update NavigationPageRenderer (dotnet#238)

- Implement title view

* Fix build errors and apply upstream changes

* Refactoring Window and modal (dotnet#246)

* Obsolete AndExpand & fix build eror

* [NUI] Implement BlazorWebView (dotnet#259)

* Implement BlazorWebView

* Update NUI WebView alias name

* Bump to latest

* Fix MinimumWidth/Height MaximumWidth/Height (dotnet#270)

* [NUI] Add GestureManager (dotnet#272)

* Add gesture handler

* enable nullable

* use lazy

* Remove unnessary EFL code in ScrollViewHandler (dotnet#274)

* Add TabbedPage Renderer (dotnet#275)

* [NUI] Implement WrapperView enabling Border and Shadow (dotnet#273)

* [NUI] Add MauiDrawable enabling Border and Shadow

* [NUI] Remove BorderView type and refactor

* Refactor StrokeExtensions

* Remove unnecessary code

* Update a way clearing content

* [NUI] Add Picker handler (dotnet#276)

* Add Picker handler

* Apply code review

* Change timing adding event handler

* Update Picker on touch (dotnet#293)

* Fix NeedsContainer (dotnet#306)

* Update FrameRenderer to support Brush (dotnet#309)

* Fix minor layout issue (dotnet#314)

* Fix build error

* Fix ScrollView ContentSize (dotnet#324)

* Refactor Maui context (dotnet#328)

* Fix build error after bumping to latest

* [Tizen] Add ImageButtonHandler (dotnet#334)

* [NUI] Implement Editor/Entry handler (dotnet#335)

* Implement Editor/Entry handler

* Fix measure issue

* Update paramer name

* Fix if statement

* Fix Editor/Entry CursorPosition issue (dotnet#336)

* [NUI] Add CollectionViewHandler (dotnet#352)

* Fix EmptyView on CollectionView

* Add CollectionViewHandler

* Add SearchBar handler (dotnet#354)

* Implement Clip (dotnet#384)

* Bump to latest

* [NUI] Add TimePickerHandler (dotnet#390)

* [NUI] Add TimePickerHandler

* Update button placement

* Clean up code after rebase (dotnet#399)

* Fix TabbedPage to use Controls.Grid instead Compatibility.Grid (dotnet#400)

* Fix Controls MapText (dotnet#406)

* Fix focus management (dotnet#407)

* Update WrapperView (dotnet#409)

* Update Tizen platform to tizen10.0 (dotnet#416)

* Update WebView handler and MauiWebView handler (dotnet#417)

* Update Label shadow (dotnet#420)

* Fix build error after rebase

* Fix InputTransparent (dotnet#424)

* Implement CarouselView handler (dotnet#428)

* Fix GestureManager crash issue (dotnet#432)

* Update WebView EvaluateJavaScript async (dotnet#435)

* Fix CascadeInputTransparent (dotnet#442)

* Add NavigationView handler (dotnet#449)

* Update WindowOverlay handler (dotnet#452)

* Update ViewExtensions (dotnet#455)

* Update ImageSourceService (dotnet#454)

* Fix MauiSearchBar IsEnabled property (dotnet#458)

* Add SwipeView handler (dotnet#460)

* Clean code after rebase

* Fix GetPath to return a correct path (dotnet#465)

* Update for focus navigation (dotnet#459)

* Cleanup code after rebase

* Fix build error after rebase

* Implement UpdateBackgroundImageSourceAsync extensions method (dotnet#479)

* [NUI] Update SliderHandler with NUI slider component (dotnet#487)

* Update SliderHandler with NUI compnent

* Update SliderHandler with review feedback

* Update with review feedback

* Fix GetPlatformViewBounds as Pixel coordinate (dotnet#488)

* Fix ScrollView content size update issue (dotnet#492)

* Implement Controls.Compatibility for tizen (dotnet#493)

* Optimize Layout Measure (dotnet#495)

* Code cleanup after code rebase

* Fix z-order on Layout (dotnet#497)

* [NUI] Update StepperHandler (dotnet#498)

* Update StepperHandler

* Apply Review comment

* Fix Frame measure (dotnet#501)

* Fix BorderView (dotnet#500)

* Add RadioButton handler (dotnet#499)

* Fix CollectionView Item measure (dotnet#502)

* Fix Measure contraint convert (dotnet#504)

* Fix WrapperView measure (dotnet#507)

* Implement Missing mapper (dotnet#509)

* Fix WrapperView Width/HeightSpecification (dotnet#510)

* Fix ShapeView (dotnet#511)

* Optimize View measure (dotnet#513)

* Fix NavigationPage disposing pages (dotnet#514)

* Fix build error after rebase

* Fix WebView (dotnet#515)

* Fix TableView (dotnet#516)

* Fix Compatibility Cell templates (dotnet#517)

* [NUI] Add IndicatorViewHandler (dotnet#518)

* Add IndicatorViewHandler

* Update review comment

* Add space

* Fix ListViewRenderer (dotnet#519)

* Fix Binding error on CollectionView (dotnet#520)

* Fix layout issue when view was shown from hide (dotnet#522)

* [NUI] Fix ImageButton Clicked (dotnet#523)

* Fix ImageButton Clicked

* Apply review comment

* Fix BlazorWebView RequestIntercept issue (dotnet#524)

* Fix Layout size issue (dotnet#525)

* Fix build error after rebase

* [NUI] Add DatePicker Handler (dotnet#528)

* Add DatePicker

* Add missing class

* Update Style and Use DummyPopupPage

* Refactoring with MauiTimePicker

* add new file

Co-authored-by: Jay Cho <[email protected]>

* Fix GetBoundingBox/OverlayWindow touch point coordinate to DP (dotnet#529)

* Fix CollectionView EmptyView HeaderFooter (dotnet#530)

* Update DateTimePicker width on horizontal (dotnet#531)

* Fix DisconnectHandler (dotnet#532)

* Update Page default background color (dotnet#533)

* Clean up NuGet.config (dotnet#535)

* [NUI] Update font size (dotnet#536)

* Update FontNamedSize

* adjust font size on tv profile

* Add RefreshViewHandler (dotnet#490)

* [Tizen] Refactor compat renderers (dotnet#538)

* [Tizen] Refactor the TabbedPageRenderer (dotnet#541)

* [Tizen] Add FlyoutViewHandler (dotnet#540)

* Add FlyoutView

* Update FlyoutView to cover TV drawer

* Add missing connecting handler

* Update handler implementation using extensions

* Simplify code

Co-authored-by: Jay Cho <[email protected]>

* [Tizen] Add MauiPicker (dotnet#543)

* Add MenuIcon to Toolbar (dotnet#542)

* Add MenuIcon to Toolbar

* Apply Reviews

Co-authored-by: Jay Cho <[email protected]>

* [Tizen] Add ShellHandler (dotnet#539)

* [NUI] Add ShellHandler

* Update PublicAPI.Shipped.txt file

* Fix build error

* Update AppHostingBuilder

* Update ShellView with review feedback

* Remove unnecessary code

* Update Shell navigation stack

* Add IDisposable interface

* Update ShellSectionView

* Update AdppHostBuilderExtensions

* Rebase and update toolbar to resolve conflict

* Remove ShellContentHandler and update ToolbarHandler

* Update ShellView to handle DrawerToggleVisible

* Remove unnecessary code

* Fix build error after rebase

Co-authored-by: Kangho Hur <[email protected]>
Co-authored-by: 조중현/Common Platform Lab(SR)/Engineer/삼성전자 <[email protected]>
Co-authored-by: 김성수/Common Platform Lab(SR)/Staff Engineer/삼성전자 <[email protected]>
Co-authored-by: 박인서/Common Platform Lab(SR)/Associate/삼성전자 <[email protected]>
Co-authored-by: 민성현/Common Platform Lab(SR)/Staff Engineer/삼성전자 <[email protected]>
Co-authored-by: Jay Cho <[email protected]>
  • Loading branch information
7 people authored Aug 26, 2022
1 parent 79cac92 commit 9ee62c1
Show file tree
Hide file tree
Showing 539 changed files with 12,429 additions and 39,503 deletions.
1 change: 0 additions & 1 deletion .nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,4 @@
<PropertyGroup Condition=" $(TargetFramework.StartsWith('uap10.0')) ">
<DefineConstants>WINDOWS_UWP;$(DefineConstants)</DefineConstants>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion .nuspec/Microsoft.Maui.Controls.SingleProject.targets
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
BeforeTargets="_MauiInjectXamlCssAdditionalFiles;GenerateMSBuildEditorConfigFileShouldRun"
Condition=" '$(EnableDefaultItems)' == 'true' and '$(SingleProject)' == 'true' ">

<!-- Removals -->
<!-- Removals -->
<ItemGroup>
<!-- Remove everything that isn't part of this platform -->
<Compile
Expand Down
2 changes: 1 addition & 1 deletion eng/Microsoft.Extensions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
Version="$(MicrosoftCodeAnalysisPublicApiAnalyzersVersion)"
/>
<PackageReference
Update="Tizen.UIExtensions.ElmSharp"
Update="Tizen.UIExtensions.NUI"
Version="$(TizenUIExtensionsVersion)"
/>
<PackageReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ Microsoft.AspNetCore.Components.WebView.Maui.RootComponentsCollection
Microsoft.AspNetCore.Components.WebView.Maui.RootComponentsCollection.JSComponents.get -> Microsoft.AspNetCore.Components.Web.JSComponentConfigurationStore!
Microsoft.AspNetCore.Components.WebView.Maui.RootComponentsCollection.RootComponentsCollection(Microsoft.AspNetCore.Components.Web.JSComponentConfigurationStore! jsComponents) -> void
Microsoft.AspNetCore.Components.WebView.Maui.TizenWebViewManager
Microsoft.AspNetCore.Components.WebView.Maui.TizenWebViewManager.TizenWebViewManager(Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler! blazorMauiWebViewHandler, Tizen.WebView.WebView! webview, System.IServiceProvider! provider, Microsoft.AspNetCore.Components.Dispatcher! dispatcher, Microsoft.Extensions.FileProviders.IFileProvider! fileProvider, Microsoft.AspNetCore.Components.Web.JSComponentConfigurationStore! jsComponents, string! contentRootRelativeToAppRoot, string! hostPageRelativePath) -> void
Microsoft.AspNetCore.Components.WebView.Maui.TizenWebViewManager.TizenWebViewManager(Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler! blazorMauiWebViewHandler, Tizen.NUI.BaseComponents.WebView! webview, System.IServiceProvider! provider, Microsoft.AspNetCore.Components.Dispatcher! dispatcher, Microsoft.Extensions.FileProviders.IFileProvider! fileProvider, Microsoft.AspNetCore.Components.Web.JSComponentConfigurationStore! jsComponents, string! contentRootRelativeToAppRoot, string! hostPageRelativePath) -> void
override Microsoft.AspNetCore.Components.WebView.Maui.TizenWebViewManager.NavigateCore(System.Uri! absoluteUri) -> void
override Microsoft.AspNetCore.Components.WebView.Maui.TizenWebViewManager.SendMessage(string! message) -> void
Microsoft.AspNetCore.Components.WebView.Maui.WebViewContainer
Microsoft.AspNetCore.Components.WebView.Maui.WebViewContainer.WebViewContainer(ElmSharp.EvasObject! parent) -> void
Microsoft.AspNetCore.Components.WebView.Maui.WebViewContainer.WebView.get -> Tizen.WebView.WebView!
Microsoft.AspNetCore.Components.WebView.UrlLoadingEventArgs
Microsoft.AspNetCore.Components.WebView.UrlLoadingEventArgs.Url.get -> System.Uri!
Microsoft.AspNetCore.Components.WebView.UrlLoadingEventArgs.UrlLoadingStrategy.get -> Microsoft.AspNetCore.Components.WebView.UrlLoadingStrategy
Expand All @@ -51,13 +48,13 @@ Microsoft.AspNetCore.Components.WebView.UrlLoadingStrategy.CancelLoad = 2 -> Mic
Microsoft.AspNetCore.Components.WebView.UrlLoadingStrategy.OpenExternally = 0 -> Microsoft.AspNetCore.Components.WebView.UrlLoadingStrategy
Microsoft.AspNetCore.Components.WebView.UrlLoadingStrategy.OpenInWebView = 1 -> Microsoft.AspNetCore.Components.WebView.UrlLoadingStrategy
Microsoft.Extensions.DependencyInjection.BlazorWebViewServiceCollectionExtensions
override Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.CreatePlatformView() -> Microsoft.AspNetCore.Components.WebView.Maui.WebViewContainer!
override Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.ConnectHandler(Microsoft.AspNetCore.Components.WebView.Maui.WebViewContainer! platformView) -> void
override Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.DisconnectHandler(Microsoft.AspNetCore.Components.WebView.Maui.WebViewContainer! platformView) -> void
override Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.CreatePlatformView() -> Tizen.NUI.BaseComponents.WebView!
override Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.ConnectHandler(Tizen.NUI.BaseComponents.WebView! platformView) -> void
override Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.DisconnectHandler(Tizen.NUI.BaseComponents.WebView! platformView) -> void
static Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.MapHostPage(Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler! handler, Microsoft.AspNetCore.Components.WebView.Maui.IBlazorWebView! webView) -> void
static Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.MapRootComponents(Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler! handler, Microsoft.AspNetCore.Components.WebView.Maui.IBlazorWebView! webView) -> void
static Microsoft.Extensions.DependencyInjection.BlazorWebViewServiceCollectionExtensions.AddBlazorWebViewDeveloperTools(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
static Microsoft.Extensions.DependencyInjection.BlazorWebViewServiceCollectionExtensions.AddMauiBlazorWebView(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> Microsoft.AspNetCore.Components.WebView.Maui.IMauiBlazorWebViewBuilder!
static Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler.BlazorWebViewMapper -> Microsoft.Maui.PropertyMapper<Microsoft.AspNetCore.Components.WebView.Maui.IBlazorWebView!, Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler!>!
virtual Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebView.CreateFileProvider(string! contentRootDir) -> Microsoft.Extensions.FileProviders.IFileProvider!
~Microsoft.AspNetCore.Components.WebView.BlazorWebViewInitializedEventArgs.WebView.get -> Tizen.WebView.WebView
~Microsoft.AspNetCore.Components.WebView.BlazorWebViewInitializedEventArgs.WebView.get -> Tizen.NUI.BaseComponents.WebView
150 changes: 77 additions & 73 deletions src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Maui;
using Microsoft.Maui.Dispatching;
using Microsoft.Maui.Handlers;
using Tizen.WebView;
using TChromium = Tizen.WebView.Chromium;
using TWebView = Tizen.WebView.WebView;
using Tizen.NUI;
using NWebView = Tizen.NUI.BaseComponents.WebView;

namespace Microsoft.AspNetCore.Components.WebView.Maui
{
/// <summary>
/// The Tizen <see cref="ViewHandler"/> for <see cref="BlazorWebView"/>.
/// </summary>
public partial class BlazorWebViewHandler : ViewHandler<IBlazorWebView, WebViewContainer>
public partial class BlazorWebViewHandler : ViewHandler<IBlazorWebView, NWebView>
{
private const string BlazorWebViewIdentifier = "BlazorWebView:";
private const string UserAgentHeaderKey = "User-Agent";
private const string AppOrigin = "http://0.0.0.0/";
private const string BlazorInitScript = @"
window.__receiveMessageCallbacks = [];
Expand All @@ -42,53 +44,99 @@ public partial class BlazorWebViewHandler : ViewHandler<IBlazorWebView, WebViewC
})();
";

private TizenWebViewManager? _webviewManager;
private WebViewExtensions.InterceptRequestCallback? _interceptRequestCallback;
static private Dictionary<string, WeakReference<BlazorWebViewHandler>> s_webviewHandlerTable = new Dictionary<string, WeakReference<BlazorWebViewHandler>>();

private TWebView PlatformWebView => PlatformView.WebView;
private TizenWebViewManager? _webviewManager;

private bool RequiredStartupPropertiesSet =>
//_webview != null &&
HostPage != null &&
Services != null;

/// <inheritdoc />
protected override WebViewContainer CreatePlatformView()
protected override NWebView CreatePlatformView()
{
TChromium.Initialize();
MauiApplication.Current.Terminated += (s, e) => TChromium.Shutdown();

return new WebViewContainer(PlatformParent);
return new NWebView()
{
MouseEventsEnabled = true,
KeyEventsEnabled = true,
};
}

/// <inheritdoc />
protected override void ConnectHandler(WebViewContainer platformView)
protected override void ConnectHandler(NWebView platformView)
{
_interceptRequestCallback = OnRequestInterceptCallback;
PlatformWebView.LoadFinished += OnLoadFinished;
PlatformWebView.AddJavaScriptMessageHandler("BlazorHandler", PostMessageFromJS);
PlatformWebView.SetInterceptRequestCallback(_interceptRequestCallback);
PlatformWebView.GetSettings().JavaScriptEnabled = true;
platformView.PageLoadFinished += OnLoadFinished;
platformView.Context.RegisterHttpRequestInterceptedCallback(OnRequestInterceptStaticCallback);
platformView.AddJavaScriptMessageHandler("BlazorHandler", PostMessageFromJS);
platformView.UserAgent += $" {BlazorWebViewIdentifier}{GetHashCode()}";
s_webviewHandlerTable[GetHashCode().ToString()] = new WeakReference<BlazorWebViewHandler>(this);
}

/// <inheritdoc />
protected override void DisconnectHandler(WebViewContainer platformView)
protected override void DisconnectHandler(NWebView platformView)
{
PlatformWebView.LoadFinished -= OnLoadFinished;
platformView.PageLoadFinished -= OnLoadFinished;
base.DisconnectHandler(platformView);
s_webviewHandlerTable.Remove(GetHashCode().ToString());
}


private void PostMessageFromJS(string message)
{
_webviewManager!.MessageReceivedInternal(new Uri(PlatformView.Url), message);
}

private void PostMessageFromJS(JavaScriptMessage message)
private void OnLoadFinished(object? sender, WebViewPageLoadEventArgs e)
{
if (message is null)
//FocusManager.Instance.SetCurrentFocusView(NativeView);
var url = PlatformView.Url;

if (url == AppOrigin)
PlatformView.EvaluateJavaScript(BlazorInitScript);
}

private static void OnRequestInterceptStaticCallback(WebHttpRequestInterceptor interceptor)
{
if (interceptor.Headers.TryGetValue(UserAgentHeaderKey, out var agent))
{
throw new ArgumentNullException(nameof(message));
var idx = agent.IndexOf(BlazorWebViewIdentifier);
if (idx >= 0)
{
var webviewKey = agent.Substring(idx + BlazorWebViewIdentifier.Length);
if (s_webviewHandlerTable.TryGetValue(webviewKey, out var weakHandler)
&& weakHandler.TryGetTarget(out var handler))
{
handler.OnRequestInterceptCallback(interceptor);
return;
}
}
}
interceptor.Ignore();
}

if (message.Name.Equals("BlazorHandler", StringComparison.Ordinal))
private void OnRequestInterceptCallback(WebHttpRequestInterceptor interceptor)
{
var url = interceptor.Url;
if (url.StartsWith(AppOrigin))
{
_webviewManager!.MessageReceivedInternal(new Uri(PlatformWebView.Url), message.GetBodyAsString());
var allowFallbackOnHostPage = url.EndsWith("/");
url = QueryStringHelper.RemovePossibleQueryString(url);
if (_webviewManager!.TryGetResponseContentInternal(url, allowFallbackOnHostPage, out var statusCode, out var statusMessage, out var content, out var headers))
{
var header = $"HTTP/1.0 200 OK\r\n";
foreach (var item in headers)
{
header += $"{item.Key}:{item.Value}\r\n";
}
header += "\r\n";
MemoryStream memstream = new MemoryStream();
content.CopyTo(memstream);
interceptor.SetResponse(header, memstream.ToArray());
return;
}
}
interceptor.Ignore();
}

private void StartWebViewCoreIfPossible()
Expand All @@ -105,14 +153,14 @@ private void StartWebViewCoreIfPossible()

// We assume the host page is always in the root of the content directory, because it's
// unclear there's any other use case. We can add more options later if so.
var contentRootDir = Path.GetDirectoryName(HostPage!) ?? string.Empty;
var hostPageRelativePath = Path.GetRelativePath(contentRootDir, HostPage!);
var contentRootDir = System.IO.Path.GetDirectoryName(HostPage!) ?? string.Empty;
var hostPageRelativePath = System.IO.Path.GetRelativePath(contentRootDir, HostPage!);

var fileProvider = VirtualView.CreateFileProvider(contentRootDir);

_webviewManager = new TizenWebViewManager(
this,
PlatformWebView,
PlatformView,
Services!,
new MauiDispatcher(Services!.GetRequiredService<IDispatcher>()),
fileProvider,
Expand All @@ -125,7 +173,7 @@ private void StartWebViewCoreIfPossible()
VirtualView.BlazorWebViewInitializing(new BlazorWebViewInitializingEventArgs());
VirtualView.BlazorWebViewInitialized(new BlazorWebViewInitializedEventArgs
{
WebView = PlatformWebView,
WebView = PlatformView,
});

if (RootComponents != null)
Expand All @@ -139,50 +187,6 @@ private void StartWebViewCoreIfPossible()
_webviewManager.Navigate("/");
}

private void OnRequestInterceptCallback(IntPtr context, IntPtr request, IntPtr userdata)
{
if (request == IntPtr.Zero)
{
return;
}

var url = PlatformWebView.GetInterceptRequestUrl(request);

if (url.StartsWith(AppOrigin))
{
var allowFallbackOnHostPage = url.EndsWith("/");
url = QueryStringHelper.RemovePossibleQueryString(url);
if (_webviewManager!.TryGetResponseContentInternal(url, allowFallbackOnHostPage, out var statusCode, out var statusMessage, out var content, out var headers))
{
var header = $"HTTP/1.0 200 OK\r\n";
foreach (var item in headers)
{
header += $"{item.Key}:{item.Value}\r\n";
}
header += "\r\n";

using (MemoryStream memstream = new MemoryStream())
{
content.CopyTo(memstream);
var body = memstream.ToArray();
PlatformWebView.SetInterceptRequestResponse(request, header, body, (uint)body.Length);
}
return;
}
}

PlatformWebView.IgnoreInterceptRequest(request);
}

private void OnLoadFinished(object? sender, EventArgs e)
{
PlatformWebView.SetFocus(true);
var url = PlatformWebView.Url;

if (url == AppOrigin)
PlatformWebView.Eval(BlazorInitScript);
}

internal IFileProvider CreateFileProvider(string contentRootDir)
{
return new TizenMauiAssetFileProvider(contentRootDir);
Expand Down
8 changes: 4 additions & 4 deletions src/BlazorWebView/src/Maui/Tizen/TizenWebViewManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.FileProviders;
using TWebView = Tizen.WebView.WebView;
using NWebView = Tizen.NUI.BaseComponents.WebView;

namespace Microsoft.AspNetCore.Components.WebView.Maui
{
Expand All @@ -17,7 +17,7 @@ public class TizenWebViewManager : WebViewManager
private const string AppOrigin = "http://0.0.0.0/";

private readonly BlazorWebViewHandler _blazorMauiWebViewHandler;
private readonly TWebView _webview;
private readonly NWebView _webview;
private readonly string _contentRootRelativeToAppRoot;

/// <summary>
Expand All @@ -31,7 +31,7 @@ public class TizenWebViewManager : WebViewManager
/// <param name="jsComponents">Describes configuration for adding, removing, and updating root components from JavaScript code.</param>
/// <param name="contentRootRelativeToAppRoot">Path to the directory containing application content files.</param>
/// <param name="hostPageRelativePath">Path to the host page within the fileProvider.</param>
public TizenWebViewManager(BlazorWebViewHandler blazorMauiWebViewHandler, TWebView webview, IServiceProvider provider, Dispatcher dispatcher, IFileProvider fileProvider, JSComponentConfigurationStore jsComponents, string contentRootRelativeToAppRoot, string hostPageRelativePath)
public TizenWebViewManager(BlazorWebViewHandler blazorMauiWebViewHandler, NWebView webview, IServiceProvider provider, Dispatcher dispatcher, IFileProvider fileProvider, JSComponentConfigurationStore jsComponents, string contentRootRelativeToAppRoot, string hostPageRelativePath)
: base(provider, dispatcher, new Uri(AppOrigin), fileProvider, jsComponents, hostPageRelativePath)
{
_blazorMauiWebViewHandler = blazorMauiWebViewHandler ?? throw new ArgumentNullException(nameof(blazorMauiWebViewHandler));
Expand All @@ -58,7 +58,7 @@ protected override void NavigateCore(Uri absoluteUri)
protected override void SendMessage(string message)
{
var messageJSStringLiteral = JavaScriptEncoder.Default.Encode(message);
_webview.Eval($"__dispatchMessageCallback(\"{messageJSStringLiteral}\")");
_webview.EvaluateJavaScript($"__dispatchMessageCallback(\"{messageJSStringLiteral}\")");
}

internal void MessageReceivedInternal(Uri uri, string message)
Expand Down
42 changes: 0 additions & 42 deletions src/BlazorWebView/src/Maui/Tizen/WebViewContainer.cs

This file was deleted.

Loading

0 comments on commit 9ee62c1

Please sign in to comment.