()
| 804 | } |
| 805 | |
| 806 | func layoutSend() fyne.CanvasObject { |
| 807 | session.Domain = "app.send" |
| 808 | |
| 809 | wSpacer := widget.NewLabel(" ") |
| 810 | frame := &iframe{} |
| 811 | |
| 812 | btnSend := widget.NewButton("Save", nil) |
| 813 | |
| 814 | wAmount := widget.NewEntry() |
| 815 | wAmount.SetPlaceHolder("Amount") |
| 816 | |
| 817 | wMessage := widget.NewEntry() |
| 818 | wMessage.SetValidationError(nil) |
| 819 | wMessage.SetPlaceHolder("Message") |
| 820 | wMessage.Validator = func(s string) error { |
| 821 | bytes := []byte(s) |
| 822 | if len(bytes) <= 130 { |
| 823 | tx.Comment = s |
| 824 | wMessage.SetValidationError(nil) |
| 825 | return nil |
| 826 | } else { |
| 827 | err := errors.New("message too long") |
| 828 | wMessage.SetValidationError(err) |
| 829 | return err |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | wPaymentID := widget.NewEntry() |
| 834 | wPaymentID.Validator = func(s string) (err error) { |
| 835 | tx.PaymentID, err = strconv.ParseUint(s, 10, 64) |
| 836 | if err != nil { |
| 837 | wPaymentID.SetValidationError(err) |
| 838 | tx.PaymentID = 0 |
| 839 | } |
| 840 | |
| 841 | return |
| 842 | } |
| 843 | wPaymentID.SetPlaceHolder("Payment ID / Service Port") |
| 844 | |
| 845 | options := []string{"Anonymity Set: 2 (None)", "Anonymity Set: 4 (Low)", "Anonymity Set: 8 (Low)", "Anonymity Set: 16 (Recommended)", "Anonymity Set: 32 (Medium)", "Anonymity Set: 64 (High)", "Anonymity Set: 128 (High)"} |
| 846 | wRings := widget.NewSelect(options, nil) |
| 847 | |
| 848 | wReceiver := widget.NewEntry() |
| 849 | wReceiver.SetPlaceHolder("Receiver username or address") |
| 850 | wReceiver.SetValidationError(nil) |
| 851 | wReceiver.Validator = func(s string) error { |
| 852 | address, err := globals.ParseValidateAddress(s) |
| 853 | if err != nil { |
| 854 | tx.Address = nil |
| 855 | addr, _ := checkUsername(s, -1) |
| 856 | if addr == "" { |
| 857 | btnSend.Disable() |
| 858 | err = errors.New("invalid username or address") |
| 859 | wReceiver.SetValidationError(err) |
| 860 | tx.Address = nil |
| 861 | return err |
| 862 | } else { |
| 863 | wReceiver.SetValidationError(nil) |
no test coverage detected