Skip to content

Commit

Permalink
Remove QR code for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 4, 2025
1 parent cc4f352 commit 741b7cc
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/fynelabs/fyneselfupdate v0.1.1
github.com/fynelabs/selfupdate v0.2.0
github.com/klauspost/compress v1.17.11
github.com/rymdport/go-qrcode v1.1.0
github.com/rymdport/wormhole v0.1.1-0.20241116103349-4e36e05aff6c
github.com/stretchr/testify v1.9.0
)
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/rymdport/go-qrcode v1.1.0 h1:FBbvYA4pHGO+C22QmIx5wNVnlHQOGKOlXg9s6syskps=
github.com/rymdport/go-qrcode v1.1.0/go.mod h1:/DWqWDSfM/AcbuUr+/nNZev3SjO4bdZYqatpTpB9Js4=
github.com/rymdport/portal v0.3.0 h1:QRHcwKwx3kY5JTQcsVhmhC3TGqGQb9LFghVNUy8AdB8=
github.com/rymdport/portal v0.3.0/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4=
github.com/rymdport/wormhole v0.1.1-0.20241116103349-4e36e05aff6c h1:PEoCBrif+0g6CvQb9yXZefHqgJJn+W7gM8P3ksb5E9w=
Expand Down
54 changes: 54 additions & 0 deletions internal/ui/components/stack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package components

import (
"fyne.io/fyne/v2"
)

// StackNavigator represents a stack-based navigation manager
type StackNavigator struct {
stack []fyne.CanvasObject
current int
OnBack func()
}

// NewNavigator creates a new Navigator instance.
func NewNavigator(initialPage fyne.CanvasObject) *StackNavigator {
return &StackNavigator{stack: []fyne.CanvasObject{initialPage}}
}

// Next moves the view to the next view in the stack without adding contents.
// This allows viewes to move forwards through views without recreating each time.
func (n *StackNavigator) Next() {
if n.current == len(n.stack)-1 {
return
}

n.current++
}

// Previous moves the view to the previous view in the stack without removing contents.
// This allows viewes to move backwards through views without recreating each time.
func (n *StackNavigator) Previous() {
if n.current == 0 || len(n.stack) < 1 {

}

n.current--
}

// Push adds a new page to the stack and displays it.
func (n *StackNavigator) Push(page fyne.CanvasObject) {
n.stack = append(n.stack, page)
n.Next()
}

// Pop removes the current page and returns to the previous one.
func (n *StackNavigator) Pop() {
if len(n.stack) <= 1 {
return // Prevent popping the last page
}

n.stack[len(n.stack)-1] = nil
n.stack = n.stack[:len(n.stack)-1]
n.Previous()
}

0 comments on commit 741b7cc

Please sign in to comment.