mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-06-30 18:51:03 +00:00
Revert "pwa: Add support for installable detection and prompt"
This reverts commit 6bfc3beda9c671dc26bd1ee1845c22b217902095.
This commit is contained in:
parent
1c721ce8f7
commit
15981876ff
@ -4,40 +4,15 @@ import (
|
||||
"github.com/maxence-charriere/go-app/v9/pkg/app"
|
||||
)
|
||||
|
||||
const (
|
||||
introText = "Hello! Welcome to Salty IM 🧂 This PWA App is not quite ready yet! Come back later 🤞"
|
||||
)
|
||||
|
||||
// Hello is a component that displays a simple "Hello World!". A component is a
|
||||
// hello is a component that displays a simple "Hello World!". A component is a
|
||||
// customizable, independent, and reusable UI element. It is created by
|
||||
// embedding app.Compo into a struct.
|
||||
type Hello struct {
|
||||
app.Compo
|
||||
|
||||
name string
|
||||
isAppInstallable bool
|
||||
}
|
||||
|
||||
func (h *Hello) OnAppInstallChange(ctx app.Context) {
|
||||
h.isAppInstallable = ctx.IsAppInstallable()
|
||||
}
|
||||
|
||||
func (h *Hello) OnMount(ctx app.Context) {
|
||||
h.isAppInstallable = ctx.IsAppInstallable()
|
||||
}
|
||||
|
||||
// The Render method is where the component appearance is defined. Here, a
|
||||
// "Hello World!" is displayed as a heading.
|
||||
func (h *Hello) Render() app.UI {
|
||||
return app.Div().
|
||||
Body(
|
||||
app.H1().Text(introText),
|
||||
app.If(h.isAppInstallable,
|
||||
app.Button().
|
||||
Text("Install App").
|
||||
OnClick(h.onInstallButtonClicked),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
func (h *Hello) onInstallButtonClicked(ctx app.Context, e app.Event) {
|
||||
ctx.ShowAppInstallPrompt()
|
||||
return app.H1().Text("Hello! Welcome to Salty IM 🧂 This PWA App is not quite ready yet! Come back later 🤞")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user