-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from doo/EPIC-4279-xam-sdk-update-v4.2.0
[EPIC-4283] - Xamarin SDK Update to 4.2.0
- Loading branch information
Showing
14 changed files
with
836 additions
and
268 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ers.Example.Forms/Native.Renderers.Example.Forms.iOS/Delegates/BarcodeScannerDelegates.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Native.Renderers.Example.Forms.iOS.Utils; | ||
using ScanbotSDK.iOS; | ||
using ScanbotSDK.Xamarin.Forms; | ||
|
||
namespace Native.Renderers.Example.Forms.iOS | ||
{ | ||
|
||
// Since we cannot directly inherit from SBSDKBarcodeScannerViewControllerDelegate in our ViewRenderer, | ||
// we have created this wrapper class to allow binding to its events through the use of delegates | ||
internal class BarcodeScannerDelegate : SBSDKBarcodeScannerViewControllerDelegate | ||
{ | ||
public delegate void OnDetectHandler(SBSDKBarcodeScannerResult[] codes); | ||
public OnDetectHandler OnDetect; | ||
|
||
public override void DidDetectBarcodes(SBSDKBarcodeScannerViewController controller, SBSDKBarcodeScannerResult[] codes) | ||
{ | ||
OnDetect?.Invoke(codes); | ||
} | ||
|
||
public override bool ShouldDetectBarcodes(SBSDKBarcodeScannerViewController controller) | ||
{ | ||
if (!SBSDK.IsLicenseValid) | ||
{ | ||
ViewUtils.ShowAlert("License Expired!", "Ok"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
|
||
internal class BarcodeTrackingOverlayDelegate : SBSDKBarcodeTrackingOverlayControllerDelegate | ||
{ | ||
public delegate void DidTapOnBarcodeAROverlay(SBSDKBarcodeScannerResult barcode); | ||
public DidTapOnBarcodeAROverlay DidTapBarcodeOverlay; | ||
|
||
public override void DidTapOnBarcode(SBSDKBarcodeTrackingOverlayController controller, SBSDKBarcodeScannerResult barcode) | ||
{ | ||
DidTapBarcodeOverlay?.Invoke(barcode); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Native.Renderers.Example.Forms/Native.Renderers.Example.Forms.iOS/Utils/ViewUtils.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using UIKit; | ||
|
||
namespace Native.Renderers.Example.Forms.iOS.Utils | ||
{ | ||
public static class ViewUtils | ||
{ | ||
/// <summary> | ||
/// RootViewContoller from the view hierarchy. | ||
/// </summary> | ||
internal static UIViewController RooViewController => (UIApplication.SharedApplication?.Delegate as AppDelegate)?.Window?.RootViewController; | ||
|
||
// ------------------------------------------------------------------------------------------------------------------------ | ||
// Displays a popup message with message and a single button.s | ||
// ------------------------------------------------------------------------------------------------------------------------ | ||
internal static void ShowAlert(string message, string buttonTitle) | ||
{ | ||
var alert = UIAlertController.Create("Alert", message, UIAlertControllerStyle.Alert); | ||
var action = UIAlertAction.Create(buttonTitle ?? "Ok", UIAlertActionStyle.Cancel, (obj) => { }); | ||
alert.AddAction(action); | ||
RooViewController?.PresentViewController(alert, true, null); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.