wip-account-creation #4
19
cmd/main.go
19
cmd/main.go
@ -14,6 +14,7 @@ import (
|
|||||||
|
|
||||||
"git.defalsify.org/vise.git/cache"
|
"git.defalsify.org/vise.git/cache"
|
||||||
"git.defalsify.org/vise.git/engine"
|
"git.defalsify.org/vise.git/engine"
|
||||||
|
"git.defalsify.org/vise.git/lang"
|
||||||
"git.defalsify.org/vise.git/persist"
|
"git.defalsify.org/vise.git/persist"
|
||||||
"git.defalsify.org/vise.git/resource"
|
"git.defalsify.org/vise.git/resource"
|
||||||
"git.defalsify.org/vise.git/state"
|
"git.defalsify.org/vise.git/state"
|
||||||
@ -76,6 +77,16 @@ type fsData struct {
|
|||||||
st *state.State
|
st *state.State
|
||||||
Alfred-mk marked this conversation as resolved
Outdated
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
func codeFromCtx(ctx context.Context) string {
|
||||||
|
var code string
|
||||||
|
engine.Logg.DebugCtxf(ctx, "in msg", "ctx", ctx, "val", code)
|
||||||
|
if ctx.Value("Language") != nil {
|
||||||
|
lang := ctx.Value("Language").(lang.Language)
|
||||||
|
code = lang.Code
|
||||||
|
}
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
|
||||||
func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
inputStr := string(input)
|
inputStr := string(input)
|
||||||
res := resource.Result{}
|
res := resource.Result{}
|
||||||
@ -269,8 +280,12 @@ func checkAccountStatus(trackingId string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lash
commented
this shouldnt switch on the input string; that requires manual syncing between here and the menu code. how about using INCMP and the language switches on the sym instead? Have a look at the this shouldnt switch on the input string; that requires manual syncing between here and the menu code.
how about using INCMP and the language switches on the sym instead?
Have a look at the `lash/reuse-example` go-vise branch, I've added an example that might illustrate.
lash
commented
priority **priority**
lash
commented
I see this still isn't resolved. I will make an issue of this, and mark it priority. We will handle it after merge. I see this still isn't resolved.
I will make an issue of this, and mark it priority. We will handle it after merge.
|
|||||||
func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
res := resource.Result{
|
res := resource.Result{}
|
||||||
Content: "Your account is being created",
|
switch codeFromCtx(ctx) {
|
||||||
|
case "swa":
|
||||||
|
res.Content = "Asante kwa kutumia huduma ya Sarafu. Kwaheri!"
|
||||||
|
default:
|
||||||
Alfred-mk marked this conversation as resolved
Outdated
lash
commented
should error? should error?
lash
commented
priority **priority**
Alfred-mk
commented
The switch only takes in two options, 0 or 1. The switch only takes in two options, 0 or 1.
The menu remains on the select language node if an alternative input is provided
|
|||||||
|
res.Content = "Thank you for using Sarafu. Goodbye!"
|
||||||
}
|
}
|
||||||
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
|
||||||
return res, nil
|
return res, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user
can this (and all its methods) be moved to a separate package please?