Skip to content

Commit

Permalink
Upgraded iOS SDK to 10.1.2 and Android SDK to 8.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BradenHancock authored Feb 14, 2023
1 parent 012c00c commit 2c69b1a
Show file tree
Hide file tree
Showing 11 changed files with 12,606 additions and 5,366 deletions.
14 changes: 7 additions & 7 deletions Example/AndroidExample/AndroidExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.2.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.0.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
<PackageReference Include="iProov.Android">
<Version>7.5.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.3.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
<Version>13.0.2</Version>
</PackageReference>
<PackageReference Include="AndHUD">
<Version>1.4.3</Version>
</PackageReference>
<PackageReference Include="iProov.Android">
<Version>8.1.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\APIClient\iProov.APIClient.csproj">
Expand Down
25 changes: 25 additions & 0 deletions Example/AndroidExample/AndroidExample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1704.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidExample", "AndroidExample.csproj", "{2622D791-1535-4992-92AF-5D8528B71AAB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2622D791-1535-4992-92AF-5D8528B71AAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2622D791-1535-4992-92AF-5D8528B71AAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2622D791-1535-4992-92AF-5D8528B71AAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2622D791-1535-4992-92AF-5D8528B71AAB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {195FFCF4-898D-4118-893F-B76D0E5D3F99}
EndGlobalSection
EndGlobal
114 changes: 54 additions & 60 deletions Example/AndroidExample/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@
using iProov.APIClient;
using iProov.Android;
using Android.Content.PM;
using Xamarin.Essentials;

namespace AndroidExample
{
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)]
public class MainActivity : AppCompatActivity
public class MainActivity : AppCompatActivity, IProovCallbackLauncher.IListener
{

APIClient apiClient = new APIClient(
Credentials.BASE_URL,
Credentials.API_CLIENT_URL,
Credentials.API_KEY,
Credentials.SECRET,
"com.iproov.xamarin");

private IProovListener listener;
private IProovCallbackLauncher iProovLauncher = new IProovCallbackLauncher();

protected override void OnCreate(Bundle savedInstanceState)
{
Expand All @@ -36,27 +37,15 @@ protected override void OnCreate(Bundle savedInstanceState)
Toolbar toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(toolbar);

listener = new IProovListener(this);
IProov.RegisterListener(listener);
iProovLauncher.Listener = this;

AppCompatButton launchButton = FindViewById<AppCompatButton>(Resource.Id.launchButton);
launchButton.Click += async delegate {
var userId = Guid.NewGuid().ToString(); // Generate a random User ID
var token = await apiClient.GetToken(
AssuranceType.GenuinePresence, // Choose between GenuinePresence or Liveness
ClaimType.Enrol, // Choose between Enrol or Verify
userId); // Pass the User ID

var options = new IProov.Options();
options.Ui.FloatingPromptEnabled = true;

IProov.Launch(this, Credentials.BASE_URL, token, options);
};
launchButton.Click += launchIProov;
}

protected override void OnDestroy()
{
IProov.UnregisterListener(listener);
iProovLauncher.Listener = null;
base.OnDestroy();
}

Expand All @@ -67,50 +56,55 @@ public override void OnRequestPermissionsResult(int requestCode, string[] permis
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}

private class IProovListener : Java.Lang.Object, IProov.IListener
private async void launchIProov(object sender, EventArgs eventArgs)
{
var guid = Guid.NewGuid().ToString();

private Context context;

public IProovListener(Context context)
{
this.context = context;
}

public void OnConnected()
{
AndHUD.Shared.Show(context, "Connecting...");
}

public void OnConnecting()
{
AndHUD.Shared.Dismiss();
}

public void OnCancelled()
{
AndHUD.Shared.Dismiss(context);
}

public void OnError(IProovException error)
{
AndHUD.Shared.ShowErrorWithStatus(context, error.Reason, timeout: TimeSpan.FromSeconds(1));
}

public void OnFailure(IProov.FailureResult result)
{
AndHUD.Shared.ShowErrorWithStatus(context, result.Reason, timeout: TimeSpan.FromSeconds(1));
}

public void OnProcessing(double progress, string message)
{
AndHUD.Shared.Show(context, message, (int) (progress * 100));
}

public void OnSuccess(IProov.SuccessResult result)
{
AndHUD.Shared.ShowSuccess(context, "Success!", timeout: TimeSpan.FromSeconds(1));
}
var token = await apiClient.GetToken(AssuranceType.GenuinePresence, ClaimType.Enrol, guid);

var options = new IProov.Options();
options.EnableScreenshots = true;

iProovLauncher.Launch(this, Credentials.BASE_URL, token, options);
}

public void OnConnected()
{
AndHUD.Shared.Show(this, "Connecting...");
}

public void OnConnecting()
{
AndHUD.Shared.Dismiss();
}

public void OnCancelled(IProov.Canceller canceller)
{
var cancelledBy = canceller.Name();
AndHUD.Shared.Dismiss(this);
}

public void OnError(IProovException error)
{
AndHUD.Shared.ShowErrorWithStatus(this, error.Reason, timeout: TimeSpan.FromSeconds(1));
}

public void OnFailure(IProov.FailureResult result)
{
var feedbackCode = result.Reason.FeedbackCode;
var reason = this.GetString(result.Reason.Description);
AndHUD.Shared.ShowErrorWithStatus(this, reason, timeout: TimeSpan.FromSeconds(1));
}

public void OnProcessing(double progress, string message)
{
AndHUD.Shared.Show(this, message, (int) (progress * 100));
}

public void OnSuccess(IProov.SuccessResult result)
{
AndHUD.Shared.ShowSuccess(this, "Success!", timeout: TimeSpan.FromSeconds(1));
}

}
}
Loading

0 comments on commit 2c69b1a

Please sign in to comment.