add quit with helpline info

This commit is contained in:
Carlosokumu 2024-09-14 20:52:17 +03:00
parent b5d33a98f0
commit 28fa2947cc
Signed by: carlos
GPG Key ID: 7BD6BC8160A5C953
4 changed files with 20 additions and 1 deletions

View File

@ -71,6 +71,7 @@ func getHandler(appFlags *asm.FlagParser, rs *resource.DbResource, pe *persist.P
rs.AddLocalFunc("reset_incorrect_date_format", ussdHandlers.ResetIncorrectYob)
rs.AddLocalFunc("set_reset_single_edit", ussdHandlers.SetResetSingleEdit)
rs.AddLocalFunc("initiate_transaction", ussdHandlers.InitiateTransaction)
rs.AddLocalFunc("quit_with_help",ussdHandlers.QuitWithHelp)
return ussdHandlers, nil
}

View File

@ -569,6 +569,22 @@ func (h *Handlers) Quit(ctx context.Context, sym string, input []byte) (resource
return res, nil
}
// QuitWithHelp displays helpline information then exits the menu
func (h *Handlers) QuitWithHelp(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result
flag_account_authorized, _ := h.flagManager.GetFlag("flag_account_authorized")
code := codeFromCtx(ctx)
l := gotext.NewLocale(translationDir, code)
l.AddDomain("default")
res.Content = l.Get("For more help,please call: 0757628885")
res.FlagReset = append(res.FlagReset, flag_account_authorized)
return res, nil
}
// VerifyYob verifies the length of the given input
func (h *Handlers) VerifyYob(ctx context.Context, sym string, input []byte) (resource.Result, error) {
var res resource.Result

View File

@ -0,0 +1,2 @@
LOAD quit_with_help 0
HALT

View File

@ -10,6 +10,6 @@ HALT
INCMP send 1
INCMP quit 2
INCMP my_account 3
INCMP quit 4
INCMP help 4
INCMP quit 9
INCMP . *