Skip to content

Commit

Permalink
add better analytics on ability activation and stanardize steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kibagateaux committed Feb 21, 2024
1 parent f627956 commit e25f99a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default {
},
android: {
package: packageName,
versionCode: 4,
versionCode: 6,
adaptiveIcon: {
foregroundImage: './public/adaptive-icon.png',
backgroundColor: '#ffffff',
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/AvatarViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const AvatarViewer = ({ SVG, uri, is3d }: AvatarViewerProps) => {
if (!SVG && !uri) {
return <Text>Spiritual connection lost. Cannot display your Jinni</Text>;
}

// console.log('AvatarViewer', { SVG, uri, is3d });

const SvgComponent = () => (!SVG ? null : <SVG />);

// TODO add suppoort for rendering base64 encoded images
// https://stackoverflow.com/questions/29380265/does-react-native-support-base64-encoded-images
return (
<View
{...panResponder.panHandlers}
Expand Down
2 changes: 1 addition & 1 deletion src/inventory/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const item: InventoryItem = {
})({ player_id: pid, provider: ITEM_ID });
track(ABILITY_TRACK_COMMITS, {
spell: ABILITY_TRACK_COMMITS,
activityType: 'completed',
activityType: 'success',
provider: providerId,
});
console.log('inv;Github:sync-repos:res', response);
Expand Down
29 changes: 24 additions & 5 deletions src/inventory/maliks-majik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,33 +104,52 @@ const item: InventoryItem = {
return 'ethereal';
},
do: async () => {
track(ABILITY_ACTIVATE_JINNI, {
spell: ABILITY_ACTIVATE_JINNI,
activityType: 'initiated',
});
const myProof = await getStorage(PROOF_MALIKS_MAJIK_SLOT);
const myId = await getStorage(ID_PLAYER_SLOT);
try {
track(ABILITY_ACTIVATE_JINNI, { ability: ABILITY_ACTIVATE_JINNI });
if (!myId) throw Error('You need to create an magic ID first');
if (!myProof)
if (!myId) {
track(ABILITY_ACTIVATE_JINNI, {
spell: ABILITY_ACTIVATE_JINNI,
activityType: 'unauthenticated',
});
throw Error('You need to create an magic ID first');
}
if (!myProof) {
track(ABILITY_ACTIVATE_JINNI, {
spell: ABILITY_ACTIVATE_JINNI,
activityType: 'unequipped',
});
throw Error(
'You must to meet the Master Djinn before you can activate your jinni',
);
}
console.log('Mani:Jinni:ActivateJinn:proof', myProof);
console.log('Mani:Jinni:ActivateJinn:ID', myId);

const response = await qu({ mutation: MU_ACTIVATE_JINNI })({
majik_msg: myProof.ether,
player_id: myId,
});

console.log('Mani:Jinni:ActivateJinn:Response', response);
const uuid = response?.data ? response.data.activate_jinni : null;
// server shouldnt allow multiple jinnis yet. Just in case dont overwrite existing uuid
const result = uuid && (await saveStorage<string>(ID_JINNI_SLOT, uuid, false));
console.log('Mani:Jinni:ActivateJinn:Result', result);
track(ABILITY_ACTIVATE_JINNI, {
spell: ABILITY_ACTIVATE_JINNI,
activityType: 'success',
});
return async () => (uuid ? true : false);
} catch (e) {
console.error('Mani:Jinni:ActivateJinn:ERROR - ', e);
debug(e, {
tags: { api: true },
extra: { ability: ABILITY_ACTIVATE_JINNI },
extra: { spell: ABILITY_ACTIVATE_JINNI },
});
return async () => false;
}
Expand All @@ -156,7 +175,7 @@ const item: InventoryItem = {
if (!pk) throw Error('No account to backup');

const success = await saveMysticCrypt(ID_PKEY_SLOT, pk);
track(ABILITY_MYSTIC_CRYPT, { ability: ABILITY_MYSTIC_CRYPT });
track(ABILITY_MYSTIC_CRYPT, { spell: ABILITY_MYSTIC_CRYPT });
return async () => success;
} catch (e) {
console.error('Mani:Jinni:MysticCrypt:ERROR --', e);
Expand Down
2 changes: 1 addition & 1 deletion src/inventory/spotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const item: InventoryItem = {
if (action === Share.sharedAction) {
track(TRACK_SHARE_CONTENT, {
spell: ABILITY_SHARE_PROFILE,
activityType: activityType ?? 'shared',
activityType: activityType ?? 'success',
providerId,
success: true,
});
Expand Down

0 comments on commit e25f99a

Please sign in to comment.