mirror of
https://github.com/muesli/telephant
synced 2025-02-17 03:58:25 +00:00
Open ConnectionPopup on first start
This commit is contained in:
parent
78c0212cf3
commit
7367656c68
2 changed files with 14 additions and 9 deletions
|
@ -3,6 +3,7 @@ package mastodon
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"regexp"
|
||||
|
@ -70,17 +71,17 @@ func (mod *Account) Authenticate(code string) (string, string, string, string, e
|
|||
}
|
||||
|
||||
// Run executes the account's event loop.
|
||||
func (mod *Account) Run(eventChan chan interface{}) {
|
||||
func (mod *Account) Run(eventChan chan interface{}) error {
|
||||
mod.evchan = eventChan
|
||||
|
||||
if mod.config.AccessToken == "" {
|
||||
return
|
||||
return errors.New("no accesstoken found")
|
||||
}
|
||||
|
||||
var err error
|
||||
mod.self, err = mod.client.GetAccountCurrentUser(context.Background())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
|
||||
ev := accounts.LoginEvent{
|
||||
|
@ -104,7 +105,7 @@ func (mod *Account) Run(eventChan chan interface{}) {
|
|||
Limit: initialNotificationsCount,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
for i := len(nn) - 1; i >= 0; i-- {
|
||||
mod.handleNotification(nn[i])
|
||||
|
@ -114,13 +115,14 @@ func (mod *Account) Run(eventChan chan interface{}) {
|
|||
Limit: initialFeedCount,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return err
|
||||
}
|
||||
for i := len(tt) - 1; i >= 0; i-- {
|
||||
mod.evchan <- mod.handleStatus(tt[i])
|
||||
}
|
||||
|
||||
mod.handleStream()
|
||||
go mod.handleStream()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mod *Account) Logo() string {
|
||||
|
|
9
chirp.go
9
chirp.go
|
@ -186,9 +186,12 @@ func setupMastodon(config Account) {
|
|||
|
||||
evchan := make(chan interface{})
|
||||
go handleEvents(evchan, postModel, notificationModel)
|
||||
go func() {
|
||||
tc.Run(evchan)
|
||||
}()
|
||||
err := tc.Run(evchan)
|
||||
if err != nil {
|
||||
// panic(err)
|
||||
fmt.Println("Error connecting:", err)
|
||||
}
|
||||
configBridge.SetFirstRun(err != nil)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
Loading…
Add table
Reference in a new issue