Add experimental and very buggy reply text
This commit is contained in:
21
main.go
21
main.go
@@ -163,14 +163,18 @@ func CreateUITab(chatJidStr string) ChatTabUI {
|
|||||||
content.Wrapping = fyne.TextWrapWord
|
content.Wrapping = fyne.TextWrapWord
|
||||||
content.Selectable = true
|
content.Selectable = true
|
||||||
icon := theme.FileVideoIcon()
|
icon := theme.FileVideoIcon()
|
||||||
|
replytext := widget.NewLabel("> fallback reply text")
|
||||||
|
replytext.Hide()
|
||||||
|
replytext.Importance = widget.SuccessImportance
|
||||||
btn := widget.NewButtonWithIcon("View media", icon, func() {
|
btn := widget.NewButtonWithIcon("View media", icon, func() {
|
||||||
|
|
||||||
})
|
})
|
||||||
return container.NewVBox(widget.NewLabel("example text"), container.NewHBox(ico, author), content, btn)
|
return container.NewVBox(replytext, container.NewHBox(ico, author), content, btn)
|
||||||
},
|
},
|
||||||
func(i widget.ListItemID, co fyne.CanvasObject) {
|
func(i widget.ListItemID, co fyne.CanvasObject) {
|
||||||
vbox := co.(*fyne.Container)
|
vbox := co.(*fyne.Container)
|
||||||
authorBox := vbox.Objects[1].(*fyne.Container)
|
authorBox := vbox.Objects[1].(*fyne.Container)
|
||||||
|
replytext := vbox.Objects[0].(*widget.Label)
|
||||||
// generate a Icon
|
// generate a Icon
|
||||||
|
|
||||||
gen, _ := identicon.New("github", 5, 3)
|
gen, _ := identicon.New("github", 5, 3)
|
||||||
@@ -235,7 +239,17 @@ func CreateUITab(chatJidStr string) ChatTabUI {
|
|||||||
//content.ParseMarkdown(msgContent)
|
//content.ParseMarkdown(msgContent)
|
||||||
content.SetText(msgContent)
|
content.SetText(msgContent)
|
||||||
if chatTabs[chatJidStr].Messages[i].ReplyID != "PICLIENT:UNAVAILABLE" {
|
if chatTabs[chatJidStr].Messages[i].ReplyID != "PICLIENT:UNAVAILABLE" {
|
||||||
author.SetText(fmt.Sprintf("%s > %s", chatTabs[chatJidStr].Messages[i].Author, jid.MustParse(chatTabs[chatJidStr].Messages[i].Raw.Reply.To).Resourcepart()))
|
reply := chatTabs[chatJidStr].Messages[i].Raw.Reply
|
||||||
|
// TODO: EXPERIMENTALLY GET REPLIED TO TEXT
|
||||||
|
|
||||||
|
for i := len(chatTabs[chatJidStr].Messages) - 1; i >= 0; i-- {
|
||||||
|
if reply.ID == chatTabs[chatJidStr].Messages[i].Raw.StanzaID.ID {
|
||||||
|
replytext.Show()
|
||||||
|
replytext.SetText(fmt.Sprintf("> %s", chatTabs[chatJidStr].Messages[i].Content))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
author.SetText(fmt.Sprintf("%s > %s", chatTabs[chatJidStr].Messages[i].Author, jid.MustParse(reply.To).Resourcepart()))
|
||||||
} else {
|
} else {
|
||||||
author.SetText(chatTabs[chatJidStr].Messages[i].Author)
|
author.SetText(chatTabs[chatJidStr].Messages[i].Author)
|
||||||
}
|
}
|
||||||
@@ -370,6 +384,7 @@ func main() {
|
|||||||
|
|
||||||
config = piConfig{}
|
config = piConfig{}
|
||||||
a = app.NewWithID("pi-im")
|
a = app.NewWithID("pi-im")
|
||||||
|
//a.Settings().SetTheme(&myTheme{})
|
||||||
reader, err := a.Storage().Open("pi.xml")
|
reader, err := a.Storage().Open("pi.xml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dropToSignInPage(err.Error())
|
dropToSignInPage(err.Error())
|
||||||
@@ -631,7 +646,7 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
a = app.New()
|
a = app.New()
|
||||||
//a.Settings().SetTheme(myTheme{})
|
//a.Settings().SetTheme(&myTheme{})
|
||||||
w = a.NewWindow("pi")
|
w = a.NewWindow("pi")
|
||||||
w.Resize(fyne.NewSize(500, 500))
|
w.Resize(fyne.NewSize(500, 500))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user