Skip to content

Commit

Permalink
sulutions for issue #2 and #4
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicius.dutra committed Feb 11, 2020
1 parent 710f1ba commit 5e8613d
Show file tree
Hide file tree
Showing 4 changed files with 1,640 additions and 16 deletions.
14 changes: 14 additions & 0 deletions HybridWebView/Droid/HybridWebViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ protected override void OnElementChanged(ElementChangedEventArgs<HybridWebViewCo
Control.Settings.UseWideViewPort = true;
}
}

if (Control != null)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
{
// chromium, enable hardware acceleration
Control.SetLayerType(Android.Views.LayerType.Hardware, null);
}
else
{
// older android version, disable hardware acceleration
Control.SetLayerType(Android.Views.LayerType.Software, null);
}
}
}

private void SetupElement(HybridWebViewControl element)
Expand Down
12 changes: 6 additions & 6 deletions HybridWebView/HybridWebView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<!--Work around so the conditions work below-->
<TargetFrameworks></TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid81;uap10.0.16299;Xamarin.Mac20</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid81;uap10.0.18362;Xamarin.Mac20</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.0;netstandard2.0;Xamarin.iOS10;MonoAndroid81;Xamarin.Mac20</TargetFrameworks>
<!--Feel free to add as many targets as you need below
netstandard1.0;netstandard2.0;MonoAndroid81;Xamarin.iOS10;uap10.0.16299;Xamarin.TVOS10;Xamarin.WatchOS10;Xamarin.Mac20;Tizen40
Expand All @@ -14,10 +14,10 @@
<PackageId>Plugin.HybridWebView</PackageId>

<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
<Version>1.0.0.0</Version>
<PackageVersion>1.0.0.0</PackageVersion>
<AssemblyVersion>1.0.0.2</AssemblyVersion>
<AssemblyFileVersion>1.0.0.2</AssemblyFileVersion>
<Version>1.0.0.2</Version>
<PackageVersion>1.0.0.2-alpha</PackageVersion>
<PackOnBuild>true</PackOnBuild>
<NeutralLanguage>en</NeutralLanguage>
<LangVersion>default</LangVersion>
Expand All @@ -30,7 +30,7 @@
<DebugType>portable</DebugType>

<!--TODO: Fill these in-->
<PackageLicenseUrl>https://github.com/devsmadeofsteel/Plugin.HybridWebView/blob/master/LICENCE.md</PackageLicenseUrl>
<license>https://github.com/devsmadeofsteel/Plugin.HybridWebView/blob/master/LICENCE.md</license>
<PackageProjectUrl>https://github.com/devsmadeofsteel/Plugin.HybridWebView</PackageProjectUrl>
<RepositoryUrl>https://github.com/devsmadeofsteel/Plugin.HybridWebView</RepositoryUrl>
<PackageReleaseNotes>RELEASE NOTES</PackageReleaseNotes>
Expand Down
13 changes: 7 additions & 6 deletions HybridWebView/iOS/HybridWebViewRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ private async Task OnClearCookiesRequest()
await store.DeleteCookieAsync(c);
}

var url = new Uri(Element.Source);
var sharedCookies = NSHttpCookieStorage.SharedStorage.CookiesForUrl(url);
foreach (var c in sharedCookies)
if (Uri.TryCreate(Element.Source, UriKind.RelativeOrAbsolute, out var url))
{
NSHttpCookieStorage.SharedStorage.DeleteCookie(c);
var sharedCookies = NSHttpCookieStorage.SharedStorage.CookiesForUrl(url);
foreach (var c in sharedCookies)
{
NSHttpCookieStorage.SharedStorage.DeleteCookie(c);
}
}

}

private async Task<string> OnSetCookieRequestAsync(Cookie cookie)
Expand Down Expand Up @@ -214,7 +215,7 @@ private async Task<string> OnGetAllCookiesRequestAsync()

private async Task<string> OnGetCookieRequestAsync(string key)
{
if (Control == null || Element == null) return string.Empty;
if (Control?.Url == null || Element == null) return string.Empty;
var url = Control.Url;
var toReturn = string.Empty;

Expand Down

0 comments on commit 5e8613d

Please sign in to comment.