Skip to content

Instantly share code, notes, and snippets.

View furkanaydgn's full-sized avatar
:octocat:
Feeling good

furkanaydgn furkanaydgn

:octocat:
Feeling good
  • Turkısh Airlines Technology
  • Istanbul
View GitHub Profile
@furkanaydgn
furkanaydgn / movie_page.js
Created October 14, 2022 12:23
checkEnvironmentReady
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);
@furkanaydgn
furkanaydgn / movie_page.js
Created October 14, 2022 11:55
function buy_movie()
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"]));
@furkanaydgn
furkanaydgn / movie_page.js
Last active October 14, 2022 10:50
accountSignOut()
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));
});
@furkanaydgn
furkanaydgn / login.js
Created October 14, 2022 07:03
signIn()
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);
@furkanaydgn
furkanaydgn / login.js
Created October 14, 2022 05:42
huawei_button_logo
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);
}