status-lib/status/browser.nim

29 lines
819 B
Nim
Raw Normal View History

# import statusgo_backend/browser as status_browser
2021-09-08 14:05:39 -04:00
import ../eventemitter
Keycard initial integration (#63) * add nim-keycard-go to makefile * fix keycard-go build * add keycard.nim * remove test make task * remove debug line from makefile * fix import keycard_go * add keycard-go to .PHONY * add keycard start/stop/select methods * use https url for submodule * add KeycardApplication info and return it from select * update nim-keycard-go version * fix select return type * actually return the result * update nim-keycard-go * add keycard methods to backend * add base/mock keycard backends * imports * export keycard methods in backend * update start/stop keycard implementation * add KeycardStarted signal * fix keycard started signal * rename to KeycardConnected signal * fix keycard signal renamed * add keycardgo in makefile tasks * add back build/.gitignore * fix .gitignore * fix .gitignore * Makefile: export keycard vars * add keycard lib to nimble file * use spaces instead of tabs in non-recipe sections of Makefile * use install_name_tool on libkeycard on macOS * in GHA ubuntu environment install libpcsclite-dev with apt at start of workflow * add Keycard exceptions * remove useless test * remove useless return * move keycard types to /types * reraise exception from status/keycard.nim * remove unused import * add keycard commands: opensecure channel, pair, verify pin, export key * fix last keycard commands * add exportKey params * update nim-keycard-go Co-authored-by: Michele Balistreri <michele@bitgamma.com> Co-authored-by: Michael Bradley, Jr <michaelsbradleyjr@gmail.com>
2021-10-04 23:21:07 +02:00
import ../../types/[bookmark]
import ../backends/backend
2021-09-08 14:05:39 -04:00
type
BrowserModel* = ref object
events*: EventEmitter
backend*: Backend
2021-09-08 14:05:39 -04:00
proc newBrowserModel*(events: EventEmitter, backend: Backend): BrowserModel =
2021-09-08 14:05:39 -04:00
result = BrowserModel()
result.events = events
result.backend = backend
2021-09-08 14:05:39 -04:00
2021-09-28 21:21:50 +02:00
proc storeBookmark*(self: BrowserModel, bookmark: Bookmark): Bookmark =
return self.backend.storeBookmark(bookmark)
2021-09-08 14:05:39 -04:00
2021-09-28 21:21:50 +02:00
proc updateBookmark*(self: BrowserModel, originalUrl: string, bookmark: Bookmark) =
self.backend.updateBookmark(originalUrl, bookmark)
2021-09-08 14:05:39 -04:00
2021-09-28 21:21:50 +02:00
proc getBookmarks*(self: BrowserModel): seq[Bookmark] =
result = self.backend.getBookmarks()
2021-09-08 14:05:39 -04:00
proc deleteBookmark*(self: BrowserModel, url: string) =
self.backend.deleteBookmark(url)