Feat: add check permissions failed signals (#14374)
* Feat: add check permissions failed signals Close #14313 * Chore: replace check permissions signals with a property
This commit is contained in:
parent
b5dbac2e74
commit
d4b1dac65d
|
@ -867,9 +867,11 @@ method checkPermissions*(self: Module, communityId: string, sharedAddresses: seq
|
|||
self.joiningCommunityDetails.communityIdForPermissions = communityId
|
||||
|
||||
self.controller.asyncCheckPermissionsToJoin(communityId, sharedAddresses)
|
||||
self.view.setJoinPermissionsCheckSuccessful(false)
|
||||
self.checkingPermissionToJoinInProgress = true
|
||||
|
||||
self.controller.asyncCheckAllChannelsPermissions(communityId, sharedAddresses)
|
||||
self.view.setChannelsPermissionsCheckSuccessful(false)
|
||||
self.checkingAllChannelPermissionsInProgress = true
|
||||
|
||||
self.view.setCheckingPermissionsInProgress(inProgress = true)
|
||||
|
@ -945,12 +947,12 @@ proc updateCheckingPermissionsInProgressIfNeeded(self: Module, inProgress = fals
|
|||
self.view.setCheckingPermissionsInProgress(inProgress)
|
||||
|
||||
method onCommunityCheckPermissionsToJoinFailed*(self: Module, communityId: string, error: string) =
|
||||
# TODO show error
|
||||
self.view.setJoinPermissionsCheckSuccessful(false)
|
||||
self.checkingPermissionToJoinInProgress = false
|
||||
self.updateCheckingPermissionsInProgressIfNeeded(inProgress = false)
|
||||
|
||||
method onCommunityCheckAllChannelPermissionsFailed*(self: Module, communityId: string, error: string) =
|
||||
# TODO show error
|
||||
self.view.setChannelsPermissionsCheckSuccessful(false)
|
||||
self.checkingAllChannelPermissionsInProgress = false
|
||||
self.updateCheckingPermissionsInProgressIfNeeded(inProgress = false)
|
||||
|
||||
|
@ -961,6 +963,7 @@ method onCommunityCheckPermissionsToJoinResponse*(self: Module, communityId: str
|
|||
return
|
||||
self.applyPermissionResponse(communityId, checkPermissionsToJoinResponse.permissions)
|
||||
self.checkingPermissionToJoinInProgress = false
|
||||
self.view.setJoinPermissionsCheckSuccessful(true)
|
||||
self.updateCheckingPermissionsInProgressIfNeeded(inProgress = false)
|
||||
|
||||
method onCommunityCheckAllChannelsPermissionsResponse*(self: Module, communityId: string,
|
||||
|
@ -969,6 +972,7 @@ method onCommunityCheckAllChannelsPermissionsResponse*(self: Module, communityId
|
|||
self.joiningCommunityDetails.communityIdForPermissions != communityId:
|
||||
return
|
||||
self.checkingAllChannelPermissionsInProgress = false
|
||||
self.view.setChannelsPermissionsCheckSuccessful(true)
|
||||
self.updateCheckingPermissionsInProgressIfNeeded(inProgress = false)
|
||||
for _, channelPermissionResponse in checkChannelPermissionsResponse.channels:
|
||||
self.applyPermissionResponse(
|
||||
|
|
|
@ -55,6 +55,8 @@ QtObject:
|
|||
discordImportHasCommunityImage: bool
|
||||
downloadingCommunityHistoryArchives: bool
|
||||
checkingPermissionsInProgress: bool
|
||||
joinPermissionsCheckSuccessful: bool
|
||||
channelsPermissionsCheckSuccessful: bool
|
||||
myRevealedAddressesStringForCurrentCommunity: string
|
||||
myRevealedAirdropAddressForCurrentCommunity: string
|
||||
keypairsSigningModel: KeyPairModel
|
||||
|
@ -120,6 +122,9 @@ QtObject:
|
|||
result.tokenListModelVariant = newQVariant(result.tokenListModel)
|
||||
result.collectiblesListModel = newTokenListModel()
|
||||
result.collectiblesListModelVariant = newQVariant(result.collectiblesListModel)
|
||||
result.checkingPermissionsInProgress = false
|
||||
result.joinPermissionsCheckSuccessful = false
|
||||
result.channelsPermissionsCheckSuccessful = false
|
||||
|
||||
proc load*(self: View) =
|
||||
self.delegate.viewDidLoad()
|
||||
|
@ -800,6 +805,34 @@ QtObject:
|
|||
read = getCheckingPermissionsInProgress
|
||||
notify = checkingPermissionsInProgressChanged
|
||||
|
||||
proc joinPermissionsCheckSuccessfulChanged*(self: View) {.signal.}
|
||||
|
||||
proc setJoinPermissionsCheckSuccessful*(self: View, successful: bool) =
|
||||
if (self.joinPermissionsCheckSuccessful == successful): return
|
||||
self.joinPermissionsCheckSuccessful = successful
|
||||
self.joinPermissionsCheckSuccessfulChanged()
|
||||
|
||||
proc getJoinPermissionsCheckSuccessful*(self: View): bool {.slot.} =
|
||||
return self.joinPermissionsCheckSuccessful
|
||||
|
||||
QtProperty[bool] joinPermissionsCheckSuccessful:
|
||||
read = getJoinPermissionsCheckSuccessful
|
||||
notify = joinPermissionsCheckSuccessfulChanged
|
||||
|
||||
proc channelsPermissionsCheckSuccessfulChanged*(self: View) {.signal.}
|
||||
|
||||
proc setChannelsPermissionsCheckSuccessful*(self: View, successful: bool) =
|
||||
if (self.channelsPermissionsCheckSuccessful == successful): return
|
||||
self.channelsPermissionsCheckSuccessful = successful
|
||||
self.channelsPermissionsCheckSuccessfulChanged()
|
||||
|
||||
proc getChannelsPermissionsCheckSuccessful*(self: View): bool {.slot.} =
|
||||
return self.channelsPermissionsCheckSuccessful
|
||||
|
||||
QtProperty[bool] channelsPermissionsCheckSuccessful:
|
||||
read = getChannelsPermissionsCheckSuccessful
|
||||
notify = channelsPermissionsCheckSuccessfulChanged
|
||||
|
||||
proc keypairsSigningModel*(self: View): KeyPairModel =
|
||||
return self.keypairsSigningModel
|
||||
|
||||
|
|
Loading…
Reference in New Issue