Skip to content

Commit faaef33

Browse files
authored
fix: [deps] updates Gio version (#105)
1 parent 653221c commit faaef33

File tree

11 files changed

+204
-198
lines changed

11 files changed

+204
-198
lines changed

README.md

Lines changed: 83 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
Gio-Plugins
22
-------
33

4-
Compatible with Gio v0.8.0 (except "Auth", which [required a forked version](https://github.com/inkeliz/gio)).
4+
Compatible with Gio v0.9.1 (go get gioui.org@7bcb315ee174467d8e51c214ee434c41207cc718)
55

66
> [!NOTE]
77
> This package is not maintained by the Gio core team, and it is not part of the official Gio project. It is used
8-
> in a commercial application, and some efforts are made to keep it up-to-date with internal changes.
8+
> in a commercial application, and some efforts are made to keep it up-to-date with internal changes.
9+
10+
> [!IMPORTANT]
11+
> You may need to use a FORKED GOGIO to build your application with those plugins,
12+
> see [gogio-fork](https://github.com/inkeliz/gio-cmd).
913
1014
------
1115

@@ -34,28 +38,35 @@ First, you must download the `plugin` package:
3438
go get -u github.com/gioui-plugins/gio-plugins@latest
3539
```
3640

37-
Now, you need to modify your event-loop, you must include `gioplugins.Hijack(window)` in your event-loop, before handling
38-
events:
41+
You need to modify your event-loop, you must include `gioplugins.Hijack(window)` in your event-loop, before handling
42+
events and `gioplugins.ProxyEvents(app.Events)`, like this:
3943

4044
```diff
4145
window := &app.Window{} // Gio window
4246

43-
for {
47+
go func() {
48+
for {
4449
+ evt := gioplugins.Hijack(window) // Gio main event loop
45-
46-
switch evt := evt.(type) {
50+
51+
switch evt := evt.(type) {
4752
// ...
48-
}
49-
}
53+
}
54+
}
55+
}()
56+
57+
go gioplugins.ProxyEvents(app.Events) // Proxy Gio events to gioplugins
58+
59+
app.Main()
5060
```
5161

5262
Each plugin has its own README.md file, explaining how to use it. In general, you can simple
53-
use `nameOfPlugin.SomeOp{}.Add(gtx.Ops)`, similar of how you use `pointer.PassOp{}.Add(gtx.Ops)`, native
63+
use `nameOfPlugin.SomeOp{}.Add(gtx.Ops)`, similar of how you use `pointer.PassOp{}.Add(gtx.Ops)`, native
5464
from Gio. Beginning with Gio 0.6, it also introduces `Command`, which is executed using `gtx.Execute`, you can
55-
also use Commands, if the plugin supports it, for instance `gioplugins.Execute(gtx, gioshare.TextCmd{Text: "Hello, World!"})`,
65+
also use Commands, if the plugin supports it, for instance
66+
`gioplugins.Execute(gtx, gioshare.TextCmd{Text: "Hello, World!"})`,
5667
similar to what you are familiar with `gtx.Execute(clipboard.WriteCmd{Text: "Hello, World!"})`.
5768

58-
Once `gioplugins.Event` is set, you can use the plugins as simple `op` operations or `cmd` commands. If you are unsure
69+
Once `gioplugins.Event` is set, you can use the plugins as simple `op` operations or `cmd` commands. If you are unsure
5970
if the plugin is working, you can use the `pingpong` package, which will return on `PongEvent` to the given Tag:
6071

6172
```go
@@ -71,22 +82,32 @@ You can receive responses using the `Tag`, similar Gio-core operations:
7182

7283
```go
7384
for {
74-
evt, ok := gioplugins.Event(pingpong.Filter{Tag: &something})
75-
if !ok {
76-
break
77-
}
78-
79-
if evt, ok := evt.(pingpong.PongEvent); ok {
80-
fmt.Println(evt.Pong)
81-
}
85+
evt, ok := gioplugins.Event(gtx, pingpong.Filter{Tag: &something})
86+
if !ok {
87+
break
88+
}
89+
90+
if evt, ok := evt.(pingpong.PongEvent); ok {
91+
fmt.Println(evt.Pong)
92+
}
8293
}
8394
```
8495

8596
Of course, `pingpong` has no use in real-world applications, but it can be used to test if the plugin is working.
8697

98+
> [!IMPORTANT]
99+
> It uses `gioplugins.Event` and not `gtx.Event`!
100+
87101
## Plugins
88102

89-
**We have few plugins available:**
103+
**Available from Gio (not in this repository):**
104+
105+
| Name | Description |
106+
|------------------------------------------------------------|--------------------------------------------------------------------------|
107+
| **[Clipboard](https://pkg.go.dev/gioui.org/io/clipboard)** | Read/Write text from/to the native clipboard. |
108+
| **[Deeplink](https://pkg.go.dev/gioui.org/app)** | Handle deeplinks (custom URL schemes) using the native platform support. |
109+
110+
**Available plugins in this repository:**
90111

91112
| Name | Description | OS |
92113
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------|-------------------------------------------------------------|
@@ -96,11 +117,16 @@ Of course, `pingpong` has no use in real-world applications, but it can be used
96117
| **[Hyperlink](https://github.com/gioui-plugins/gio-plugins/tree/main/hyperlink)** | Open hyperlinks in the default browser. | _Android, iOS, macOS, Windows, WebAssembly_ |
97118
| **[Explorer](https://github.com/gioui-plugins/gio-plugins/tree/main/explorer)** | Opens the native file-dialog, to read/write files. | _Android, iOS, macOS, Windows, WebAssembly_ |
98119
| **[Safedata](https://github.com/gioui-plugins/gio-plugins/tree/main/safedata)** | Read/Write files into the secure storage of the device. | _Android, iOS, macOS, Windows, WebAssembly_ |
99-
| **[Auth](https://github.com/gioui-plugins/gio-plugins/tree/main/auth)** | Authenticate the user using third party (Google and Apple). | _Android, iOS, macOS, Windows, WebAssembly_ |
120+
| **[Auth](https://github.com/gioui-plugins/gio-plugins/tree/main/auth)** | Authenticate the user using third party (Google and Apple). | _Android, iOS, macOS, Windows, WebAssembly_ |
121+
| **ALTCHA (Coming Soon)** | Display captchas using ALTCHA, a reCaptcha alternative. | _Android, iOS, macOS, Windows, WebAssembly_ |
122+
| **InAppPay (Coming Soon)** | Display in-app products to buy, using Google Play, Apple Store and Aptoide. | _Android, iOS_ |
123+
| **Ads (Coming Soon)** | Display advertisements using AdMob. | _Android, iOS_ |
100124

101-
**We have few plugins planned:**
125+
* ALTCHA, Google Play, Apple Store and Aptoide are names trademarks of their respective owners.
126+
Currently, those plugins are not endorsed by those companies.
102127

103-
Some plugins are planned, but not yet implemented, follow the development at https://github.com/orgs/gioui-plugins/projects/1. Also,
128+
More plugins are planned, but not yet implemented, follow the development
129+
at https://github.com/orgs/gioui-plugins/projects/1. Also,
104130
consider send some 👍 on issues which mentions features that you like.
105131

106132
> [!TIP]
@@ -128,18 +154,18 @@ Most packages are compatible with the latest version of Gio, and only the latest
128154
that internal changes in the Gio API can break the compatibility with `plugin`. None of the packages has stable API,
129155
and breaking changes can happen at any time.
130156

131-
Most plugins are compatible with Android 5+, iOS 13+, MacOS 12+, Windows 10+ and WebAssembly. Currently, we consider
132-
the Windows and Android as high-priority, and the WebAssembly as medium-priority, MacOS and iOS as low-priority.
157+
Most plugins are compatible with Android 5+, iOS 13+, MacOS 12+, Windows 10+ and WebAssembly.
158+
133159
Furthermore, we don't have any plans to support Linux and FreeBSD due to the low market-share and the lack of API
134160
standards.
135161

136162
| Priority | OS | Arch |
137163
|----------|-------------|--------------|
138-
| High | Windows | AMD64 |
139164
| High | Android | ARM64, ARMv7 |
140-
| Medium | WebAssembly | WASMv1 |
165+
| High | iOS | ARM64 |
166+
| Medium | Windows | AMD64 |
167+
| Low | WebAssembly | WASMv1 |
141168
| Low | MacOS | ARM64, AMD64 |
142-
| Low | iOS | ARM64 |
143169
| Ignored | FreeBSD | - |
144170
| Ignored | Linux | - |
145171

@@ -157,34 +183,34 @@ integrity of native-APIs, so we can't guarantee that the native-APIs will have t
157183
Since we have limited resources and devices, we can't test all plugins on all platforms and devices. Currently, we have
158184
a few devices available and with limited range of OS versions. Plugins are usually tested on those devices:
159185

160-
- **Android**:
161-
- Motorola Droid Maxx,
162-
- Motorola G 2Gen,
163-
- Motorola E6,
164-
- Motorola E14,
165-
- Motorola E15,
166-
- Xiaomi A7,
167-
- Xiaomi Note 9,
168-
- Xiaomi Redmi A3,
169-
- Samsung Galaxy A20e,
170-
- SPC Discovery,
171-
- Blackberry Key One,
172-
- (+ BrowserStack)
173-
- **iOS**:
174-
- iPhone SE 2Gen (2020),
175-
- iPad Air 5Gen,
176-
- (+ BrowserStack),
177-
- **WASM**:
178-
- Chrome,
179-
- Firefox,
180-
- Safari,
181-
- (+ BrowserStack)
182-
- **Windows**:
183-
- Custom Device (RYZEN 3900X + RX 7900XT),
184-
- Custom VM (EPYC 7501P),
185-
- **MacOS**:
186-
- MacBook Air (M1, 2020)
187-
- MacStudio (M2 Max, 2022)
186+
- **Android**:
187+
- Motorola Droid Maxx,
188+
- Motorola G 2Gen,
189+
- Motorola E6,
190+
- Motorola E14,
191+
- Motorola E15,
192+
- Xiaomi A7,
193+
- Xiaomi Note 9,
194+
- Xiaomi Redmi A3,
195+
- Samsung Galaxy A20e,
196+
- SPC Discovery,
197+
- Blackberry Key One,
198+
- (+ BrowserStack)
199+
- **iOS**:
200+
- iPhone SE 2Gen (2020),
201+
- iPad Air 5Gen,
202+
- (+ BrowserStack),
203+
- **WASM**:
204+
- Chrome,
205+
- Firefox,
206+
- Safari,
207+
- (+ BrowserStack)
208+
- **Windows**:
209+
- Custom Device (RYZEN 3900X + RX 7900XT),
210+
- Custom VM (EPYC 7501P),
211+
- **MacOS**:
212+
- MacBook Air (M1, 2020)
213+
- MacStudio (M2 Max, 2022)
188214

189215
Tests are performed manually, since most features interact with the native platform, and automated tests are not
190216
easy to implement. We are open to suggestions on how to improve the testing process.

auth/gioauth/plugin.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gioauth
33
import (
44
"gioui.org/app"
55
"gioui.org/io/event"
6-
"gioui.org/io/transfer"
76
"github.com/gioui-plugins/gio-plugins/auth"
87
"github.com/gioui-plugins/gio-plugins/auth/providers"
98
"github.com/gioui-plugins/gio-plugins/plugin"
@@ -59,24 +58,6 @@ func (p *authPlugin) Execute(cmd interface{}) {
5958
// Event implements plugin.Handler.
6059
func (p *authPlugin) Event(evt event.Event) {
6160
switch evt := evt.(type) {
62-
case app.FrameEvent:
63-
for {
64-
evt, ok := evt.Source.Event(transfer.URLFilter{Scheme: ""})
65-
if !ok {
66-
break
67-
}
68-
69-
switch evt := evt.(type) {
70-
case transfer.URLEvent:
71-
if p.client != nil {
72-
if err := p.client.ProcessCustomSchemeCallback(evt.URL.String()); err != nil {
73-
p.plugin.SendEventUntagged(intName, ErrorEvent(auth.ErrorEvent{Error: err}))
74-
}
75-
} else {
76-
p.startupURL = evt.URL.String()
77-
}
78-
}
79-
}
8061
case app.ViewEvent:
8162
if p.client == nil {
8263
p.config = NewConfigFromViewEvent(p.window, evt)
@@ -106,3 +87,23 @@ func (p *authPlugin) Event(evt event.Event) {
10687
}
10788
}
10889
}
90+
91+
func (p *authPlugin) TypeGlobalEvent() []reflect.Type {
92+
return wantGlobalEvents
93+
}
94+
95+
func (p *authPlugin) GlobalEvent(evt event.Event) {
96+
/*
97+
switch evt := evt.(type) {
98+
99+
case app.URLEvent:
100+
if p.client != nil {
101+
if err := p.client.ProcessCustomSchemeCallback(evt.URL.String()); err != nil {
102+
p.plugin.SendEventUntagged(intName, ErrorEvent(auth.ErrorEvent{Error: err}))
103+
}
104+
} else {
105+
p.startupURL = evt.URL.String()
106+
}
107+
}
108+
*/
109+
}

auth/gioauth/plugin_events.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import (
44
"github.com/gioui-plugins/gio-plugins/auth"
55
"github.com/gioui-plugins/gio-plugins/plugin"
66
"reflect"
7-
8-
"gioui.org/app"
97
)
108

119
var (
1210
wantEvents = []reflect.Type{
1311
reflect.TypeOf(plugin.ViewEvent{}),
14-
reflect.TypeOf(app.FrameEvent{}),
1512
reflect.TypeOf(plugin.EndFrameEvent{}),
1613
}
14+
wantGlobalEvents = []reflect.Type{
15+
// reflect.TypeOf(app.URLEvent{}),
16+
}
1717
)
1818

1919
// ErrorEvent is issued when an error occurs.

auth/gioauth/plugin_js.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ package gioauth
33
import "syscall/js"
44

55
func startURL() string {
6-
76
return js.Global().Get("location").Get("href").String()
87
}

go.mod

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
11
module github.com/gioui-plugins/gio-plugins
22

3-
go 1.22
3+
go 1.24.0
4+
5+
toolchain go1.24.3
46

57
require (
6-
gioui.org v0.6.1-0.20240607083507-1151eac07d84
8+
gioui.org v0.9.1-0.20251215212054-7bcb315ee174
79
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0
810
github.com/go-ole/go-ole v1.2.6
11+
github.com/inkeliz/giosvg v0.0.0-20230915151051-c8ae55d003c6
912
github.com/inkeliz/go_inkwasm v0.1.23-0.20240519174017-989fbe5b10f6
10-
golang.org/x/crypto v0.23.0
11-
golang.org/x/sys v0.20.0
13+
golang.org/x/crypto v0.46.0
14+
golang.org/x/sys v0.39.0
1215
)
1316

1417
require (
15-
gioui.org/cpu v0.0.0-20220412190645-f1e9e8c3b1f7 // indirect
1618
gioui.org/shader v1.0.8 // indirect
17-
github.com/chromedp/cdproto v0.0.0-20220131204822-e6abebe7b8cd // indirect
18-
github.com/chromedp/chromedp v0.7.7 // indirect
19-
github.com/chromedp/sysutil v1.0.0 // indirect
20-
github.com/go-text/typesetting v0.1.1 // indirect
21-
github.com/gobwas/httphead v0.1.0 // indirect
22-
github.com/gobwas/pool v0.2.1 // indirect
23-
github.com/gobwas/ws v1.1.0 // indirect
24-
github.com/inkeliz/giosvg v0.0.0-20230915151051-c8ae55d003c6 // indirect
25-
github.com/josharian/intern v1.0.0 // indirect
26-
github.com/mailru/easyjson v0.7.7 // indirect
27-
golang.org/x/exp v0.0.0-20221012211006-4de253d81b95 // indirect
28-
golang.org/x/exp/shiny v0.0.0-20220921164117-439092de6870 // indirect
29-
golang.org/x/image v0.5.0 // indirect
30-
golang.org/x/mod v0.17.0 // indirect
31-
golang.org/x/net v0.25.0 // indirect
32-
golang.org/x/sync v0.7.0 // indirect
33-
golang.org/x/text v0.15.0 // indirect
34-
golang.org/x/tools v0.21.0 // indirect
19+
github.com/go-text/typesetting v0.3.0 // indirect
20+
golang.org/x/exp/shiny v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
21+
golang.org/x/image v0.26.0 // indirect
22+
golang.org/x/net v0.48.0 // indirect
23+
golang.org/x/text v0.32.0 // indirect
3524
)

0 commit comments

Comments
 (0)