mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-20 14:01:24 +00:00
chore: tweak user settings
This commit is contained in:
parent
6920313b77
commit
87deeca110
@ -2,7 +2,7 @@ import { Option, Select } from "@mui/joy";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import BetaBadge from "@/components/BetaBadge";
|
||||
import { useUserStore } from "@/stores";
|
||||
import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v1/user_setting_service";
|
||||
import { UserSetting } from "@/types/proto/api/v1/user_setting_service";
|
||||
|
||||
const PreferenceSection: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -13,39 +13,39 @@ const PreferenceSection: React.FC = () => {
|
||||
|
||||
const languageOptions = [
|
||||
{
|
||||
value: UserSetting_Locale.LOCALE_EN,
|
||||
value: "EN",
|
||||
label: "English",
|
||||
},
|
||||
{
|
||||
value: UserSetting_Locale.LOCALE_ZH,
|
||||
value: "ZH",
|
||||
label: "中文",
|
||||
},
|
||||
{
|
||||
value: UserSetting_Locale.LOCALE_FR,
|
||||
value: "FR",
|
||||
label: "Français",
|
||||
},
|
||||
{
|
||||
value: UserSetting_Locale.LOCALE_JA,
|
||||
value: "JA",
|
||||
label: "日本語",
|
||||
},
|
||||
];
|
||||
|
||||
const colorThemeOptions = [
|
||||
{
|
||||
value: UserSetting_ColorTheme.COLOR_THEME_SYSTEM,
|
||||
value: "SYSTEM",
|
||||
label: "System",
|
||||
},
|
||||
{
|
||||
value: UserSetting_ColorTheme.COLOR_THEME_LIGHT,
|
||||
value: "LIGHT",
|
||||
label: "Light",
|
||||
},
|
||||
{
|
||||
value: UserSetting_ColorTheme.COLOR_THEME_DARK,
|
||||
value: "DARK",
|
||||
label: "Dark",
|
||||
},
|
||||
];
|
||||
|
||||
const handleSelectLanguage = async (locale: UserSetting_Locale) => {
|
||||
const handleSelectLanguage = async (locale: string) => {
|
||||
await userStore.updateUserSetting(
|
||||
{
|
||||
...userSetting,
|
||||
@ -55,7 +55,7 @@ const PreferenceSection: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const handleSelectColorTheme = async (colorTheme: UserSetting_ColorTheme) => {
|
||||
const handleSelectColorTheme = async (colorTheme: string) => {
|
||||
await userStore.updateUserSetting(
|
||||
{
|
||||
...userSetting,
|
||||
@ -73,7 +73,7 @@ const PreferenceSection: React.FC = () => {
|
||||
<div className="flex flex-row justify-start items-center gap-x-1">
|
||||
<span className="dark:text-gray-400">{t("settings.preference.color-theme")}</span>
|
||||
</div>
|
||||
<Select defaultValue={colorTheme} onChange={(_, value) => handleSelectColorTheme(value as UserSetting_ColorTheme)}>
|
||||
<Select defaultValue={colorTheme} onChange={(_, value) => handleSelectColorTheme(value as string)}>
|
||||
{colorThemeOptions.map((option) => {
|
||||
return (
|
||||
<Option key={option.value} value={option.value}>
|
||||
@ -88,7 +88,7 @@ const PreferenceSection: React.FC = () => {
|
||||
<span className="dark:text-gray-400">{t("common.language")}</span>
|
||||
<BetaBadge />
|
||||
</div>
|
||||
<Select defaultValue={language} onChange={(_, value) => handleSelectLanguage(value as UserSetting_Locale)}>
|
||||
<Select defaultValue={language} onChange={(_, value) => handleSelectLanguage(value as string)}>
|
||||
{languageOptions.map((option) => {
|
||||
return (
|
||||
<Option key={option.value} value={option.value}>
|
||||
|
@ -7,7 +7,6 @@ import Header from "@/components/Header";
|
||||
import Navigator from "@/components/Navigator";
|
||||
import useNavigateTo from "@/hooks/useNavigateTo";
|
||||
import { useUserStore } from "@/stores";
|
||||
import { UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v1/user_setting_service";
|
||||
|
||||
const Root: React.FC = () => {
|
||||
const navigateTo = useNavigateTo();
|
||||
@ -35,19 +34,19 @@ const Root: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_ZH)) {
|
||||
if (isEqual(currentUserSetting.locale, "ZH")) {
|
||||
i18n.changeLanguage("zh");
|
||||
} else if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_FR)) {
|
||||
} else if (isEqual(currentUserSetting.locale, "FR")) {
|
||||
i18n.changeLanguage("fr");
|
||||
} else if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_JA)) {
|
||||
} else if (isEqual(currentUserSetting.locale, "JA")) {
|
||||
i18n.changeLanguage("ja");
|
||||
} else {
|
||||
i18n.changeLanguage("en");
|
||||
}
|
||||
|
||||
if (currentUserSetting.colorTheme === UserSetting_ColorTheme.COLOR_THEME_LIGHT) {
|
||||
if (currentUserSetting.colorTheme === "LIGHT") {
|
||||
setMode("light");
|
||||
} else if (currentUserSetting.colorTheme === UserSetting_ColorTheme.COLOR_THEME_DARK) {
|
||||
} else if (currentUserSetting.colorTheme === "DARK") {
|
||||
setMode("dark");
|
||||
} else {
|
||||
setMode("system");
|
||||
|
@ -28,24 +28,11 @@ message UserSetting {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
|
||||
enum Locale {
|
||||
LOCALE_UNSPECIFIED = 0;
|
||||
LOCALE_EN = 1;
|
||||
LOCALE_ZH = 2;
|
||||
LOCALE_FR = 3;
|
||||
LOCALE_JA = 4;
|
||||
}
|
||||
// locale is the user locale.
|
||||
Locale locale = 2;
|
||||
string locale = 2;
|
||||
|
||||
enum ColorTheme {
|
||||
COLOR_THEME_UNSPECIFIED = 0;
|
||||
COLOR_THEME_SYSTEM = 1;
|
||||
COLOR_THEME_LIGHT = 2;
|
||||
COLOR_THEME_DARK = 3;
|
||||
}
|
||||
// color_theme is the user color theme.
|
||||
ColorTheme color_theme = 3;
|
||||
string color_theme = 3;
|
||||
}
|
||||
|
||||
message GetUserSettingRequest {
|
||||
|
@ -99,9 +99,6 @@
|
||||
- [UpdateUserSettingResponse](#slash-api-v1-UpdateUserSettingResponse)
|
||||
- [UserSetting](#slash-api-v1-UserSetting)
|
||||
|
||||
- [UserSetting.ColorTheme](#slash-api-v1-UserSetting-ColorTheme)
|
||||
- [UserSetting.Locale](#slash-api-v1-UserSetting-Locale)
|
||||
|
||||
- [UserSettingService](#slash-api-v1-UserSettingService)
|
||||
|
||||
- [api/v1/workspace_service.proto](#api_v1_workspace_service-proto)
|
||||
@ -1326,8 +1323,8 @@
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [int32](#int32) | | id is the user id. |
|
||||
| locale | [UserSetting.Locale](#slash-api-v1-UserSetting-Locale) | | locale is the user locale. |
|
||||
| color_theme | [UserSetting.ColorTheme](#slash-api-v1-UserSetting-ColorTheme) | | color_theme is the user color theme. |
|
||||
| locale | [string](#string) | | locale is the user locale. |
|
||||
| color_theme | [string](#string) | | color_theme is the user color theme. |
|
||||
|
||||
|
||||
|
||||
@ -1336,35 +1333,6 @@
|
||||
|
||||
|
||||
|
||||
<a name="slash-api-v1-UserSetting-ColorTheme"></a>
|
||||
|
||||
### UserSetting.ColorTheme
|
||||
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| COLOR_THEME_UNSPECIFIED | 0 | |
|
||||
| COLOR_THEME_SYSTEM | 1 | |
|
||||
| COLOR_THEME_LIGHT | 2 | |
|
||||
| COLOR_THEME_DARK | 3 | |
|
||||
|
||||
|
||||
|
||||
<a name="slash-api-v1-UserSetting-Locale"></a>
|
||||
|
||||
### UserSetting.Locale
|
||||
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| LOCALE_UNSPECIFIED | 0 | |
|
||||
| LOCALE_EN | 1 | |
|
||||
| LOCALE_ZH | 2 | |
|
||||
| LOCALE_FR | 3 | |
|
||||
| LOCALE_JA | 4 | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -22,113 +22,6 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type UserSetting_Locale int32
|
||||
|
||||
const (
|
||||
UserSetting_LOCALE_UNSPECIFIED UserSetting_Locale = 0
|
||||
UserSetting_LOCALE_EN UserSetting_Locale = 1
|
||||
UserSetting_LOCALE_ZH UserSetting_Locale = 2
|
||||
UserSetting_LOCALE_FR UserSetting_Locale = 3
|
||||
UserSetting_LOCALE_JA UserSetting_Locale = 4
|
||||
)
|
||||
|
||||
// Enum value maps for UserSetting_Locale.
|
||||
var (
|
||||
UserSetting_Locale_name = map[int32]string{
|
||||
0: "LOCALE_UNSPECIFIED",
|
||||
1: "LOCALE_EN",
|
||||
2: "LOCALE_ZH",
|
||||
3: "LOCALE_FR",
|
||||
4: "LOCALE_JA",
|
||||
}
|
||||
UserSetting_Locale_value = map[string]int32{
|
||||
"LOCALE_UNSPECIFIED": 0,
|
||||
"LOCALE_EN": 1,
|
||||
"LOCALE_ZH": 2,
|
||||
"LOCALE_FR": 3,
|
||||
"LOCALE_JA": 4,
|
||||
}
|
||||
)
|
||||
|
||||
func (x UserSetting_Locale) Enum() *UserSetting_Locale {
|
||||
p := new(UserSetting_Locale)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x UserSetting_Locale) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (UserSetting_Locale) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_v1_user_setting_service_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (UserSetting_Locale) Type() protoreflect.EnumType {
|
||||
return &file_api_v1_user_setting_service_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x UserSetting_Locale) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserSetting_Locale.Descriptor instead.
|
||||
func (UserSetting_Locale) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_v1_user_setting_service_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
type UserSetting_ColorTheme int32
|
||||
|
||||
const (
|
||||
UserSetting_COLOR_THEME_UNSPECIFIED UserSetting_ColorTheme = 0
|
||||
UserSetting_COLOR_THEME_SYSTEM UserSetting_ColorTheme = 1
|
||||
UserSetting_COLOR_THEME_LIGHT UserSetting_ColorTheme = 2
|
||||
UserSetting_COLOR_THEME_DARK UserSetting_ColorTheme = 3
|
||||
)
|
||||
|
||||
// Enum value maps for UserSetting_ColorTheme.
|
||||
var (
|
||||
UserSetting_ColorTheme_name = map[int32]string{
|
||||
0: "COLOR_THEME_UNSPECIFIED",
|
||||
1: "COLOR_THEME_SYSTEM",
|
||||
2: "COLOR_THEME_LIGHT",
|
||||
3: "COLOR_THEME_DARK",
|
||||
}
|
||||
UserSetting_ColorTheme_value = map[string]int32{
|
||||
"COLOR_THEME_UNSPECIFIED": 0,
|
||||
"COLOR_THEME_SYSTEM": 1,
|
||||
"COLOR_THEME_LIGHT": 2,
|
||||
"COLOR_THEME_DARK": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x UserSetting_ColorTheme) Enum() *UserSetting_ColorTheme {
|
||||
p := new(UserSetting_ColorTheme)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x UserSetting_ColorTheme) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (UserSetting_ColorTheme) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_v1_user_setting_service_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (UserSetting_ColorTheme) Type() protoreflect.EnumType {
|
||||
return &file_api_v1_user_setting_service_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x UserSetting_ColorTheme) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserSetting_ColorTheme.Descriptor instead.
|
||||
func (UserSetting_ColorTheme) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_v1_user_setting_service_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
type UserSetting struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -137,9 +30,9 @@ type UserSetting struct {
|
||||
// id is the user id.
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// locale is the user locale.
|
||||
Locale UserSetting_Locale `protobuf:"varint,2,opt,name=locale,proto3,enum=slash.api.v1.UserSetting_Locale" json:"locale,omitempty"`
|
||||
Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"`
|
||||
// color_theme is the user color theme.
|
||||
ColorTheme UserSetting_ColorTheme `protobuf:"varint,3,opt,name=color_theme,json=colorTheme,proto3,enum=slash.api.v1.UserSetting_ColorTheme" json:"color_theme,omitempty"`
|
||||
ColorTheme string `protobuf:"bytes,3,opt,name=color_theme,json=colorTheme,proto3" json:"color_theme,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UserSetting) Reset() {
|
||||
@ -181,18 +74,18 @@ func (x *UserSetting) GetId() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UserSetting) GetLocale() UserSetting_Locale {
|
||||
func (x *UserSetting) GetLocale() string {
|
||||
if x != nil {
|
||||
return x.Locale
|
||||
}
|
||||
return UserSetting_LOCALE_UNSPECIFIED
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserSetting) GetColorTheme() UserSetting_ColorTheme {
|
||||
func (x *UserSetting) GetColorTheme() string {
|
||||
if x != nil {
|
||||
return x.ColorTheme
|
||||
}
|
||||
return UserSetting_COLOR_THEME_UNSPECIFIED
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetUserSettingRequest struct {
|
||||
@ -414,88 +307,70 @@ 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,
|
||||
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,
|
||||
0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xec, 0x02, 0x0a, 0x0b, 0x55,
|
||||
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,
|
||||
0x63, 0x61, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x73, 0x6c, 0x61,
|
||||
0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65,
|
||||
0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x52, 0x06, 0x6c, 0x6f,
|
||||
0x63, 0x61, 0x6c, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x74, 0x68,
|
||||
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,
|
||||
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, 0x5c, 0x0a, 0x06, 0x4c,
|
||||
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,
|
||||
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, 0x12, 0x0d, 0x0a, 0x09, 0x4c,
|
||||
0x4f, 0x43, 0x41, 0x4c, 0x45, 0x5f, 0x46, 0x52, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x4c, 0x4f,
|
||||
0x43, 0x41, 0x4c, 0x45, 0x5f, 0x4a, 0x41, 0x10, 0x04, 0x22, 0x6e, 0x0a, 0x0a, 0x43, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x4f, 0x4c, 0x4f, 0x52,
|
||||
0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
|
||||
0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48,
|
||||
0x45, 0x4d, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11,
|
||||
0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x5f, 0x4c, 0x49, 0x47, 0x48,
|
||||
0x54, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45,
|
||||
0x4d, 0x45, 0x5f, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x22, 0x27, 0x0a, 0x15, 0x47, 0x65, 0x74,
|
||||
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
|
||||
0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x0c,
|
||||
0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75,
|
||||
0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0xa5, 0x01, 0x0a, 0x18, 0x55,
|
||||
0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x56, 0x0a, 0x0b, 0x55, 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, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
|
||||
0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x74, 0x68, 0x65, 0x6d, 0x65,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65,
|
||||
0x6d, 0x65, 0x22, 0x27, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x56, 0x0a, 0x16, 0x47,
|
||||
0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65,
|
||||
0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c,
|
||||
0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53,
|
||||
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74,
|
||||
0x69, 0x6e, 0x67, 0x22, 0xa5, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73,
|
||||
0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64,
|
||||
0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
|
||||
0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b,
|
||||
0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52,
|
||||
0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x59, 0x0a, 0x19, 0x55,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||
0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
||||
0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65,
|
||||
0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65,
|
||||
0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,
|
||||
0x6d, 0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61,
|
||||
0x73, 0x6b, 0x22, 0x59, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72,
|
||||
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd1, 0x02,
|
||||
0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x12, 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
||||
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65,
|
||||
0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73,
|
||||
0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55,
|
||||
0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x28, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12,
|
||||
0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b,
|
||||
0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x01, 0x0a,
|
||||
0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69,
|
||||
0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74,
|
||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x61,
|
||||
0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x18, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b,
|
||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73,
|
||||
0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x73, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74,
|
||||
0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
|
||||
0x01, 0x5a, 0x36, 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, 0x61, 0x70, 0x69,
|
||||
0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa,
|
||||
0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02,
|
||||
0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18,
|
||||
0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68,
|
||||
0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x75, 0x73, 0x65, 0x72,
|
||||
0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73,
|
||||
0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x53,
|
||||
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd1, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53,
|
||||
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x85, 0x01,
|
||||
0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74,
|
||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0xda, 0x41, 0x02,
|
||||
0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0xb2, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
|
||||
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c,
|
||||
0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0xda, 0x41,
|
||||
0x18, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2b, 0x3a,
|
||||
0x0c, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x1b, 0x2f,
|
||||
0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64,
|
||||
0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, 0xb5, 0x01, 0x0a, 0x10, 0x63,
|
||||
0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42,
|
||||
0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 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, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69,
|
||||
0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68,
|
||||
0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c,
|
||||
0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41,
|
||||
0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a,
|
||||
0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -510,34 +385,29 @@ func file_api_v1_user_setting_service_proto_rawDescGZIP() []byte {
|
||||
return file_api_v1_user_setting_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_api_v1_user_setting_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_api_v1_user_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_api_v1_user_setting_service_proto_goTypes = []any{
|
||||
(UserSetting_Locale)(0), // 0: slash.api.v1.UserSetting.Locale
|
||||
(UserSetting_ColorTheme)(0), // 1: slash.api.v1.UserSetting.ColorTheme
|
||||
(*UserSetting)(nil), // 2: slash.api.v1.UserSetting
|
||||
(*GetUserSettingRequest)(nil), // 3: slash.api.v1.GetUserSettingRequest
|
||||
(*GetUserSettingResponse)(nil), // 4: slash.api.v1.GetUserSettingResponse
|
||||
(*UpdateUserSettingRequest)(nil), // 5: slash.api.v1.UpdateUserSettingRequest
|
||||
(*UpdateUserSettingResponse)(nil), // 6: slash.api.v1.UpdateUserSettingResponse
|
||||
(*fieldmaskpb.FieldMask)(nil), // 7: google.protobuf.FieldMask
|
||||
(*UserSetting)(nil), // 0: slash.api.v1.UserSetting
|
||||
(*GetUserSettingRequest)(nil), // 1: slash.api.v1.GetUserSettingRequest
|
||||
(*GetUserSettingResponse)(nil), // 2: slash.api.v1.GetUserSettingResponse
|
||||
(*UpdateUserSettingRequest)(nil), // 3: slash.api.v1.UpdateUserSettingRequest
|
||||
(*UpdateUserSettingResponse)(nil), // 4: slash.api.v1.UpdateUserSettingResponse
|
||||
(*fieldmaskpb.FieldMask)(nil), // 5: google.protobuf.FieldMask
|
||||
}
|
||||
var file_api_v1_user_setting_service_proto_depIdxs = []int32{
|
||||
0, // 0: slash.api.v1.UserSetting.locale:type_name -> slash.api.v1.UserSetting.Locale
|
||||
1, // 1: slash.api.v1.UserSetting.color_theme:type_name -> slash.api.v1.UserSetting.ColorTheme
|
||||
2, // 2: slash.api.v1.GetUserSettingResponse.user_setting:type_name -> slash.api.v1.UserSetting
|
||||
2, // 3: slash.api.v1.UpdateUserSettingRequest.user_setting:type_name -> slash.api.v1.UserSetting
|
||||
7, // 4: slash.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
|
||||
2, // 5: slash.api.v1.UpdateUserSettingResponse.user_setting:type_name -> slash.api.v1.UserSetting
|
||||
3, // 6: slash.api.v1.UserSettingService.GetUserSetting:input_type -> slash.api.v1.GetUserSettingRequest
|
||||
5, // 7: slash.api.v1.UserSettingService.UpdateUserSetting:input_type -> slash.api.v1.UpdateUserSettingRequest
|
||||
4, // 8: slash.api.v1.UserSettingService.GetUserSetting:output_type -> slash.api.v1.GetUserSettingResponse
|
||||
6, // 9: slash.api.v1.UserSettingService.UpdateUserSetting:output_type -> slash.api.v1.UpdateUserSettingResponse
|
||||
8, // [8:10] is the sub-list for method output_type
|
||||
6, // [6:8] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
0, // 0: slash.api.v1.GetUserSettingResponse.user_setting:type_name -> slash.api.v1.UserSetting
|
||||
0, // 1: slash.api.v1.UpdateUserSettingRequest.user_setting:type_name -> slash.api.v1.UserSetting
|
||||
5, // 2: slash.api.v1.UpdateUserSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
|
||||
0, // 3: slash.api.v1.UpdateUserSettingResponse.user_setting:type_name -> slash.api.v1.UserSetting
|
||||
1, // 4: slash.api.v1.UserSettingService.GetUserSetting:input_type -> slash.api.v1.GetUserSettingRequest
|
||||
3, // 5: slash.api.v1.UserSettingService.UpdateUserSetting:input_type -> slash.api.v1.UpdateUserSettingRequest
|
||||
2, // 6: slash.api.v1.UserSettingService.GetUserSetting:output_type -> slash.api.v1.GetUserSettingResponse
|
||||
4, // 7: slash.api.v1.UserSettingService.UpdateUserSetting:output_type -> slash.api.v1.UpdateUserSettingResponse
|
||||
6, // [6:8] is the sub-list for method output_type
|
||||
4, // [4:6] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_api_v1_user_setting_service_proto_init() }
|
||||
@ -612,14 +482,13 @@ func file_api_v1_user_setting_service_proto_init() {
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_api_v1_user_setting_service_proto_rawDesc,
|
||||
NumEnums: 2,
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_api_v1_user_setting_service_proto_goTypes,
|
||||
DependencyIndexes: file_api_v1_user_setting_service_proto_depIdxs,
|
||||
EnumInfos: file_api_v1_user_setting_service_proto_enumTypes,
|
||||
MessageInfos: file_api_v1_user_setting_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_api_v1_user_setting_service_proto = out.File
|
||||
|
@ -724,23 +724,6 @@ definitions:
|
||||
description: |-
|
||||
expires_at is the expiration time of the access token.
|
||||
If expires_at is not set, the access token will never expire.
|
||||
UserSettingColorTheme:
|
||||
type: string
|
||||
enum:
|
||||
- COLOR_THEME_UNSPECIFIED
|
||||
- COLOR_THEME_SYSTEM
|
||||
- COLOR_THEME_LIGHT
|
||||
- COLOR_THEME_DARK
|
||||
default: COLOR_THEME_UNSPECIFIED
|
||||
UserSettingLocale:
|
||||
type: string
|
||||
enum:
|
||||
- LOCALE_UNSPECIFIED
|
||||
- LOCALE_EN
|
||||
- LOCALE_ZH
|
||||
- LOCALE_FR
|
||||
- LOCALE_JA
|
||||
default: LOCALE_UNSPECIFIED
|
||||
apiv1AutoBackupWorkspaceSetting:
|
||||
type: object
|
||||
properties:
|
||||
@ -845,10 +828,10 @@ definitions:
|
||||
format: int32
|
||||
description: id is the user id.
|
||||
locale:
|
||||
$ref: '#/definitions/UserSettingLocale'
|
||||
type: string
|
||||
description: locale is the user locale.
|
||||
colorTheme:
|
||||
$ref: '#/definitions/UserSettingColorTheme'
|
||||
type: string
|
||||
description: color_theme is the user color theme.
|
||||
apiv1Visibility:
|
||||
type: string
|
||||
|
@ -23,8 +23,6 @@
|
||||
- [AccessTokensUserSetting.AccessToken](#slash-store-AccessTokensUserSetting-AccessToken)
|
||||
- [UserSetting](#slash-store-UserSetting)
|
||||
|
||||
- [ColorThemeUserSetting](#slash-store-ColorThemeUserSetting)
|
||||
- [LocaleUserSetting](#slash-store-LocaleUserSetting)
|
||||
- [UserSettingKey](#slash-store-UserSettingKey)
|
||||
|
||||
- [store/workspace_setting.proto](#store_workspace_setting-proto)
|
||||
@ -276,8 +274,8 @@
|
||||
| user_id | [int32](#int32) | | |
|
||||
| key | [UserSettingKey](#slash-store-UserSettingKey) | | |
|
||||
| access_tokens | [AccessTokensUserSetting](#slash-store-AccessTokensUserSetting) | | |
|
||||
| locale | [LocaleUserSetting](#slash-store-LocaleUserSetting) | | |
|
||||
| color_theme | [ColorThemeUserSetting](#slash-store-ColorThemeUserSetting) | | |
|
||||
| locale | [string](#string) | | |
|
||||
| color_theme | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
@ -286,35 +284,6 @@
|
||||
|
||||
|
||||
|
||||
<a name="slash-store-ColorThemeUserSetting"></a>
|
||||
|
||||
### ColorThemeUserSetting
|
||||
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| COLOR_THEME_USER_SETTING_UNSPECIFIED | 0 | |
|
||||
| SYSTEM | 1 | |
|
||||
| LIGHT | 2 | |
|
||||
| DARK | 3 | |
|
||||
|
||||
|
||||
|
||||
<a name="slash-store-LocaleUserSetting"></a>
|
||||
|
||||
### LocaleUserSetting
|
||||
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| LOCALE_USER_SETTING_UNSPECIFIED | 0 | |
|
||||
| EN | 1 | |
|
||||
| ZH | 2 | |
|
||||
| FR | 3 | |
|
||||
| JA | 4 | |
|
||||
|
||||
|
||||
|
||||
<a name="slash-store-UserSettingKey"></a>
|
||||
|
||||
### UserSettingKey
|
||||
|
@ -75,113 +75,6 @@ func (UserSettingKey) EnumDescriptor() ([]byte, []int) {
|
||||
return file_store_user_setting_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type LocaleUserSetting int32
|
||||
|
||||
const (
|
||||
LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED LocaleUserSetting = 0
|
||||
LocaleUserSetting_EN LocaleUserSetting = 1
|
||||
LocaleUserSetting_ZH LocaleUserSetting = 2
|
||||
LocaleUserSetting_FR LocaleUserSetting = 3
|
||||
LocaleUserSetting_JA LocaleUserSetting = 4
|
||||
)
|
||||
|
||||
// Enum value maps for LocaleUserSetting.
|
||||
var (
|
||||
LocaleUserSetting_name = map[int32]string{
|
||||
0: "LOCALE_USER_SETTING_UNSPECIFIED",
|
||||
1: "EN",
|
||||
2: "ZH",
|
||||
3: "FR",
|
||||
4: "JA",
|
||||
}
|
||||
LocaleUserSetting_value = map[string]int32{
|
||||
"LOCALE_USER_SETTING_UNSPECIFIED": 0,
|
||||
"EN": 1,
|
||||
"ZH": 2,
|
||||
"FR": 3,
|
||||
"JA": 4,
|
||||
}
|
||||
)
|
||||
|
||||
func (x LocaleUserSetting) Enum() *LocaleUserSetting {
|
||||
p := new(LocaleUserSetting)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x LocaleUserSetting) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (LocaleUserSetting) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_store_user_setting_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (LocaleUserSetting) Type() protoreflect.EnumType {
|
||||
return &file_store_user_setting_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x LocaleUserSetting) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LocaleUserSetting.Descriptor instead.
|
||||
func (LocaleUserSetting) EnumDescriptor() ([]byte, []int) {
|
||||
return file_store_user_setting_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
type ColorThemeUserSetting int32
|
||||
|
||||
const (
|
||||
ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED ColorThemeUserSetting = 0
|
||||
ColorThemeUserSetting_SYSTEM ColorThemeUserSetting = 1
|
||||
ColorThemeUserSetting_LIGHT ColorThemeUserSetting = 2
|
||||
ColorThemeUserSetting_DARK ColorThemeUserSetting = 3
|
||||
)
|
||||
|
||||
// Enum value maps for ColorThemeUserSetting.
|
||||
var (
|
||||
ColorThemeUserSetting_name = map[int32]string{
|
||||
0: "COLOR_THEME_USER_SETTING_UNSPECIFIED",
|
||||
1: "SYSTEM",
|
||||
2: "LIGHT",
|
||||
3: "DARK",
|
||||
}
|
||||
ColorThemeUserSetting_value = map[string]int32{
|
||||
"COLOR_THEME_USER_SETTING_UNSPECIFIED": 0,
|
||||
"SYSTEM": 1,
|
||||
"LIGHT": 2,
|
||||
"DARK": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ColorThemeUserSetting) Enum() *ColorThemeUserSetting {
|
||||
p := new(ColorThemeUserSetting)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ColorThemeUserSetting) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ColorThemeUserSetting) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_store_user_setting_proto_enumTypes[2].Descriptor()
|
||||
}
|
||||
|
||||
func (ColorThemeUserSetting) Type() protoreflect.EnumType {
|
||||
return &file_store_user_setting_proto_enumTypes[2]
|
||||
}
|
||||
|
||||
func (x ColorThemeUserSetting) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ColorThemeUserSetting.Descriptor instead.
|
||||
func (ColorThemeUserSetting) EnumDescriptor() ([]byte, []int) {
|
||||
return file_store_user_setting_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type UserSetting struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -257,18 +150,18 @@ func (x *UserSetting) GetAccessTokens() *AccessTokensUserSetting {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UserSetting) GetLocale() LocaleUserSetting {
|
||||
func (x *UserSetting) GetLocale() string {
|
||||
if x, ok := x.GetValue().(*UserSetting_Locale); ok {
|
||||
return x.Locale
|
||||
}
|
||||
return LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UserSetting) GetColorTheme() ColorThemeUserSetting {
|
||||
func (x *UserSetting) GetColorTheme() string {
|
||||
if x, ok := x.GetValue().(*UserSetting_ColorTheme); ok {
|
||||
return x.ColorTheme
|
||||
}
|
||||
return ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED
|
||||
return ""
|
||||
}
|
||||
|
||||
type isUserSetting_Value interface {
|
||||
@ -280,11 +173,11 @@ type UserSetting_AccessTokens struct {
|
||||
}
|
||||
|
||||
type UserSetting_Locale struct {
|
||||
Locale LocaleUserSetting `protobuf:"varint,4,opt,name=locale,proto3,enum=slash.store.LocaleUserSetting,oneof"`
|
||||
Locale string `protobuf:"bytes,4,opt,name=locale,proto3,oneof"`
|
||||
}
|
||||
|
||||
type UserSetting_ColorTheme struct {
|
||||
ColorTheme ColorThemeUserSetting `protobuf:"varint,5,opt,name=color_theme,json=colorTheme,proto3,enum=slash.store.ColorThemeUserSetting,oneof"`
|
||||
ColorTheme string `protobuf:"bytes,5,opt,name=color_theme,json=colorTheme,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*UserSetting_AccessTokens) isUserSetting_Value() {}
|
||||
@ -403,7 +296,7 @@ var File_store_user_setting_proto protoreflect.FileDescriptor
|
||||
var file_store_user_setting_proto_rawDesc = []byte{
|
||||
0x0a, 0x18, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x73, 0x6c, 0x61, 0x73,
|
||||
0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xac, 0x02, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72,
|
||||
0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xe8, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72,
|
||||
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
|
||||
0x12, 0x2d, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e,
|
||||
@ -413,57 +306,41 @@ var file_store_user_setting_proto_rawDesc = []byte{
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x0c,
|
||||
0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x38, 0x0a, 0x06,
|
||||
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x73,
|
||||
0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c,
|
||||
0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48, 0x00, 0x52, 0x06,
|
||||
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f,
|
||||
0x74, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x73, 0x6c,
|
||||
0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54,
|
||||
0x68, 0x65, 0x6d, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x48,
|
||||
0x00, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x42, 0x07, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x17, 0x41, 0x63, 0x63, 0x65, 0x73,
|
||||
0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69,
|
||||
0x6e, 0x67, 0x12, 0x55, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b,
|
||||
0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x73, 0x6c, 0x61, 0x73,
|
||||
0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f,
|
||||
0x6b, 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e,
|
||||
0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x1a, 0x52, 0x0a, 0x0b, 0x41, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65,
|
||||
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,
|
||||
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, 0x62, 0x0a,
|
||||
0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12,
|
||||
0x20, 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f,
|
||||
0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
|
||||
0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45,
|
||||
0x4e, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02,
|
||||
0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x10,
|
||||
0x03, 0x2a, 0x58, 0x0a, 0x11, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53,
|
||||
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x1f, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45,
|
||||
0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x55, 0x4e,
|
||||
0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x45,
|
||||
0x4e, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x5a, 0x48, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x46,
|
||||
0x52, 0x10, 0x03, 0x12, 0x06, 0x0a, 0x02, 0x4a, 0x41, 0x10, 0x04, 0x2a, 0x62, 0x0a, 0x15, 0x43,
|
||||
0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74,
|
||||
0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x0a, 0x24, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48,
|
||||
0x45, 0x4d, 0x45, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47,
|
||||
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0a,
|
||||
0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x49,
|
||||
0x47, 0x48, 0x54, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x52, 0x4b, 0x10, 0x03, 0x42,
|
||||
0xa1, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74,
|
||||
0x6f, 0x72, 0x65, 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
|
||||
0x50, 0x72, 0x6f, 0x74, 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,
|
||||
0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x06,
|
||||
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06,
|
||||
0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f,
|
||||
0x74, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x63,
|
||||
0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x68, 0x65, 0x6d, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x17, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b,
|
||||
0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x55,
|
||||
0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74,
|
||||
0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73,
|
||||
0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x1a, 0x52, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 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, 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, 0x62, 0x0a, 0x0e, 0x55, 0x73, 0x65,
|
||||
0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x1c, 0x55,
|
||||
0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f,
|
||||
0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a,
|
||||
0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x53, 0x10, 0x01,
|
||||
0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b,
|
||||
0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x54, 0x48, 0x45, 0x4d, 0x45, 0x10, 0x03, 0x42, 0xa1, 0x01,
|
||||
0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x65, 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72,
|
||||
0x6f, 0x74, 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 (
|
||||
@ -478,27 +355,23 @@ func file_store_user_setting_proto_rawDescGZIP() []byte {
|
||||
return file_store_user_setting_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_store_user_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
|
||||
var file_store_user_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_store_user_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_store_user_setting_proto_goTypes = []any{
|
||||
(UserSettingKey)(0), // 0: slash.store.UserSettingKey
|
||||
(LocaleUserSetting)(0), // 1: slash.store.LocaleUserSetting
|
||||
(ColorThemeUserSetting)(0), // 2: slash.store.ColorThemeUserSetting
|
||||
(*UserSetting)(nil), // 3: slash.store.UserSetting
|
||||
(*AccessTokensUserSetting)(nil), // 4: slash.store.AccessTokensUserSetting
|
||||
(*AccessTokensUserSetting_AccessToken)(nil), // 5: slash.store.AccessTokensUserSetting.AccessToken
|
||||
(*UserSetting)(nil), // 1: slash.store.UserSetting
|
||||
(*AccessTokensUserSetting)(nil), // 2: slash.store.AccessTokensUserSetting
|
||||
(*AccessTokensUserSetting_AccessToken)(nil), // 3: slash.store.AccessTokensUserSetting.AccessToken
|
||||
}
|
||||
var file_store_user_setting_proto_depIdxs = []int32{
|
||||
0, // 0: slash.store.UserSetting.key:type_name -> slash.store.UserSettingKey
|
||||
4, // 1: slash.store.UserSetting.access_tokens:type_name -> slash.store.AccessTokensUserSetting
|
||||
1, // 2: slash.store.UserSetting.locale:type_name -> slash.store.LocaleUserSetting
|
||||
2, // 3: slash.store.UserSetting.color_theme:type_name -> slash.store.ColorThemeUserSetting
|
||||
5, // 4: slash.store.AccessTokensUserSetting.access_tokens:type_name -> slash.store.AccessTokensUserSetting.AccessToken
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
2, // 1: slash.store.UserSetting.access_tokens:type_name -> slash.store.AccessTokensUserSetting
|
||||
3, // 2: slash.store.AccessTokensUserSetting.access_tokens:type_name -> slash.store.AccessTokensUserSetting.AccessToken
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_store_user_setting_proto_init() }
|
||||
@ -554,7 +427,7 @@ func file_store_user_setting_proto_init() {
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_store_user_setting_proto_rawDesc,
|
||||
NumEnums: 3,
|
||||
NumEnums: 1,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
|
@ -12,9 +12,9 @@ message UserSetting {
|
||||
oneof value {
|
||||
AccessTokensUserSetting access_tokens = 3;
|
||||
|
||||
LocaleUserSetting locale = 4;
|
||||
string locale = 4;
|
||||
|
||||
ColorThemeUserSetting color_theme = 5;
|
||||
string color_theme = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,18 +38,3 @@ message AccessTokensUserSetting {
|
||||
}
|
||||
repeated AccessToken access_tokens = 1;
|
||||
}
|
||||
|
||||
enum LocaleUserSetting {
|
||||
LOCALE_USER_SETTING_UNSPECIFIED = 0;
|
||||
EN = 1;
|
||||
ZH = 2;
|
||||
FR = 3;
|
||||
JA = 4;
|
||||
}
|
||||
|
||||
enum ColorThemeUserSetting {
|
||||
COLOR_THEME_USER_SETTING_UNSPECIFIED = 0;
|
||||
SYSTEM = 1;
|
||||
LIGHT = 2;
|
||||
DARK = 3;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda
|
||||
UserId: user.ID,
|
||||
Key: storepb.UserSettingKey_LOCALE,
|
||||
Value: &storepb.UserSetting_Locale{
|
||||
Locale: convertUserSettingLocaleToStore(request.UserSetting.Locale),
|
||||
Locale: request.UserSetting.Locale,
|
||||
},
|
||||
}); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to update user setting: %v", err)
|
||||
@ -47,7 +47,7 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda
|
||||
UserId: user.ID,
|
||||
Key: storepb.UserSettingKey_COLOR_THEME,
|
||||
Value: &storepb.UserSetting_ColorTheme{
|
||||
ColorTheme: convertUserSettingColorThemeToStore(request.UserSetting.ColorTheme),
|
||||
ColorTheme: request.UserSetting.ColorTheme,
|
||||
},
|
||||
}); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to update user setting: %v", err)
|
||||
@ -76,71 +76,15 @@ func getUserSetting(ctx context.Context, s *store.Store, userID int32) (*v1pb.Us
|
||||
|
||||
userSetting := &v1pb.UserSetting{
|
||||
Id: userID,
|
||||
Locale: v1pb.UserSetting_LOCALE_EN,
|
||||
ColorTheme: v1pb.UserSetting_COLOR_THEME_SYSTEM,
|
||||
Locale: "EN",
|
||||
ColorTheme: "SYSTEM",
|
||||
}
|
||||
for _, setting := range userSettings {
|
||||
if setting.Key == storepb.UserSettingKey_LOCALE {
|
||||
userSetting.Locale = convertUserSettingLocaleFromStore(setting.GetLocale())
|
||||
userSetting.Locale = setting.GetLocale()
|
||||
} else if setting.Key == storepb.UserSettingKey_COLOR_THEME {
|
||||
userSetting.ColorTheme = convertUserSettingColorThemeFromStore(setting.GetColorTheme())
|
||||
userSetting.ColorTheme = setting.GetColorTheme()
|
||||
}
|
||||
}
|
||||
return userSetting, nil
|
||||
}
|
||||
|
||||
func convertUserSettingLocaleToStore(locale v1pb.UserSetting_Locale) storepb.LocaleUserSetting {
|
||||
switch locale {
|
||||
case v1pb.UserSetting_LOCALE_EN:
|
||||
return storepb.LocaleUserSetting_EN
|
||||
case v1pb.UserSetting_LOCALE_ZH:
|
||||
return storepb.LocaleUserSetting_ZH
|
||||
case v1pb.UserSetting_LOCALE_FR:
|
||||
return storepb.LocaleUserSetting_FR
|
||||
case v1pb.UserSetting_LOCALE_JA:
|
||||
return storepb.LocaleUserSetting_JA
|
||||
default:
|
||||
return storepb.LocaleUserSetting_LOCALE_USER_SETTING_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
||||
func convertUserSettingLocaleFromStore(locale storepb.LocaleUserSetting) v1pb.UserSetting_Locale {
|
||||
switch locale {
|
||||
case storepb.LocaleUserSetting_EN:
|
||||
return v1pb.UserSetting_LOCALE_EN
|
||||
case storepb.LocaleUserSetting_ZH:
|
||||
return v1pb.UserSetting_LOCALE_ZH
|
||||
case storepb.LocaleUserSetting_FR:
|
||||
return v1pb.UserSetting_LOCALE_FR
|
||||
case storepb.LocaleUserSetting_JA:
|
||||
return v1pb.UserSetting_LOCALE_JA
|
||||
default:
|
||||
return v1pb.UserSetting_LOCALE_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
||||
func convertUserSettingColorThemeToStore(colorTheme v1pb.UserSetting_ColorTheme) storepb.ColorThemeUserSetting {
|
||||
switch colorTheme {
|
||||
case v1pb.UserSetting_COLOR_THEME_SYSTEM:
|
||||
return storepb.ColorThemeUserSetting_SYSTEM
|
||||
case v1pb.UserSetting_COLOR_THEME_LIGHT:
|
||||
return storepb.ColorThemeUserSetting_LIGHT
|
||||
case v1pb.UserSetting_COLOR_THEME_DARK:
|
||||
return storepb.ColorThemeUserSetting_DARK
|
||||
default:
|
||||
return storepb.ColorThemeUserSetting_COLOR_THEME_USER_SETTING_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
||||
func convertUserSettingColorThemeFromStore(colorTheme storepb.ColorThemeUserSetting) v1pb.UserSetting_ColorTheme {
|
||||
switch colorTheme {
|
||||
case storepb.ColorThemeUserSetting_SYSTEM:
|
||||
return v1pb.UserSetting_COLOR_THEME_SYSTEM
|
||||
case storepb.ColorThemeUserSetting_LIGHT:
|
||||
return v1pb.UserSetting_COLOR_THEME_LIGHT
|
||||
case storepb.ColorThemeUserSetting_DARK:
|
||||
return v1pb.UserSetting_COLOR_THEME_DARK
|
||||
default:
|
||||
return v1pb.UserSetting_COLOR_THEME_UNSPECIFIED
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ func (d *DB) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting)
|
||||
}
|
||||
valueString = string(valueBytes)
|
||||
} else if upsert.Key == storepb.UserSettingKey_LOCALE {
|
||||
valueString = upsert.GetLocale().String()
|
||||
valueString = upsert.GetLocale()
|
||||
} else if upsert.Key == storepb.UserSettingKey_COLOR_THEME {
|
||||
valueString = upsert.GetColorTheme().String()
|
||||
valueString = upsert.GetColorTheme()
|
||||
} else {
|
||||
return nil, errors.New("invalid user setting key")
|
||||
}
|
||||
@ -90,11 +90,11 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting)
|
||||
}
|
||||
} else if userSetting.Key == storepb.UserSettingKey_LOCALE {
|
||||
userSetting.Value = &storepb.UserSetting_Locale{
|
||||
Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]),
|
||||
Locale: valueString,
|
||||
}
|
||||
} else if userSetting.Key == storepb.UserSettingKey_COLOR_THEME {
|
||||
userSetting.Value = &storepb.UserSetting_ColorTheme{
|
||||
ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]),
|
||||
ColorTheme: valueString,
|
||||
}
|
||||
} else {
|
||||
// Skip unknown key.
|
||||
|
@ -29,9 +29,9 @@ func (d *DB) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting)
|
||||
}
|
||||
valueString = string(valueBytes)
|
||||
} else if upsert.Key == storepb.UserSettingKey_LOCALE {
|
||||
valueString = upsert.GetLocale().String()
|
||||
valueString = upsert.GetLocale()
|
||||
} else if upsert.Key == storepb.UserSettingKey_COLOR_THEME {
|
||||
valueString = upsert.GetColorTheme().String()
|
||||
valueString = upsert.GetColorTheme()
|
||||
} else {
|
||||
return nil, errors.New("invalid user setting key")
|
||||
}
|
||||
@ -89,11 +89,11 @@ func (d *DB) ListUserSettings(ctx context.Context, find *store.FindUserSetting)
|
||||
}
|
||||
} else if userSetting.Key == storepb.UserSettingKey_LOCALE {
|
||||
userSetting.Value = &storepb.UserSetting_Locale{
|
||||
Locale: storepb.LocaleUserSetting(storepb.LocaleUserSetting_value[valueString]),
|
||||
Locale: valueString,
|
||||
}
|
||||
} else if userSetting.Key == storepb.UserSettingKey_COLOR_THEME {
|
||||
userSetting.Value = &storepb.UserSetting_ColorTheme{
|
||||
ColorTheme: storepb.ColorThemeUserSetting(storepb.ColorThemeUserSetting_value[valueString]),
|
||||
ColorTheme: valueString,
|
||||
}
|
||||
} else {
|
||||
// Skip unknown key.
|
||||
|
@ -79,42 +79,42 @@ func TestUserSettingStore(t *testing.T) {
|
||||
UserId: user.ID,
|
||||
Key: storepb.UserSettingKey_LOCALE,
|
||||
Value: &storepb.UserSetting_Locale{
|
||||
Locale: storepb.LocaleUserSetting_ZH,
|
||||
Locale: "ZH",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, localeUserSetting)
|
||||
require.Equal(t, storepb.UserSettingKey_LOCALE, localeUserSetting.Key)
|
||||
require.Equal(t, storepb.LocaleUserSetting_ZH, localeUserSetting.GetLocale())
|
||||
require.Equal(t, "ZH", localeUserSetting.GetLocale())
|
||||
localeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{
|
||||
UserId: user.ID,
|
||||
Key: storepb.UserSettingKey_LOCALE,
|
||||
Value: &storepb.UserSetting_Locale{
|
||||
Locale: storepb.LocaleUserSetting_EN,
|
||||
Locale: "EN",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, storepb.LocaleUserSetting_EN, localeUserSetting.GetLocale())
|
||||
require.Equal(t, "EN", localeUserSetting.GetLocale())
|
||||
|
||||
// Test for color theme user setting.
|
||||
colorThemeUserSetting, err := ts.UpsertUserSetting(ctx, &storepb.UserSetting{
|
||||
UserId: user.ID,
|
||||
Key: storepb.UserSettingKey_COLOR_THEME,
|
||||
Value: &storepb.UserSetting_ColorTheme{
|
||||
ColorTheme: storepb.ColorThemeUserSetting_LIGHT,
|
||||
ColorTheme: "LIGHT",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, colorThemeUserSetting)
|
||||
require.Equal(t, storepb.UserSettingKey_COLOR_THEME, colorThemeUserSetting.Key)
|
||||
require.Equal(t, storepb.ColorThemeUserSetting_LIGHT, colorThemeUserSetting.GetColorTheme())
|
||||
require.Equal(t, "LIGHT", colorThemeUserSetting.GetColorTheme())
|
||||
colorThemeUserSetting, err = ts.UpsertUserSetting(ctx, &storepb.UserSetting{
|
||||
UserId: user.ID,
|
||||
Key: storepb.UserSettingKey_COLOR_THEME,
|
||||
Value: &storepb.UserSetting_ColorTheme{
|
||||
ColorTheme: storepb.ColorThemeUserSetting_DARK,
|
||||
ColorTheme: "DARK",
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, storepb.ColorThemeUserSetting_DARK, colorThemeUserSetting.GetColorTheme())
|
||||
require.Equal(t, "DARK", colorThemeUserSetting.GetColorTheme())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user