parent
95f8a545d9
commit
a306d3a9d7
|
@ -11,6 +11,7 @@ import ../../../app_service/service/community/service as community_service
|
||||||
import ../../../app_service/service/contacts/service as contacts_service
|
import ../../../app_service/service/contacts/service as contacts_service
|
||||||
import ../../../app_service/service/message/service as message_service
|
import ../../../app_service/service/message/service as message_service
|
||||||
import ../../../app_service/service/gif/service as gif_service
|
import ../../../app_service/service/gif/service as gif_service
|
||||||
|
import ../../../app_service/service/privacy/service as privacy_service
|
||||||
|
|
||||||
export controller_interface
|
export controller_interface
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ type
|
||||||
messageService: message_service.Service
|
messageService: message_service.Service
|
||||||
contactsService: contacts_service.Service
|
contactsService: contacts_service.Service
|
||||||
gifService: gif_service.Service
|
gifService: gif_service.Service
|
||||||
|
privacyService: privacy_service.Service
|
||||||
activeSectionId: string
|
activeSectionId: string
|
||||||
|
|
||||||
proc newController*(delegate: io_interface.AccessInterface,
|
proc newController*(delegate: io_interface.AccessInterface,
|
||||||
|
@ -41,6 +43,7 @@ proc newController*(delegate: io_interface.AccessInterface,
|
||||||
contactsService: contacts_service.Service,
|
contactsService: contacts_service.Service,
|
||||||
messageService: message_service.Service,
|
messageService: message_service.Service,
|
||||||
gifService: gif_service.Service,
|
gifService: gif_service.Service,
|
||||||
|
privacyService: privacy_service.Service,
|
||||||
):
|
):
|
||||||
Controller =
|
Controller =
|
||||||
result = Controller()
|
result = Controller()
|
||||||
|
@ -54,6 +57,7 @@ proc newController*(delegate: io_interface.AccessInterface,
|
||||||
result.contactsService = contactsService
|
result.contactsService = contactsService
|
||||||
result.messageService = messageService
|
result.messageService = messageService
|
||||||
result.gifService = gifService
|
result.gifService = gifService
|
||||||
|
result.privacyService = privacyService
|
||||||
|
|
||||||
method delete*(self: Controller) =
|
method delete*(self: Controller) =
|
||||||
discard
|
discard
|
||||||
|
@ -134,6 +138,9 @@ method init*(self: Controller) =
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
self.delegate.contactUpdated(args.contactId)
|
self.delegate.contactUpdated(args.contactId)
|
||||||
|
|
||||||
|
self.events.on(SIGNAL_MNEMONIC_REMOVAL) do(e: Args):
|
||||||
|
self.delegate.mnemonicBackedUp()
|
||||||
|
|
||||||
method getJoinedCommunities*(self: Controller): seq[CommunityDto] =
|
method getJoinedCommunities*(self: Controller): seq[CommunityDto] =
|
||||||
return self.communityService.getJoinedCommunities()
|
return self.communityService.getJoinedCommunities()
|
||||||
|
|
||||||
|
@ -213,4 +220,7 @@ method getContactNameAndImage*(self: Controller, contactId: string):
|
||||||
return self.contactsService.getContactNameAndImage(contactId)
|
return self.contactsService.getContactNameAndImage(contactId)
|
||||||
|
|
||||||
method resolveENS*(self: Controller, ensName: string, uuid: string = "") =
|
method resolveENS*(self: Controller, ensName: string, uuid: string = "") =
|
||||||
self.contactsService.resolveENS(ensName, uuid)
|
self.contactsService.resolveENS(ensName, uuid)
|
||||||
|
|
||||||
|
method isMnemonicBackedUp*(self: Controller): bool =
|
||||||
|
result = self.privacyService.isMnemonicBackedUp()
|
|
@ -44,5 +44,8 @@ method getContactNameAndImage*(self: AccessInterface, contactId: string):
|
||||||
tuple[name: string, image: string, isIdenticon: bool] {.base.} =
|
tuple[name: string, image: string, isIdenticon: bool] {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method resolveENS*(self: AccessInterface, ensName: string, uuid: string = ""): void {.base.} =
|
method resolveENS*(self: AccessInterface, ensName: string, uuid: string = "") {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method isMnemonicBackedUp*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
|
@ -68,6 +68,9 @@ type
|
||||||
nodeSectionModule: node_section_module.AccessInterface
|
nodeSectionModule: node_section_module.AccessInterface
|
||||||
moduleLoaded: bool
|
moduleLoaded: bool
|
||||||
|
|
||||||
|
# Forward declaration
|
||||||
|
method calculateProfileSectionHasNotification*[T](self: Module[T]): bool
|
||||||
|
|
||||||
proc newModule*[T](
|
proc newModule*[T](
|
||||||
delegate: T,
|
delegate: T,
|
||||||
events: EventEmitter,
|
events: EventEmitter,
|
||||||
|
@ -114,6 +117,7 @@ proc newModule*[T](
|
||||||
contactsService,
|
contactsService,
|
||||||
messageService,
|
messageService,
|
||||||
gifService,
|
gifService,
|
||||||
|
privacyService,
|
||||||
)
|
)
|
||||||
result.moduleLoaded = false
|
result.moduleLoaded = false
|
||||||
|
|
||||||
|
@ -321,7 +325,7 @@ method load*[T](
|
||||||
image = "",
|
image = "",
|
||||||
conf.SETTINGS_SECTION_ICON,
|
conf.SETTINGS_SECTION_ICON,
|
||||||
color = "",
|
color = "",
|
||||||
hasNotification = false,
|
hasNotification = self.calculateProfileSectionHasNotification(),
|
||||||
notificationsCount = 0,
|
notificationsCount = 0,
|
||||||
active = false,
|
active = false,
|
||||||
enabled = true)
|
enabled = true)
|
||||||
|
@ -598,4 +602,13 @@ method resolvedENS*[T](self: Module[T], publicKey: string, address: string, uuid
|
||||||
|
|
||||||
method contactUpdated*[T](self: Module[T], publicKey: string) =
|
method contactUpdated*[T](self: Module[T], publicKey: string) =
|
||||||
let (name, image, isIdenticon) = self.controller.getContactNameAndImage(publicKey)
|
let (name, image, isIdenticon) = self.controller.getContactNameAndImage(publicKey)
|
||||||
self.view.activeSection().updateMember(publicKey, name, image, isIdenticon)
|
self.view.activeSection().updateMember(publicKey, name, image, isIdenticon)
|
||||||
|
|
||||||
|
method calculateProfileSectionHasNotification*[T](self: Module[T]): bool =
|
||||||
|
return not self.controller.isMnemonicBackedUp()
|
||||||
|
|
||||||
|
method mnemonicBackedUp*[T](self: Module[T]) =
|
||||||
|
self.view.model().udpateNotifications(
|
||||||
|
conf.SETTINGS_SECTION_ID,
|
||||||
|
self.calculateProfileSectionHasNotification(),
|
||||||
|
notificationsCount = 0)
|
|
@ -24,4 +24,7 @@ method load*(
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method checkForStoringPassword*(self: AccessInterface) {.base.} =
|
method checkForStoringPassword*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method calculateProfileSectionHasNotification*(self: AccessInterface): bool {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
|
@ -35,3 +35,6 @@ method resolvedENS*(self: AccessInterface, publicKey: string, address: string, u
|
||||||
|
|
||||||
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
|
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method mnemonicBackedUp*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
|
@ -134,10 +134,10 @@ proc icon*(self: SectionItem): string {.inline.} =
|
||||||
proc color*(self: SectionItem): string {.inline.} =
|
proc color*(self: SectionItem): string {.inline.} =
|
||||||
self.color
|
self.color
|
||||||
|
|
||||||
proc hasNotification*(self: SectionItem): bool {.inline.} =
|
proc hasNotification*(self: SectionItem): bool {.inline.} =
|
||||||
self.hasNotification
|
self.hasNotification
|
||||||
|
|
||||||
proc `hasNotification=`*(self: var SectionItem, value: bool) {.inline.} =
|
proc `hasNotification=`*(self: var SectionItem, value: bool) {.inline.} =
|
||||||
self.hasNotification = value
|
self.hasNotification = value
|
||||||
|
|
||||||
proc notificationsCount*(self: SectionItem): int {.inline.} =
|
proc notificationsCount*(self: SectionItem): int {.inline.} =
|
||||||
|
|
Loading…
Reference in New Issue