refactor(coordinator): decouple popup_types.go and oauth.go from webkit
Replace *webkit.WebView with port.WebView and webkit.LoadEvent with port.LoadEvent in popup_types.go, oauth.go, and oauth_test.go.
- commit
- bcab118e10ddda39e9d455ebff7834d1460c9a64
- author
- brice · · 2026-03-15 16:43 UTC
- parent
- f36a1c5
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +10 -11
M internal/ui/coordinator/oauth.go +5 -5
| @@ -3,7 +3,7 @@ package coordinator | |||
| 3 | 3 | import ( | |
| 4 | 4 | "strings" | |
| 5 | 5 | ||
| 6 | - | "github.com/bnema/dumber/internal/infrastructure/webkit" | |
| 6 | + | "github.com/bnema/dumber/internal/application/port" | |
| 7 | 7 | ) | |
| 8 | 8 | ||
| 9 | 9 | // oauthFlowPatterns are URL patterns that indicate an OAuth flow is in progress. | |
| @@ -177,16 +177,16 @@ func composeOnURIChanged(existing, next func(string)) func(string) { | |||
| 177 | 177 | } | |
| 178 | 178 | ||
| 179 | 179 | func composeOnLoadChanged( | |
| 180 | - | existing func(webkit.LoadEvent), | |
| 181 | - | next func(webkit.LoadEvent), | |
| 182 | - | ) func(webkit.LoadEvent) { | |
| 180 | + | existing func(port.LoadEvent), | |
| 181 | + | next func(port.LoadEvent), | |
| 182 | + | ) func(port.LoadEvent) { | |
| 183 | 183 | if existing == nil { | |
| 184 | 184 | return next | |
| 185 | 185 | } | |
| 186 | 186 | if next == nil { | |
| 187 | 187 | return existing | |
| 188 | 188 | } | |
| 189 | - | return func(event webkit.LoadEvent) { | |
| 189 | + | return func(event port.LoadEvent) { | |
| 190 | 190 | existing(event) | |
| 191 | 191 | next(event) | |
| 192 | 192 | } | |
| @@ -3,7 +3,7 @@ package coordinator | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "strings" | 4 | "strings" | ||
| 5 | 5 | ||||
| 6 | - | "github.com/bnema/dumber/internal/infrastructure/webkit" | 6 | + | "github.com/bnema/dumber/internal/application/port" |
| 7 | ) | 7 | ) | ||
| 8 | 8 | ||||
| 9 | // oauthFlowPatterns are URL patterns that indicate an OAuth flow is in progress. | 9 | // oauthFlowPatterns are URL patterns that indicate an OAuth flow is in progress. | ||
| @@ -177,16 +177,16 @@ func composeOnURIChanged(existing, next func(string)) func(string) { | |||||
| 177 | } | 177 | } | ||
| 178 | 178 | ||||
| 179 | func composeOnLoadChanged( | 179 | func composeOnLoadChanged( | ||
| 180 | - | existing func(webkit.LoadEvent), | 180 | + | existing func(port.LoadEvent), |
| 181 | - | next func(webkit.LoadEvent), | 181 | + | next func(port.LoadEvent), |
| 182 | - | ) func(webkit.LoadEvent) { | 182 | + | ) func(port.LoadEvent) { |
| 183 | if existing == nil { | 183 | if existing == nil { | ||
| 184 | return next | 184 | return next | ||
| 185 | } | 185 | } | ||
| 186 | if next == nil { | 186 | if next == nil { | ||
| 187 | return existing | 187 | return existing | ||
| 188 | } | 188 | } | ||
| 189 | - | return func(event webkit.LoadEvent) { | 189 | + | return func(event port.LoadEvent) { |
| 190 | existing(event) | 190 | existing(event) | ||
| 191 | next(event) | 191 | next(event) | ||
| 192 | } | 192 | } | ||
M internal/ui/coordinator/oauth_test.go +3 -3
| @@ -40,10 +40,10 @@ func TestComposeOnLoadChanged_Order(t *testing.T) { | |||
| 40 | 40 | var calls []string | |
| 41 | 41 | ||
| 42 | 42 | composed := composeOnLoadChanged( | |
| 43 | - | func(_ webkit.LoadEvent) { calls = append(calls, "existing") }, | |
| 44 | - | func(_ webkit.LoadEvent) { calls = append(calls, "next") }, | |
| 43 | + | func(_ port.LoadEvent) { calls = append(calls, "existing") }, | |
| 44 | + | func(_ port.LoadEvent) { calls = append(calls, "next") }, | |
| 45 | 45 | ) | |
| 46 | - | composed(webkit.LoadCommitted) | |
| 46 | + | composed(port.LoadCommitted) | |
| 47 | 47 | ||
| 48 | 48 | assert.Equal(t, []string{"existing", "next"}, calls) | |
| 49 | 49 | } | |
| @@ -40,10 +40,10 @@ func TestComposeOnLoadChanged_Order(t *testing.T) { | |||||
| 40 | var calls []string | 40 | var calls []string | ||
| 41 | 41 | ||||
| 42 | composed := composeOnLoadChanged( | 42 | composed := composeOnLoadChanged( | ||
| 43 | - | func(_ webkit.LoadEvent) { calls = append(calls, "existing") }, | 43 | + | func(_ port.LoadEvent) { calls = append(calls, "existing") }, |
| 44 | - | func(_ webkit.LoadEvent) { calls = append(calls, "next") }, | 44 | + | func(_ port.LoadEvent) { calls = append(calls, "next") }, |
| 45 | ) | 45 | ) | ||
| 46 | - | composed(webkit.LoadCommitted) | 46 | + | composed(port.LoadCommitted) |
| 47 | 47 | ||||
| 48 | assert.Equal(t, []string{"existing", "next"}, calls) | 48 | assert.Equal(t, []string{"existing", "next"}, calls) | ||
| 49 | } | 49 | } | ||
M internal/ui/coordinator/popup_types.go +2 -3
| @@ -6,7 +6,6 @@ import ( | |||
| 6 | 6 | "github.com/bnema/dumber/internal/application/port" | |
| 7 | 7 | "github.com/bnema/dumber/internal/domain/entity" | |
| 8 | 8 | "github.com/bnema/dumber/internal/infrastructure/config" | |
| 9 | - | "github.com/bnema/dumber/internal/infrastructure/webkit" | |
| 10 | 9 | ) | |
| 11 | 10 | ||
| 12 | 11 | // PopupType indicates whether the popup was triggered by a link or JavaScript. | |
| @@ -39,7 +38,7 @@ func (t PopupType) String() string { | |||
| 39 | 38 | type PendingPopup struct { | |
| 40 | 39 | // WebView is the related WebView created in the "create" phase. | |
| 41 | 40 | // It shares cookies/session with the parent for OAuth support. | |
| 42 | - | WebView *webkit.WebView | |
| 41 | + | WebView port.WebView | |
| 43 | 42 | ||
| 44 | 43 | // ParentPaneID is the pane that spawned this popup. | |
| 45 | 44 | ParentPaneID entity.PaneID | |
| @@ -85,7 +84,7 @@ type InsertPopupInput struct { | |||
| 85 | 84 | PopupPane *entity.Pane | |
| 86 | 85 | ||
| 87 | 86 | // WebView is the related WebView for the popup. | |
| 88 | - | WebView *webkit.WebView | |
| 87 | + | WebView port.WebView | |
| 89 | 88 | ||
| 90 | 89 | // Behavior determines how the popup is inserted (split/stacked/tabbed). | |
| 91 | 90 | Behavior config.PopupBehavior | |
| @@ -6,7 +6,6 @@ import ( | |||||
| 6 | "github.com/bnema/dumber/internal/application/port" | 6 | "github.com/bnema/dumber/internal/application/port" | ||
| 7 | "github.com/bnema/dumber/internal/domain/entity" | 7 | "github.com/bnema/dumber/internal/domain/entity" | ||
| 8 | "github.com/bnema/dumber/internal/infrastructure/config" | 8 | "github.com/bnema/dumber/internal/infrastructure/config" | ||
| 9 | - | "github.com/bnema/dumber/internal/infrastructure/webkit" | |||
| 10 | ) | 9 | ) | ||
| 11 | 10 | ||||
| 12 | // PopupType indicates whether the popup was triggered by a link or JavaScript. | 11 | // PopupType indicates whether the popup was triggered by a link or JavaScript. | ||
| @@ -39,7 +38,7 @@ func (t PopupType) String() string { | |||||
| 39 | type PendingPopup struct { | 38 | type PendingPopup struct { | ||
| 40 | // WebView is the related WebView created in the "create" phase. | 39 | // WebView is the related WebView created in the "create" phase. | ||
| 41 | // It shares cookies/session with the parent for OAuth support. | 40 | // It shares cookies/session with the parent for OAuth support. | ||
| 42 | - | WebView *webkit.WebView | 41 | + | WebView port.WebView |
| 43 | 42 | ||||
| 44 | // ParentPaneID is the pane that spawned this popup. | 43 | // ParentPaneID is the pane that spawned this popup. | ||
| 45 | ParentPaneID entity.PaneID | 44 | ParentPaneID entity.PaneID | ||
| @@ -85,7 +84,7 @@ type InsertPopupInput struct { | |||||
| 85 | PopupPane *entity.Pane | 84 | PopupPane *entity.Pane | ||
| 86 | 85 | ||||
| 87 | // WebView is the related WebView for the popup. | 86 | // WebView is the related WebView for the popup. | ||
| 88 | - | WebView *webkit.WebView | 87 | + | WebView port.WebView |
| 89 | 88 | ||||
| 90 | // Behavior determines how the popup is inserted (split/stacked/tabbed). | 89 | // Behavior determines how the popup is inserted (split/stacked/tabbed). | ||
| 91 | Behavior config.PopupBehavior | 90 | Behavior config.PopupBehavior | ||