Compare commits
No commits in common. "b54f3f32b5f4aeabb65933b5bc84142cea674721" and "ffd091c9a98cca3ce447e7f75c4ef7aeb30d4328" have entirely different histories.
b54f3f32b5
...
ffd091c9a9
@ -117,8 +117,8 @@ func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource
|
|||||||
func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
|
|
||||||
symbol, _ := h.st.Where()
|
sym, _ = h.st.Where()
|
||||||
code := strings.Split(symbol, "_")[1]
|
code := strings.Split(sym, "_")[1]
|
||||||
|
|
||||||
if !utils.IsValidISO639(code) {
|
if !utils.IsValidISO639(code) {
|
||||||
return res, nil
|
return res, nil
|
||||||
@ -279,8 +279,26 @@ func (h *Handlers) ConfirmPinChange(ctx context.Context, sym string, input []byt
|
|||||||
// SetResetSingleEdit sets and resets flags to allow gradual editing of profile information.
|
// SetResetSingleEdit sets and resets flags to allow gradual editing of profile information.
|
||||||
func (h *Handlers) SetResetSingleEdit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *Handlers) SetResetSingleEdit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
|
|
||||||
|
menuOption := string(input)
|
||||||
|
|
||||||
|
flag_allow_update, _ := h.flagManager.GetFlag("flag_allow_update")
|
||||||
flag_single_edit, _ := h.flagManager.GetFlag("flag_single_edit")
|
flag_single_edit, _ := h.flagManager.GetFlag("flag_single_edit")
|
||||||
res.FlagReset = append(res.FlagReset, flag_single_edit)
|
|
||||||
|
switch menuOption {
|
||||||
|
case "2":
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_allow_update)
|
||||||
|
res.FlagSet = append(res.FlagSet, flag_single_edit)
|
||||||
|
case "3":
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_allow_update)
|
||||||
|
res.FlagSet = append(res.FlagSet, flag_single_edit)
|
||||||
|
case "4":
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_allow_update)
|
||||||
|
res.FlagSet = append(res.FlagSet, flag_single_edit)
|
||||||
|
default:
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_single_edit)
|
||||||
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +374,7 @@ func (h *Handlers) SaveFamilyname(ctx context.Context, sym string, input []byte)
|
|||||||
if !ok {
|
if !ok {
|
||||||
return res, fmt.Errorf("missing session")
|
return res, fmt.Errorf("missing session")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(input) > 0 {
|
if len(input) > 0 {
|
||||||
familyName := string(input)
|
familyName := string(input)
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
@ -378,15 +397,7 @@ func (h *Handlers) SaveYob(ctx context.Context, sym string, input []byte) (resou
|
|||||||
if !ok {
|
if !ok {
|
||||||
return res, fmt.Errorf("missing session")
|
return res, fmt.Errorf("missing session")
|
||||||
}
|
}
|
||||||
flag_allow_update, _ := h.flagManager.GetFlag("flag_allow_update")
|
|
||||||
flag_single_edit, _ := h.flagManager.GetFlag("flag_single_edit")
|
|
||||||
execPath := utils.GetSingleEditExecutionPath("save_yob")
|
|
||||||
isSingleEdit := utils.MatchNavigationPath(execPath, h.st.ExecPath)
|
|
||||||
|
|
||||||
if isSingleEdit {
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_allow_update)
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_single_edit)
|
|
||||||
}
|
|
||||||
if len(input) == 4 {
|
if len(input) == 4 {
|
||||||
yob := string(input)
|
yob := string(input)
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
@ -408,16 +419,6 @@ func (h *Handlers) SaveLocation(ctx context.Context, sym string, input []byte) (
|
|||||||
return res, fmt.Errorf("missing session")
|
return res, fmt.Errorf("missing session")
|
||||||
}
|
}
|
||||||
|
|
||||||
flag_allow_update, _ := h.flagManager.GetFlag("flag_allow_update")
|
|
||||||
flag_single_edit, _ := h.flagManager.GetFlag("flag_single_edit")
|
|
||||||
execPath := utils.GetSingleEditExecutionPath("save_location")
|
|
||||||
isSingleEdit := utils.MatchNavigationPath(execPath, h.st.ExecPath)
|
|
||||||
|
|
||||||
if isSingleEdit {
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_allow_update)
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_single_edit)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(input) > 0 {
|
if len(input) > 0 {
|
||||||
location := string(input)
|
location := string(input)
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
@ -438,15 +439,6 @@ func (h *Handlers) SaveGender(ctx context.Context, sym string, input []byte) (re
|
|||||||
if !ok {
|
if !ok {
|
||||||
return res, fmt.Errorf("missing session")
|
return res, fmt.Errorf("missing session")
|
||||||
}
|
}
|
||||||
flag_allow_update, _ := h.flagManager.GetFlag("flag_allow_update")
|
|
||||||
flag_single_edit, _ := h.flagManager.GetFlag("flag_single_edit")
|
|
||||||
execPath := utils.GetSingleEditExecutionPath("select_gender")
|
|
||||||
isSingleEdit := utils.MatchNavigationPath(execPath, h.st.ExecPath)
|
|
||||||
if isSingleEdit {
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_allow_update)
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_single_edit)
|
|
||||||
}
|
|
||||||
|
|
||||||
code := codeFromCtx(ctx)
|
code := codeFromCtx(ctx)
|
||||||
if len(input) > 0 {
|
if len(input) > 0 {
|
||||||
gender := string(input)
|
gender := string(input)
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
func MatchNavigationPath(a, b []string) bool {
|
|
||||||
|
|
||||||
if len(a) != len(b) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
//Check if the navigation path matches with single edit
|
|
||||||
for i := range a {
|
|
||||||
if a[i] != b[i] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetSingleEditExecutionPath(key string) []string {
|
|
||||||
paths := make(map[string][]string)
|
|
||||||
paths["select_gender"] = []string{"root", "main", "my_account", "edit_profile", "select_gender"}
|
|
||||||
paths["save_location"] = []string{"root", "main", "my_account", "edit_profile", "enter_location"}
|
|
||||||
paths["save_yob"] = []string{"root", "main", "my_account", "edit_profile", "enter_yob"}
|
|
||||||
return paths[key]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user