This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const checkEnvironmentReady = async () => { | |
try { | |
let message = await HMSInAppPurchases.isEnvReady(true); | |
console.log(message); | |
let sandbox = await HMSInAppPurchases.isSandboxActivated(); | |
console.log(sandbox); | |
getProductsInformation(); | |
// alert("Success(HMSInAppPurchases.isEnvReady):" + JSON.stringify(message, null, 4)); | |
} catch (errMsg) { | |
console.log(errMsg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function buy_movie() { | |
alert("buy_movie"); | |
try { | |
let message = await HMSInAppPurchases.createPurchaseIntent({ | |
priceType: PRICETYPE.CONSUMABLE, | |
productId: "test_movie_item_2", | |
developerPayload: "HMSCoreDeveloper", | |
}); | |
console.log(JSON.stringify(message, ["returnCode", "errMsg", "inAppPurchaseData", "inAppDataSignature", "signatureAlgorithm"])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function accountSignOut() { | |
HMSAccount.signOut().then(function () { | |
if (confirm('HuaweiId Authorization will be also deleted!')) { | |
HMSAccount.cancelAuthorization(); | |
window.location = "login.html"; | |
} | |
}).catch(function () { | |
alert('signOut -> Error : ' + JSON.stringify(ex)); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function signIn() { | |
const signInParameters = { | |
authRequestOption: [HMSCommonTypes.AuthRequestOption.SCOPE_ID_TOKEN, HMSCommonTypes.AuthRequestOption.SCOPE_ACCESS_TOKEN, HMSCommonTypes.AuthRequestOption.SCOPE_CARRIER_ID], | |
authParam: HMSCommonTypes.AuthParams.DEFAULT_AUTH_REQUEST_PARAM, | |
authIdTokenSignAlg: HMSCommonTypes.AuthIdTokenSignAlg.PS256 | |
} | |
const packageName = HMSCommonTypes.PackageName.ACCOUNT; | |
const res = await HMSAccountAuthService.signIn(signInParameters, packageName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function huawei_button_logo() { | |
const edittedButton = "btn_auth_button"; | |
HMSHuaweiIdAuthButton.getHuaweiIdAuthButton(edittedButton, | |
HMSHuaweiIdAuthButton.Theme.THEME_FULL_TITLE, | |
HMSHuaweiIdAuthButton.ColorPolicy.COLOR_POLICY_RED, | |
HMSHuaweiIdAuthButton.CornerRadius.CORNER_RADIUS_LARGE); | |
} |