Skip to content

Commit

Permalink
Add reward when following GDevelop Tiktok account
Browse files Browse the repository at this point in the history
  • Loading branch information
4ian committed May 22, 2024
1 parent 7d95e44 commit d36f829
Show file tree
Hide file tree
Showing 11 changed files with 388 additions and 217 deletions.
34 changes: 34 additions & 0 deletions newIDE/app/src/Profile/AuthenticatedUserProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getUserBadges,
listDefaultRecommendations,
listRecommendations,
type CommunityLinks,
} from '../Utils/GDevelopServices/User';
import { getAchievements } from '../Utils/GDevelopServices/Badge';
import Authentication, {
Expand Down Expand Up @@ -1299,6 +1300,36 @@ export default class AuthenticatedUserProvider extends React.Component<
}
};

_onUpdateTiktokFollow = async (
communityLinks: CommunityLinks,
preferences: PreferencesValues
) => {
const { authentication } = this.props;

await this._doEdit(
{
communityLinks,
},
preferences
);

this.setState({
editInProgress: true,
});
try {
const response = await authentication.updateTiktokFollow(
authentication.getAuthorizationHeader
);
this._fetchUserBadges();

return response;
} finally {
this.setState({
editInProgress: false,
});
}
};

render() {
return (
<PreferencesContext.Consumer>
Expand Down Expand Up @@ -1343,6 +1374,9 @@ export default class AuthenticatedUserProvider extends React.Component<
onUpdateGitHubStar={githubUsername =>
this._onUpdateGithubStar(githubUsername, preferences)
}
onUpdateTiktokFollow={communityLinks =>
this._onUpdateTiktokFollow(communityLinks, preferences)
}
onDelete={this._doDeleteAccount}
actionInProgress={
this.state.editInProgress || this.state.deleteInProgress
Expand Down
10 changes: 7 additions & 3 deletions newIDE/app/src/Profile/CreateAccountForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const styles = {
alignItems: 'stretch',
marginTop: 30,
},
icon: {
width: 16,
height: 16,
}
};

type Props = {|
Expand Down Expand Up @@ -139,7 +143,7 @@ const CreateAccountForm = ({
primary
fullWidth
label="Google"
leftIcon={<Google />}
leftIcon={<Google style={styles.icon} />}
onClick={() => {
onLoginWithProvider('google');
}}
Expand All @@ -149,7 +153,7 @@ const CreateAccountForm = ({
primary
fullWidth
label="GitHub"
leftIcon={<GitHub />}
leftIcon={<GitHub style={styles.icon} />}
onClick={() => {
onLoginWithProvider('github');
}}
Expand All @@ -159,7 +163,7 @@ const CreateAccountForm = ({
primary
fullWidth
label="Apple"
leftIcon={<Apple />}
leftIcon={<Apple style={styles.icon} />}
onClick={() => {
onLoginWithProvider('apple');
}}
Expand Down

0 comments on commit d36f829

Please sign in to comment.