Skip to content

Commit

Permalink
v0.0.8, Web3Auth for WebGL and full Metaplex support (#65)
Browse files Browse the repository at this point in the history
* ⬆️ 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
  • Loading branch information
GabrielePicco authored Mar 28, 2023
1 parent 40c9b4b commit 31a84d6
Show file tree
Hide file tree
Showing 109 changed files with 13,665 additions and 12,141 deletions.
Binary file modified Packages/NativeWebSocket.dll
Binary file not shown.
Binary file added Packages/Solana.Unity.Metaplex.dll
Binary file not shown.
33 changes: 33 additions & 0 deletions Packages/Solana.Unity.Metaplex.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Packages/Solana.Unity.Rpc.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions Runtime/Plugins/Phantom.jslib
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mergeInto(LibraryManager.library, {

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

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


ExternSignMessage: async function (message, callback) {
if ('phantom' in window && window.phantom != null && window.phantom.solana != null) {
if ('phantom' in window && window.phantom != undefined && window.phantom.solana != undefined) {
try {
const messageBase64String = UTF8ToString(message);
const messageBytes = Uint8Array.from(atob(messageBase64String), (c) => c.charCodeAt(0));
Expand Down
16 changes: 8 additions & 8 deletions Runtime/Plugins/Web3AuthSDK/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions Runtime/Plugins/Web3AuthSDK/Android/BrowserView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.web3auth.unity.android;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager;
import android.net.Uri;

import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsService;

import java.util.ArrayList;
import java.util.List;

public class BrowserView {

static String[] customTabsAllowed = new String[] {
"com.android.chrome",
"com.google.android.apps.chrome",
"com.chrome.beta",
"com.chrome.dev"
};

public static String getDefaultBrowser(Activity context) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://web3auth.io"));
ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent,PackageManager.MATCH_DEFAULT_ONLY);

if (resolveInfo != null && !resolveInfo.activityInfo.packageName.isEmpty()) {
return resolveInfo.activityInfo.packageName;
}

return null;
}

public static List<String> getCustomTabsBrowsers(Activity context) {
ArrayList<String> customTabBrowsers = new ArrayList<>();
for (String browser : customTabsAllowed) {
Intent customTabIntent = new Intent();
customTabIntent.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
customTabIntent.setPackage(browser);

if (context.getPackageManager().resolveService(customTabIntent, 0) != null) {
customTabBrowsers.add(browser);
}
}

return customTabBrowsers;
}

public static void launchUrl(Activity context, String url) {
String defaultBrowser = getDefaultBrowser(context);
List<String> customTabBrowsers = getCustomTabsBrowsers(context);

if (customTabBrowsers.contains(defaultBrowser)) {
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();

customTabsIntent.intent.setPackage(defaultBrowser);
customTabsIntent.launchUrl(context, Uri.parse(url));
} else if (!customTabBrowsers.isEmpty()) {
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder().build();

customTabsIntent.intent.setPackage(customTabBrowsers.get(0));
customTabsIntent.launchUrl(context, Uri.parse(url));
} else {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
}
}
32 changes: 32 additions & 0 deletions Runtime/Plugins/Web3AuthSDK/Android/BrowserView.java.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 31a84d6

Please sign in to comment.