From fac3fe100e7b3f10744e6bff98edbcf9a8fb200c Mon Sep 17 00:00:00 2001
From: wanggang <76527413@qq.com>
Date: Mon, 23 Mar 2020 17:13:59 +0800
Subject: [PATCH] update
Former-commit-id: 068a0d9a11392aa04d68d5c7441402bb35e09625
---
.../Properties/AndroidManifest.xml | 12 ++--
labs/XamarinApp/XamarinApp.iOS/Info.plist | 64 +++++++++---------
.../XamarinApp.iOS/WkWebViewRenderer.cs | 23 +++++++
.../XamarinApp.iOS/XamarinApp.iOS.csproj | 4 ++
labs/XamarinApp/XamarinApp/App.xaml.cs | 9 ++-
labs/XamarinApp/XamarinApp/Images/options.png | Bin 0 -> 1773 bytes
labs/XamarinApp/XamarinApp/MainPage.xaml | 9 ++-
labs/XamarinApp/XamarinApp/MainPage.xaml.cs | 11 ++-
labs/XamarinApp/XamarinApp/XamarinApp.csproj | 8 +++
projects/WebMVC/Startup.cs | 10 +--
projects/WebSPA/Startup.cs | 10 +--
tools/nginx-1.16.0/conf/nginx.conf | 4 +-
12 files changed, 107 insertions(+), 57 deletions(-)
create mode 100644 labs/XamarinApp/XamarinApp.iOS/WkWebViewRenderer.cs
create mode 100644 labs/XamarinApp/XamarinApp/Images/options.png
diff --git a/labs/XamarinApp/XamarinApp.Android/Properties/AndroidManifest.xml b/labs/XamarinApp/XamarinApp.Android/Properties/AndroidManifest.xml
index afb4b80c..cdb5380a 100644
--- a/labs/XamarinApp/XamarinApp.Android/Properties/AndroidManifest.xml
+++ b/labs/XamarinApp/XamarinApp.Android/Properties/AndroidManifest.xml
@@ -1,6 +1,6 @@
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/labs/XamarinApp/XamarinApp.iOS/Info.plist b/labs/XamarinApp/XamarinApp.iOS/Info.plist
index 995fd7bf..f4336c5d 100644
--- a/labs/XamarinApp/XamarinApp.iOS/Info.plist
+++ b/labs/XamarinApp/XamarinApp.iOS/Info.plist
@@ -2,37 +2,37 @@
- UIDeviceFamily
-
- 1
- 2
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UISupportedInterfaceOrientations~ipad
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- MinimumOSVersion
- 8.0
- CFBundleDisplayName
- XamarinApp
- CFBundleIdentifier
- com.companyname.XamarinApp
- CFBundleVersion
- 1.0
- UILaunchStoryboardName
- LaunchScreen
- CFBundleName
- XamarinApp
- XSAppIconAssets
- Assets.xcassets/AppIcon.appiconset
+ UIDeviceFamily
+
+ 1
+ 2
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ MinimumOSVersion
+ 8.0
+ CFBundleDisplayName
+ XamarinApp
+ CFBundleIdentifier
+ com.nbaxp.iot
+ CFBundleVersion
+ 1.0
+ UILaunchStoryboardName
+ LaunchScreen
+ CFBundleName
+ XamarinApp
+ XSAppIconAssets
+ Assets.xcassets/AppIcon.appiconset
diff --git a/labs/XamarinApp/XamarinApp.iOS/WkWebViewRenderer.cs b/labs/XamarinApp/XamarinApp.iOS/WkWebViewRenderer.cs
new file mode 100644
index 00000000..b9ab0d79
--- /dev/null
+++ b/labs/XamarinApp/XamarinApp.iOS/WkWebViewRenderer.cs
@@ -0,0 +1,23 @@
+using System.Runtime.InteropServices;
+using Xamarin.Essentials;
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.iOS;
+using XamarinApp.iOS;
+
+[assembly: ExportRenderer(typeof(WebView), typeof(CustomWebViewRenderer))]
+
+namespace XamarinApp.iOS
+{
+ public class CustomWebViewRenderer : WkWebViewRenderer
+ {
+ protected override void OnElementChanged(VisualElementChangedEventArgs e)
+ {
+ base.OnElementChanged(e);
+
+ if (e.NewElement != null)
+ {
+ CustomUserAgent = $"{DeviceInfo.Manufacturer}~{DeviceInfo.Model}~{Device.RuntimePlatform}~{(Device.Idiom == TargetIdiom.Tablet ? "ipad" : "iphone")}";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/labs/XamarinApp/XamarinApp.iOS/XamarinApp.iOS.csproj b/labs/XamarinApp/XamarinApp.iOS/XamarinApp.iOS.csproj
index 6c3376a0..51a743a5 100644
--- a/labs/XamarinApp/XamarinApp.iOS/XamarinApp.iOS.csproj
+++ b/labs/XamarinApp/XamarinApp.iOS/XamarinApp.iOS.csproj
@@ -62,9 +62,13 @@
iPhone Developer
Entitlements.plist
+
+
+
+
diff --git a/labs/XamarinApp/XamarinApp/App.xaml.cs b/labs/XamarinApp/XamarinApp/App.xaml.cs
index c2419110..3946b8ed 100644
--- a/labs/XamarinApp/XamarinApp/App.xaml.cs
+++ b/labs/XamarinApp/XamarinApp/App.xaml.cs
@@ -9,7 +9,12 @@ namespace XamarinApp
public App()
{
InitializeComponent();
-
+#if DEBUG
+ foreach (var res in this.GetType().Assembly.GetManifestResourceNames())
+ {
+ System.Diagnostics.Debug.WriteLine($"resource:{res} ");
+ }
+#endif
MainPage = new MainPage();
}
@@ -25,4 +30,4 @@ namespace XamarinApp
{
}
}
-}
+}
\ No newline at end of file
diff --git a/labs/XamarinApp/XamarinApp/Images/options.png b/labs/XamarinApp/XamarinApp/Images/options.png
new file mode 100644
index 0000000000000000000000000000000000000000..267af1cb749f5aefe653cabe90d0aa2d3edd3b08
GIT binary patch
literal 1773
zcmVhP9DlWp#Yi$65}(PS<$E>Sw;^v9x0q%6@N
z#+hi`4`WPbG;V*0mt<@(*u{-ewhm#ew3N17#;pZP`+eUrUs(~@*YdS6Hjf*(~p*3L<3yn#1-w-XU5-4;o7gdPtfqjm$*;arbyPL?Vn409p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iunsU@iQX-RV6}yvSik?m
zY9Yqq`7(>2l>8h9@FIXy(lC3p_p9o$q|2z#g2j*e;tKr*sZ2847fo?I@JGFnU$M4|
zA|u_dE7FLnDDm*EYFj1dM69tzOQ?a;4F*9zBQ_uprLi@e;C9UauF2LS@3`h(Z*K#huV}g66!1feq!-?#|Ztv28j0`=?@&yJK{)(o{L~B0(c1kDgdAX
z1G?n5RUH*d;z#Zilh{i0Amx^9?mkH4E1~-_fR)(A<>+`Ef#vMpO04}4Lp6q8l-q_u
P00000NkvXXu0mjfK{s8*
literal 0
HcmV?d00001
diff --git a/labs/XamarinApp/XamarinApp/MainPage.xaml b/labs/XamarinApp/XamarinApp/MainPage.xaml
index 9155315c..57664725 100644
--- a/labs/XamarinApp/XamarinApp/MainPage.xaml
+++ b/labs/XamarinApp/XamarinApp/MainPage.xaml
@@ -5,8 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="XamarinApp.MainPage">
-
+
-
+
\ No newline at end of file
diff --git a/labs/XamarinApp/XamarinApp/MainPage.xaml.cs b/labs/XamarinApp/XamarinApp/MainPage.xaml.cs
index 97b16a49..34a27d38 100644
--- a/labs/XamarinApp/XamarinApp/MainPage.xaml.cs
+++ b/labs/XamarinApp/XamarinApp/MainPage.xaml.cs
@@ -15,6 +15,7 @@ namespace XamarinApp
public MainPage()
{
InitializeComponent();
+ this.option.Source = ImageSource.FromResource($"{this.GetType().Assembly.GetName().Name}.Images.options.png");
this._configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "config.txt");
if (!File.Exists(this._configFile))
{
@@ -43,9 +44,13 @@ namespace XamarinApp
private async Task SetBaseUrl()
{
- this._baseUrl = await DisplayPromptAsync("服务器", "配置服务器地址", "确定", "取消", this._baseUrl, keyboard: Keyboard.Url, initialValue: this._baseUrl);
- File.WriteAllText(this._configFile, this._baseUrl);
- this.webView.Source = this._baseUrl;
+ var input = await DisplayPromptAsync("服务器", "配置服务器地址", "确定", "取消", this._baseUrl, keyboard: Keyboard.Url, initialValue: this._baseUrl);
+ if (!string.IsNullOrEmpty(input))
+ {
+ this._baseUrl = input;
+ File.WriteAllText(this._configFile, this._baseUrl);
+ this.webView.Source = this._baseUrl;
+ }
}
}
}
\ No newline at end of file
diff --git a/labs/XamarinApp/XamarinApp/XamarinApp.csproj b/labs/XamarinApp/XamarinApp/XamarinApp.csproj
index dfaf4d43..16621c14 100644
--- a/labs/XamarinApp/XamarinApp/XamarinApp.csproj
+++ b/labs/XamarinApp/XamarinApp/XamarinApp.csproj
@@ -10,6 +10,14 @@
true
+
+
+
+
+
+
+
+
diff --git a/projects/WebMVC/Startup.cs b/projects/WebMVC/Startup.cs
index a29eb9c0..081d982e 100644
--- a/projects/WebMVC/Startup.cs
+++ b/projects/WebMVC/Startup.cs
@@ -29,6 +29,11 @@ namespace WebMVC
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
+ app.Use(async (context, next) =>
+ {
+ System.Console.WriteLine(context.Request.Headers["user-agent"]);
+ await next.Invoke();
+ });
}
else
{
@@ -51,11 +56,6 @@ namespace WebMVC
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
-
- app.Use(async (context, next) =>
- {
- await next.Invoke();
- });
}
}
}
\ No newline at end of file
diff --git a/projects/WebSPA/Startup.cs b/projects/WebSPA/Startup.cs
index 441ad604..b107109e 100644
--- a/projects/WebSPA/Startup.cs
+++ b/projects/WebSPA/Startup.cs
@@ -29,6 +29,11 @@ namespace WebSPA
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
+ app.Use(async (context, next) =>
+ {
+ System.Console.WriteLine(context.Request.Headers["user-agent"]);
+ await next.Invoke();
+ });
}
else
{
@@ -50,11 +55,6 @@ namespace WebSPA
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
-
- app.Use(async (context, next) =>
- {
- await next.Invoke();
- });
}
}
}
\ No newline at end of file
diff --git a/tools/nginx-1.16.0/conf/nginx.conf b/tools/nginx-1.16.0/conf/nginx.conf
index 99e7ec44..25efbad1 100644
--- a/tools/nginx-1.16.0/conf/nginx.conf
+++ b/tools/nginx-1.16.0/conf/nginx.conf
@@ -33,11 +33,11 @@ http {
location / {
#proxy_set_header Host $host:$server_port;
- proxy_pass http://localhost:5001/;
if ($http_user_agent ~* "(mobile|android|ipad|iphone|ipod|tablet)") {
- #rewrite ^(.*) http://localhost:5002$1 permanent;
proxy_pass http://localhost:5002;
+ break;
}
+ proxy_pass http://localhost:5001/;
}
location ^~ /dfs/ {