Skip to content

Commit

Permalink
chore(@desktop/community): unused code removed
Browse files Browse the repository at this point in the history
  • Loading branch information
saledjenic committed Nov 3, 2023
1 parent 81fd275 commit 37e35d1
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 45 deletions.
9 changes: 0 additions & 9 deletions src/app/modules/main/communities/controller.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type
tmpRequestToJoinEnsName: string
tmpAddressesToShare: seq[string]
tmpAirdropAddress: string
tmpAuthenticationWithCallbackInProgress: bool

proc newController*(
delegate: io_interface.AccessInterface,
Expand All @@ -66,7 +65,6 @@ proc newController*(
result.tmpRequestToJoinEnsName = ""
result.tmpAirdropAddress = ""
result.tmpAddressesToShare = @[]
result.tmpAuthenticationWithCallbackInProgress = false

proc delete*(self: Controller) =
discard
Expand Down Expand Up @@ -204,10 +202,6 @@ proc init*(self: Controller) =
if args.uniqueIdentifier != UNIQUE_COMMUNITIES_MODULE_AUTH_IDENTIFIER:
return
self.delegate.onUserAuthenticated(args.pin, args.password, args.keyUid)
if self.tmpAuthenticationWithCallbackInProgress:
let authenticated = not (args.password == "" and args.pin == "")
self.delegate.callbackFromAuthentication(authenticated)
self.tmpAuthenticationWithCallbackInProgress = false

self.events.on(SIGNAL_CHECK_PERMISSIONS_TO_JOIN_FAILED) do(e: Args):
let args = CheckPermissionsToJoinFailedArgs(e)
Expand Down Expand Up @@ -429,9 +423,6 @@ proc authenticateToEditSharedAddresses*(self: Controller, communityId: string, a
self.tmpAddressesToShare = addressesToShare
self.authenticate()

proc authenticateWithCallback*(self: Controller) =
self.tmpAuthenticationWithCallbackInProgress = true
self.authenticate()

proc getCommunityPublicKeyFromPrivateKey*(self: Controller, communityPrivateKey: string): string =
result = self.communityService.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
Expand Down
6 changes: 0 additions & 6 deletions src/app/modules/main/communities/io_interface.nim
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ method editSharedAddressesWithAuthentication*(self: AccessInterface, communityId
{.base.} =
raise newException(ValueError, "No implementation available")

method authenticateWithCallback*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")

method callbackFromAuthentication*(self: AccessInterface, authenticated: bool) {.base.} =
raise newException(ValueError, "No implementation available")

method prepareTokenModelForCommunity*(self: AccessInterface, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")

Expand Down
4 changes: 0 additions & 4 deletions src/app/modules/main/communities/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,7 @@ method requestToJoinCommunityWithAuthentication*(self: Module, communityId, ensN
method editSharedAddressesWithAuthentication*(self: Module, communityId: string, addressesToShare: seq[string], airdropAddress: string) =
self.controller.authenticateToEditSharedAddresses(communityId, addressesToShare, airdropAddress)

method authenticateWithCallback*(self: Module) =
self.controller.authenticateWithCallback()

method callbackFromAuthentication*(self: Module, authenticated: bool) =
self.view.callbackFromAuthentication(authenticated)

method getCommunityPublicKeyFromPrivateKey*(self: Module, communityPrivateKey: string): string =
result = self.controller.getCommunityPublicKeyFromPrivateKey(communityPrivateKey)
Expand Down
11 changes: 3 additions & 8 deletions src/app/modules/main/communities/view.nim
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ QtObject:
proc communityInfoAlreadyRequested*(self: View) {.signal.}

proc communityTagsChanged*(self: View) {.signal.}

proc setCommunityTags*(self: View, communityTags: string) =
self.communityTags = newQVariant(communityTags)
self.communityTagsChanged()
Expand Down Expand Up @@ -285,7 +285,7 @@ QtObject:
proc addItem*(self: View, item: SectionItem) =
self.model.addItem(item)
self.communityAdded(item.id)

proc updateItem(self: View, item: SectionItem) =
self.model.editItem(item)
self.communityChanged(item.id)
Expand All @@ -295,7 +295,7 @@ QtObject:
self.updateItem(item)
else:
self.addItem(item)

proc model*(self: View): SectionModel =
result = self.model

Expand Down Expand Up @@ -675,11 +675,6 @@ QtObject:

proc userAuthenticationCanceled*(self: View) {.signal.}

proc authenticateWithCallback*(self: View) {.slot.} =
self.delegate.authenticateWithCallback()

proc callbackFromAuthentication*(self: View, authenticated: bool) {.signal.}

proc requestToJoinCommunityWithAuthentication*(self: View, communityId: string, ensName: string) {.slot.} =
self.delegate.requestToJoinCommunityWithAuthentication(communityId, ensName, @[], "")

Expand Down
18 changes: 0 additions & 18 deletions ui/app/AppLayouts/Chat/stores/RootStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,6 @@ QtObject {
return Constants.LoginType.Password
}

function authenticateWithCallback(callback) {
_d.authenticationCallbacks.push(callback)
communitiesModuleInst.authenticateWithCallback()
}

readonly property Connections communitiesModuleConnections: Connections {
target: communitiesModuleInst
function onImportingCommunityStateChanged(communityId, state, errorMsg) {
Expand Down Expand Up @@ -593,19 +588,6 @@ QtObject {
}

readonly property QtObject _d: QtObject {
property var authenticationCallbacks: []

readonly property Connections chatCommunitySectionModuleConnections: Connections {
target: communitiesModuleInst
function onCallbackFromAuthentication(authenticated: bool) {
_d.authenticationCallbacks.forEach((callback) => {
if(!!callback)
callback(authenticated)
})
_d.authenticationCallbacks = []
}
}

readonly property var sectionDetailsInstantiator: Instantiator {
model: SortFilterProxyModel {
sourceModel: mainModuleInst.sectionsModel
Expand Down

0 comments on commit 37e35d1

Please sign in to comment.