-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@desktop/wallet): Implement connection error screens
fixes #9835
- Loading branch information
1 parent
6a69877
commit cf65802
Showing
34 changed files
with
517 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/app/modules/main/network_connection/network_connection_item.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import NimQml, strformat | ||
|
||
QtObject: | ||
type NetworkConnectionItem* = ref object of QObject | ||
completelyDown: bool | ||
connectionState: int | ||
chainIds: string | ||
lastCheckedAt: int | ||
timeToAutoRetryInSecs: int | ||
withCache: bool | ||
|
||
proc delete*(self: NetworkConnectionItem) = | ||
self.QObject.delete | ||
|
||
proc newNetworkConnectionItem*(completelyDown = false, connectionState = 0, chainIds = "", lastCheckedAt = 0, timeToAutoRetryInSecs = 0, withCache = false,): NetworkConnectionItem = | ||
new(result, delete) | ||
result.QObject.setup | ||
result.completelyDown = completelyDown | ||
result.connectionState = connectionState | ||
result.chainIds = chainIds | ||
result.lastCheckedAt = lastCheckedAt | ||
result.timeToAutoRetryInSecs = timeToAutoRetryInSecs | ||
result.withCache = withCache | ||
|
||
proc `$`*(self: NetworkConnectionItem): string = | ||
result = fmt"""NetworkConnectionItem[ | ||
completelyDown: {self.completelyDown}, | ||
connectionState: {self.connectionState}, | ||
chainIds: {self.chainIds}, | ||
lastCheckedAt: {self.lastCheckedAt}, | ||
timeToAutoRetryInSecs: {self.timeToAutoRetryInSecs}, | ||
withCache: {self.withCache} | ||
]""" | ||
|
||
proc completelyDownChanged*(self: NetworkConnectionItem) {.signal.} | ||
proc getCompletelyDown*(self: NetworkConnectionItem): bool {.slot.} = | ||
return self.completelyDown | ||
QtProperty[bool] completelyDown: | ||
read = getCompletelyDown | ||
notify = completelyDownChanged | ||
|
||
proc connectionStateChanged*(self: NetworkConnectionItem) {.signal.} | ||
proc getConnectionState*(self: NetworkConnectionItem): int {.slot.} = | ||
return self.connectionState | ||
QtProperty[int] connectionState: | ||
read = getConnectionState | ||
notify = connectionStateChanged | ||
|
||
proc chainIdsChanged*(self: NetworkConnectionItem) {.signal.} | ||
proc getChainIds*(self: NetworkConnectionItem): string {.slot.} = | ||
return self.chainIds | ||
QtProperty[string] chainIds: | ||
read = getChainIds | ||
notify = chainIdsChanged | ||
|
||
proc lastCheckedAtChanged*(self: NetworkConnectionItem) {.signal.} | ||
proc getLastCheckedAt*(self: NetworkConnectionItem): int {.slot.} = | ||
return self.lastCheckedAt | ||
QtProperty[int] lastCheckedAt: | ||
read = getLastCheckedAt | ||
notify = lastCheckedAtChanged | ||
|
||
proc timeToAutoRetryInSecsChanged*(self: NetworkConnectionItem) {.signal.} | ||
proc getTimeToAutoRetryInSecs*(self: NetworkConnectionItem): int {.slot.} = | ||
return self.timeToAutoRetryInSecs | ||
QtProperty[int] timeToAutoRetryInSecs: | ||
read = getTimeToAutoRetryInSecs | ||
notify = timeToAutoRetryInSecsChanged | ||
|
||
proc withCacheChanged*(self: NetworkConnectionItem) {.signal.} | ||
proc getWithCache*(self: NetworkConnectionItem): bool {.slot.} = | ||
return self.withCache | ||
QtProperty[bool] withCache: | ||
read = getWithCache | ||
notify = withCacheChanged | ||
|
||
proc updateValues*(self: NetworkConnectionItem, completelyDown: bool, connectionState: int, | ||
chainIds: string, lastCheckedAt: int, timeToAutoRetryInSecs: int, withCache: bool) = | ||
if self.completelyDown != completelyDown : | ||
self.completelyDown = completelyDown | ||
self.completelyDownChanged() | ||
|
||
if self.connectionState != connectionState : | ||
self.connectionState = connectionState | ||
self.connectionStateChanged() | ||
|
||
if self.chainIds != chainIds : | ||
self.chainIds = chainIds | ||
self.chainIdsChanged() | ||
|
||
if self.lastCheckedAt != lastCheckedAt : | ||
self.lastCheckedAt = lastCheckedAt | ||
self.lastCheckedAtChanged() | ||
|
||
if self.timeToAutoRetryInSecs != timeToAutoRetryInSecs : | ||
self.timeToAutoRetryInSecs = timeToAutoRetryInSecs | ||
self.timeToAutoRetryInSecsChanged() | ||
|
||
if self.withCache != withCache : | ||
self.withCache = withCache | ||
self.withCacheChanged() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.