chore: support fr locale

prod
Steven 4 months ago
parent 4444c72042
commit 6746b9dc58

@ -20,6 +20,10 @@ const PreferenceSection: React.FC = () => {
value: UserSetting_Locale.LOCALE_ZH, value: UserSetting_Locale.LOCALE_ZH,
label: "中文", label: "中文",
}, },
{
value: UserSetting_Locale.LOCALE_FR,
label: "Français",
},
]; ];
const colorThemeOptions = [ const colorThemeOptions = [

@ -1,6 +1,7 @@
import i18n from "i18next"; import i18n from "i18next";
import { initReactI18next } from "react-i18next"; import { initReactI18next } from "react-i18next";
import en from "../../locales/en.json"; import en from "../../locales/en.json";
import fr from "../../locales/fr.json";
import zh from "../../locales/zh.json"; import zh from "../../locales/zh.json";
i18n.use(initReactI18next).init({ i18n.use(initReactI18next).init({
@ -11,6 +12,9 @@ i18n.use(initReactI18next).init({
zh: { zh: {
translation: zh, translation: zh,
}, },
fr: {
translation: fr,
},
}, },
lng: "en", lng: "en",
fallbackLng: "en", fallbackLng: "en",

@ -37,6 +37,8 @@ const Root: React.FC = () => {
if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_ZH)) { if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_ZH)) {
i18n.changeLanguage("zh"); i18n.changeLanguage("zh");
} else if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_FR)) {
i18n.changeLanguage("fr");
} else { } else {
i18n.changeLanguage("en"); i18n.changeLanguage("en");
} }

@ -32,6 +32,7 @@ message UserSetting {
LOCALE_UNSPECIFIED = 0; LOCALE_UNSPECIFIED = 0;
LOCALE_EN = 1; LOCALE_EN = 1;
LOCALE_ZH = 2; LOCALE_ZH = 2;
LOCALE_FR = 3;
} }
// locale is the user locale. // locale is the user locale.
Locale locale = 2; Locale locale = 2;

@ -1360,6 +1360,7 @@
| LOCALE_UNSPECIFIED | 0 | | | LOCALE_UNSPECIFIED | 0 | |
| LOCALE_EN | 1 | | | LOCALE_EN | 1 | |
| LOCALE_ZH | 2 | | | LOCALE_ZH | 2 | |
| LOCALE_FR | 3 | |

@ -28,6 +28,7 @@ const (
UserSetting_LOCALE_UNSPECIFIED UserSetting_Locale = 0 UserSetting_LOCALE_UNSPECIFIED UserSetting_Locale = 0
UserSetting_LOCALE_EN UserSetting_Locale = 1 UserSetting_LOCALE_EN UserSetting_Locale = 1
UserSetting_LOCALE_ZH UserSetting_Locale = 2 UserSetting_LOCALE_ZH UserSetting_Locale = 2
UserSetting_LOCALE_FR UserSetting_Locale = 3
) )
// Enum value maps for UserSetting_Locale. // Enum value maps for UserSetting_Locale.
@ -36,11 +37,13 @@ var (
0: "LOCALE_UNSPECIFIED", 0: "LOCALE_UNSPECIFIED",
1: "LOCALE_EN", 1: "LOCALE_EN",
2: "LOCALE_ZH", 2: "LOCALE_ZH",
3: "LOCALE_FR",
} }
UserSetting_Locale_value = map[string]int32{ UserSetting_Locale_value = map[string]int32{
"LOCALE_UNSPECIFIED": 0, "LOCALE_UNSPECIFIED": 0,
"LOCALE_EN": 1, "LOCALE_EN": 1,
"LOCALE_ZH": 2, "LOCALE_ZH": 2,
"LOCALE_FR": 3,
} }
) )
@ -408,7 +411,7 @@ var file_api_v1_user_setting_service_proto_rawDesc = []byte{
0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65,
0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f,
0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xce, 0x02, 0x0a, 0x0b, 0x55, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x02, 0x0a, 0x0b, 0x55,
0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x38, 0x0a, 0x06, 0x6c, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x38, 0x0a, 0x06, 0x6c, 0x6f,
0x63, 0x61, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x73, 0x6c, 0x61,
@ -418,76 +421,77 @@ var file_api_v1_user_setting_service_proto_rawDesc = []byte{
0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x65, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73,
0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
0x74, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x52, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x52,
0x0a, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x3e, 0x0a, 0x06, 0x4c, 0x0a, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x22, 0x4d, 0x0a, 0x06, 0x4c,
0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f,
0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a,
0x09, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x09, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09,
0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x5a, 0x48, 0x10, 0x02, 0x22, 0x6e, 0x0a, 0x0a, 0x43, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x5a, 0x48, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x4c,
0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x46, 0x52, 0x10, 0x03, 0x22, 0x6e, 0x0a, 0x0a, 0x43, 0x6f,
0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4c, 0x4f,
0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x15, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54,
0x0a, 0x11, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x4c, 0x49, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x15, 0x0a,
0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x11, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x4c, 0x49, 0x47,
0x48, 0x45, 0x4d, 0x45, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x22, 0x27, 0x0a, 0x15, 0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48,
0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x45, 0x4d, 0x45, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x22, 0x27, 0x0a, 0x15, 0x47, 0x65,
0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75,
0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65,
0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20,
0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0xa5, 0x01, 0x0a, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b,
0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0xa5, 0x01, 0x0a, 0x18,
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72,
0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53,
0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69,
0x4d, 0x61, 0x73, 0x6b, 0x22, 0x59, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d,
0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x61, 0x73, 0x6b, 0x22, 0x59, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65,
0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61,
0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
0xd1, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd1,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65,
0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65,
0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68,
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53,
0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e,
0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x1d, 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x6e, 0x73, 0x65, 0x22, 0x28, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d,
0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f,
0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x01,
0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74,
0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x6c,
0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x18, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x18, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65,
0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65,
0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75,
0x6e, 0x67, 0x73, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x67, 0x73, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68,
0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x79, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79,
0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c,
0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70,
0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58,
0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca,
0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73,
0x74, 0x6f, 0x33, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
} }
var ( var (

@ -738,6 +738,7 @@ definitions:
- LOCALE_UNSPECIFIED - LOCALE_UNSPECIFIED
- LOCALE_EN - LOCALE_EN
- LOCALE_ZH - LOCALE_ZH
- LOCALE_FR
default: LOCALE_UNSPECIFIED default: LOCALE_UNSPECIFIED
apiv1AutoBackupWorkspaceSetting: apiv1AutoBackupWorkspaceSetting:
type: object type: object

@ -294,9 +294,9 @@
| Name | Number | Description | | Name | Number | Description |
| ---- | ------ | ----------- | | ---- | ------ | ----------- |
| COLOR_THEME_USER_SETTING_UNSPECIFIED | 0 | | | COLOR_THEME_USER_SETTING_UNSPECIFIED | 0 | |
| COLOR_THEME_USER_SETTING_SYSTEM | 1 | | | SYSTEM | 1 | |
| COLOR_THEME_USER_SETTING_LIGHT | 2 | | | LIGHT | 2 | |
| COLOR_THEME_USER_SETTING_DARK | 3 | | | DARK | 3 | |
@ -308,8 +308,9 @@
| Name | Number | Description | | Name | Number | Description |
| ---- | ------ | ----------- | | ---- | ------ | ----------- |
| LOCALE_USER_SETTING_UNSPECIFIED | 0 | | | LOCALE_USER_SETTING_UNSPECIFIED | 0 | |
| LOCALE_USER_SETTING_EN | 1 | | | EN | 1 | |
| LOCALE_USER_SETTING_ZH | 2 | | | ZH | 2 | |
| FR | 3 | |
@ -321,9 +322,9 @@
| Name | Number | Description | | Name | Number | Description |
| ---- | ------ | ----------- | | ---- | ------ | ----------- |
| USER_SETTING_KEY_UNSPECIFIED | 0 | | | USER_SETTING_KEY_UNSPECIFIED | 0 | |
| USER_SETTING_ACCESS_TOKENS | 1 | Access tokens for the user. | | ACCESS_TOKENS | 1 | Access tokens for the user. |
| USER_SETTING_LOCALE | 2 | Locale for the user. | | LOCALE | 2 | Locale for the user. |
| USER_SETTING_COLOR_THEME | 3 | Color theme for the user. | | COLOR_THEME | 3 | Color theme for the user. |

@ -25,26 +25,26 @@ type UserSettingKey int32
const ( const (
UserSettingKey_USER_SETTING_KEY_UNSPECIFIED UserSettingKey = 0 UserSettingKey_USER_SETTING_KEY_UNSPECIFIED UserSettingKey = 0
// Access tokens for the user. // Access tokens for the user.
UserSettingKey_USER_SETTING_ACCESS_TOKENS UserSettingKey = 1 UserSettingKey_ACCESS_TOKENS UserSettingKey = 1
// Locale for the user. // Locale for the user.
UserSettingKey_USER_SETTING_LOCALE UserSettingKey = 2 UserSettingKey_LOCALE UserSettingKey = 2
// Color theme for the user. // Color theme for the user.
UserSettingKey_USER_SETTING_COLOR_THEME UserSettingKey = 3 UserSettingKey_COLOR_THEME UserSettingKey = 3
) )
// Enum value maps for UserSettingKey. // Enum value maps for UserSettingKey.
var ( var (
UserSettingKey_name = map[int32]string{ UserSettingKey_name = map[int32]string{
0: "USER_SETTING_KEY_UNSPECIFIED", 0: "USER_SETTING_KEY_UNSPECIFIED",
1: "USER_SETTING_ACCESS_TOKENS", 1: "ACCESS_TOKENS",
2: "USER_SETTING_LOCALE", 2: "LOCALE",
3: "USER_SETTING_COLOR_THEME", 3: "COLOR_THEME",
} }
UserSettingKey_value = map[string]int32{ UserSettingKey_value = map[string]int32{
"USER_SETTING_KEY_UNSPECIFIED": 0, "USER_SETTING_KEY_UNSPECIFIED": 0,
"USER_SETTING_ACCESS_TOKENS": 1, "ACCESS_TOKENS": 1,
"USER_SETTING_LOCALE": 2, "LOCALE": 2,
"USER_SETTING_COLOR_THEME": 3, "COLOR_THEME": 3,
} }
) )
@ -79,21 +79,24 @@ type LocaleUserSetting int32
const ( const (
LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED LocaleUserSetting = 0 LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED LocaleUserSetting = 0
LocaleUserSetting_LOCALE_USER_SETTING_EN LocaleUserSetting = 1 LocaleUserSetting_EN LocaleUserSetting = 1
LocaleUserSetting_LOCALE_USER_SETTING_ZH LocaleUserSetting = 2 LocaleUserSetting_ZH LocaleUserSetting = 2
LocaleUserSetting_FR LocaleUserSetting = 3
) )
// Enum value maps for LocaleUserSetting. // Enum value maps for LocaleUserSetting.
var ( var (
LocaleUserSetting_name = map[int32]string{ LocaleUserSetting_name = map[int32]string{
0: "LOCALE_USER_SETTING_UNSPECIFIED", 0: "LOCALE_USER_SETTING_UNSPECIFIED",
1: "LOCALE_USER_SETTING_EN", 1: "EN",
2: "LOCALE_USER_SETTING_ZH", 2: "ZH",
3: "FR",
} }
LocaleUserSetting_value = map[string]int32{ LocaleUserSetting_value = map[string]int32{
"LOCALE_USER_SETTING_UNSPECIFIED": 0, "LOCALE_USER_SETTING_UNSPECIFIED": 0,
"LOCALE_USER_SETTING_EN": 1, "EN": 1,
"LOCALE_USER_SETTING_ZH": 2, "ZH": 2,
"FR": 3,
} }
) )
@ -128,24 +131,24 @@ type ColorThemeUserSetting int32
const ( const (
ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED ColorThemeUserSetting = 0 ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED ColorThemeUserSetting = 0
ColorThemeUserSetting_COLOR_THEME_USER_SETTING_SYSTEM ColorThemeUserSetting = 1 ColorThemeUserSetting_SYSTEM ColorThemeUserSetting = 1
ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT ColorThemeUserSetting = 2 ColorThemeUserSetting_LIGHT ColorThemeUserSetting = 2
ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK ColorThemeUserSetting = 3 ColorThemeUserSetting_DARK ColorThemeUserSetting = 3
) )
// Enum value maps for ColorThemeUserSetting. // Enum value maps for ColorThemeUserSetting.
var ( var (
ColorThemeUserSetting_name = map[int32]string{ ColorThemeUserSetting_name = map[int32]string{
0: "COLOR_THEME_USER_SETTING_UNSPECIFIED", 0: "COLOR_THEME_USER_SETTING_UNSPECIFIED",
1: "COLOR_THEME_USER_SETTING_SYSTEM", 1: "SYSTEM",
2: "COLOR_THEME_USER_SETTING_LIGHT", 2: "LIGHT",
3: "COLOR_THEME_USER_SETTING_DARK", 3: "DARK",
} }
ColorThemeUserSetting_value = map[string]int32{ ColorThemeUserSetting_value = map[string]int32{
"COLOR_THEME_USER_SETTING_UNSPECIFIED": 0, "COLOR_THEME_USER_SETTING_UNSPECIFIED": 0,
"COLOR_THEME_USER_SETTING_SYSTEM": 1, "SYSTEM": 1,
"COLOR_THEME_USER_SETTING_LIGHT": 2, "LIGHT": 2,
"COLOR_THEME_USER_SETTING_DARK": 3, "DARK": 3,
} }
) )
@ -428,45 +431,36 @@ var file_store_user_setting_proto_rawDesc = []byte{
0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64,
0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x89, 0x01, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x62, 0x0a,
0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12,
0x12, 0x20, 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x20, 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f,
0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45,
0x4e, 0x47, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x53, 0x4e, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02,
0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x10,
0x4e, 0x47, 0x5f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x55, 0x03, 0x2a, 0x50, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53,
0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x4f, 0x4c, 0x4f, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45,
0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x10, 0x03, 0x2a, 0x70, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e,
0x61, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45,
0x0a, 0x1f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x5a, 0x48, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46,
0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x52, 0x10, 0x03, 0x2a, 0x62, 0x0a, 0x15, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d,
0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x53, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x24,
0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x45, 0x4e, 0x10, 0x01, 0x12, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52,
0x1a, 0x0a, 0x16, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,
0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x5a, 0x48, 0x10, 0x02, 0x2a, 0xad, 0x01, 0x0a, 0x15, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d,
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a,
0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x24, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x04, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x42, 0xa1, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e,
0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x10, 0x55, 0x73, 0x65,
0x47, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a,
0x23, 0x0a, 0x1f, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x6f, 0x75, 0x72,
0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68,
0x45, 0x4d, 0x10, 0x01, 0x12, 0x22, 0x0a, 0x1e, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x53,
0x5f, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x21, 0x0a, 0x1d, 0x43, 0x4f, 0x4c, 0x4f, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, 0x6f,
0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65,
0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x42, 0xa1, 0x01, 0x0a, 0x0f, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x53,
0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x74, 0x6f, 0x33,
0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x79, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73,
0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73,
0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61,
0x73, 0x68, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68,
0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53,
0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0xea, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

@ -21,11 +21,11 @@ message UserSetting {
enum UserSettingKey { enum UserSettingKey {
USER_SETTING_KEY_UNSPECIFIED = 0; USER_SETTING_KEY_UNSPECIFIED = 0;
// Access tokens for the user. // Access tokens for the user.
USER_SETTING_ACCESS_TOKENS = 1; ACCESS_TOKENS = 1;
// Locale for the user. // Locale for the user.
USER_SETTING_LOCALE = 2; LOCALE = 2;
// Color theme for the user. // Color theme for the user.
USER_SETTING_COLOR_THEME = 3; COLOR_THEME = 3;
} }
message AccessTokensUserSetting { message AccessTokensUserSetting {
@ -41,13 +41,14 @@ message AccessTokensUserSetting {
enum LocaleUserSetting { enum LocaleUserSetting {
LOCALE_USER_SETTING_UNSPECIFIED = 0; LOCALE_USER_SETTING_UNSPECIFIED = 0;
LOCALE_USER_SETTING_EN = 1; EN = 1;
LOCALE_USER_SETTING_ZH = 2; ZH = 2;
FR = 3;
} }
enum ColorThemeUserSetting { enum ColorThemeUserSetting {
COLOR_THEME_USER_SETTING_UNSPECIFIED = 0; COLOR_THEME_USER_SETTING_UNSPECIFIED = 0;
COLOR_THEME_USER_SETTING_SYSTEM = 1; SYSTEM = 1;
COLOR_THEME_USER_SETTING_LIGHT = 2; LIGHT = 2;
COLOR_THEME_USER_SETTING_DARK = 3; DARK = 3;
} }

@ -260,7 +260,7 @@ func (s *APIV1Service) DeleteUserAccessToken(ctx context.Context, request *apiv1
} }
if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, Key: storepb.UserSettingKey_ACCESS_TOKENS,
Value: &storepb.UserSetting_AccessTokens{ Value: &storepb.UserSetting_AccessTokens{
AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: &storepb.AccessTokensUserSetting{
AccessTokens: updatedUserAccessTokens, AccessTokens: updatedUserAccessTokens,
@ -285,7 +285,7 @@ func (s *APIV1Service) UpsertAccessTokenToStore(ctx context.Context, user *store
userAccessTokens = append(userAccessTokens, &userAccessToken) userAccessTokens = append(userAccessTokens, &userAccessToken)
if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, Key: storepb.UserSettingKey_ACCESS_TOKENS,
Value: &storepb.UserSetting_AccessTokens{ Value: &storepb.UserSetting_AccessTokens{
AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: &storepb.AccessTokensUserSetting{
AccessTokens: userAccessTokens, AccessTokens: userAccessTokens,

@ -35,7 +35,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *apiv1pb.U
if path == "locale" { if path == "locale" {
if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_LOCALE, Key: storepb.UserSettingKey_LOCALE,
Value: &storepb.UserSetting_Locale{ Value: &storepb.UserSetting_Locale{
Locale: convertUserSettingLocaleToStore(request.UserSetting.Locale), Locale: convertUserSettingLocaleToStore(request.UserSetting.Locale),
}, },
@ -45,7 +45,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *apiv1pb.U
} else if path == "color_theme" { } else if path == "color_theme" {
if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_COLOR_THEME, Key: storepb.UserSettingKey_COLOR_THEME,
Value: &storepb.UserSetting_ColorTheme{ Value: &storepb.UserSetting_ColorTheme{
ColorTheme: convertUserSettingColorThemeToStore(request.UserSetting.ColorTheme), ColorTheme: convertUserSettingColorThemeToStore(request.UserSetting.ColorTheme),
}, },
@ -80,9 +80,9 @@ func getUserSetting(ctx context.Context, s *store.Store, userID int32) (*apiv1pb
ColorTheme: apiv1pb.UserSetting_COLOR_THEME_SYSTEM, ColorTheme: apiv1pb.UserSetting_COLOR_THEME_SYSTEM,
} }
for _, setting := range userSettings { for _, setting := range userSettings {
if setting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { if setting.Key == storepb.UserSettingKey_LOCALE {
userSetting.Locale = convertUserSettingLocaleFromStore(setting.GetLocale()) userSetting.Locale = convertUserSettingLocaleFromStore(setting.GetLocale())
} else if setting.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { } else if setting.Key == storepb.UserSettingKey_COLOR_THEME {
userSetting.ColorTheme = convertUserSettingColorThemeFromStore(setting.GetColorTheme()) userSetting.ColorTheme = convertUserSettingColorThemeFromStore(setting.GetColorTheme())
} }
} }
@ -92,9 +92,11 @@ func getUserSetting(ctx context.Context, s *store.Store, userID int32) (*apiv1pb
func convertUserSettingLocaleToStore(locale apiv1pb.UserSetting_Locale) storepb.LocaleUserSetting { func convertUserSettingLocaleToStore(locale apiv1pb.UserSetting_Locale) storepb.LocaleUserSetting {
switch locale { switch locale {
case apiv1pb.UserSetting_LOCALE_EN: case apiv1pb.UserSetting_LOCALE_EN:
return storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN return storepb.LocaleUserSetting_EN
case apiv1pb.UserSetting_LOCALE_ZH: case apiv1pb.UserSetting_LOCALE_ZH:
return storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH return storepb.LocaleUserSetting_ZH
case apiv1pb.UserSetting_LOCALE_FR:
return storepb.LocaleUserSetting_FR
default: default:
return storepb.LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED return storepb.LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED
} }
@ -102,10 +104,12 @@ func convertUserSettingLocaleToStore(locale apiv1pb.UserSetting_Locale) storepb.
func convertUserSettingLocaleFromStore(locale storepb.LocaleUserSetting) apiv1pb.UserSetting_Locale { func convertUserSettingLocaleFromStore(locale storepb.LocaleUserSetting) apiv1pb.UserSetting_Locale {
switch locale { switch locale {
case storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN: case storepb.LocaleUserSetting_EN:
return apiv1pb.UserSetting_LOCALE_EN return apiv1pb.UserSetting_LOCALE_EN
case storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH: case storepb.LocaleUserSetting_ZH:
return apiv1pb.UserSetting_LOCALE_ZH return apiv1pb.UserSetting_LOCALE_ZH
case storepb.LocaleUserSetting_FR:
return apiv1pb.UserSetting_LOCALE_FR
default: default:
return apiv1pb.UserSetting_LOCALE_UNSPECIFIED return apiv1pb.UserSetting_LOCALE_UNSPECIFIED
} }
@ -114,11 +118,11 @@ func convertUserSettingLocaleFromStore(locale storepb.LocaleUserSetting) apiv1pb
func convertUserSettingColorThemeToStore(colorTheme apiv1pb.UserSetting_ColorTheme) storepb.ColorThemeUserSetting { func convertUserSettingColorThemeToStore(colorTheme apiv1pb.UserSetting_ColorTheme) storepb.ColorThemeUserSetting {
switch colorTheme { switch colorTheme {
case apiv1pb.UserSetting_COLOR_THEME_SYSTEM: case apiv1pb.UserSetting_COLOR_THEME_SYSTEM:
return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_SYSTEM return storepb.ColorThemeUserSetting_SYSTEM
case apiv1pb.UserSetting_COLOR_THEME_LIGHT: case apiv1pb.UserSetting_COLOR_THEME_LIGHT:
return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT return storepb.ColorThemeUserSetting_LIGHT
case apiv1pb.UserSetting_COLOR_THEME_DARK: case apiv1pb.UserSetting_COLOR_THEME_DARK:
return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK return storepb.ColorThemeUserSetting_DARK
default: default:
return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED
} }
@ -126,11 +130,11 @@ func convertUserSettingColorThemeToStore(colorTheme apiv1pb.UserSetting_ColorThe
func convertUserSettingColorThemeFromStore(colorTheme storepb.ColorThemeUserSetting) apiv1pb.UserSetting_ColorTheme { func convertUserSettingColorThemeFromStore(colorTheme storepb.ColorThemeUserSetting) apiv1pb.UserSetting_ColorTheme {
switch colorTheme { switch colorTheme {
case storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_SYSTEM: case storepb.ColorThemeUserSetting_SYSTEM:
return apiv1pb.UserSetting_COLOR_THEME_SYSTEM return apiv1pb.UserSetting_COLOR_THEME_SYSTEM
case storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT: case storepb.ColorThemeUserSetting_LIGHT:
return apiv1pb.UserSetting_COLOR_THEME_LIGHT return apiv1pb.UserSetting_COLOR_THEME_LIGHT
case storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK: case storepb.ColorThemeUserSetting_DARK:
return apiv1pb.UserSetting_COLOR_THEME_DARK return apiv1pb.UserSetting_COLOR_THEME_DARK
default: default:
return apiv1pb.UserSetting_COLOR_THEME_UNSPECIFIED return apiv1pb.UserSetting_COLOR_THEME_UNSPECIFIED

@ -87,7 +87,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
func (s *Server) Start(ctx context.Context) error { func (s *Server) Start(ctx context.Context) error {
// Load subscription. // Load subscription.
if _, err := s.licenseService.LoadSubscription(ctx); err != nil { if _, err := s.licenseService.LoadSubscription(ctx); err != nil {
slog.Error("failed to load subscription", err) slog.Error("failed to load subscription", slog.Any("error", err))
} }
// Start gRPC server. // Start gRPC server.
listen, err := net.Listen("tcp", fmt.Sprintf(":%d", s.Profile.Port+1)) listen, err := net.Listen("tcp", fmt.Sprintf(":%d", s.Profile.Port+1))

@ -23,15 +23,15 @@ func (d *DB) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting)
` `
var valueString string var valueString string
if upsert.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { if upsert.Key == storepb.UserSettingKey_ACCESS_TOKENS {
valueBytes, err := protojson.Marshal(upsert.GetAccessTokens()) valueBytes, err := protojson.Marshal(upsert.GetAccessTokens())
if err != nil { if err != nil {
return nil, err return nil, err
} }
valueString = string(valueBytes) valueString = string(valueBytes)
} else if upsert.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { } else if upsert.Key == storepb.UserSettingKey_LOCALE {
valueString = upsert.GetLocale().String() valueString = upsert.GetLocale().String()
} else if upsert.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { } else if upsert.Key == storepb.UserSettingKey_COLOR_THEME {
valueString = upsert.GetColorTheme().String() valueString = upsert.GetColorTheme().String()
} else { } else {
return nil, errors.New("invalid user setting key") return nil, errors.New("invalid user setting key")
@ -80,7 +80,7 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting)
return nil, err return nil, err
} }
userSetting.Key = storepb.UserSettingKey(storepb.UserSettingKey_value[keyString]) userSetting.Key = storepb.UserSettingKey(storepb.UserSettingKey_value[keyString])
if userSetting.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { if userSetting.Key == storepb.UserSettingKey_ACCESS_TOKENS {
accessTokensUserSetting := &storepb.AccessTokensUserSetting{} accessTokensUserSetting := &storepb.AccessTokensUserSetting{}
if err := protojson.Unmarshal([]byte(valueString), accessTokensUserSetting); err != nil { if err := protojson.Unmarshal([]byte(valueString), accessTokensUserSetting); err != nil {
return nil, err return nil, err
@ -88,16 +88,17 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting)
userSetting.Value = &storepb.UserSetting_AccessTokens{ userSetting.Value = &storepb.UserSetting_AccessTokens{
AccessTokens: accessTokensUserSetting, AccessTokens: accessTokensUserSetting,
} }
} else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { } else if userSetting.Key == storepb.UserSettingKey_LOCALE {
userSetting.Value = &storepb.UserSetting_Locale{ userSetting.Value = &storepb.UserSetting_Locale{
Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]), Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]),
} }
} else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { } else if userSetting.Key == storepb.UserSettingKey_COLOR_THEME {
userSetting.Value = &storepb.UserSetting_ColorTheme{ userSetting.Value = &storepb.UserSetting_ColorTheme{
ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]), ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]),
} }
} else { } else {
return nil, errors.New("invalid user setting key") // Skip unknown key.
continue
} }
userSettingList = append(userSettingList, userSetting) userSettingList = append(userSettingList, userSetting)
} }

@ -22,15 +22,15 @@ func (d *DB) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting)
SET value = EXCLUDED.value SET value = EXCLUDED.value
` `
var valueString string var valueString string
if upsert.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { if upsert.Key == storepb.UserSettingKey_ACCESS_TOKENS {
valueBytes, err := protojson.Marshal(upsert.GetAccessTokens()) valueBytes, err := protojson.Marshal(upsert.GetAccessTokens())
if err != nil { if err != nil {
return nil, err return nil, err
} }
valueString = string(valueBytes) valueString = string(valueBytes)
} else if upsert.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { } else if upsert.Key == storepb.UserSettingKey_LOCALE {
valueString = upsert.GetLocale().String() valueString = upsert.GetLocale().String()
} else if upsert.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { } else if upsert.Key == storepb.UserSettingKey_COLOR_THEME {
valueString = upsert.GetColorTheme().String() valueString = upsert.GetColorTheme().String()
} else { } else {
return nil, errors.New("invalid user setting key") return nil, errors.New("invalid user setting key")
@ -79,7 +79,7 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting)
return nil, err return nil, err
} }
userSetting.Key = storepb.UserSettingKey(storepb.UserSettingKey_value[keyString]) userSetting.Key = storepb.UserSettingKey(storepb.UserSettingKey_value[keyString])
if userSetting.Key == storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS { if userSetting.Key == storepb.UserSettingKey_ACCESS_TOKENS {
accessTokensUserSetting := &storepb.AccessTokensUserSetting{} accessTokensUserSetting := &storepb.AccessTokensUserSetting{}
if err := protojson.Unmarshal([]byte(valueString), accessTokensUserSetting); err != nil { if err := protojson.Unmarshal([]byte(valueString), accessTokensUserSetting); err != nil {
return nil, err return nil, err
@ -87,16 +87,17 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting)
userSetting.Value = &storepb.UserSetting_AccessTokens{ userSetting.Value = &storepb.UserSetting_AccessTokens{
AccessTokens: accessTokensUserSetting, AccessTokens: accessTokensUserSetting,
} }
} else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE { } else if userSetting.Key == storepb.UserSettingKey_LOCALE {
userSetting.Value = &storepb.UserSetting_Locale{ userSetting.Value = &storepb.UserSetting_Locale{
Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]), Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]),
} }
} else if userSetting.Key == storepb.UserSettingKey_USER_SETTING_COLOR_THEME { } else if userSetting.Key == storepb.UserSettingKey_COLOR_THEME {
userSetting.Value = &storepb.UserSetting_ColorTheme{ userSetting.Value = &storepb.UserSetting_ColorTheme{
ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]), ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]),
} }
} else { } else {
return nil, errors.New("invalid user setting key") // Skip unknown key.
continue
} }
userSettingList = append(userSettingList, userSetting) userSettingList = append(userSettingList, userSetting)
} }

@ -57,7 +57,7 @@ func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*sto
func (s *Store) GetUserAccessTokens(ctx context.Context, userID int32) ([]*storepb.AccessTokensUserSetting_AccessToken, error) { func (s *Store) GetUserAccessTokens(ctx context.Context, userID int32) ([]*storepb.AccessTokensUserSetting_AccessToken, error) {
userSetting, err := s.GetUserSetting(ctx, &FindUserSetting{ userSetting, err := s.GetUserSetting(ctx, &FindUserSetting{
UserID: &userID, UserID: &userID,
Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, Key: storepb.UserSettingKey_ACCESS_TOKENS,
}) })
if err != nil { if err != nil {
return nil, err return nil, err

@ -24,7 +24,7 @@ func TestUserSettingStore(t *testing.T) {
// Test for access tokens user setting. // Test for access tokens user setting.
accessTokensUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{ accessTokensUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, Key: storepb.UserSettingKey_ACCESS_TOKENS,
Value: &storepb.UserSetting_AccessTokens{ Value: &storepb.UserSetting_AccessTokens{
AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: &storepb.AccessTokensUserSetting{
AccessTokens: []*storepb.AccessTokensUserSetting_AccessToken{ AccessTokens: []*storepb.AccessTokensUserSetting_AccessToken{
@ -37,7 +37,7 @@ func TestUserSettingStore(t *testing.T) {
}) })
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, accessTokensUserSetting) require.NotNil(t, accessTokensUserSetting)
require.Equal(t, storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, accessTokensUserSetting.Key) require.Equal(t, storepb.UserSettingKey_ACCESS_TOKENS, accessTokensUserSetting.Key)
require.Equal(t, user.ID, accessTokensUserSetting.UserId) require.Equal(t, user.ID, accessTokensUserSetting.UserId)
require.Equal(t, 1, len(accessTokensUserSetting.GetAccessTokens().AccessTokens)) require.Equal(t, 1, len(accessTokensUserSetting.GetAccessTokens().AccessTokens))
userSettings, err = ts.ListUserSettings(ctx, &store.FindUserSetting{ userSettings, err = ts.ListUserSettings(ctx, &store.FindUserSetting{
@ -48,7 +48,7 @@ func TestUserSettingStore(t *testing.T) {
require.Equal(t, accessTokensUserSetting, userSettings[0]) require.Equal(t, accessTokensUserSetting, userSettings[0])
accessTokensUserSetting, err = ts.GetUserSetting(ctx, &store.FindUserSetting{ accessTokensUserSetting, err = ts.GetUserSetting(ctx, &store.FindUserSetting{
UserID: &user.ID, UserID: &user.ID,
Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, Key: storepb.UserSettingKey_ACCESS_TOKENS,
}) })
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, accessTokensUserSetting) require.NotNil(t, accessTokensUserSetting)
@ -56,7 +56,7 @@ func TestUserSettingStore(t *testing.T) {
require.Equal(t, "test_access_token", accessTokensUserSetting.GetAccessTokens().AccessTokens[0].AccessToken) require.Equal(t, "test_access_token", accessTokensUserSetting.GetAccessTokens().AccessTokens[0].AccessToken)
accessTokensUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{ accessTokensUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_ACCESS_TOKENS, Key: storepb.UserSettingKey_ACCESS_TOKENS,
Value: &storepb.UserSetting_AccessTokens{ Value: &storepb.UserSetting_AccessTokens{
AccessTokens: &storepb.AccessTokensUserSetting{ AccessTokens: &storepb.AccessTokensUserSetting{
AccessTokens: []*storepb.AccessTokensUserSetting_AccessToken{ AccessTokens: []*storepb.AccessTokensUserSetting_AccessToken{
@ -77,44 +77,44 @@ func TestUserSettingStore(t *testing.T) {
// Test for locale user setting. // Test for locale user setting.
localeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{ localeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_LOCALE, Key: storepb.UserSettingKey_LOCALE,
Value: &storepb.UserSetting_Locale{ Value: &storepb.UserSetting_Locale{
Locale: storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH, Locale: storepb.LocaleUserSetting_ZH,
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, localeUserSetting) require.NotNil(t, localeUserSetting)
require.Equal(t, storepb.UserSettingKey_USER_SETTING_LOCALE, localeUserSetting.Key) require.Equal(t, storepb.UserSettingKey_LOCALE, localeUserSetting.Key)
require.Equal(t, storepb.LocaleUserSetting_LOCALE_USER_SETTING_ZH, localeUserSetting.GetLocale()) require.Equal(t, storepb.LocaleUserSetting_ZH, localeUserSetting.GetLocale())
localeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{ localeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_LOCALE, Key: storepb.UserSettingKey_LOCALE,
Value: &storepb.UserSetting_Locale{ Value: &storepb.UserSetting_Locale{
Locale: storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN, Locale: storepb.LocaleUserSetting_EN,
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, storepb.LocaleUserSetting_LOCALE_USER_SETTING_EN, localeUserSetting.GetLocale()) require.Equal(t, storepb.LocaleUserSetting_EN, localeUserSetting.GetLocale())
// Test for color theme user setting. // Test for color theme user setting.
colorThemeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{ colorThemeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_COLOR_THEME, Key: storepb.UserSettingKey_COLOR_THEME,
Value: &storepb.UserSetting_ColorTheme{ Value: &storepb.UserSetting_ColorTheme{
ColorTheme: storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT, ColorTheme: storepb.ColorThemeUserSetting_LIGHT,
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, colorThemeUserSetting) require.NotNil(t, colorThemeUserSetting)
require.Equal(t, storepb.UserSettingKey_USER_SETTING_COLOR_THEME, colorThemeUserSetting.Key) require.Equal(t, storepb.UserSettingKey_COLOR_THEME, colorThemeUserSetting.Key)
require.Equal(t, storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_LIGHT, colorThemeUserSetting.GetColorTheme()) require.Equal(t, storepb.ColorThemeUserSetting_LIGHT, colorThemeUserSetting.GetColorTheme())
colorThemeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{ colorThemeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{
UserId: user.ID, UserId: user.ID,
Key: storepb.UserSettingKey_USER_SETTING_COLOR_THEME, Key: storepb.UserSettingKey_COLOR_THEME,
Value: &storepb.UserSetting_ColorTheme{ Value: &storepb.UserSetting_ColorTheme{
ColorTheme: storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK, ColorTheme: storepb.ColorThemeUserSetting_DARK,
}, },
}) })
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_DARK, colorThemeUserSetting.GetColorTheme()) require.Equal(t, storepb.ColorThemeUserSetting_DARK, colorThemeUserSetting.GetColorTheme())
} }

Loading…
Cancel
Save