Skip to content

Commit 31a84d6

Browse files
v0.0.8, Web3Auth for WebGL and full Metaplex support (#65)
* ⬆️ Update native websocket libs * ⬆️ Update rpc lib * ✨ Usage metaplex lib instead of custom implementation * ♻️ Remove unused class * ⬆️ Update NativeWebSockets * ⬆️ Update rpc lib * ⚡ Improve error handling * 🎨 Improve nft visualisation * ✨ Add Web3Auth login for WebGL * 🔖 Bump version to 0.0.8
1 parent 40c9b4b commit 31a84d6

File tree

109 files changed

+13665
-12141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+13665
-12141
lines changed

Packages/NativeWebSocket.dll

0 Bytes
Binary file not shown.

Packages/Solana.Unity.Metaplex.dll

494 KB
Binary file not shown.

Packages/Solana.Unity.Metaplex.dll.meta

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/Solana.Unity.Rpc.dll

0 Bytes
Binary file not shown.

Runtime/Plugins/Phantom.jslib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mergeInto(LibraryManager.library, {
22

33
ExternConnectPhantom: async function (callback) {
4-
if ('phantom' in window && window.phantom != null && window.phantom.solana != null) {
4+
if ('phantom' in window && window.phantom != undefined && window.phantom.solana != undefined) {
55
try {
66
const resp = await window.phantom.solana.connect();
77
var pubKey = resp.publicKey.toString();
@@ -20,7 +20,7 @@ mergeInto(LibraryManager.library, {
2020
},
2121

2222
ExternSignTransaction: async function (transaction, callback) {
23-
if ('phantom' in window && window.phantom != null && window.phantom.solana != null) {
23+
if ('phantom' in window && window.phantom != undefined && window.phantom.solana != undefined) {
2424
try {
2525
const signedTransaction = await window.phantom.solana.request({
2626
method: 'signTransaction',
@@ -44,7 +44,7 @@ mergeInto(LibraryManager.library, {
4444

4545

4646
ExternSignMessage: async function (message, callback) {
47-
if ('phantom' in window && window.phantom != null && window.phantom.solana != null) {
47+
if ('phantom' in window && window.phantom != undefined && window.phantom.solana != undefined) {
4848
try {
4949
const messageBase64String = UTF8ToString(message);
5050
const messageBytes = Uint8Array.from(atob(messageBase64String), (c) => c.charCodeAt(0));

Runtime/Plugins/Web3AuthSDK/Android.meta

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package com.web3auth.unity.android;
2+
3+
import android.app.Activity;
4+
import android.content.Intent;
5+
import android.content.pm.ResolveInfo;
6+
import android.content.pm.PackageManager;
7+
import android.net.Uri;
8+
9+
import androidx.browser.customtabs.CustomTabsIntent;
10+
import androidx.browser.customtabs.CustomTabsService;
11+
12+
import java.util.ArrayList;
13+
import java.util.List;
14+
15+
public class BrowserView {
16+
17+
static String[] customTabsAllowed = new String[] {
18+
"com.android.chrome",
19+
"com.google.android.apps.chrome",
20+
"com.chrome.beta",
21+
"com.chrome.dev"
22+
};
23+
24+
public static String getDefaultBrowser(Activity context) {
25+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://web3auth.io"));
26+
ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent,PackageManager.MATCH_DEFAULT_ONLY);
27+
28+
if (resolveInfo != null && !resolveInfo.activityInfo.packageName.isEmpty()) {
29+
return resolveInfo.activityInfo.packageName;
30+
}
31+
32+
return null;
33+
}
34+
35+
public static List<String> getCustomTabsBrowsers(Activity context) {
36+
ArrayList<String> customTabBrowsers = new ArrayList<>();
37+
for (String browser : customTabsAllowed) {
38+
Intent customTabIntent = new Intent();
39+
customTabIntent.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
40+
customTabIntent.setPackage(browser);
41+
42+
if (context.getPackageManager().resolveService(customTabIntent, 0) != null) {
43+
customTabBrowsers.add(browser);
44+
}
45+
}
46+
47+
return customTabBrowsers;
48+
}
49+
50+
public static void launchUrl(Activity context, String url) {
51+
String defaultBrowser = getDefaultBrowser(context);
52+
List<String> customTabBrowsers = getCustomTabsBrowsers(context);
53+
54+
if (customTabBrowsers.contains(defaultBrowser)) {
55+
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();
56+
57+
customTabsIntent.intent.setPackage(defaultBrowser);
58+
customTabsIntent.launchUrl(context, Uri.parse(url));
59+
} else if (!customTabBrowsers.isEmpty()) {
60+
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();
61+
62+
customTabsIntent.intent.setPackage(customTabBrowsers.get(0));
63+
customTabsIntent.launchUrl(context, Uri.parse(url));
64+
} else {
65+
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
66+
}
67+
}
68+
}

Runtime/Plugins/Web3AuthSDK/Android/BrowserView.java.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Plugins/Web3AuthSDK/Android/androidx.annotation.annotation-1.1.0.jar.meta

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Runtime/Plugins/Web3AuthSDK/Android/androidx.arch.core.core-common-2.0.0.jar.meta

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)