Skip to content

Commit

Permalink
v119 & send language to aoe2backend
Browse files Browse the repository at this point in the history
  • Loading branch information
denniske committed Nov 16, 2024
1 parent b2dade5 commit 6580e75
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
18 changes: 18 additions & 0 deletions app/src/api/following.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,24 @@ export async function setAccountProfile(account_id: string, profile: IAccountPro
})
}

export async function setAccountLanguage(account_id: string, language: string): Promise<any> {
const url = getHost('aoe2companion-api') + `account/language`;

const data = {
account_id,
language
};

return await fetchJson('setAccountLanguage', url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(data),
})
}

export async function setNotificationConfig(account_id: string, push_enabled: boolean): Promise<any> {
const url = getHost('aoe2companion-api') + `notification/config`;

Expand Down
8 changes: 5 additions & 3 deletions app/src/app/more/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Platform, StyleSheet, TouchableOpacity, View } from 'react-native';
import { Button, Checkbox } from 'react-native-paper';

import {
follow,
follow, setAccountLanguage,
setAccountProfile,
setAccountPushToken,
setAccountPushTokenWeb,
Expand Down Expand Up @@ -237,9 +237,9 @@ export default function SettingsPage() {
const formatLanguage = (x: string | null, inList?: boolean) => {
return x != null ? languageMap[x] : 'empty';
};
const languageList: (string | null)[] = Object.keys(languageMap);
const languageList: string[] = Object.keys(languageMap);
const divider = (x: any, i: number) => i === 0;
const onLanguageSelected = async (language: string | null) => {
const onLanguageSelected = async (language: string) => {
const resultingLanguage = language == 'system' ? getLanguageFromSystemLocale2(Localization.locale) : language;
setInternalLanguage(resultingLanguage);

Expand All @@ -249,6 +249,8 @@ export default function SettingsPage() {
};
await saveConfigToStorage(newConfig);
mutate(setConfig(newConfig));

setAccountLanguage(accountId, resultingLanguage);
};
const onMainPageSelected = async (page: string) => {
const newConfig = {
Expand Down
2 changes: 1 addition & 1 deletion app/src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export const changelog4: IChangelog = {
};

export const changelog: IChangelog = {
'118.0.0': [
'119.0.0': [
{
type: 'feature',
title: 'Steam Family Sharing Indicator',
Expand Down
2 changes: 1 addition & 1 deletion app2.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const sentryConfigPlugin = [
}
];

const version = '118.0.0';
const version = '119.0.0';
const versionParts = version.split('.');

const runtimeVersion = versionParts[0] + '.' + versionParts[1] + '.0';
Expand Down

0 comments on commit 6580e75

Please sign in to comment.