Skip to content

Commit

Permalink
Wert clickId added (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
mismirnov authored May 18, 2021
1 parent a3682d3 commit 69e1b0b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion atomex.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.8" package="com.atomex.android" android:versionCode="13">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.8.1" package="com.atomex.android" android:versionCode="14">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />
<application android:label="Atomex" android:allowBackup="false" android:icon="@drawable/ic_launcher">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification" />
Expand Down
2 changes: 1 addition & 1 deletion atomex.iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<key>CFBundleIdentifier</key>
<string>com.atomex.ios</string>
<key>CFBundleVersion</key>
<string>1.8.0</string>
<string>1.8.1</string>
<key>UILaunchStoryboardName</key>
<string>AtomexLaunchScreen</string>
<key>CFBundleName</key>
Expand Down
16 changes: 14 additions & 2 deletions atomex/ViewModel/BuyViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using System.Linq;
using System.Windows.Input;
using Atomex;
using Atomex.Common;
using Atomex.Core;
using Atomex.Cryptography;
using Xamarin.Essentials;
using Xamarin.Forms;

Expand All @@ -29,9 +31,9 @@ public Network Network
_network = value;

if (_network == Network.MainNet)
Url = $"https://widget.wert.io/?partner_id=atomex&theme={_appTheme}";
Url = $"https://widget.wert.io/atomex/widget?click_id=user:{_userId}/network:{_network}&theme={_appTheme}";
else
Url = $"https://sandbox.wert.io/?partner_id=01F298K3HP4DY326AH1NS3MM3M&theme={_appTheme}";
Url = $"https://sandbox.wert.io/01F298K3HP4DY326AH1NS3MM3M/widget?click_id=user:{_userId}/network:{_network}&theme={_appTheme}";

OnPropertyChanged(nameof(Network));
}
Expand All @@ -44,6 +46,8 @@ public string Url
set { _url = value; OnPropertyChanged(nameof(Url)); }
}

private string _userId;

private string _appTheme;

private string[] _redirectedUrls = { "https://widget.wert.io/terms-and-conditions",
Expand All @@ -56,6 +60,7 @@ public BuyViewModel(IAtomexApp app, string appTheme)
{
AtomexApp = app ?? throw new ArgumentNullException(nameof(AtomexApp));
IsLoading = true;
_userId = GetUserId();
_appTheme = appTheme;
Network = app.Account.Network;
}
Expand All @@ -73,6 +78,13 @@ private void CanExecute(WebNavigatingEventArgs args)
args.Cancel = true;
}
}

private string GetUserId()
{
using var servicePublicKey = AtomexApp.Account.Wallet.GetServicePublicKey(AtomexApp.Account.UserSettings.AuthenticationKeyIndex);
using var publicKey = servicePublicKey.ToUnsecuredBytes();
return Sha256.Compute(Sha256.Compute(publicKey)).ToHexString();
}
}
}

0 comments on commit 69e1b0b

Please sign in to comment.