update sth
This commit is contained in:
parent
6bf8e47827
commit
633987fb25
12
.idea/dictionaries/zhl.xml
generated
Normal file
12
.idea/dictionaries/zhl.xml
generated
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<component name="ProjectDictionaryState">
|
||||||
|
<dictionary name="zhl">
|
||||||
|
<words>
|
||||||
|
<w>errcode</w>
|
||||||
|
<w>errmsg</w>
|
||||||
|
<w>jcfw</w>
|
||||||
|
<w>jcwallet</w>
|
||||||
|
<w>ljava</w>
|
||||||
|
<w>walletconnect</w>
|
||||||
|
</words>
|
||||||
|
</dictionary>
|
||||||
|
</component>
|
@ -95,11 +95,6 @@ android.applicationVariants.all { variant ->
|
|||||||
include "bin/**"
|
include "bin/**"
|
||||||
into outputDir
|
into outputDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy {
|
|
||||||
// from "${sourceDir}/main.js"
|
|
||||||
// into outputDir
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,15 +16,36 @@ public class JcSDK {
|
|||||||
Log.i(TAG, "call init common callback from unity");
|
Log.i(TAG, "call init common callback from unity");
|
||||||
commonCB = callBack;
|
commonCB = callBack;
|
||||||
}
|
}
|
||||||
// 不使用该方法, 直接由unity调用cpp方法
|
|
||||||
|
/**
|
||||||
|
* 不使用该方法, 直接由unity调用cpp方法
|
||||||
|
* @param password
|
||||||
|
*/
|
||||||
public static void initWallet(String password) {
|
public static void initWallet(String password) {
|
||||||
Log.i(TAG, "call init wallet from unity with password: " + password);
|
Log.i(TAG, "call init wallet from unity with password: " + password);
|
||||||
CocosJSHelper.initWallet(password);
|
CocosJSHelper.initWallet(password);
|
||||||
commonCB.stringCallback("wallet init success");
|
commonCB.stringCallback("wallet init success");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void connectwallet(String url){
|
// public static void connectwallet(String url){
|
||||||
// String url = "https://metamask.app.link/wc?uri="+ExampleApplication.config.toWCUri();
|
// Uri uri = Uri.parse(url);
|
||||||
|
// Log.i(TAG, url);
|
||||||
|
// Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
|
// try {
|
||||||
|
// MainActivity.app.startActivity(intent);
|
||||||
|
// } catch (ActivityNotFoundException e) {
|
||||||
|
// Intent i = new Intent(Intent.ACTION_VIEW);
|
||||||
|
// i.setData(Uri.parse("https://metamask.io/download/"));
|
||||||
|
// MainActivity.app.startActivity(i);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* check if metamask installed and jump to metamask
|
||||||
|
* @param url
|
||||||
|
* sample: "https://metamask.app.link/wc?uri="+ExampleApplication.config.toWCUri();
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static void toWallet(String url) {
|
||||||
Uri uri = Uri.parse(url);
|
Uri uri = Uri.parse(url);
|
||||||
Log.i(TAG, url);
|
Log.i(TAG, url);
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||||
@ -36,10 +57,4 @@ public class JcSDK {
|
|||||||
MainActivity.app.startActivity(i);
|
MainActivity.app.startActivity(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toWallet(String url) {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
||||||
intent.setData(Uri.parse(url));
|
|
||||||
MainActivity.app.startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,15 @@ function initWallet(funId, type, password) {
|
|||||||
}
|
}
|
||||||
type = parseInt(type);
|
type = parseInt(type);
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
console.log('wallet inited, begin connect')
|
console.log('wallet init success, begin connect')
|
||||||
wallet.initThirdPartyWallet()
|
wallet.initThirdPartyWallet()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('walletconnect inited')
|
console.log('walletconnect connect success')
|
||||||
var account = jc.wallet.currentAccount();
|
var account = jc.wallet.currentAccount();
|
||||||
jsb.jcCallback(funId, JSON.stringify({errcode: 0, data: account}));
|
jsb.jcCallback(funId, JSON.stringify({errcode: 0, data: account}));
|
||||||
})
|
})
|
||||||
.catch(err =>{
|
.catch(err =>{
|
||||||
console.log('walletconnect inited error: ' + JSON.stringify(err));
|
console.log('walletconnect connect error: ' + JSON.stringify(err));
|
||||||
jsb.jcCallback(funId, JSON.stringify({errcode: 1, errmsg: err}));
|
jsb.jcCallback(funId, JSON.stringify({errcode: 1, errmsg: err}));
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -31,7 +31,7 @@ function initWallet(funId, type, password) {
|
|||||||
jsb.jcCallback(funId, JSON.stringify({errcode: 0, data: address}));
|
jsb.jcCallback(funId, JSON.stringify({errcode: 0, data: address}));
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error('error init wallet: ' + JSON.stringify(err));
|
console.error('wallet init with error: ' + JSON.stringify(err));
|
||||||
jsb.jcCallback(funId, JSON.stringify({errcode: 1, errmsg: err}));
|
jsb.jcCallback(funId, JSON.stringify({errcode: 1, errmsg: err}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
if (window.JavascriptJavaBridge) {
|
if (window.JavascriptJavaBridge) {
|
||||||
console.log('regist android jsb.reflection')
|
console.log('register android jsb.reflection')
|
||||||
jsb.reflection = new JavascriptJavaBridge();
|
jsb.reflection = new JavascriptJavaBridge();
|
||||||
} else if (window.JavaScriptObjCBridge) {
|
} else if (window.JavaScriptObjCBridge) {
|
||||||
jsb.reflection = new JavaScriptObjCBridge();
|
jsb.reflection = new JavaScriptObjCBridge();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user