Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cocos2d-x feature guides #1094

Merged
merged 69 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
e9d16b8
Add Cocos-2dx migration guide
Sporiff Sep 20, 2024
4923ab8
Merge branch 'main' into ADAPP-18656-cocos-2-dx-v-5-migration-guide
Sporiff Sep 23, 2024
e7fa518
Merge branch 'main' into ADAPP-18656-cocos-2-dx-v-5-migration-guide
Sporiff Sep 23, 2024
43a760a
Remove table tags
Sporiff Sep 23, 2024
ba2132c
Remove table tag
Sporiff Sep 23, 2024
c9aae92
Merge branch 'main' into ADAPP-18656-cocos-2-dx-v-5-migration-guide
Sporiff Sep 23, 2024
7ae6edd
Merge branch 'main' into ADAPP-18656-cocos-2-dx-v-5-migration-guide
Sporiff Sep 23, 2024
3a535f6
Migrate to markdoc
Sporiff Sep 23, 2024
fd384b3
Merge branch 'main' into ADAPP-18656-cocos-2-dx-v-5-migration-guide
Sporiff Sep 23, 2024
54e7082
Remove unused code blocks
Sporiff Sep 23, 2024
12d5418
Move v4 content to new folder
Sporiff Sep 24, 2024
cb9333b
Add support for checkbox lists
Sporiff Sep 24, 2024
75ccb73
Add integration guide
Sporiff Sep 24, 2024
e387e2e
Add configuration guide
Sporiff Sep 24, 2024
0cabc85
Add features index page
Sporiff Sep 24, 2024
3d04021
Add ad revenue page
Sporiff Sep 24, 2024
0490b23
Merge branch 'main' into ADAPP-18657-cocos-2-dx-v-5-integrations
Sporiff Sep 24, 2024
9a8978f
Add ATT guide
Sporiff Sep 24, 2024
a310479
Add attribution guide
Sporiff Sep 25, 2024
8ec0b8f
Add callbacks guide
Sporiff Sep 25, 2024
235b710
Add deep links guide
Sporiff Sep 25, 2024
08f7574
Add device info getter guide
Sporiff Sep 25, 2024
52f1381
Add events guide
Sporiff Sep 25, 2024
6646d3e
Add privacy guide
Sporiff Sep 25, 2024
2f956c2
Fix list columns component
Sporiff Sep 25, 2024
34115e6
Add global parameters guide
Sporiff Sep 25, 2024
c6e7b98
Add short link guide
Sporiff Sep 25, 2024
cd66806
Fix tabs element
Sporiff Sep 25, 2024
27e3dbd
Add SKAN guide
Sporiff Sep 25, 2024
217c323
Update vector init in URL strategy
Sporiff Sep 25, 2024
f28d79c
Add updates from doc
Sporiff Sep 25, 2024
2fcfaee
Fix broken links
Sporiff Sep 26, 2024
cd49766
Update slug for broken link
Sporiff Sep 26, 2024
2b6ec91
Update variable usage
Sporiff Sep 26, 2024
afa2bcf
Add third party sharing clarifications
Sporiff Sep 26, 2024
0e41c75
Added subscription
ivosam3 Sep 26, 2024
3ad64de
Merge branch 'main' into ADAPP-18657-cocos-2-dx-v-5-integrations
Sporiff Sep 27, 2024
87cc17d
Apply suggestions from code review
Sporiff Sep 27, 2024
bb7ed0c
Merge branch 'main' into ADAPP-18656-cocos-2-dx-v-5-migration-guide
Sporiff Sep 27, 2024
9133501
Add suggestions from feedback
Sporiff Sep 27, 2024
efc5b6a
Apply suggestions from PR
Sporiff Sep 27, 2024
076d57e
Apply changes from code review
Sporiff Sep 27, 2024
79409f0
Enable parsing non-text elements in definition lists
Sporiff Sep 27, 2024
9026915
Use definition lists in privacy doc
Sporiff Sep 27, 2024
57a9caa
Update privacy doc
Sporiff Sep 30, 2024
0a44f6f
Remove tables and add definition lists
Sporiff Sep 30, 2024
ec42b8a
Merge branch 'main' into ADAPP-18657-cocos-2-dx-v-5-integrations
Sporiff Sep 30, 2024
b83177a
Update dl block style
Sporiff Sep 30, 2024
4f478cd
Migrate to deflist, add optional loglevel constructor argument
Sporiff Sep 30, 2024
029fb50
Fix up definition lists
Sporiff Sep 30, 2024
2a2669a
Add FB Meta Install Referrer information
Sporiff Sep 30, 2024
6915a2d
Add more explicit code examples
Sporiff Sep 30, 2024
072cdad
Update vale settings
Sporiff Sep 30, 2024
b909c3d
Apply suggestion from review
Sporiff Sep 30, 2024
5dda4a7
Add missing types to deflist
Sporiff Sep 30, 2024
a7af93e
Update wording for 3rd party sharing
Sporiff Oct 1, 2024
ece25c7
Fix typo
Sporiff Oct 2, 2024
0be931b
Add purchase verification doc
Sporiff Oct 2, 2024
da365f8
Add preinstall app guide
Sporiff Oct 2, 2024
7bf2313
Update src/content/docs/sdk/migration/cocos2dx/v4-to-v5.mdoc
Sporiff Oct 2, 2024
61e314e
Add signature library integration steps
Sporiff Oct 2, 2024
02ae522
Update signature library steps and clean up code snippets
Sporiff Oct 2, 2024
e1fd7cd
Add signature privacy manifest link
Sporiff Oct 2, 2024
4953f26
Add Cocos-2dx migration guide (#1080)
Sporiff Oct 2, 2024
c4f8167
Clarify that signature library is mandatory
Sporiff Oct 2, 2024
6de1eb6
Remove iOS-only note
Sporiff Oct 2, 2024
bb5e336
Rework install steps
Sporiff Oct 2, 2024
9aefdf5
Update integration guide order
Sporiff Oct 2, 2024
454e674
Minor wording changes
Sporiff Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/styles/Microsoft/HeadingAcronyms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ exceptions:
- AAR
- CPU
- IDE
- SKAN
- SKAD
11 changes: 11 additions & 0 deletions .github/styles/config/vocabularies/Adjust/accept.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MUST
MUST NOT
REQUIRED
SHALL
SHALL NOT
SHOULD
SHOULD NOT
RECOMMENDED
NOT RECOMMENDED
MAY
OPTIONAL
51 changes: 51 additions & 0 deletions .schema/List.markdoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import markdoc from "@markdoc/markdoc";
const { Tag } = markdoc;

/**
* A function to transform checkbox markers ([ ] and [x]) into checkboxes
* @param children The child elements of the list item
* @returns Updated children with checkboxes added if necessary
*/
function transformListItemChildren(children) {
return children.flatMap((child, index) => {
if (typeof child === 'string' && index === 0) {
if (child.startsWith("[ ]")) {
return [
new Tag("input", { type: "checkbox" }, []),
child.slice(3).trim()
];
} else if (child.startsWith("[x]")) {
return [
new Tag("input", { type: "checkbox", checked: "", }, []),
child.slice(3).trim()
];
}
} else if (child instanceof Tag) {
// Recursively call this function on nested lists
return new Tag(child.name, child.attributes, transformListItemChildren(child.children));
}

return child;
});
}

export const list = {
children: ['item'],
attributes: {
ordered: { type: Boolean, default: false },
marker: { type: String }
},
transform(node, config) {
const attributes = node.transformAttributes(config);
const children = node.transformChildren(config);
// If it's an ordered list, do nothing
if (attributes.ordered) return new Tag("ol", attributes, children.map(child => new Tag("li", {}, child.children)));

// If the list is unordered, apply the transformation
return new Tag("ul", attributes, children.map(child => {
// Transform each list item
const listItemChildren = transformListItemChildren(child.children);
return new Tag("li", {}, listItemChildren);
}));
}
};
3 changes: 3 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ IgnoredScopes = code, tt, img, url, a
SkippedScopes = script, style, pre, figure, code
MinAlertLevel = warning # suggestion, warning or error

Vocab = Adjust

# Force Vale to treat MDX files as markdown
[formats]
mdx = md
mdoc = md

# Only Markdown and .txt files; change to whatever you're using.
[*.md]
Expand Down
8 changes: 6 additions & 2 deletions markdoc.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';
import { heading } from ".schema/Heading.markdoc";
import { link } from ".schema/Link.markdoc";
import { paragraph } from ".schema/Paragraph.markdoc";
import { list } from ".schema/List.markdoc";
import versions from "src/versionMap.json";
import variables from "src/variables.json";

export default defineMarkdocConfig({
variables: {
versions
versions,
variables
},
nodes: {
heading,
link,
list,
paragraph,
fence: {
attributes: { ...nodes.fence.attributes },
Expand Down Expand Up @@ -123,7 +127,7 @@ export default defineMarkdocConfig({
}
},
tabs: {
render: component("src/components/Tab.astro"),
render: component("src/components/Tabs.astro"),
},
}
})
2 changes: 1 addition & 1 deletion src/components/ListColumns.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const content = Astro.slots.has("default")
? await Astro.slots.render("default")
: "";

const lists = content.split("<hr>");
const lists = content.split(/<hr\/?>/);
---

<div class="col-group grid grid-flow-row lg:grid-flow-col gap-6 mb-7">
Expand Down
91 changes: 56 additions & 35 deletions src/components/utils/parseDefList.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
import { unified } from "unified";
import rehypeParse from "rehype-parse";
import rehypeStringify from "rehype-stringify";
import type { Element, Root } from "hast";
import type { Element, Root, Text } from "hast";

/**
* Extracts text content from an element's children recursively.
* @param children The children of the element.
* @returns The concatenated text content.
*/
const getTextContent = (children: (Element | Text)[]): string => {
return children
.map((child) => {
if (child.type === 'text') {
return child.value;
} else if (child.type === 'element') {
// Recursively get the text content of nested elements
return getTextContent(child.children as (Element | Text)[]);
}
return '';
})
.join('');
};

/**
* Checks if a value is a definition list term.
* @param text The text value of the element.
* @param children The children of the element.
* @returns Whether the value of the element is a term.
*/
const isTerm = (text: string): boolean => {
return /^\S[^: ].*$/.test(text.trim());
const isTerm = (children: (Element | Text)[]): boolean => {
const text = getTextContent(children).trim();
return /^\S[^: ].*$/.test(text);
};

/**
* Checks if a value is a definition list description.
* @param text The text value of the element.
* @returns Whether the value of the element is a term.
* @param children The children of the element.
* @returns Whether the value of the element is a description.
*/
const isDescription = (text: string): boolean => {
return /^(:|\s)/.test(text.trim());
const isDescription = (children: (Element | Text)[]): boolean => {
const text = getTextContent(children).trim();
return /^(:|\s)/.test(text);
};

/**
Expand Down Expand Up @@ -53,78 +74,78 @@ export const parseDefList = async (htmlString: string): Promise<string> => {
children.forEach((element) => {
if (element.type === 'element') {
if (element.tagName === 'p') {
const text = element.children
.filter((child): child is Element & { value: string } => child.type === 'text')
.map((child) => child.value)
.join("")
.trim();
const textChildren = element.children as (Element | Text)[];

// Perform this action for each term
if (isTerm(text)) {
// Check if this paragraph contains a term
if (isTerm(textChildren)) {
// If we reach a new term, we need to finish appending the descriptions to the last term we were working on.
if (currentTerm) {
// Add the term to the list
// Push the last term and its descriptions
dlNode.children.push(currentTerm);
// Add all collected descriptions
currentDescription.forEach(dd => dlNode.children.push(dd));
currentDescription = [];
}

// If this is the first term, assign it as the current term.
currentTerm = {
type: "element",
tagName: "dt",
children: [{ type: "text", value: text }],
children: textChildren, // Keep all children, including inline formatting
properties: {},
};
} else if (isDescription(text) && currentTerm) {
// If the element is a description (paragraph starting with whitespace or a colon), add it to the currentDescription array
} else if (isDescription(textChildren) && currentTerm) {
currentDescription.push({
type: "element",
tagName: "dd",
children: [{ type: "text", value: text.replace(/^:/, "").trim() }],
children: [{
type: "element",
tagName: "p",
children: textChildren.map(child => {
if (child.type === 'text') {
// Strip leading colon or whitespace for descriptions
return {
...child,
value: child.value.replace(/^:/, '').trim(),
};
}
return child;
}),
properties: {},
}],
properties: {},
});
}
} else {
// If the element isn't a paragraph tag, it will be a description
// Non-paragraph elements are considered descriptions
if (currentTerm) {
// If we have an ongoing term, finalize it
dlNode.children.push(currentTerm);
currentTerm = null;
// Add all collected descriptions
currentDescription.forEach(dd => dlNode.children.push(dd));
currentDescription = [];
}

// Wrap all elements that aren't a paragraph in a <dd> tag
const ddElement: Element = {
type: "element",
tagName: "dd",
children: [element],
children: [element], // Wrap the non-paragraph element
properties: {},
};
// Add the description element to the definition list
dlNode.children.push(ddElement);
}
}
});

// Finalize the last term-description pair if it exists
// Finalize the last term-description pair
if (currentTerm) {
dlNode.children.push(currentTerm);
if (currentDescription.length > 0) {
currentDescription.forEach(dd => dlNode.children.push(dd));
}
currentDescription.forEach(dd => dlNode.children.push(dd));
}

// Overwrite the entire tree with the new <dl> node
// Replace the tree with the new <dl> node
tree.children = [dlNode];
};
})
.use(rehypeStringify); // Convert the result to a string so we can use set:html
.use(rehypeStringify);

// Process and return the transformed HTML
const result = await processor.process(htmlString);
return String(result);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
title: Configuration
description: Follow the guides in this section to configure the Adjust SDK.
category-title: Configuration
slug: en/sdk/cocos2dx/configuration
slug: en/sdk/cocos2dx/v4/configuration
sidebar-position: 1
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /en/sdk/cocos2dx/configuration
---

Use the methods in this document to configure the behavior of the Adjust SDK.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
---
title: Send ad revenue information
description: Send ad revenue information for supported network partners using the Adjust SDK.
slug: en/sdk/cocos2dx/features/ad-revenue
slug: en/sdk/cocos2dx/v4/features/ad-revenue
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /en/sdk/cocos2dx/features/ad-revenue
---

You can record ad revenue for [supported network partners](https://help.adjust.com/en/article/ad-revenue) using the Adjust SDK.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
---
title: Set up App Tracking Transparency
description: Configure your app to use Apple's App Tracking Transparency framework
slug: en/sdk/cocos2dx/features/att
slug: en/sdk/cocos2dx/v4/features/att
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /en/sdk/cocos2dx/features/att
---

If you want to record the device's ID for Advertisers (IDFA), you must display a prompt to get your user's authorization. To do this, you need to include Apple's App Tracking Transparency (ATT) framework in your app. The Adjust SDK stores the user's authorization status and sends it to Adjust's servers with each request.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
---
title: Get attribution information
description: Listen for attribution changes using the Adjust SDK
slug: en/sdk/cocos2dx/features/attribution
slug: en/sdk/cocos2dx/v4/features/attribution
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /en/sdk/cocos2dx/features/attribution
---

When a user interacts with an Adjust link, their attribution information updates. This can happen if the user interacts with a [deep link](https://help.adjust.com/en/article/deep-links). Information about a user's attribution is represented in the `AdjustAttribution2dx` class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
---
title: Send callback information
description: Use these methods to send callback information to Adjust.
slug: en/sdk/cocos2dx/features/callbacks
slug: en/sdk/cocos2dx/v4/features/callbacks
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /en/sdk/cocos2dx/features/callbacks
---

Set up callbacks to trigger functions when the SDK sends information to Adjust. You can set up callbacks for **sessions** and **events**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
title: Deep linking
description: Follow the guides in this section to set up deep linking.
category-title: Deep linking
slug: en/sdk/cocos2dx/features/deep-links
slug: en/sdk/cocos2dx/v4/features/deep-links
versions:
- label: v5
value: v5
default: true
- label: v4
value: v4
redirects:
v5: /en/sdk/cocos2dx/features/deep-links
---

You can create deep links to take users to specific pages in your app. The Adjust SDK uses different logic depending on if the user already has your app installed on their device:
Expand Down
Loading