Skip to content

Commit

Permalink
Release 6.1.0 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-graca authored Apr 11, 2024
1 parent 2e3f39e commit 991c2e9
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 15 deletions.
6 changes: 3 additions & 3 deletions MAUI/Anyline.Examples.MAUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ApplicationIdGuid>9C37433F-9192-4C96-B49A-B9A7E047FBC2</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>6.0.0</ApplicationDisplayVersion>
<ApplicationDisplayVersion>6.1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">12.0</SupportedOSPlatformVersion>
Expand Down Expand Up @@ -79,9 +79,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Anyline.SDK.NET.Android" Version="6.0.0" />
<PackageReference Include="Anyline.SDK.NET.iOS" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Anyline.SDK.NET.iOS" Version="6.1.0" />
<PackageReference Include="Anyline.SDK.NET.Android" Version="6.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 7 additions & 12 deletions MAUI/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down Expand Up @@ -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()
{
Expand Down
10 changes: 10 additions & 0 deletions MAUI/Platforms/Android/AnylineSDKService.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
}
}

/// <summary>
/// On layout change, propagate changes to ScanView.
/// </summary>
/// <param name="changed"></param>
/// <param name="left"></param>
/// <param name="top"></param>
/// <param name="right"></param>
/// <param name="bottom"></param>
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);
}

/// <summary>
/// On device rotated, dispose and re-initialize the ScanView.
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions MAUI/Platforms/iOS/AnylineSDKService.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
81 changes: 81 additions & 0 deletions MAUI/Resources/Raw/Configs/tire_tin_dot_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
]
}
}
}
81 changes: 81 additions & 0 deletions MAUI/Resources/Raw/Configs/tire_tin_universal_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
]
}
}
}

0 comments on commit 991c2e9

Please sign in to comment.