diff --git a/MAUI/Anyline.Examples.MAUI.csproj b/MAUI/Anyline.Examples.MAUI.csproj index 9961cfd..173dac7 100644 --- a/MAUI/Anyline.Examples.MAUI.csproj +++ b/MAUI/Anyline.Examples.MAUI.csproj @@ -18,7 +18,7 @@ 9C37433F-9192-4C96-B49A-B9A7E047FBC2 - 6.0.0 + 6.1.0 1 12.0 @@ -79,9 +79,9 @@ - - + + diff --git a/MAUI/MainPage.xaml.cs b/MAUI/MainPage.xaml.cs index fa8064e..001c895 100644 --- a/MAUI/MainPage.xaml.cs +++ b/MAUI/MainPage.xaml.cs @@ -15,12 +15,12 @@ public MainPage() NavigationPage.SetBackButtonTitle(this, "Home"); // (this license key should be, ideally, securely fetched from your back-end server, a secret manager/provider, or obfuscated in the final app) - string licenseKey = "YOUR_LICENSE_KEY_HERE"; string licenseErrorMessage = null; // Initializes the Anyline SDK natively in each platform and gets the result of the initialization back - bool isAnylineInitialized = new AnylineSDKService().SetupWithLicenseKey(licenseKey, out licenseErrorMessage); + AnylineSDKService anylineSDKService = new AnylineSDKService(); + bool isAnylineInitialized = anylineSDKService.SetupWithLicenseKey(licenseKey, out licenseErrorMessage); if (isAnylineInitialized) { @@ -45,7 +45,7 @@ public MainPage() slScanModes.Add(new Label { Text = licenseErrorMessage, FontSize = 14, TextColor = Colors.White, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }); } - ShowAnylineSDKVersion(); + ShowAnylineSDKVersion(anylineSDKService); } private async void BtScan_Clicked(object sender, EventArgs e) @@ -74,16 +74,11 @@ private async void BtScan_Clicked(object sender, EventArgs e) (sender as Button).IsEnabled = true; } - private void ShowAnylineSDKVersion() + private void ShowAnylineSDKVersion(AnylineSDKService anylineSDKService) { - Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); - var assembly = assemblies.Where(x => x.FullName.StartsWith("Anyline.SDK.NET")).FirstOrDefault(); - if (assembly != null) - { - Version ver = assembly.GetName().Version; - slScanModes.Children.Add(new Label { Text = $"Anyline SDK Version: {ver}", FontSize = 10, Margin = 10, TextColor = Colors.White }); - slScanModes.Children.Add(new Label { Text = $"App build: {GetAppVersion()}", FontSize = 10, Margin = 10, TextColor = Colors.White }); - } + slScanModes.Children.Add(new Label { Text = $"Anyline Native SDK Version: {anylineSDKService.GetSDKVersion()}", FontSize = 10, Margin = 10, TextColor = Colors.White }); + slScanModes.Children.Add(new Label { Text = $"Anyline Plugin Version: {anylineSDKService.GetPluginVersion()}", FontSize = 10, Margin = 10, TextColor = Colors.White }); + slScanModes.Children.Add(new Label { Text = $"App build: {GetAppVersion()}", FontSize = 10, Margin = 10, TextColor = Colors.White }); } private string GetAppVersion() { diff --git a/MAUI/Platforms/Android/AnylineSDKService.Android.cs b/MAUI/Platforms/Android/AnylineSDKService.Android.cs index b5da04f..9be384a 100644 --- a/MAUI/Platforms/Android/AnylineSDKService.Android.cs +++ b/MAUI/Platforms/Android/AnylineSDKService.Android.cs @@ -17,5 +17,15 @@ public partial bool SetupWithLicenseKey(string licenseKey, out string licenseErr return false; } } + + public String GetPluginVersion() + { + return IO.Anyline2.AnylineSdk.GetPluginVersion().ToString(); + } + + public String GetSDKVersion() + { + return AT.Nineyards.Anyline.BuildConfig.VersionName; + } } } diff --git a/MAUI/Platforms/Android/CustomRenderers/AnylineScanningViewRenderer.cs b/MAUI/Platforms/Android/CustomRenderers/AnylineScanningViewRenderer.cs index b48013b..d258c04 100644 --- a/MAUI/Platforms/Android/CustomRenderers/AnylineScanningViewRenderer.cs +++ b/MAUI/Platforms/Android/CustomRenderers/AnylineScanningViewRenderer.cs @@ -12,6 +12,7 @@ using Java.Util; using Microsoft.Maui.Controls.Handlers.Compatibility; using Microsoft.Maui.Controls.Platform; +using IO.Anyline2.Viewplugin.AR.UiFeedback; namespace Anyline.Examples.MAUI.Platforms.Android.CustomRenderers { @@ -61,6 +62,7 @@ private void InitializeAnyline() _scanView.ScanViewPlugin.ResultReceived = this; _scanView.ScanViewPlugin.ResultsReceived = this; + _scanView.ScanViewPlugin.UiFeedbackInfoReceived = new UIFeedbackLogger(); // Handle camera open events _scanView.CameraView.CameraOpened += _scanView_CameraOpened; @@ -105,6 +107,49 @@ public void EventReceived(Java.Lang.Object data) } } + partial class UIFeedbackLogger : Java.Lang.Object, IEvent + { + void IEvent.EventReceived(Java.Lang.Object data) + { + var json = (Org.Json.JSONObject)data; + var messageArray = json.OptJSONArray("messages"); + if (messageArray != null) + { + for (int i = 0; i < messageArray.Length(); i++) + { + var msgEntry = UIFeedbackOverlayInfoEntry.FromJson((Org.Json.JSONObject) messageArray.Get(i)); + if (msgEntry.GetLevel() == UIFeedbackOverlayInfoEntry.Level.Info) + { + Log.Info("AnylineScanningViewRenderer - Android", "UIFeedbackInfo: " + msgEntry.Message); + } + else if (msgEntry.GetLevel() == UIFeedbackOverlayInfoEntry.Level.Warning) + { + Log.Warn("AnylineScanningViewRenderer - Android", "UIFeedbackWarn: " + msgEntry.Message); + } + else if (msgEntry.GetLevel() == UIFeedbackOverlayInfoEntry.Level.Error) + { + Log.Error("AnylineScanningViewRenderer - Android", "UIFeedbackError: " + msgEntry.Message); + } + } + } + } + } + + /// + /// On layout change, propagate changes to ScanView. + /// + /// + /// + /// + /// + /// + protected override void OnLayout(bool changed, int left, int top, int right, int bottom) + { + base.OnLayout(changed, left, top, right, bottom); + if (_scanView != null) + _scanView.Layout(left, top, right, bottom); + } + /// /// On device rotated, dispose and re-initialize the ScanView. /// diff --git a/MAUI/Platforms/iOS/AnylineSDKService.iOS.cs b/MAUI/Platforms/iOS/AnylineSDKService.iOS.cs index d3e55fb..db26acc 100644 --- a/MAUI/Platforms/iOS/AnylineSDKService.iOS.cs +++ b/MAUI/Platforms/iOS/AnylineSDKService.iOS.cs @@ -20,5 +20,15 @@ public partial bool SetupWithLicenseKey(string licenseKey, out string licenseErr return false; } } + + public String GetPluginVersion() + { + return Anyline.SDK.NET.iOS.AnylineSDK.GetPluginVersion().ToString(); + } + + public String GetSDKVersion() + { + return Anyline.SDK.NET.iOS.AnylineSDK.VersionNumber; + } } } diff --git a/MAUI/Resources/Raw/Configs/tire_tin_dot_config.json b/MAUI/Resources/Raw/Configs/tire_tin_dot_config.json index fa6bb11..97dc4f3 100644 --- a/MAUI/Resources/Raw/Configs/tire_tin_dot_config.json +++ b/MAUI/Resources/Raw/Configs/tire_tin_dot_config.json @@ -43,6 +43,87 @@ "beepOnResult": false, "vibrateOnResult": true, "blinkAnimationOnResult": true + }, + "uiFeedbackConfig": { + "presets": [ + { + "presetName": "tin_custom_v1", + "presetAttributes": [ + { + "attributeName": "lighting_toodark_image", + "attributeValue": "uifeedback_tin_toodark" + }, + { + "attributeName": "lighting_toobright_image", + "attributeValue": "uifeedback_tin_toobright" + }, + { + "attributeName": "distance_moveback_image", + "attributeValue": "uifeedback_tin_moveback" + }, + { + "attributeName": "distance_movecloser_image", + "attributeValue": "uifeedback_tin_movecloser" + }, + { + "attributeName": "format_wrong_image", + "attributeValue": "uifeedback_tin_wrongformat" + }, + { + "attributeName": "date_wrong_image", + "attributeValue": "uifeedback_tin_wrongformat" + }, + { + "attributeName": "lighting_toodark_text", + "attributeValue": "" + }, + { + "attributeName": "lighting_toobright_text", + "attributeValue": "" + }, + { + "attributeName": "distance_moveback_text", + "attributeValue": "" + }, + { + "attributeName": "distance_movecloser_text", + "attributeValue": "" + }, + { + "attributeName": "format_wrong_text", + "attributeValue": "" + }, + { + "attributeName": "date_wrong_text", + "attributeValue": "" + }, + { + "attributeName": "lighting_toodark_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "lighting_toobright_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "distance_moveback_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "distance_movecloser_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "format_wrong_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "date_wrong_sound", + "attributeValue": "info_sound_TIN.wav" + } + ] + } + ] } } } \ No newline at end of file diff --git a/MAUI/Resources/Raw/Configs/tire_tin_universal_config.json b/MAUI/Resources/Raw/Configs/tire_tin_universal_config.json index cfdbe45..2e1eba1 100644 --- a/MAUI/Resources/Raw/Configs/tire_tin_universal_config.json +++ b/MAUI/Resources/Raw/Configs/tire_tin_universal_config.json @@ -43,6 +43,87 @@ "beepOnResult": false, "vibrateOnResult": true, "blinkAnimationOnResult": true + }, + "uiFeedbackConfig": { + "presets": [ + { + "presetName": "tin_custom_v1", + "presetAttributes": [ + { + "attributeName": "lighting_toodark_image", + "attributeValue": "uifeedback_tin_toodark" + }, + { + "attributeName": "lighting_toobright_image", + "attributeValue": "uifeedback_tin_toobright" + }, + { + "attributeName": "distance_moveback_image", + "attributeValue": "uifeedback_tin_moveback" + }, + { + "attributeName": "distance_movecloser_image", + "attributeValue": "uifeedback_tin_movecloser" + }, + { + "attributeName": "format_wrong_image", + "attributeValue": "uifeedback_tin_wrongformat" + }, + { + "attributeName": "date_wrong_image", + "attributeValue": "uifeedback_tin_wrongformat" + }, + { + "attributeName": "lighting_toodark_text", + "attributeValue": "" + }, + { + "attributeName": "lighting_toobright_text", + "attributeValue": "" + }, + { + "attributeName": "distance_moveback_text", + "attributeValue": "" + }, + { + "attributeName": "distance_movecloser_text", + "attributeValue": "" + }, + { + "attributeName": "format_wrong_text", + "attributeValue": "" + }, + { + "attributeName": "date_wrong_text", + "attributeValue": "" + }, + { + "attributeName": "lighting_toodark_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "lighting_toobright_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "distance_moveback_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "distance_movecloser_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "format_wrong_sound", + "attributeValue": "info_sound_TIN.wav" + }, + { + "attributeName": "date_wrong_sound", + "attributeValue": "info_sound_TIN.wav" + } + ] + } + ] } } } \ No newline at end of file