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 00000000..267af1cb
Binary files /dev/null and b/labs/XamarinApp/XamarinApp/Images/options.png differ
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/ {