MCPcopy Create free account
hub / github.com/DEROFDN/Engram / verificationOverlay

Function verificationOverlay

functions.go:2096–2225  ·  view source on GitHub ↗

Verification overlay for user actions with or without password

(password bool, headerText, subText, dismiss string, callback func(bool))

Source from the content-addressed store, hash-verified

2094
2095// Verification overlay for user actions with or without password
2096func verificationOverlay(password bool, headerText, subText, dismiss string, callback func(bool)) {
2097 overlay := session.Window.Canvas().Overlays()
2098
2099 rectSpacer := canvas.NewRectangle(color.Transparent)
2100 rectSpacer.SetMinSize(fyne.NewSize(10, 5))
2101
2102 if password {
2103 headerText = "ACCOUNT VERIFICATION REQUIRED"
2104 dismiss = "Submit"
2105 }
2106
2107 header := canvas.NewText(headerText, colors.Gray)
2108 header.TextSize = 14
2109 header.Alignment = fyne.TextAlignCenter
2110 header.TextStyle = fyne.TextStyle{Bold: true}
2111
2112 btnConfirm := widget.NewButton(dismiss, nil)
2113 btnConfirm.Disable()
2114
2115 entryPassword := NewReturnEntry()
2116 entryPassword.Password = true
2117 entryPassword.PlaceHolder = "Password"
2118 entryPassword.OnChanged = func(s string) {
2119 if s == "" {
2120 btnConfirm.Text = dismiss
2121 btnConfirm.Disable()
2122 btnConfirm.Refresh()
2123 } else {
2124 btnConfirm.Text = dismiss
2125 btnConfirm.Enable()
2126 btnConfirm.Refresh()
2127 }
2128 }
2129
2130 subHeader := canvas.NewText(subText, colors.Account)
2131 if password {
2132 subText = "Confirm Password"
2133 subHeader.TextSize = 22
2134 } else {
2135 subHeader.TextSize = 18
2136 entryPassword.Hide()
2137 btnConfirm.Enable()
2138 btnConfirm.Refresh()
2139 }
2140
2141 subHeader.Text = subText
2142 subHeader.Alignment = fyne.TextAlignCenter
2143 subHeader.TextStyle = fyne.TextStyle{Bold: true}
2144 subHeader.Refresh()
2145
2146 linkClose := widget.NewHyperlinkWithStyle("Cancel", nil, fyne.TextAlignCenter, fyne.TextStyle{Bold: true})
2147 linkClose.OnTapped = func() {
2148 callback(false)
2149 overlay.Top().Hide()
2150 overlay.Remove(overlay.Top())
2151 overlay.Remove(overlay.Top())
2152 }
2153

Callers 5

rateTELAOverlayFunction · 0.85
AskPermissionForRequestFunction · 0.85
layoutAccountFunction · 0.85
layoutContractEditorFunction · 0.85
layoutTELAFunction · 0.85

Calls 2

NewReturnEntryFunction · 0.85
RefreshMethod · 0.80

Tested by

no test coverage detected