fix(profile): fix profile seed phrase backup badge

Fixes #4573
This commit is contained in:
Jonathan Rainville 2022-01-27 10:11:18 -05:00 committed by Sale Djenic
parent 95f8a545d9
commit a306d3a9d7
6 changed files with 38 additions and 6 deletions

View File

@ -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/message/service as message_service
import ../../../app_service/service/gif/service as gif_service
import ../../../app_service/service/privacy/service as privacy_service
export controller_interface
@ -29,6 +30,7 @@ type
messageService: message_service.Service
contactsService: contacts_service.Service
gifService: gif_service.Service
privacyService: privacy_service.Service
activeSectionId: string
proc newController*(delegate: io_interface.AccessInterface,
@ -41,6 +43,7 @@ proc newController*(delegate: io_interface.AccessInterface,
contactsService: contacts_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
privacyService: privacy_service.Service,
):
Controller =
result = Controller()
@ -54,6 +57,7 @@ proc newController*(delegate: io_interface.AccessInterface,
result.contactsService = contactsService
result.messageService = messageService
result.gifService = gifService
result.privacyService = privacyService
method delete*(self: Controller) =
discard
@ -134,6 +138,9 @@ method init*(self: Controller) =
var args = ContactArgs(e)
self.delegate.contactUpdated(args.contactId)
self.events.on(SIGNAL_MNEMONIC_REMOVAL) do(e: Args):
self.delegate.mnemonicBackedUp()
method getJoinedCommunities*(self: Controller): seq[CommunityDto] =
return self.communityService.getJoinedCommunities()
@ -214,3 +221,6 @@ method getContactNameAndImage*(self: Controller, contactId: string):
method resolveENS*(self: Controller, ensName: string, uuid: string = "") =
self.contactsService.resolveENS(ensName, uuid)
method isMnemonicBackedUp*(self: Controller): bool =
result = self.privacyService.isMnemonicBackedUp()

View File

@ -44,5 +44,8 @@ method getContactNameAndImage*(self: AccessInterface, contactId: string):
tuple[name: string, image: string, isIdenticon: bool] {.base.} =
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")

View File

@ -68,6 +68,9 @@ type
nodeSectionModule: node_section_module.AccessInterface
moduleLoaded: bool
# Forward declaration
method calculateProfileSectionHasNotification*[T](self: Module[T]): bool
proc newModule*[T](
delegate: T,
events: EventEmitter,
@ -114,6 +117,7 @@ proc newModule*[T](
contactsService,
messageService,
gifService,
privacyService,
)
result.moduleLoaded = false
@ -321,7 +325,7 @@ method load*[T](
image = "",
conf.SETTINGS_SECTION_ICON,
color = "",
hasNotification = false,
hasNotification = self.calculateProfileSectionHasNotification(),
notificationsCount = 0,
active = false,
enabled = true)
@ -599,3 +603,12 @@ method resolvedENS*[T](self: Module[T], publicKey: string, address: string, uuid
method contactUpdated*[T](self: Module[T], publicKey: string) =
let (name, image, isIdenticon) = self.controller.getContactNameAndImage(publicKey)
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)

View File

@ -25,3 +25,6 @@ method load*(
method checkForStoringPassword*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method calculateProfileSectionHasNotification*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -35,3 +35,6 @@ method resolvedENS*(self: AccessInterface, publicKey: string, address: string, u
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available")
method mnemonicBackedUp*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")