Compare commits

..

No commits in common. "2e7c07e6f4d576c63e00eb5c3dbb340d1ea6078d" and "dc14480519e588834be551f494f7a1b4f4a2c6c5" have entirely different histories.

11 changed files with 41 additions and 33 deletions

View File

@ -84,7 +84,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, userdataStore
if err != nil {
return nil, err
}
rs.AddLocalFunc("set_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("select_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("create_account", ussdHandlers.CreateAccount)
rs.AddLocalFunc("save_pin", ussdHandlers.SavePin)
rs.AddLocalFunc("verify_pin", ussdHandlers.VerifyPin)
@ -116,10 +116,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, userdataStore
rs.AddLocalFunc("reset_incorrect_date_format", ussdHandlers.ResetIncorrectYob)
rs.AddLocalFunc("set_reset_single_edit", ussdHandlers.SetResetSingleEdit)
rs.AddLocalFunc("initiate_transaction", ussdHandlers.InitiateTransaction)
rs.AddLocalFunc("save_temporary_pin", ussdHandlers.SaveTemporaryPin)
rs.AddLocalFunc("verify_new_pin", ussdHandlers.VerifyNewPin)
rs.AddLocalFunc("confirm_pin_change", ussdHandlers.ConfirmPinChange)
rs.AddLocalFunc("quit_with_help",ussdHandlers.QuitWithHelp)
rs.AddLocalFunc("set_new_language", ussdHandlers.SetNewLanguage)
return ussdHandlers, nil
}

View File

@ -54,7 +54,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, userdataStore
if err != nil {
return nil, err
}
rs.AddLocalFunc("set_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("select_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("create_account", ussdHandlers.CreateAccount)
rs.AddLocalFunc("save_pin", ussdHandlers.SavePin)
rs.AddLocalFunc("verify_pin", ussdHandlers.VerifyPin)
@ -86,10 +86,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, userdataStore
rs.AddLocalFunc("reset_incorrect_date_format", ussdHandlers.ResetIncorrectYob)
rs.AddLocalFunc("set_reset_single_edit", ussdHandlers.SetResetSingleEdit)
rs.AddLocalFunc("initiate_transaction", ussdHandlers.InitiateTransaction)
rs.AddLocalFunc("save_temporary_pin", ussdHandlers.SaveTemporaryPin)
rs.AddLocalFunc("verify_new_pin", ussdHandlers.VerifyNewPin)
rs.AddLocalFunc("confirm_pin_change", ussdHandlers.ConfirmPinChange)
rs.AddLocalFunc("quit_with_help",ussdHandlers.QuitWithHelp)
rs.AddLocalFunc("set_new_language", ussdHandlers.SetNewLanguage)
return ussdHandlers, nil
}

View File

@ -44,7 +44,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, userdataStore
if err != nil {
return nil, err
}
rs.AddLocalFunc("set_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("select_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("create_account", ussdHandlers.CreateAccount)
rs.AddLocalFunc("save_pin", ussdHandlers.SavePin)
rs.AddLocalFunc("verify_pin", ussdHandlers.VerifyPin)
@ -76,10 +76,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, userdataStore
rs.AddLocalFunc("reset_incorrect_date_format", ussdHandlers.ResetIncorrectYob)
rs.AddLocalFunc("set_reset_single_edit", ussdHandlers.SetResetSingleEdit)
rs.AddLocalFunc("initiate_transaction", ussdHandlers.InitiateTransaction)
rs.AddLocalFunc("save_temporary_pin", ussdHandlers.SaveTemporaryPin)
rs.AddLocalFunc("verify_new_pin", ussdHandlers.VerifyNewPin)
rs.AddLocalFunc("confirm_pin_change", ussdHandlers.ConfirmPinChange)
rs.AddLocalFunc("quit_with_help",ussdHandlers.QuitWithHelp)
rs.AddLocalFunc("set_new_language", ussdHandlers.SetNewLanguage)
return ussdHandlers, nil
}

View File

@ -39,7 +39,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, pe *persist.P
return nil, err
}
ussdHandlers = ussdHandlers.WithPersister(pe)
rs.AddLocalFunc("set_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("select_language", ussdHandlers.SetLanguage)
rs.AddLocalFunc("create_account", ussdHandlers.CreateAccount)
rs.AddLocalFunc("save_pin", ussdHandlers.SavePin)
rs.AddLocalFunc("verify_pin", ussdHandlers.VerifyPin)
@ -75,6 +75,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, pe *persist.P
rs.AddLocalFunc("verify_new_pin", ussdHandlers.VerifyNewPin)
rs.AddLocalFunc("confirm_pin_change", ussdHandlers.ConfirmPinChange)
rs.AddLocalFunc("quit_with_help",ussdHandlers.QuitWithHelp)
rs.AddLocalFunc("set_new_language", ussdHandlers.SetNewLanguage)
return ussdHandlers, nil
}

View File

@ -121,15 +121,15 @@ func (h *Handlers) Init(ctx context.Context, sym string, input []byte) (resource
// SetLanguage sets the language across the menu
func (h *Handlers) SetLanguage(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
var err error
sym, _ = h.st.Where()
switch sym {
case "set_default":
res.FlagSet = append(res.FlagSet, state.FLAG_LANG)
inputStr := string(input)
switch inputStr {
case "0":
res.FlagSet = []uint32{state.FLAG_LANG}
res.Content = "eng"
case "set_swa":
res.FlagSet = append(res.FlagSet, state.FLAG_LANG)
case "1":
res.FlagSet = []uint32{state.FLAG_LANG}
res.Content = "swa"
default:
}
@ -1045,3 +1045,22 @@ func (h *Handlers) GetProfileInfo(ctx context.Context, sym string, input []byte)
return res, nil
}
// SetNewLanguage sets the new language based on user input
func (h *Handlers) SetNewLanguage(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
inputStr := string(input)
switch inputStr {
case "0":
res.FlagSet = append(res.FlagSet, state.FLAG_LANG)
res.Content = "eng"
case "1":
res.FlagSet = append(res.FlagSet, state.FLAG_LANG)
res.Content = "swa"
default:
}
return res, nil
}

View File

@ -5,6 +5,6 @@ CATCH pin_entry flag_account_authorized 0
MOUT english 0
MOUT kiswahili 1
HALT
INCMP set_default 0
INCMP set_swa 1
INCMP language_changed 0
INCMP language_changed 1
INCMP . *

View File

@ -1,3 +1,4 @@
LOAD set_new_language 6
MOUT back 0
MOUT quit 9
HALT

View File

@ -1,6 +1,6 @@
MOUT english 0
MOUT kiswahili 1
HALT
INCMP set_default 0
INCMP set_swa 1
INCMP terms 0
INCMP terms 1
INCMP . *

View File

@ -1,3 +0,0 @@
LOAD set_language 6
CATCH terms flag_account_created 0
MOVE language_changed

View File

@ -1,3 +0,0 @@
LOAD set_language 6
CATCH terms flag_account_created 0
MOVE language_changed

View File

@ -1,3 +1,5 @@
LOAD select_language 0
RELOAD select_language
MOUT yes 0
MOUT no 1
HALT