Skip to content

Commit

Permalink
Release 3.27.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hisyam committed Feb 12, 2020
1 parent 2847209 commit e4cd522
Show file tree
Hide file tree
Showing 2,553 changed files with 3,191,691 additions and 999,571 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ UpgradeLog.*
*.DS_Store
*.nib
*.pfx
.vs
30 changes: 24 additions & 6 deletions MOLPayXDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Text;
using Xamarin.Essentials;

namespace MPayXDKExample //Update to your project namespace accordingly
{
Expand Down Expand Up @@ -99,7 +100,7 @@ private void OnMolpayUILoadBegin(object sender, WebNavigatingEventArgs e)

}

private void OnMolpayUILoadFinish(object sender, WebNavigatedEventArgs e)
private async void OnMolpayUILoadFinish(object sender, WebNavigatedEventArgs e)
{
if (isInternalDebugging)
{
Expand All @@ -119,6 +120,23 @@ private void OnMolpayUILoadFinish(object sender, WebNavigatedEventArgs e)
string evaljs = "window.open = function (open) { return function (url, name, features) { window.location = url ; return window; }; } (window.open);";
this.molpayUI.Eval(evaljs);
}
if (url.Contains("intermediate_appTNG-EWALLET.php"))
{
if (isInternalDebugging)
{
System.Diagnostics.Debug.WriteLine("+++++++++++ tngdurl found");
}

string result = await this.molpayUI.EvaluateJavaScriptAsync($"document.getElementById('systembrowserurl').innerHTML");
string decodedResult = Base64Decode(result);
System.Diagnostics.Debug.WriteLine("+++++++++++ systembrowserurl, result = {0}", decodedResult);

Uri uri = new Uri(decodedResult, UriKind.Absolute);
System.Diagnostics.Debug.WriteLine("+++++++++++ uri = {0}", uri);

if (await Launcher.CanOpenAsync(uri))
await Launcher.OpenAsync(uri);
}
}

// MainUI handlers
Expand All @@ -144,7 +162,7 @@ private void OnMainUILoadBegin (object sender, WebNavigatingEventArgs e)

url = url.Replace(mpopenmolpaywindow, "");

if (Device.OS == TargetPlatform.iOS)
if (Device.RuntimePlatform == Device.iOS)
{
url = url.Replace("-", "+");
url = url.Replace("_", "=");
Expand Down Expand Up @@ -183,7 +201,7 @@ private void OnMainUILoadBegin (object sender, WebNavigatingEventArgs e)

url = url.Replace(mptransactionresults, "");

if (Device.OS == TargetPlatform.iOS)
if (Device.RuntimePlatform == Device.iOS)
{
url = url.Replace("-", "+");
url = url.Replace("_", "=");
Expand Down Expand Up @@ -237,7 +255,7 @@ private void OnMainUILoadBegin (object sender, WebNavigatingEventArgs e)

url = url.Replace(mprunscriptonpopup, "");

if (Device.OS == TargetPlatform.iOS)
if (Device.RuntimePlatform == Device.iOS)
{
url = url.Replace("-", "+");
url = url.Replace("_", "=");
Expand Down Expand Up @@ -266,7 +284,7 @@ private void OnMainUILoadBegin (object sender, WebNavigatingEventArgs e)

url = url.Replace(mppinstructioncapture, "");

if (Device.OS == TargetPlatform.iOS)
if (Device.RuntimePlatform == Device.iOS)
{
url = url.Replace("-", "+");
url = url.Replace("_", "=");
Expand Down Expand Up @@ -312,7 +330,7 @@ private void OnMainUILoadBegin (object sender, WebNavigatingEventArgs e)

url = url.Replace(mpopenbankwindow, "");

if (Device.OS == TargetPlatform.iOS)
if (Device.RuntimePlatform == Device.iOS)
{
url = url.Replace("-", "+");
url = url.Replace("_", "=");
Expand Down
4 changes: 2 additions & 2 deletions MPayXDKExample/Droid/MOLPayExtensionForAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public void saveImageToDevice(String base64ImageString, String filename)
System.Diagnostics.Debug.WriteLine("+++++++++++ saveImageToDevice, filename = {0}", filename);

byte[] imageAsBytes = Base64.Decode(base64ImageString, Base64Flags.Default);
Bitmap bitmap = BitmapFactory.DecodeByteArray(imageAsBytes, 0, imageAsBytes.Length);
Android.Graphics.Bitmap bitmap = BitmapFactory.DecodeByteArray(imageAsBytes, 0, imageAsBytes.Length);

var sdCardPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
var filePath = System.IO.Path.Combine(sdCardPath.ToString(), filename);
var stream = new FileStream(filePath, FileMode.Create);

bool compress = bitmap.Compress(Bitmap.CompressFormat.Png, 100, stream);
bool compress = bitmap.Compress(Android.Graphics.Bitmap.CompressFormat.Png, 100, stream);
stream.Close();

MediaScannerConnection.ScanFile(Application.Context, new String[] { filePath }, null, null);
Expand Down
100 changes: 53 additions & 47 deletions MPayXDKExample/Droid/MPayXDKExample.Droid.csproj

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion MPayXDKExample/Droid/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.molpay.mpayxdkexample">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="MPayXDKExample"></application>
<application android:label="MPayXDKExample">
<activity android:name="DeepLinkActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="testappurl" />
</intent-filter>
</activity>
</application>
</manifest>
Loading

0 comments on commit e4cd522

Please sign in to comment.