Merge branch 'unity' of git.kingsome.cn:tools/cocos_android into unity
This commit is contained in:
commit
8ab91fa7b1
File diff suppressed because one or more lines are too long
137
Data/js/main.js
137
Data/js/main.js
@ -2,7 +2,8 @@ console.log(">>begin load wallet main file");
|
|||||||
|
|
||||||
function promiseCb(funId, promiseFun, dataParser) {
|
function promiseCb(funId, promiseFun, dataParser) {
|
||||||
dataParser = dataParser || ((v) => v);
|
dataParser = dataParser || ((v) => v);
|
||||||
promiseFun.then((result) => {
|
promiseFun
|
||||||
|
.then((result) => {
|
||||||
jsb.jcCallback(funId, JSON.stringify({ errcode: 0, data: result }));
|
jsb.jcCallback(funId, JSON.stringify({ errcode: 0, data: result }));
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@ -12,32 +13,30 @@ function promiseCb(funId, promiseFun, dataParser) {
|
|||||||
/**
|
/**
|
||||||
* init wallet, must call this before all other method
|
* init wallet, must call this before all other method
|
||||||
* @param {string} type: wallet type, 0: internal wallet, 1: third party wallet
|
* @param {string} type: wallet type, 0: internal wallet, 1: third party wallet
|
||||||
|
* @param {string} chain: chain type, 1: ETH, 2: ICON
|
||||||
|
* @param {string} channel: channel type, 0: google, 1: apple, 2: tiktok, 3: facebook, 4: twitter
|
||||||
*/
|
*/
|
||||||
function initWallet(funId, type, chain, channel, test) {
|
function initWallet(funId, type, chain, channel = 0) {
|
||||||
type = parseInt(type);
|
|
||||||
chain = parseInt(chain);
|
chain = parseInt(chain);
|
||||||
channel = channel || 0; // 0:google, 1: apple, 2: tiktok
|
|
||||||
channel = parseInt(channel);
|
|
||||||
console.log(
|
console.log(
|
||||||
`initWallet:: type: ${type}, chain: ${chain}, channel: ${channel}`
|
`initWallet:: type: ${type}, chain: ${chain}, channel: ${channel}`
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
let wallet;
|
const wallet =
|
||||||
if (!window.jc || !jc.wallet) {
|
!window.jc || !jc.wallet
|
||||||
wallet = new jcwallet.default({ chain, type });
|
? new jcwallet.default({ chain, type })
|
||||||
} else {
|
: jc.wallet;
|
||||||
wallet = jc.wallet;
|
|
||||||
}
|
if (parseInt(type) === 1) {
|
||||||
type = parseInt(type);
|
|
||||||
if (type === 1) {
|
|
||||||
console.log("wallet init success, begin connect");
|
console.log("wallet init success, begin connect");
|
||||||
wallet
|
wallet
|
||||||
.initThirdPartyWallet()
|
.initThirdPartyWallet()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("walletconnect connect success");
|
console.log("walletconnect connect success");
|
||||||
let account = jc.wallet.currentAccount();
|
jsb.jcCallback(
|
||||||
jsb.jcCallback(funId, JSON.stringify({ errcode: 0, data: account }));
|
funId,
|
||||||
|
JSON.stringify({ errcode: 0, data: jc.wallet.currentAccount() })
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("walletconnect connect error: " + JSON.stringify(err));
|
console.log("walletconnect connect error: " + JSON.stringify(err));
|
||||||
@ -45,11 +44,13 @@ function initWallet(funId, type, chain, channel, test) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
wallet
|
wallet
|
||||||
.initInternalWallet(channel)
|
.initInternalWallet(parseInt(channel))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("internal init success");
|
console.log("internal init success");
|
||||||
let address = jc.wallet.nativeAccount;
|
jsb.jcCallback(
|
||||||
jsb.jcCallback(funId, JSON.stringify({ errcode: 0, data: address }));
|
funId,
|
||||||
|
JSON.stringify({ errcode: 0, data: jc.wallet.nativeAccount })
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("internal wallet error: " + JSON.stringify(err));
|
console.log("internal wallet error: " + JSON.stringify(err));
|
||||||
@ -131,7 +132,7 @@ function getEthBalance(funId, account) {
|
|||||||
*/
|
*/
|
||||||
function sendEth(funId, to, amount, estimate) {
|
function sendEth(funId, to, amount, estimate) {
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId, jc.wallet.sendEth(to, amount, estimate))
|
promiseCb(funId, jc.wallet.sendEth(to, amount, estimate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,7 +198,10 @@ function sendErc1155(funId, address, to, tokenIds, amounts, estimate) {
|
|||||||
tokenIds = JSON.parse(tokenIds);
|
tokenIds = JSON.parse(tokenIds);
|
||||||
amounts = JSON.parse(amounts);
|
amounts = JSON.parse(amounts);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId, jc.wallet.sendErc1155(address, to, tokenIds, amounts, estimate));
|
promiseCb(
|
||||||
|
funId,
|
||||||
|
jc.wallet.sendErc1155(address, to, tokenIds, amounts, estimate)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showQRCode(funId, content) {
|
function showQRCode(funId, content) {
|
||||||
@ -209,6 +213,16 @@ function showQRCode(funId, content) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showWebPage(funId, url) {
|
||||||
|
try {
|
||||||
|
jsb.showWebPage(funId, url);
|
||||||
|
// jsb.openURL(url);
|
||||||
|
return JSON.stringify({ errcode: 0, data: 1 });
|
||||||
|
} catch (err) {
|
||||||
|
return JSON.stringify({ errcode: 1, errmsg: err });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function scanQRCode(funId, title) {
|
function scanQRCode(funId, title) {
|
||||||
console.log("scanQRCode: " + title);
|
console.log("scanQRCode: " + title);
|
||||||
promiseCb(funId, jc.wallet.nativeSvr.scanQRCode(title));
|
promiseCb(funId, jc.wallet.nativeSvr.scanQRCode(title));
|
||||||
@ -228,12 +242,16 @@ function buyNft721(funId, addresses, values, signature, estimate) {
|
|||||||
addresses = JSON.parse(addresses);
|
addresses = JSON.parse(addresses);
|
||||||
values = JSON.parse(values);
|
values = JSON.parse(values);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId, jc.wallet.jcStandard.buyNft721({
|
promiseCb(
|
||||||
|
funId,
|
||||||
|
jc.wallet.jcStandard.buyNft721({
|
||||||
addresses,
|
addresses,
|
||||||
values,
|
values,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buyNft1155(
|
function buyNft1155(
|
||||||
@ -251,15 +269,18 @@ function buyNft1155(
|
|||||||
amounts = JSON.parse(amounts);
|
amounts = JSON.parse(amounts);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
|
|
||||||
promiseCb(funId, jc.wallet.jcStandard
|
promiseCb(
|
||||||
.buyNft1155({
|
funId,
|
||||||
|
jc.wallet.jcStandard.buyNft1155({
|
||||||
addresses,
|
addresses,
|
||||||
values,
|
values,
|
||||||
ids,
|
ids,
|
||||||
amounts,
|
amounts,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function evolveNft721(
|
function evolveNft721(
|
||||||
@ -273,30 +294,34 @@ function evolveNft721(
|
|||||||
) {
|
) {
|
||||||
tokenIds = JSON.parse(tokenIds);
|
tokenIds = JSON.parse(tokenIds);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId,
|
promiseCb(
|
||||||
jc.wallet.jcStandard
|
funId,
|
||||||
.evolve721NFT({
|
jc.wallet.jcStandard.evolve721NFT({
|
||||||
nftAddress,
|
nftAddress,
|
||||||
tokenIds,
|
tokenIds,
|
||||||
startTime,
|
startTime,
|
||||||
nonce,
|
nonce,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function evolveChip(funId, tokenIds, startTime, nonce, signature, estimate) {
|
function evolveChip(funId, tokenIds, startTime, nonce, signature, estimate) {
|
||||||
tokenIds = JSON.parse(tokenIds);
|
tokenIds = JSON.parse(tokenIds);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId,
|
promiseCb(
|
||||||
jc.wallet.jcStandard
|
funId,
|
||||||
.evolveChip({
|
jc.wallet.jcStandard.evolveChip({
|
||||||
tokenIds,
|
tokenIds,
|
||||||
startTime,
|
startTime,
|
||||||
nonce,
|
nonce,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mintShardBatchUser(
|
function mintShardBatchUser(
|
||||||
@ -311,16 +336,18 @@ function mintShardBatchUser(
|
|||||||
tokenIds = JSON.parse(tokenIds);
|
tokenIds = JSON.parse(tokenIds);
|
||||||
amounts = JSON.parse(amounts);
|
amounts = JSON.parse(amounts);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId,
|
promiseCb(
|
||||||
jc.wallet.jcStandard
|
funId,
|
||||||
.mintShardBatchUser({
|
jc.wallet.jcStandard.mintShardBatchUser({
|
||||||
tokenIds,
|
tokenIds,
|
||||||
amounts,
|
amounts,
|
||||||
startTime,
|
startTime,
|
||||||
nonce,
|
nonce,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function shardMixByUser(
|
function shardMixByUser(
|
||||||
@ -339,9 +366,9 @@ function shardMixByUser(
|
|||||||
ids = JSON.parse(ids);
|
ids = JSON.parse(ids);
|
||||||
amounts = JSON.parse(amounts);
|
amounts = JSON.parse(amounts);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId,
|
promiseCb(
|
||||||
jc.wallet.jcStandard
|
funId,
|
||||||
.shardMixByUser({
|
jc.wallet.jcStandard.shardMixByUser({
|
||||||
tokenId,
|
tokenId,
|
||||||
nftType,
|
nftType,
|
||||||
payToken,
|
payToken,
|
||||||
@ -352,7 +379,9 @@ function shardMixByUser(
|
|||||||
nonce,
|
nonce,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// addresses: [nftId, chip, sign_address]
|
// addresses: [nftId, chip, sign_address]
|
||||||
@ -372,16 +401,18 @@ function pluginChip(
|
|||||||
values = JSON.parse(values);
|
values = JSON.parse(values);
|
||||||
chipIds = JSON.parse(chipIds);
|
chipIds = JSON.parse(chipIds);
|
||||||
slots = JSON.parse(slots);
|
slots = JSON.parse(slots);
|
||||||
promiseCb(funId,
|
promiseCb(
|
||||||
jc.wallet.jcStandard
|
funId,
|
||||||
.pluginChip({
|
jc.wallet.jcStandard.pluginChip({
|
||||||
addresses,
|
addresses,
|
||||||
values,
|
values,
|
||||||
chipIds,
|
chipIds,
|
||||||
slots,
|
slots,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// addresses: [nftId, chip, sign_address]
|
// addresses: [nftId, chip, sign_address]
|
||||||
@ -401,16 +432,18 @@ function unplugChip(
|
|||||||
chipIds = JSON.parse(chipIds);
|
chipIds = JSON.parse(chipIds);
|
||||||
slots = JSON.parse(slots);
|
slots = JSON.parse(slots);
|
||||||
estimate = (estimate || "0") | 0;
|
estimate = (estimate || "0") | 0;
|
||||||
promiseCb(funId,
|
promiseCb(
|
||||||
jc.wallet.jcStandard
|
funId,
|
||||||
.unplugChip({
|
jc.wallet.jcStandard.unplugChip({
|
||||||
addresses,
|
addresses,
|
||||||
values,
|
values,
|
||||||
chipIds,
|
chipIds,
|
||||||
slots,
|
slots,
|
||||||
signature,
|
signature,
|
||||||
estimate,
|
estimate,
|
||||||
}), (v)=>JSON.stringify(v));
|
}),
|
||||||
|
(v) => JSON.stringify(v)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// ======= end of interact with contract =======
|
// ======= end of interact with contract =======
|
||||||
|
|
||||||
@ -420,7 +453,7 @@ function ethHistory(funId, start, limit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tokenHistory(funId, start, limit, address, tokenId) {
|
function tokenHistory(funId, start, limit, address, tokenId) {
|
||||||
var data = {start, limit, address, tokenId}
|
var data = { start, limit, address, tokenId };
|
||||||
promiseCb(funId, jc.wallet.historySvr.tokenRecords(data))
|
promiseCb(funId, jc.wallet.historySvr.tokenRecords(data));
|
||||||
}
|
}
|
||||||
// ======= end of transaction history =======
|
// ======= end of transaction history =======
|
||||||
|
@ -14,15 +14,20 @@
|
|||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||||
<!-- Tell Cocos2dxActivity the name of our .so -->
|
<!-- Tell Cocos2dxActivity the name of our .so -->
|
||||||
<meta-data android:name="android.app.lib_name"
|
<meta-data
|
||||||
|
android:name="android.app.lib_name"
|
||||||
android:value="cocos2djs" />
|
android:value="cocos2djs" />
|
||||||
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
|
<meta-data
|
||||||
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
|
android:name="com.facebook.sdk.ApplicationId"
|
||||||
|
android:value="@string/facebook_app_id" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.facebook.sdk.ClientToken"
|
||||||
|
android:value="@string/facebook_client_token" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:authorities="com.facebook.app.FacebookContentProvider1204701000119770"
|
android:authorities="com.facebook.app.FacebookContentProvider1204701000119770"
|
||||||
android:name="com.facebook.FacebookContentProvider"
|
android:name="com.facebook.FacebookContentProvider"
|
||||||
android:exported="true"
|
android:exported="true" />
|
||||||
/>
|
|
||||||
<provider
|
<provider
|
||||||
android:name="androidx.core.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="com.cege.games.release.provider"
|
android:authorities="com.cege.games.release.provider"
|
||||||
@ -34,20 +39,42 @@
|
|||||||
android:resource="@xml/app_files"
|
android:resource="@xml/app_files"
|
||||||
tools:replace="android:resource" />
|
tools:replace="android:resource" />
|
||||||
</provider>
|
</provider>
|
||||||
<activity android:name=".MainActivity"
|
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
android:exported="true"
|
android:exported="true">
|
||||||
>
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<!-- deeplink -->
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data
|
||||||
|
android:scheme="http"
|
||||||
|
android:host="www.cebg.games"
|
||||||
|
android:pathPrefix="/client" />
|
||||||
|
</intent-filter>
|
||||||
|
<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="https"
|
||||||
|
android:host="www.cebg.games"
|
||||||
|
android:pathPrefix="/client" />
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.king.zxing.CaptureActivity"
|
android:name="com.king.zxing.CaptureActivity"
|
||||||
android:theme="@style/CaptureTheme" />
|
android:theme="@style/CaptureTheme" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.WebPageActivity"
|
||||||
|
android:theme="@style/WebViewTheme" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.CustomCaptureActivity"
|
android:name=".activity.CustomCaptureActivity"
|
||||||
android:theme="@style/CaptureTheme" />
|
android:theme="@style/CaptureTheme" />
|
||||||
@ -61,9 +88,7 @@
|
|||||||
|
|
||||||
https://developer.android.com/training/app-links/index.html
|
https://developer.android.com/training/app-links/index.html
|
||||||
|
|
||||||
The declaration from the library can be completely replaced by adding
|
The declaration from the library can be completely replaced by adding tools:node="replace"
|
||||||
|
|
||||||
tools:node="replace"
|
|
||||||
|
|
||||||
To the list of attributes on the activity element.
|
To the list of attributes on the activity element.
|
||||||
-->
|
-->
|
||||||
@ -73,31 +98,55 @@
|
|||||||
tools:node="replace">
|
tools:node="replace">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
<data android:scheme="com.googleusercontent.apps.53206975661-asnf3qe4bg29p8h981pgf099osvrjbme" />
|
<data android:scheme="com.googleusercontent.apps.53206975661-asnf3qe4bg29p8h981pgf099osvrjbme" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".tiktokapi.TikTokEntryActivity"
|
android:name=".tiktokapi.TikTokEntryActivity"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:taskAffinity="com.cege.games.release"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity
|
||||||
|
android:name=".apple.AppleLoginActivity"
|
||||||
|
android:theme="@style/WebViewTheme" />
|
||||||
|
<activity
|
||||||
|
android:name=".apple.AppleLoginCbActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
<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="cebg"
|
||||||
|
android:path="/apple_login_result" />
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.facebook.FacebookActivity"
|
<activity
|
||||||
android:configChanges=
|
android:name="com.facebook.FacebookActivity"
|
||||||
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
|
||||||
android:label="@string/app_name" />
|
android:label="@string/app_name" />
|
||||||
<activity
|
<activity
|
||||||
android:name="com.facebook.CustomTabActivity"
|
android:name="com.facebook.CustomTabActivity"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
<data android:scheme="@string/fb_login_protocol_scheme" />
|
<data android:scheme="@string/fb_login_protocol_scheme" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<service android:name ="com.youme.voiceengine.VoiceEngineService"
|
|
||||||
|
<service
|
||||||
|
android:name="com.youme.voiceengine.VoiceEngineService"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.youme.voiceengine.VoiceEngineService" />
|
<action android:name="com.youme.voiceengine.VoiceEngineService" />
|
||||||
@ -111,6 +160,7 @@
|
|||||||
android:normalScreens="true"
|
android:normalScreens="true"
|
||||||
android:smallScreens="true"
|
android:smallScreens="true"
|
||||||
android:xlargeScreens="true" />
|
android:xlargeScreens="true" />
|
||||||
|
|
||||||
<uses-feature android:glEsVersion="0x00020000" />
|
<uses-feature android:glEsVersion="0x00020000" />
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
@ -131,12 +181,14 @@
|
|||||||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
|
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.WRITE_SETTINGS"
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_SETTINGS"
|
||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"
|
<uses-permission
|
||||||
|
android:name="android.permission.CAPTURE_VIDEO_OUTPUT"
|
||||||
tools:ignore="ProtectedPermissions" />
|
tools:ignore="ProtectedPermissions" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||||
@ -147,10 +199,14 @@
|
|||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||||
android:maxSdkVersion="29" />
|
android:maxSdkVersion="29" />
|
||||||
|
|
||||||
<queries>
|
<queries>
|
||||||
<package android:name="com.zhiliaoapp.musically" />
|
<package android:name="com.zhiliaoapp.musically" />
|
||||||
<package android:name="com.ss.android.ugc.trill" />
|
<package android:name="com.ss.android.ugc.trill" />
|
||||||
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
|
|
||||||
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" /> <!-- allows sharing to Messenger app -->
|
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
|
||||||
|
<!-- allows app to access Facebook app features -->
|
||||||
|
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
|
||||||
|
<!-- allows sharing to Messenger app -->
|
||||||
</queries>
|
</queries>
|
||||||
</manifest>
|
</manifest>
|
@ -2,4 +2,11 @@ package com.cege.games.release;
|
|||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final String PREF_NAME = "jcwallet";
|
public static final String PREF_NAME = "jcwallet";
|
||||||
|
|
||||||
|
public static final String APPLE_CLIENT_ID = "wallet.cebggame.com";
|
||||||
|
public static final String APPLE_REDIRECT_URI = "https://wallet.cebggame.com/apple/oauth_redirect";
|
||||||
|
public static final String APPLE_SCOPE = "name%20email";
|
||||||
|
|
||||||
|
public static final String APPLE_AUTH_URL = "https://appleid.apple.com/auth/authorize";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,12 @@ import android.widget.Toast;
|
|||||||
import com.bytedance.sdk.open.tiktok.TikTokOpenApiFactory;
|
import com.bytedance.sdk.open.tiktok.TikTokOpenApiFactory;
|
||||||
import com.bytedance.sdk.open.tiktok.api.TikTokOpenApi;
|
import com.bytedance.sdk.open.tiktok.api.TikTokOpenApi;
|
||||||
import com.bytedance.sdk.open.tiktok.authorize.model.Authorization;
|
import com.bytedance.sdk.open.tiktok.authorize.model.Authorization;
|
||||||
|
import com.bytedance.sdk.open.tiktok.base.MediaContent;
|
||||||
|
import com.bytedance.sdk.open.tiktok.base.VideoObject;
|
||||||
|
import com.bytedance.sdk.open.tiktok.share.Share;
|
||||||
import com.cege.games.release.activity.CustomCaptureActivity;
|
import com.cege.games.release.activity.CustomCaptureActivity;
|
||||||
|
import com.cege.games.release.activity.WebPageActivity;
|
||||||
|
import com.cege.games.release.apple.AppleLoginActivity;
|
||||||
import com.cege.games.release.dialog.QRCodeActivity;
|
import com.cege.games.release.dialog.QRCodeActivity;
|
||||||
import com.facebook.AccessToken;
|
import com.facebook.AccessToken;
|
||||||
import com.facebook.CallbackManager;
|
import com.facebook.CallbackManager;
|
||||||
@ -72,6 +77,7 @@ import org.cocos2dx.lib.Cocos2dxHelper;
|
|||||||
import org.cocos2dx.lib.CocosJSHelper;
|
import org.cocos2dx.lib.CocosJSHelper;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -115,6 +121,8 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
public static final int RC_READ_PHOTO = 0X012;
|
public static final int RC_READ_PHOTO = 0X012;
|
||||||
|
|
||||||
public static final int RC_LOAD_KEY = 0X013;
|
public static final int RC_LOAD_KEY = 0X013;
|
||||||
|
|
||||||
|
public static final int FILE_SELECTOR_CODE = 0X014;
|
||||||
private String title;
|
private String title;
|
||||||
private String funId;
|
private String funId;
|
||||||
private String oid;
|
private String oid;
|
||||||
@ -132,6 +140,8 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
private CountDownLatch mAuthIntentLatch = new CountDownLatch(1);
|
private CountDownLatch mAuthIntentLatch = new CountDownLatch(1);
|
||||||
private static final String EXTRA_FAILED = "failed";
|
private static final String EXTRA_FAILED = "failed";
|
||||||
|
|
||||||
|
private TikTokOpenApi tiktokOpenApi;
|
||||||
|
|
||||||
public String getFunId() {
|
public String getFunId() {
|
||||||
return funId;
|
return funId;
|
||||||
}
|
}
|
||||||
@ -185,6 +195,12 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
// begin of facebook login
|
// begin of facebook login
|
||||||
initFacebookSDK();
|
initFacebookSDK();
|
||||||
// end of facebook login
|
// end of facebook login
|
||||||
|
// ATTENTION: This was auto-generated to handle app links.
|
||||||
|
Intent appLinkIntent = getIntent();
|
||||||
|
String appLinkAction = appLinkIntent.getAction();
|
||||||
|
Uri appLinkData = appLinkIntent.getData();
|
||||||
|
|
||||||
|
tiktokOpenApi = TikTokOpenApiFactory.create(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -223,6 +239,10 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
||||||
handleSignInResult(task);
|
handleSignInResult(task);
|
||||||
break;
|
break;
|
||||||
|
case FILE_SELECTOR_CODE:
|
||||||
|
Uri uri = data.getData();
|
||||||
|
shareToTikTok(funId, uri);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean next = false;
|
boolean next = false;
|
||||||
@ -261,9 +281,12 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
// begin for unity
|
// begin for unity
|
||||||
@Override
|
@Override
|
||||||
protected void onNewIntent(Intent intent) {
|
protected void onNewIntent(Intent intent) {
|
||||||
// To support deep linking, we need to make sure that the client can get access to
|
// To support deep linking, we need to make sure that the client can get access
|
||||||
// the last sent intent. The clients access this through a JNI api that allows them
|
// to
|
||||||
// to get the intent set on launch. To update that after launch we have to manually
|
// the last sent intent. The clients access this through a JNI api that allows
|
||||||
|
// them
|
||||||
|
// to get the intent set on launch. To update that after launch we have to
|
||||||
|
// manually
|
||||||
// replace the intent with the one caught here.
|
// replace the intent with the one caught here.
|
||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
}
|
}
|
||||||
@ -288,6 +311,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
public void runOnGLThread(Runnable pRunnable) {
|
public void runOnGLThread(Runnable pRunnable) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** begin of easypermissions */
|
/** begin of easypermissions */
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||||
@ -331,6 +355,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
RC_CAMERA, perms);
|
RC_CAMERA, perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterPermissionGranted(RC_LOAD_KEY)
|
@AfterPermissionGranted(RC_LOAD_KEY)
|
||||||
private void checkImagePermissions() {
|
private void checkImagePermissions() {
|
||||||
String[] perms;
|
String[] perms;
|
||||||
@ -352,6 +377,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
RC_LOAD_KEY, perms);
|
RC_LOAD_KEY, perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterPermissionGranted(RC_SAVE_QR)
|
@AfterPermissionGranted(RC_SAVE_QR)
|
||||||
private void checkSavePermissions() {
|
private void checkSavePermissions() {
|
||||||
String[] perms = { Manifest.permission.WRITE_EXTERNAL_STORAGE };
|
String[] perms = { Manifest.permission.WRITE_EXTERNAL_STORAGE };
|
||||||
@ -361,7 +387,8 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Do not have permissions, request them now
|
// Do not have permissions, request them now
|
||||||
EasyPermissions.requestPermissions(MainActivity.app, "We need Write WRITE_EXTERNAL_STORAGE for backup Wallet Restore Key",
|
EasyPermissions.requestPermissions(MainActivity.app,
|
||||||
|
"We need Write WRITE_EXTERNAL_STORAGE for backup Wallet Restore Key",
|
||||||
RC_SAVE_QR, perms);
|
RC_SAVE_QR, perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,6 +423,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
funId = "";
|
funId = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parsePhotoData(Bitmap bitmap) {
|
private void parsePhotoData(Bitmap bitmap) {
|
||||||
asyncThread(() -> {
|
asyncThread(() -> {
|
||||||
final String result = CodeUtils.parseQRCode(bitmap);
|
final String result = CodeUtils.parseQRCode(bitmap);
|
||||||
@ -483,14 +511,16 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
// Signed in successfully, show authenticated UI.
|
// Signed in successfully, show authenticated UI.
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
// The ApiException status code indicates the detailed failure reason.
|
// The ApiException status code indicates the detailed failure reason.
|
||||||
// Please refer to the GoogleSignInStatusCodes class reference for more information.
|
// Please refer to the GoogleSignInStatusCodes class reference for more
|
||||||
|
// information.
|
||||||
Log.w(TAG, "signInResult:failed code=" + e.getStatusCode());
|
Log.w(TAG, "signInResult:failed code=" + e.getStatusCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin of AppAuth
|
// begin of AppAuth
|
||||||
/**
|
/**
|
||||||
* Initializes the authorization service configuration if necessary, either from the local
|
* Initializes the authorization service configuration if necessary, either from
|
||||||
|
* the local
|
||||||
* static values or by retrieving an OpenID discovery document.
|
* static values or by retrieving an OpenID discovery document.
|
||||||
*/
|
*/
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
@ -505,7 +535,8 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are not using discovery, build the authorization service configuration directly
|
// if we are not using discovery, build the authorization service configuration
|
||||||
|
// directly
|
||||||
// from the static configuration values.
|
// from the static configuration values.
|
||||||
if (mConfiguration.getDiscoveryUri() == null) {
|
if (mConfiguration.getDiscoveryUri() == null) {
|
||||||
Log.i(TAG, "Creating auth config from res/raw/auth_config.json");
|
Log.i(TAG, "Creating auth config from res/raw/auth_config.json");
|
||||||
@ -582,8 +613,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
mAuthIntentLatch = new CountDownLatch(1);
|
mAuthIntentLatch = new CountDownLatch(1);
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
Log.i(TAG, "Warming up browser instance for auth request");
|
Log.i(TAG, "Warming up browser instance for auth request");
|
||||||
CustomTabsIntent.Builder intentBuilder =
|
CustomTabsIntent.Builder intentBuilder = mAuthService.createCustomTabsIntentBuilder(mAuthRequest.get().toUri());
|
||||||
mAuthService.createCustomTabsIntentBuilder(mAuthRequest.get().toUri());
|
|
||||||
mAuthIntent.set(intentBuilder.build());
|
mAuthIntent.set(intentBuilder.build());
|
||||||
mAuthIntentLatch.countDown();
|
mAuthIntentLatch.countDown();
|
||||||
});
|
});
|
||||||
@ -597,7 +627,8 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates a dynamic registration request if a client ID is not provided by the static
|
* Initiates a dynamic registration request if a client ID is not provided by
|
||||||
|
* the static
|
||||||
* configuration.
|
* configuration.
|
||||||
*/
|
*/
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
@ -610,8 +641,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegistrationResponse lastResponse =
|
RegistrationResponse lastResponse = mAuthStateManager.getCurrent().getLastRegistrationResponse();
|
||||||
mAuthStateManager.getCurrent().getLastRegistrationResponse();
|
|
||||||
if (lastResponse != null) {
|
if (lastResponse != null) {
|
||||||
Log.i(TAG, "Using dynamic client ID: " + lastResponse.clientId);
|
Log.i(TAG, "Using dynamic client ID: " + lastResponse.clientId);
|
||||||
// already dynamically registered a client ID
|
// already dynamically registered a client ID
|
||||||
@ -673,7 +703,8 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the authorization request, using the browser selected in the spinner,
|
* Performs the authorization request, using the browser selected in the
|
||||||
|
* spinner,
|
||||||
* and a user-provided `login_hint` if available.
|
* and a user-provided `login_hint` if available.
|
||||||
*/
|
*/
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
@ -738,6 +769,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
runOnUiThread(() -> successSdkCb(state.getIdToken()));
|
runOnUiThread(() -> successSdkCb(state.getIdToken()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainThread
|
@MainThread
|
||||||
private void successSdkCb(String idToken) {
|
private void successSdkCb(String idToken) {
|
||||||
JcSDK.nativeCb(this.funId, null, idToken);
|
JcSDK.nativeCb(this.funId, null, idToken);
|
||||||
@ -753,7 +785,6 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
this.funId = funId;
|
this.funId = funId;
|
||||||
Log.i(TAG, "login with tiktok: " + funId);
|
Log.i(TAG, "login with tiktok: " + funId);
|
||||||
// STEP 1: Create an instance of TiktokOpenApi
|
// STEP 1: Create an instance of TiktokOpenApi
|
||||||
TikTokOpenApi tiktokOpenApi= TikTokOpenApiFactory.create(this);
|
|
||||||
|
|
||||||
// STEP 2: Create an instance of Authorization.Request and set parameters
|
// STEP 2: Create an instance of Authorization.Request and set parameters
|
||||||
Authorization.Request request = new Authorization.Request();
|
Authorization.Request request = new Authorization.Request();
|
||||||
@ -762,7 +793,6 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
tiktokOpenApi.authorize(request);
|
tiktokOpenApi.authorize(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void showQRCode(String funid, String str, String title, String oid) {
|
public void showQRCode(String funid, String str, String title, String oid) {
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
if (qrCodeActivity == null) {
|
if (qrCodeActivity == null) {
|
||||||
@ -799,6 +829,7 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
runOnUiThread(() -> errorSdkCb("access token expired"));
|
runOnUiThread(() -> errorSdkCb("access token expired"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancel() {
|
public void onCancel() {
|
||||||
Log.d(TAG, "Login cancel");
|
Log.d(TAG, "Login cancel");
|
||||||
@ -862,5 +893,67 @@ public class MainActivity extends UnityPlayerActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void signWithApple(String funId) {
|
||||||
|
this.funId = funId;
|
||||||
|
Log.i(TAG, "login with apple: " + funId);
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Intent intent = new Intent(this, AppleLoginActivity.class);
|
||||||
|
intent.putExtra("funId", funId);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showPage(String fid, final String url) {
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
Log.i(TAG, "show page: " + url);
|
||||||
|
Intent intent = new Intent(this, WebPageActivity.class);
|
||||||
|
intent.putExtra("url", url);
|
||||||
|
startActivity(intent);
|
||||||
|
// picker video file and share to tiktok
|
||||||
|
// openFileSelector();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void shareToTikTok(String funId, Uri uriToImage) {
|
||||||
|
this.funId = funId;
|
||||||
|
grantUriPermission("com.zhiliaoapp.musically",
|
||||||
|
uriToImage, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
grantUriPermission("com.ss.android.ugc.trill",
|
||||||
|
uriToImage, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
Log.i(TAG, "share to tiktok: " + uriToImage.toString());
|
||||||
|
if (tiktokOpenApi.isShareSupportFileProvider()) {
|
||||||
|
Share.Request request = new Share.Request();
|
||||||
|
ArrayList<String> mUri = new ArrayList<>();
|
||||||
|
mUri.add(uriToImage.toString());
|
||||||
|
VideoObject videoObject = new VideoObject();
|
||||||
|
videoObject.mVideoPaths = mUri;
|
||||||
|
MediaContent content = new MediaContent();
|
||||||
|
content.mMediaObject = videoObject;
|
||||||
|
|
||||||
|
// 3.set required parameters
|
||||||
|
request.mMediaContent = content;
|
||||||
|
request.mState = funId;
|
||||||
|
request.mShareFormat = Share.Format.DEFAULT;
|
||||||
|
tiktokOpenApi.share(request);
|
||||||
|
}
|
||||||
|
// share with Android ShareSheet
|
||||||
|
// runOnUiThread(() -> {
|
||||||
|
// Log.i(TAG, "share to tiktok: " + uriToImage);
|
||||||
|
// Intent shareIntent = new Intent();
|
||||||
|
// shareIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
// shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
|
||||||
|
// shareIntent.setType("video/*");
|
||||||
|
// startActivity(Intent.createChooser(shareIntent, "share"));
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开本地文件器
|
||||||
|
*/
|
||||||
|
private void openFileSelector() {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
|
intent.setType("video/*");
|
||||||
|
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
startActivityForResult(intent, FILE_SELECTOR_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
103
app/src/com/cege/games/release/activity/WebPageActivity.java
Normal file
103
app/src/com/cege/games/release/activity/WebPageActivity.java
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
package com.cege.games.release.activity;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.webkit.ConsoleMessage;
|
||||||
|
import android.webkit.CookieManager;
|
||||||
|
import android.webkit.WebChromeClient;
|
||||||
|
import android.webkit.WebResourceError;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebResourceResponse;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import com.cege.games.release.R;
|
||||||
|
import com.cege.games.release.dialog.BaseDialog;
|
||||||
|
|
||||||
|
public class WebPageActivity extends Activity {
|
||||||
|
private WebView mWebView;
|
||||||
|
private static final String TAG = WebPageActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
@Override
|
||||||
|
protected void onCreate(android.os.Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_web_page);
|
||||||
|
WebView.setWebContentsDebuggingEnabled(true);
|
||||||
|
mWebView = findViewById(R.id.web_view);
|
||||||
|
WebSettings webSettings = mWebView.getSettings();
|
||||||
|
webSettings.setJavaScriptEnabled(true);
|
||||||
|
webSettings.setDomStorageEnabled(true);
|
||||||
|
webSettings.setDatabaseEnabled(true);
|
||||||
|
webSettings.setAllowContentAccess(true);
|
||||||
|
webSettings.setAppCacheEnabled(true);
|
||||||
|
webSettings.setBuiltInZoomControls(true);
|
||||||
|
webSettings.setUseWideViewPort(true);
|
||||||
|
webSettings.setLoadWithOverviewMode(true);
|
||||||
|
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView,true);
|
||||||
|
// get url from intent
|
||||||
|
Intent intent = getIntent();
|
||||||
|
String url = intent.getStringExtra("url");
|
||||||
|
// show web view
|
||||||
|
mWebView.loadUrl(url);
|
||||||
|
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||||
|
@Override
|
||||||
|
public void onReceivedTitle(WebView view, String title) {
|
||||||
|
super.onReceivedTitle(view, title);
|
||||||
|
Log.i(TAG, "onReceivedTitle: " + title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||||
|
Log.e("TAG", consoleMessage.message());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
mWebView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||||
|
return super.shouldOverrideUrlLoading(view, request);
|
||||||
|
// if ("www.example.com".equals(request.getUrl().getHost())) {
|
||||||
|
// // This is my website, so do not override; let my WebView load the page
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
super.onPageFinished(view, url);
|
||||||
|
Log.i(TAG, "onPageFinished: " + url);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onLoadResource(WebView view, String url) {
|
||||||
|
Log.i(TAG, "onLoadResource: " + url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
||||||
|
super.onReceivedError(view, request, error);
|
||||||
|
Log.e(TAG, "onReceivedError: " + error);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
|
||||||
|
super.onReceivedHttpError(view, request, errorResponse);
|
||||||
|
Log.e(TAG, "onReceivedHttpError: " + errorResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceivedSslError(WebView view, android.webkit.SslErrorHandler handler,
|
||||||
|
android.net.http.SslError error) {
|
||||||
|
Log.e(TAG, "onReceivedSslError: " + error.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
80
app/src/com/cege/games/release/apple/AppleLoginActivity.java
Normal file
80
app/src/com/cege/games/release/apple/AppleLoginActivity.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.cege.games.release.apple;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.webkit.CookieManager;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
|
import com.cege.games.release.Constants;
|
||||||
|
import com.cege.games.release.R;
|
||||||
|
|
||||||
|
public class AppleLoginActivity extends Activity {
|
||||||
|
private static final String TAG = AppleLoginActivity.class.getSimpleName();
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
|
@Override
|
||||||
|
public void onCreate(android.os.Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
setContentView(R.layout.activity_web_page);
|
||||||
|
|
||||||
|
WebView.setWebContentsDebuggingEnabled(true);
|
||||||
|
WebView mWebView = findViewById(R.id.web_view);
|
||||||
|
WebSettings webSettings = mWebView.getSettings();
|
||||||
|
webSettings.setJavaScriptEnabled(true);
|
||||||
|
webSettings.setDomStorageEnabled(true);
|
||||||
|
webSettings.setDatabaseEnabled(true);
|
||||||
|
webSettings.setAllowContentAccess(true);
|
||||||
|
webSettings.setAppCacheEnabled(true);
|
||||||
|
webSettings.setBuiltInZoomControls(true);
|
||||||
|
webSettings.setUseWideViewPort(true);
|
||||||
|
webSettings.setLoadWithOverviewMode(true);
|
||||||
|
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView,true);
|
||||||
|
// get url from intent
|
||||||
|
String funId = intent.getStringExtra("funId");
|
||||||
|
String url = Constants.APPLE_AUTH_URL
|
||||||
|
+ "?response_type=code%20id_token&v=1.1.6&response_mode=form_post&client_id="
|
||||||
|
+ Constants.APPLE_CLIENT_ID + "&scope=" + Constants.APPLE_SCOPE + "&state=" + funId + "&redirect_uri="
|
||||||
|
+ Constants.APPLE_REDIRECT_URI;
|
||||||
|
// show web view
|
||||||
|
mWebView.loadUrl(url);
|
||||||
|
mWebView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||||
|
String url = request.getUrl().toString();
|
||||||
|
Log.i(TAG, url);
|
||||||
|
if (url.startsWith("cebg")) {
|
||||||
|
// Close the dialog after getting the authorization code
|
||||||
|
Intent myapp_intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
myapp_intent.setData(Uri.parse(url));
|
||||||
|
startActivity(myapp_intent);
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onPageFinished(WebView view, String url) {
|
||||||
|
// super.onPageFinished(view, url);
|
||||||
|
// Rect displayRectangle = new Rect();
|
||||||
|
// Window window = getWindow();
|
||||||
|
// window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
|
||||||
|
// ViewGroup.LayoutParams layoutparms = view.getLayoutParams();
|
||||||
|
// layoutparms.height = displayRectangle.height();
|
||||||
|
// layoutparms.width = displayRectangle.width();
|
||||||
|
// view.setLayoutParams(layoutparms);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.cege.games.release.apple;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.jc.jcfw.JcSDK;
|
||||||
|
|
||||||
|
public class AppleLoginCbActivity extends Activity {
|
||||||
|
private static final String TAG = AppleLoginCbActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
Log.d(TAG, "receive apple login callback");
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||||
|
Uri uri = intent.getData();
|
||||||
|
String error = uri.getQueryParameter("error");
|
||||||
|
String state = uri.getQueryParameter("state");
|
||||||
|
if (null != error && !error.isEmpty()) {
|
||||||
|
JcSDK.nativeCb(state, error, null);
|
||||||
|
} else {
|
||||||
|
String token = uri.getQueryParameter("token");
|
||||||
|
JcSDK.nativeCb(state, null, token);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,13 +3,16 @@ package com.cege.games.release.tiktokapi;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.bytedance.sdk.open.tiktok.CommonConstants;
|
||||||
import com.bytedance.sdk.open.tiktok.TikTokOpenApiFactory;
|
import com.bytedance.sdk.open.tiktok.TikTokOpenApiFactory;
|
||||||
import com.bytedance.sdk.open.tiktok.api.TikTokOpenApi;
|
import com.bytedance.sdk.open.tiktok.api.TikTokOpenApi;
|
||||||
import com.bytedance.sdk.open.tiktok.authorize.model.Authorization;
|
import com.bytedance.sdk.open.tiktok.authorize.model.Authorization;
|
||||||
import com.bytedance.sdk.open.tiktok.common.handler.IApiEventHandler;
|
import com.bytedance.sdk.open.tiktok.common.handler.IApiEventHandler;
|
||||||
import com.bytedance.sdk.open.tiktok.common.model.BaseReq;
|
import com.bytedance.sdk.open.tiktok.common.model.BaseReq;
|
||||||
import com.bytedance.sdk.open.tiktok.common.model.BaseResp;
|
import com.bytedance.sdk.open.tiktok.common.model.BaseResp;
|
||||||
|
import com.bytedance.sdk.open.tiktok.share.Share;
|
||||||
import com.jc.jcfw.JcSDK;
|
import com.jc.jcfw.JcSDK;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -41,6 +44,15 @@ public class TikTokEntryActivity extends Activity implements IApiEventHandler {
|
|||||||
JcSDK.nativeCb(response.state, response.errorMsg, null);
|
JcSDK.nativeCb(response.state, response.errorMsg, null);
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
|
} else if (resp.getType() == CommonConstants.ModeType.SHARE_CONTENT_TO_TT_RESP) {
|
||||||
|
Share.Response response = (Share.Response) resp;
|
||||||
|
Log.i(TAG, "share result code:" + response.errorCode + " errorMessage:" + response.errorMsg);
|
||||||
|
if (response.errorCode == 0) {
|
||||||
|
JcSDK.nativeCb(response.state, null, "1");
|
||||||
|
} else {
|
||||||
|
JcSDK.nativeCb(response.state, response.errorMsg, null);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,6 +68,7 @@ public class JcSDK {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void showQRCode(String funid, String content) { MainActivity.app.showQRCode(funid, content, "", "");}
|
public static void showQRCode(String funid, String content) { MainActivity.app.showQRCode(funid, content, "", "");}
|
||||||
|
public static void showWebPage(String funid, String url) { MainActivity.app.showPage(funid, url);}
|
||||||
public static void showRestoreQR(String funid, String content, String title, String oid) { MainActivity.app.showQRCode(funid, content, title, oid);}
|
public static void showRestoreQR(String funid, String content, String title, String oid) { MainActivity.app.showQRCode(funid, content, title, oid);}
|
||||||
public static void scanQRCode(String funid, String title) {
|
public static void scanQRCode(String funid, String title) {
|
||||||
MainActivity.app.showQRScan(funid, title);
|
MainActivity.app.showQRScan(funid, title);
|
||||||
@ -93,6 +94,9 @@ public class JcSDK {
|
|||||||
public static void signWithGoogle(String funid) {
|
public static void signWithGoogle(String funid) {
|
||||||
MainActivity.app.signWithGoogle(funid);
|
MainActivity.app.signWithGoogle(funid);
|
||||||
}
|
}
|
||||||
|
public static void signWithApple(String funid) {
|
||||||
|
MainActivity.app.signWithApple(funid);
|
||||||
|
}
|
||||||
|
|
||||||
public static void signOutGoogle(String funid) {
|
public static void signOutGoogle(String funid) {
|
||||||
MainActivity.app.signOutGoogle(funid);
|
MainActivity.app.signOutGoogle(funid);
|
||||||
|
14
app/src/main/res/anim/translate_in.xml
Normal file
14
app/src/main/res/anim/translate_in.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="0"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:duration="300">
|
||||||
|
</alpha>
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:fromYDelta="100%"
|
||||||
|
android:toYDelta="0"
|
||||||
|
android:duration="300">
|
||||||
|
</translate>
|
||||||
|
</set>
|
14
app/src/main/res/anim/translate_out.xml
Normal file
14
app/src/main/res/anim/translate_out.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="1.0"
|
||||||
|
android:toAlpha="0"
|
||||||
|
android:duration="500">
|
||||||
|
</alpha>
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:fromYDelta="0"
|
||||||
|
android:toYDelta="100%"
|
||||||
|
android:duration="500">
|
||||||
|
</translate>
|
||||||
|
</set>
|
12
app/src/main/res/layout/activity_web_page.xml
Normal file
12
app/src/main/res/layout/activity_web_page.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<WebView
|
||||||
|
android:id="@+id/web_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
9
keys/assetlinks.json
Normal file
9
keys/assetlinks.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[{
|
||||||
|
"relation": ["delegate_permission/common.handle_all_urls"],
|
||||||
|
"target": {
|
||||||
|
"namespace": "android_app",
|
||||||
|
"package_name": "com.cege.games.release",
|
||||||
|
"sha256_cert_fingerprints":
|
||||||
|
["4E:3C:74:9E:92:90:51:F1:7C:12:DE:40:F9:72:9B:9A:7B:F3:D0:04:9B:CF:E2:98:94:BC:86:A9:AE:86:33:90"]
|
||||||
|
}
|
||||||
|
}]
|
@ -4,6 +4,17 @@
|
|||||||
<item name="android:windowBackground">@android:color/black</item>
|
<item name="android:windowBackground">@android:color/black</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="BaseUnityTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
<style name="BaseUnityTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||||
|
</style>
|
||||||
|
<style name="WebViewTheme" parent="android:Theme.Holo.Light.NoActionBar.Fullscreen">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="colorPrimary">@android:color/black</item>
|
||||||
|
<item name="colorPrimaryDark">@android:color/black</item>
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">true</item>
|
||||||
|
<item name="android:statusBarColor">@color/zxl_capture_status_bar_color</item>
|
||||||
|
<item name="android:navigationBarColor">@color/zxl_capture_navigation_bar_color</item>
|
||||||
|
<item name="android:windowAnimationStyle">@style/WebviewAnimator</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<style name="UnityThemeSelector.Translucent" parent="@style/UnityThemeSelector">
|
<style name="UnityThemeSelector.Translucent" parent="@style/UnityThemeSelector">
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
@ -20,4 +31,8 @@
|
|||||||
<item name="android:windowEnterAnimation">@anim/dlg_enter</item>
|
<item name="android:windowEnterAnimation">@anim/dlg_enter</item>
|
||||||
<item name="android:windowExitAnimation">@anim/dlg_exit</item>
|
<item name="android:windowExitAnimation">@anim/dlg_exit</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="WebviewAnimator">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/translate_in</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/translate_out</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
name="root_path"
|
name="root_path"
|
||||||
path="." />
|
path="." />
|
||||||
</path>
|
</path>
|
||||||
|
<external-files-path name="sharedata" path="shareData/"/>
|
||||||
<external-path
|
<external-path
|
||||||
name="camera_photos"
|
name="camera_photos"
|
||||||
path="" />
|
path="" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user