New alias flow #96
| @ -2703,38 +2703,6 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input | |||||||
| 	return res, nil | 	return res, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // ConfirmNewAlias  reads  the suggested alias from the [DATA_SUGGECTED_ALIAS] key and confirms it  as the new account alias.
 |  | ||||||
| func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) { |  | ||||||
| 	var res resource.Result |  | ||||||
| 	store := h.userdataStore |  | ||||||
| 	logdb := h.logDb |  | ||||||
| 
 |  | ||||||
| 	flag_alias_set, _ := h.flagManager.GetFlag("flag_alias_set") |  | ||||||
| 
 |  | ||||||
| 	sessionId, ok := ctx.Value("SessionId").(string) |  | ||||||
| 	if !ok { |  | ||||||
| 		return res, fmt.Errorf("missing session") |  | ||||||
| 	} |  | ||||||
| 	newAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS) |  | ||||||
| 	if err != nil { |  | ||||||
| 		return res, nil |  | ||||||
| 	} |  | ||||||
| 	logg.InfoCtxf(ctx, "Confirming new alias", "alias", string(newAlias)) |  | ||||||
| 	err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS, []byte(string(newAlias))) |  | ||||||
| 	if err != nil { |  | ||||||
| 		logg.ErrorCtxf(ctx, "failed to clear DATA_ACCOUNT_ALIAS_VALUE entry with", "key", storedb.DATA_ACCOUNT_ALIAS, "value", "empty", "error", err) |  | ||||||
| 		return res, err |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	err = logdb.WriteLogEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS, []byte(newAlias)) |  | ||||||
| 	if err != nil { |  | ||||||
| 		logg.DebugCtxf(ctx, "Failed to write account alias db log entry", "key", storedb.DATA_ACCOUNT_ALIAS, "value", newAlias) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	res.FlagSet = append(res.FlagSet, flag_alias_set) |  | ||||||
| 	return res, nil |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // ClearTemporaryValue empties the DATA_TEMPORARY_VALUE at the main menu to prevent
 | // ClearTemporaryValue empties the DATA_TEMPORARY_VALUE at the main menu to prevent
 | ||||||
| // previously stored data from being accessed
 | // previously stored data from being accessed
 | ||||||
| func (h *MenuHandlers) ClearTemporaryValue(ctx context.Context, sym string, input []byte) (resource.Result, error) { | func (h *MenuHandlers) ClearTemporaryValue(ctx context.Context, sym string, input []byte) (resource.Result, error) { | ||||||
|  | |||||||
| @ -131,7 +131,6 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService) | |||||||
| 	ls.DbRs.AddLocalFunc("reset_invalid_pin", appHandlers.ResetInvalidPIN) | 	ls.DbRs.AddLocalFunc("reset_invalid_pin", appHandlers.ResetInvalidPIN) | ||||||
| 	ls.DbRs.AddLocalFunc("request_custom_alias", appHandlers.RequestCustomAlias) | 	ls.DbRs.AddLocalFunc("request_custom_alias", appHandlers.RequestCustomAlias) | ||||||
| 	ls.DbRs.AddLocalFunc("get_suggested_alias", appHandlers.GetSuggestedAlias) | 	ls.DbRs.AddLocalFunc("get_suggested_alias", appHandlers.GetSuggestedAlias) | ||||||
| 	ls.DbRs.AddLocalFunc("confirm_new_alias", appHandlers.ConfirmNewAlias) |  | ||||||
| 	ls.DbRs.AddLocalFunc("check_account_created", appHandlers.CheckAccountCreated) | 	ls.DbRs.AddLocalFunc("check_account_created", appHandlers.CheckAccountCreated) | ||||||
| 	ls.DbRs.AddLocalFunc("reset_api_call_failure", appHandlers.ResetApiCallFailure) | 	ls.DbRs.AddLocalFunc("reset_api_call_failure", appHandlers.ResetApiCallFailure) | ||||||
| 	ls.DbRs.AddLocalFunc("swap_to_list", appHandlers.LoadSwapToList) | 	ls.DbRs.AddLocalFunc("swap_to_list", appHandlers.LoadSwapToList) | ||||||
|  | |||||||
| @ -1,5 +1,3 @@ | |||||||
| LOAD confirm_new_alias 0 |  | ||||||
| RELOAD confirm_new_alias |  | ||||||
| MOUT back 0 | MOUT back 0 | ||||||
| MOUT quit 9 | MOUT quit 9 | ||||||
| HALT | HALT | ||||||
|  | |||||||
| @ -1,2 +0,0 @@ | |||||||
| Your full alias will be: {{.get_suggested_alias}} |  | ||||||
| Please enter your PIN to confirm:  |  | ||||||
| @ -1,12 +0,0 @@ | |||||||
| LOAD reset_invalid_pin 6 |  | ||||||
| RELOAD reset_invalid_pin |  | ||||||
| LOAD get_suggested_alias 0 |  | ||||||
| RELOAD get_suggested_alias |  | ||||||
| MAP get_suggested_alias |  | ||||||
| MOUT back 0 |  | ||||||
| HALT |  | ||||||
| INCMP _ 0 |  | ||||||
| RELOAD authorize_account |  | ||||||
| CATCH incorrect_pin flag_incorrect_pin 1 |  | ||||||
| CATCH invalid_pin flag_invalid_pin 1 |  | ||||||
| CATCH update_alias flag_allow_update 1 |  | ||||||
| @ -1,2 +0,0 @@ | |||||||
| Lakabu yako kamili itakuwa: {{.get_suggested_alias}} |  | ||||||
| Tafadhali weka PIN yako ili kuthibitisha: |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user