add the replaceSeparator func and pass it to the Handler struct

This commit is contained in:
Alfred Kamanda 2024-12-18 21:56:37 +03:00
parent 17ba6a06ba
commit d08afff443
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703

View File

@ -2,6 +2,7 @@ package handlers
import ( import (
"context" "context"
"strings"
"git.defalsify.org/vise.git/asm" "git.defalsify.org/vise.git/asm"
"git.defalsify.org/vise.git/db" "git.defalsify.org/vise.git/db"
@ -64,7 +65,11 @@ func (ls *LocalHandlerService) SetDataStore(db *db.Db) {
} }
func (ls *LocalHandlerService) GetHandler(accountService remote.AccountServiceInterface) (*ussd.Handlers, error) { func (ls *LocalHandlerService) GetHandler(accountService remote.AccountServiceInterface) (*ussd.Handlers, error) {
ussdHandlers, err := ussd.NewHandlers(ls.Parser, *ls.UserdataStore, ls.AdminStore, accountService) replaceSeparator := func(input string) string {
return strings.ReplaceAll(input, ":", ls.Cfg.MenuSeparator)
}
ussdHandlers, err := ussd.NewHandlers(ls.Parser, *ls.UserdataStore, ls.AdminStore, accountService, replaceSeparator)
if err != nil { if err != nil {
return nil, err return nil, err
} }