chore: extract move gifs module (#14315)

This commit is contained in:
Igor Sirotin 2024-04-09 19:01:24 +01:00 committed by GitHub
parent e2eddc525c
commit 795b999ad8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 445 additions and 323 deletions

View File

@ -342,7 +342,6 @@ proc delete*(self: AppController) =
self.generalService.delete
self.ensService.delete
self.tokensService.delete
self.gifService.delete
self.keycardService.delete
self.networkConnectionService.delete
@ -467,7 +466,6 @@ proc load(self: AppController) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
)

View File

@ -6,8 +6,6 @@ import ../../../../../../app_service/service/message/service as message_service
import ../../../../../../app_service/service/contacts/service as contact_service
import ../../../../../../app_service/service/community/service as community_service
import ../../../../../../app_service/service/chat/service as chat_service
import ../../../../../../app_service/service/gif/service as gif_service
import ../../../../../../app_service/service/gif/dto
import ../../../../../../app_service/service/message/dto/link_preview
import ../../../../../../app_service/service/message/dto/urls_unfurling_plan
import ../../../../../../app_service/service/settings/dto/settings
@ -25,7 +23,6 @@ type
communityService: community_service.Service
contactService: contact_service.Service
chatService: chat_service.Service
gifService: gif_service.Service
messageService: message_service.Service
settingsService: settings_service.Service
linkPreviewCache: LinkPreviewCache
@ -45,7 +42,6 @@ proc newController*(
chatService: chat_service.Service,
communityService: community_service.Service,
contactService: contact_service.Service,
gifService: gif_service.Service,
messageService: message_service.Service,
settingsService: settings_service.Service
): Controller =
@ -58,7 +54,6 @@ proc newController*(
result.chatService = chatService
result.communityService = communityService
result.contactService = contactService
result.gifService = gifService
result.messageService = messageService
result.settingsService = settingsService
result.linkPreviewCache = newLinkPreiewCache()
@ -79,34 +74,6 @@ proc delete*(self: Controller) =
self.events.disconnect()
proc init*(self: Controller) =
self.events.on(SIGNAL_LOAD_RECENT_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.loadRecentGifsDone(args.gifs)
self.events.on(SIGNAL_LOAD_FAVORITE_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.loadFavoriteGifsDone(args.gifs)
self.events.on(SIGNAL_LOAD_TRENDING_GIFS_STARTED) do(e:Args):
self.delegate.loadTrendingGifsStarted()
self.events.on(SIGNAL_LOAD_TRENDING_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.loadTrendingGifsDone(args.gifs)
self.events.on(SIGNAL_LOAD_TRENDING_GIFS_ERROR) do(e:Args):
self.delegate.loadTrendingGifsError()
self.events.on(SIGNAL_SEARCH_GIFS_STARTED) do(e:Args):
self.delegate.searchGifsStarted()
self.events.on(SIGNAL_SEARCH_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.serachGifsDone(args.gifs)
self.events.on(SIGNAL_SEARCH_GIFS_ERROR) do(e:Args):
self.delegate.searchGifsError()
self.events.on(SIGNAL_URLS_UNFURLED) do(e:Args):
let args = LinkPreviewDataArgs(e)
if not self.unfurlRequests.contains(args.requestUuid):
@ -191,33 +158,6 @@ proc acceptRequestAddressForTransaction*(self: Controller, messageId: string, ad
proc acceptRequestTransaction*(self: Controller, transactionHash: string, messageId: string, signature: string) =
self.chatService.acceptRequestTransaction(transactionHash, messageId, signature)
proc searchGifs*(self: Controller, query: string) =
self.gifService.search(query)
proc getTrendingsGifs*(self: Controller) =
self.gifService.getTrending()
proc getRecentsGifs*(self: Controller): seq[GifDto] =
return self.gifService.getRecents()
proc loadRecentGifs*(self: Controller) =
self.gifService.asyncLoadRecentGifs()
proc loadFavoriteGifs*(self: Controller) =
self.gifService.asyncLoadFavoriteGifs()
proc getFavoritesGifs*(self: Controller): seq[GifDto] =
return self.gifService.getFavorites()
proc toggleFavoriteGif*(self: Controller, item: GifDto) =
self.gifService.toggleFavorite(item)
proc addToRecentsGif*(self: Controller, item: GifDto) =
self.gifService.addToRecents(item)
proc isFavorite*(self: Controller, item: GifDto): bool =
return self.gifService.isFavorite(item)
proc getLinkPreviewEnabled*(self: Controller): bool =
return self.linkPreviewPersistentSetting == UrlUnfurlingMode.Enabled or self.linkPreviewCurrentMessageSetting == UrlUnfurlingMode.Enabled

View File

@ -11,9 +11,6 @@ import ../../../../../../app_service/service/message/dto/link_preview
import ../../../../../../app_service/service/chat/service as chat_service
import ../../../../../../app_service/service/community/service as community_service
import ../../../../../../app_service/service/contacts/service as contact_service
import ../../../../../../app_service/service/gif/service as gif_service
import ../../../../../../app_service/service/gif/dto
export io_interface
type
@ -33,7 +30,6 @@ proc newModule*(
chatService: chat_service.Service,
communityService: community_service.Service,
contactService: contact_service.Service,
gifService: gif_service.Service,
messageService: message_service.Service,
settingsService: settings_service.Service
):
@ -42,7 +38,7 @@ proc newModule*(
result.delegate = delegate
result.view = view.newView(result)
result.viewVariant = newQVariant(result.view)
result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity, chatService, communityService, contactService, gifService, messageService, settingsService)
result.controller = controller.newController(result, events, sectionId, chatId, belongsToCommunity, chatService, communityService, contactService, messageService, settingsService)
result.moduleLoaded = false
method delete*(self: Module) =
@ -99,63 +95,6 @@ method acceptRequestAddressForTransaction*(self: Module, messageId: string, addr
method acceptRequestTransaction*(self: Module, transactionHash: string, messageId: string, signature: string) =
self.controller.acceptRequestTransaction(transactionHash, messageId, signature)
method searchGifs*(self: Module, query: string) =
self.controller.searchGifs(query)
method getTrendingsGifs*(self: Module) =
self.controller.getTrendingsGifs()
method getRecentsGifs*(self: Module): seq[GifDto] =
return self.controller.getRecentsGifs()
method loadRecentGifs*(self: Module) =
self.controller.loadRecentGifs()
method loadRecentGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.updateGifColumns(gifs)
method loadTrendingGifsStarted*(self: Module) =
self.view.updateGifColumns(@[])
self.view.setGifLoading(true)
method loadTrendingGifsError*(self: Module) =
# Just setting loading to false works because the UI shows an error when there are no gifs
self.view.setGifLoading(false)
method loadTrendingGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.setGifLoading(false)
self.view.updateGifColumns(gifs)
method searchGifsStarted*(self: Module) =
self.view.updateGifColumns(@[])
self.view.setGifLoading(true)
method searchGifsError*(self: Module) =
# Just setting loading to false works because the UI shows an error when there are no gifs
self.view.setGifLoading(false)
method serachGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.setGifLoading(false)
self.view.updateGifColumns(gifs)
method getFavoritesGifs*(self: Module): seq[GifDto] =
return self.controller.getFavoritesGifs()
method loadFavoriteGifs*(self: Module) =
self.controller.loadFavoriteGifs()
method loadFavoriteGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.updateGifColumns(gifs)
method toggleFavoriteGif*(self: Module, item: GifDto) =
self.controller.toggleFavoriteGif(item)
method addToRecentsGif*(self: Module, item: GifDto) =
self.controller.addToRecentsGif(item)
method isFavorite*(self: Module, item: GifDto): bool =
return self.controller.isFavorite(item)
method setText*(self: Module, text: string, unfurlNewUrls: bool) =
self.controller.setText(text, unfurlNewUrls)

View File

@ -1,20 +1,14 @@
import NimQml, sets
import ./io_interface
import ./gif_column_model
import ./preserved_properties
import ./urls_model
import ../../../../../../app/modules/shared_models/link_preview_model as link_preview_model
import ../../../../../../app/modules/shared_models/emoji_reactions_model as emoji_reactions_model
import ../../../../../../app_service/service/gif/dto
QtObject:
type
View* = ref object of QObject
delegate: io_interface.AccessInterface
gifColumnAModel: GifColumnModel
gifColumnBModel: GifColumnModel
gifColumnCModel: GifColumnModel
gifLoading: bool
preservedProperties: PreservedProperties
preservedPropertiesVariant: QVariant
linkPreviewModel: link_preview_model.Model
@ -27,9 +21,6 @@ QtObject:
proc delete*(self: View) =
self.QObject.delete
self.gifColumnAModel.delete
self.gifColumnBModel.delete
self.gifColumnCModel.delete
self.preservedPropertiesVariant.delete
self.preservedProperties.delete
self.linkPreviewModelVariant.delete
@ -43,10 +34,6 @@ QtObject:
new(result, delete)
result.QObject.setup
result.delegate = delegate
result.gifColumnAModel = newGifColumnModel()
result.gifColumnBModel = newGifColumnModel()
result.gifColumnCModel = newGifColumnModel()
result.gifLoading = false
result.preservedProperties = newPreservedProperties()
result.preservedPropertiesVariant = newQVariant(result.preservedProperties)
result.linkPreviewModel = newLinkPreviewModel()
@ -92,119 +79,6 @@ QtObject:
proc acceptRequestTransaction*(self: View, transactionHash: string, messageId: string, signature: string) {.slot.} =
self.delegate.acceptRequestTransaction(transactionHash, messageId, signature)
proc gifLoaded*(self: View) {.signal.}
proc getGifColumnA*(self: View): QVariant {.slot.} =
result = newQVariant(self.gifColumnAModel)
QtProperty[QVariant] gifColumnA:
read = getGifColumnA
notify = gifLoaded
proc getGifColumnB*(self: View): QVariant {.slot.} =
result = newQVariant(self.gifColumnBModel)
QtProperty[QVariant] gifColumnB:
read = getGifColumnB
notify = gifLoaded
proc getGifColumnC*(self: View): QVariant {.slot.} =
result = newQVariant(self.gifColumnCModel)
QtProperty[QVariant] gifColumnC:
read = getGifColumnC
notify = gifLoaded
proc updateGifColumns*(self: View, data: seq[GifDto]) =
var columnAData: seq[GifDto] = @[]
var columnAHeight = 0
var columnBData: seq[GifDto] = @[]
var columnBHeight = 0
var columnCData: seq[GifDto] = @[]
var columnCHeight = 0
for item in data:
if columnAHeight <= columnBHeight:
columnAData.add(item)
columnAHeight += item.height
elif columnBHeight <= columnCHeight:
columnBData.add(item)
columnBHeight += item.height
else:
columnCData.add(item)
columnCHeight += item.height
self.gifColumnAModel.setNewData(columnAData)
self.gifColumnBModel.setNewData(columnBData)
self.gifColumnCModel.setNewData(columnCData)
self.gifLoaded()
proc gifLoadingChanged*(self: View) {.signal.}
proc setGifLoading*(self: View, value: bool) =
self.gifLoading = value
self.gifLoadingChanged()
proc getGifLoading*(self: View): bool {.slot.} =
result = self.gifLoading
QtProperty[bool] gifLoading:
read = getGifLoading
notify = gifLoadingChanged
proc searchGifs*(self: View, query: string) {.slot.} =
self.delegate.searchGifs(query)
proc getTrendingsGifs*(self: View) {.slot.} =
self.delegate.getTrendingsGifs()
proc getRecentsGifs*(self: View) {.slot.} =
let data = self.delegate.getRecentsGifs()
if data.len > 0:
self.updateGifColumns(data)
return
# recent gifs were not loaded yet, so we do it now
self.delegate.loadRecentGifs()
proc getFavoritesGifs*(self: View) {.slot.} =
let data = self.delegate.getFavoritesGifs()
if data.len > 0:
self.updateGifColumns(data)
return
# favorite gifs were not loaded yet, so we do it now
self.delegate.loadFavoriteGifs()
proc findGifDto(self: View, id: string): GifDto =
for item in self.gifColumnAModel.gifs:
if item.id == id:
return item
for item in self.gifColumnBModel.gifs:
if item.id == id:
return item
for item in self.gifColumnCModel.gifs:
if item.id == id:
return item
raise newException(ValueError, "Invalid id " & $id)
proc toggleFavoriteGif*(self: View, id: string, reload: bool = false) {.slot.} =
let gifItem = self.findGifDto(id)
self.delegate.toggleFavoriteGif(gifItem)
if reload:
self.getFavoritesGifs()
proc addToRecentsGif*(self: View, id: string) {.slot.} =
let gifItem = self.findGifDto(id)
self.delegate.addToRecentsGif(gifItem)
proc isFavorite*(self: View, id: string): bool {.slot.} =
let gifItem = self.findGifDto(id)
return self.delegate.isFavorite(gifItem)
proc getPreservedProperties(self: View): QVariant {.slot.} =
return self.preservedPropertiesVariant

View File

@ -20,7 +20,6 @@ import ../../../../../app_service/service/node_configuration/service as node_con
import ../../../../../app_service/service/contacts/service as contact_service
import ../../../../../app_service/service/chat/service as chat_service
import ../../../../../app_service/service/community/service as community_service
import ../../../../../app_service/service/gif/service as gif_service
import ../../../../../app_service/service/message/service as message_service
import ../../../../../app_service/service/mailservers/service as mailservers_service
import ../../../../../app_service/service/shared_urls/service as shared_urls_service
@ -46,7 +45,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitt
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.Service,
nodeConfigurationService: node_configuration_service.Service, contactService: contact_service.Service,
chatService: chat_service.Service, communityService: community_service.Service,
messageService: message_service.Service, gifService: gif_service.Service,
messageService: message_service.Service,
mailserversService: mailservers_service.Service, sharedUrlsService: shared_urls_service.Service):
Module =
result = Module()
@ -59,7 +58,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitt
result.moduleLoaded = false
result.inputAreaModule = input_area_module.newModule(result, events, sectionId, chatId, belongsToCommunity,
chatService, communityService, contactService, gifService, messageService, settingsService)
chatService, communityService, contactService, messageService, settingsService)
result.messagesModule = messages_module.newModule(result, events, sectionId, chatId, belongsToCommunity,
contactService, communityService, chatService, messageService, mailserversService, sharedUrlsService)
result.usersModule = users_module.newModule(events, sectionId, chatId, belongsToCommunity,
@ -428,4 +427,4 @@ method getPermissionsCheckOngoing*(self: Module): bool =
self.view.getPermissionsCheckOngoing()
method scrollToMessage*(self: Module, messageId: string) =
self.messagesModule.scrollToMessage(messageId)
self.messagesModule.scrollToMessage(messageId)

View File

@ -9,7 +9,6 @@ import ../../../../app_service/service/chat/service as chat_service
import ../../../../app_service/service/network/service as network_service
import ../../../../app_service/service/community/service as community_service
import ../../../../app_service/service/message/service as message_service
import ../../../../app_service/service/gif/service as gif_service
import ../../../../app_service/service/mailservers/service as mailservers_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/token/service as token_service
@ -38,7 +37,6 @@ type
chatService: chat_service.Service
communityService: community_service.Service
messageService: message_service.Service
gifService: gif_service.Service
mailserversService: mailservers_service.Service
walletAccountService: wallet_account_service.Service
tokenService: token_service.Service
@ -53,7 +51,7 @@ proc newController*(delegate: io_interface.AccessInterface, sectionId: string, i
settingsService: settings_service.Service, nodeConfigurationService: node_configuration_service.Service,
contactService: contact_service.Service, chatService: chat_service.Service,
communityService: community_service.Service, messageService: message_service.Service,
gifService: gif_service.Service, mailserversService: mailservers_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service, tokenService: token_service.Service,
communityTokensService: community_tokens_service.Service,
sharedUrlsService: shared_urls_service.Service, networkService: network_service.Service): Controller =
@ -69,7 +67,6 @@ proc newController*(delegate: io_interface.AccessInterface, sectionId: string, i
result.chatService = chatService
result.communityService = communityService
result.messageService = messageService
result.gifService = gifService
result.mailserversService = mailserversService
result.walletAccountService = walletAccountService
result.tokenService = tokenService
@ -176,14 +173,14 @@ proc init*(self: Controller) =
for chat in args.chats:
let belongsToCommunity = chat.communityId.len > 0
discard self.delegate.addOrUpdateChat(chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
self.contactService, self.chatService, self.communityService, self.messageService,
self.mailserversService, self.sharedUrlsService, setChatAsActive = false)
self.events.on(SIGNAL_CHAT_CREATED) do(e: Args):
var args = CreatedChatArgs(e)
let belongsToCommunity = args.chat.communityId.len > 0
discard self.delegate.addOrUpdateChat(args.chat, belongsToCommunity, self.events, self.settingsService, self.nodeConfigurationService,
self.contactService, self.chatService, self.communityService, self.messageService, self.gifService,
self.contactService, self.chatService, self.communityService, self.messageService,
self.mailserversService, self.sharedUrlsService, setChatAsActive = true)
if (self.isCommunitySection):
@ -192,7 +189,7 @@ proc init*(self: Controller) =
let belongsToCommunity = args.chat.communityId.len > 0
discard self.delegate.addOrUpdateChat(args.chat, belongsToCommunity, self.events, self.settingsService,
self.nodeConfigurationService, self.contactService, self.chatService, self.communityService,
self.messageService, self.gifService, self.mailserversService, self.sharedUrlsService, setChatAsActive = true)
self.messageService, self.mailserversService, self.sharedUrlsService, setChatAsActive = true)
self.events.on(SIGNAL_COMMUNITY_METRICS_UPDATED) do(e: Args):
let args = CommunityMetricsArgs(e)
@ -457,7 +454,6 @@ proc getChatsAndBuildUI*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.sharedUrlsService,
)
@ -504,7 +500,7 @@ proc createOneToOneChat*(self: Controller, communityID: string, chatId: string,
if(response.success):
discard self.delegate.addOrUpdateChat(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
self.contactService, self.chatService, self.communityService, self.messageService,
self.gifService, self.mailserversService, self.sharedUrlsService)
self.mailserversService, self.sharedUrlsService)
proc switchToOrCreateOneToOneChat*(self: Controller, chatId: string, ensName: string) =
self.chatService.switchToOrCreateOneToOneChat(chatId, ensName)
@ -577,14 +573,14 @@ proc createGroupChat*(self: Controller, communityID: string, groupName: string,
if(response.success):
discard self.delegate.addOrUpdateChat(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
self.contactService, self.chatService, self.communityService, self.messageService,
self.gifService, self.mailserversService, self.sharedUrlsService)
self.mailserversService, self.sharedUrlsService)
proc joinGroupChatFromInvitation*(self: Controller, groupName: string, chatId: string, adminPK: string) =
let response = self.chatService.createGroupChatFromInvitation(groupName, chatId, adminPK)
if(response.success):
discard self.delegate.addOrUpdateChat(response.chatDto, false, self.events, self.settingsService, self.nodeConfigurationService,
self.contactService, self.chatService, self.communityService, self.messageService,
self.gifService, self.mailserversService, self.sharedUrlsService)
self.mailserversService, self.sharedUrlsService)
proc acceptRequestToJoinCommunity*(self: Controller, requestId: string, communityId: string) =
self.communityService.asyncAcceptRequestToJoinCommunity(communityId, requestId)

View File

@ -6,7 +6,6 @@ import ../../../../app_service/service/contacts/service as contact_service
import ../../../../app_service/service/chat/service as chat_service
import ../../../../app_service/service/community/service as community_service
import ../../../../app_service/service/message/service as message_service
import ../../../../app_service/service/gif/service as gif_service
import ../../../../app_service/service/mailservers/service as mailservers_service
import ../../../../app_service/service/shared_urls/service as shared_urls_service
import ../../../../app_service/common/types
@ -34,7 +33,6 @@ method onChatsLoaded*(self: AccessInterface,
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
) {.base.} =
@ -77,7 +75,6 @@ method addOrUpdateChat*(self: AccessInterface,
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
setChatAsActive: bool = true,

View File

@ -31,7 +31,6 @@ import ../../../../app_service/service/network/service as network_service
import ../../../../app_service/service/community/service as community_service
import ../../../../app_service/service/message/service as message_service
import ../../../../app_service/service/mailservers/service as mailservers_service
import ../../../../app_service/service/gif/service as gif_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/token/service as token_service
import ../../../../app_service/service/community_tokens/service as community_tokens_service
@ -65,7 +64,6 @@ proc buildChatSectionUI(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
)
@ -85,7 +83,6 @@ proc addOrUpdateChat(self: Module,
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
setChatAsActive: bool = true,
@ -103,7 +100,6 @@ proc newModule*(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,
@ -114,7 +110,7 @@ proc newModule*(
result = Module()
result.delegate = delegate
result.controller = controller.newController(result, sectionId, isCommunity, events, settingsService,
nodeConfigurationService, contactService, chatService, communityService, messageService, gifService,
nodeConfigurationService, contactService, chatService, communityService, messageService,
mailserversService, walletAccountService, tokenService, communityTokensService, sharedUrlsService, networkService)
result.view = view.newView(result)
result.viewVariant = newQVariant(result.view)
@ -244,13 +240,12 @@ proc addSubmodule(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
) =
self.chatContentModules[chatId] = chat_content_module.newModule(self, events, self.controller.getMySectionId(), chatId,
belongToCommunity, isUsersListAvailable, settingsService, nodeConfigurationService, contactService, chatService, communityService,
messageService, gifService, mailserversService, sharedUrlsService)
messageService, mailserversService, sharedUrlsService)
proc removeSubmodule(self: Module, chatId: string) =
if(not self.chatContentModules.contains(chatId)):
@ -295,7 +290,6 @@ proc buildChatSectionUI(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
) =
@ -335,7 +329,6 @@ proc buildChatSectionUI(
chatService,
communityService,
messageService,
gifService,
mailserversService,
sharedUrlsService,
setChatAsActive = false,
@ -429,13 +422,12 @@ method onChatsLoaded*(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
) =
self.chatsLoaded = true
self.buildChatSectionUI(channelGroup, events, settingsService, nodeConfigurationService,
contactService, chatService, communityService, messageService, gifService, mailserversService, sharedUrlsService)
contactService, chatService, communityService, messageService, mailserversService, sharedUrlsService)
if(not self.controller.isCommunity()):
# we do this only in case of chat section (not in case of communities)
@ -641,7 +633,6 @@ proc addNewChat(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
setChatAsActive: bool = true,
@ -750,7 +741,6 @@ proc addNewChat(
chatService,
communityService,
messageService,
gifService,
mailserversService,
sharedUrlsService,
)
@ -1387,7 +1377,6 @@ proc addOrUpdateChat(self: Module,
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
setChatAsActive: bool = true,
@ -1434,7 +1423,6 @@ proc addOrUpdateChat(self: Module,
chatService,
communityService,
messageService,
gifService,
mailserversService,
sharedUrlsService,
setChatAsActive,
@ -1451,7 +1439,6 @@ method addOrUpdateChat*(self: Module,
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
sharedUrlsService: shared_urls_service.Service,
setChatAsActive: bool = true,
@ -1468,7 +1455,6 @@ method addOrUpdateChat*(self: Module,
chatService,
communityService,
messageService,
gifService,
mailserversService,
sharedUrlsService,
setChatAsActive,

View File

@ -120,7 +120,6 @@ proc init*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.walletAccountService,
self.tokenService,
@ -138,7 +137,6 @@ proc init*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.walletAccountService,
self.tokenService,
@ -175,7 +173,6 @@ proc init*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.walletAccountService,
self.tokenService,
@ -196,7 +193,6 @@ proc init*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.walletAccountService,
self.tokenService,
@ -223,7 +219,6 @@ proc init*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.walletAccountService,
self.tokenService,
@ -246,7 +241,6 @@ proc init*(self: Controller) =
self.chatService,
self.communityService,
self.messageService,
self.gifService,
self.mailserversService,
self.walletAccountService,
self.tokenService,

View File

@ -0,0 +1,81 @@
import io_interface
import ../../../../app_service/service/gif/service as gif_service
import ../../../../app_service/service/gif/dto
import ../../../core/eventemitter
import ../../../core/unique_event_emitter
type
Controller* = ref object of RootObj
delegate: io_interface.AccessInterface
events: UniqueUUIDEventEmitter
gifService: gif_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
events: EventEmitter,
gifService: gif_service.Service,
): Controller =
result = Controller()
result.delegate = delegate
result.events = initUniqueUUIDEventEmitter(events)
result.gifService = gifService
proc delete*(self: Controller) =
self.events.disconnect()
proc init*(self: Controller) =
self.events.on(SIGNAL_LOAD_RECENT_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.loadRecentGifsDone(args.gifs)
self.events.on(SIGNAL_LOAD_FAVORITE_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.loadFavoriteGifsDone(args.gifs)
self.events.on(SIGNAL_LOAD_TRENDING_GIFS_STARTED) do(e:Args):
self.delegate.loadTrendingGifsStarted()
self.events.on(SIGNAL_LOAD_TRENDING_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.loadTrendingGifsDone(args.gifs)
self.events.on(SIGNAL_LOAD_TRENDING_GIFS_ERROR) do(e:Args):
self.delegate.loadTrendingGifsError()
self.events.on(SIGNAL_SEARCH_GIFS_STARTED) do(e:Args):
self.delegate.searchGifsStarted()
self.events.on(SIGNAL_SEARCH_GIFS_DONE) do(e:Args):
let args = GifsArgs(e)
self.delegate.serachGifsDone(args.gifs)
self.events.on(SIGNAL_SEARCH_GIFS_ERROR) do(e:Args):
self.delegate.searchGifsError()
proc searchGifs*(self: Controller, query: string) =
self.gifService.search(query)
proc getTrendingsGifs*(self: Controller) =
self.gifService.getTrending()
proc getRecentsGifs*(self: Controller): seq[GifDto] =
return self.gifService.getRecents()
proc loadRecentGifs*(self: Controller) =
self.gifService.asyncLoadRecentGifs()
proc loadFavoriteGifs*(self: Controller) =
self.gifService.asyncLoadFavoriteGifs()
proc getFavoritesGifs*(self: Controller): seq[GifDto] =
return self.gifService.getFavorites()
proc toggleFavoriteGif*(self: Controller, item: GifDto) =
self.gifService.toggleFavorite(item)
proc addToRecentsGif*(self: Controller, item: GifDto) =
self.gifService.addToRecents(item)
proc isFavorite*(self: Controller, item: GifDto): bool =
return self.gifService.isFavorite(item)

View File

@ -1,6 +1,6 @@
import NimQml, Tables, sequtils
import ../../../../../../app_service/service/gif/dto
import ../../../../app_service/service/gif/dto
type
GifRoles {.pure.} = enum

View File

@ -0,0 +1,67 @@
import ../../../../app_service/service/gif/dto
type
AccessInterface* {.pure inheritable.} = ref object of RootObj
method delete*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method load*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method isLoaded*(self: AccessInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method searchGifs*(self: AccessInterface, query: string) {.base.} =
raise newException(ValueError, "No implementation available")
method getTrendingsGifs*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method getRecentsGifs*(self: AccessInterface): seq[GifDto] {.base.} =
raise newException(ValueError, "No implementation available")
method loadRecentGifs*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method loadRecentGifsDone*(self: AccessInterface, gifs: seq[GifDto]) {.base.} =
raise newException(ValueError, "No implementation available")
method loadTrendingGifsStarted*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method loadTrendingGifsError*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method loadTrendingGifsDone*(self: AccessInterface, gifs: seq[GifDto]) {.base.} =
raise newException(ValueError, "No implementation available")
method searchGifsStarted*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method searchGifsError*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method serachGifsDone*(self: AccessInterface, gifs: seq[GifDto]) {.base.} =
raise newException(ValueError, "No implementation available")
method getFavoritesGifs*(self: AccessInterface): seq[GifDto] {.base.} =
raise newException(ValueError, "No implementation available")
method loadFavoriteGifs*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method loadFavoriteGifsDone*(self: AccessInterface, gifs: seq[GifDto]) {.base.} =
raise newException(ValueError, "No implementation available")
method toggleFavoriteGif*(self: AccessInterface, item: GifDto) {.base.} =
raise newException(ValueError, "No implementation available")
method addToRecentsGif*(self: AccessInterface, item: GifDto) {.base.} =
raise newException(ValueError, "No implementation available")
method isFavorite*(self: AccessInterface, item: GifDto): bool {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -0,0 +1,107 @@
import NimQml
import io_interface
import ../io_interface as delegate_interface
import view, controller
import ../../../global/global_singleton
import ../../../core/eventemitter
import ../../../../app_service/service/gif/service as gif_service
import ../../../../app_service/service/gif/dto
export io_interface
type
Module* = ref object of io_interface.AccessInterface
delegate: delegate_interface.AccessInterface
view: View
viewVariant: QVariant
controller: Controller
moduleLoaded: bool
proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
gifService: gif_service.Service,
):
Module =
result = Module()
result.delegate = delegate
result.view = view.newView(result)
result.viewVariant = newQVariant(result.view)
result.controller = controller.newController(result, events, gifService)
result.moduleLoaded = false
method delete*(self: Module) =
self.view.delete
self.viewVariant.delete
self.controller.delete
method load*(self: Module) =
singletonInstance.engine.setRootContextProperty("gifsModule", self.viewVariant)
self.controller.init()
self.view.load()
method isLoaded*(self: Module): bool =
return self.moduleLoaded
method viewDidLoad*(self: Module) =
self.moduleLoaded = true
self.delegate.gifsDidLoad()
method searchGifs*(self: Module, query: string) =
self.controller.searchGifs(query)
method getTrendingsGifs*(self: Module) =
self.controller.getTrendingsGifs()
method getRecentsGifs*(self: Module): seq[GifDto] =
return self.controller.getRecentsGifs()
method loadRecentGifs*(self: Module) =
self.controller.loadRecentGifs()
method loadRecentGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.updateGifColumns(gifs)
method loadTrendingGifsStarted*(self: Module) =
self.view.updateGifColumns(@[])
self.view.setGifLoading(true)
method loadTrendingGifsError*(self: Module) =
# Just setting loading to false works because the UI shows an error when there are no gifs
self.view.setGifLoading(false)
method loadTrendingGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.setGifLoading(false)
self.view.updateGifColumns(gifs)
method searchGifsStarted*(self: Module) =
self.view.updateGifColumns(@[])
self.view.setGifLoading(true)
method searchGifsError*(self: Module) =
# Just setting loading to false works because the UI shows an error when there are no gifs
self.view.setGifLoading(false)
method serachGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.setGifLoading(false)
self.view.updateGifColumns(gifs)
method getFavoritesGifs*(self: Module): seq[GifDto] =
return self.controller.getFavoritesGifs()
method loadFavoriteGifs*(self: Module) =
self.controller.loadFavoriteGifs()
method loadFavoriteGifsDone*(self: Module, gifs: seq[GifDto]) =
self.view.updateGifColumns(gifs)
method toggleFavoriteGif*(self: Module, item: GifDto) =
self.controller.toggleFavoriteGif(item)
method addToRecentsGif*(self: Module, item: GifDto) =
self.controller.addToRecentsGif(item)
method isFavorite*(self: Module, item: GifDto): bool =
return self.controller.isFavorite(item)

View File

@ -0,0 +1,143 @@
import NimQml
import ./io_interface
import ./gif_column_model
import ../../../../app_service/service/gif/dto
QtObject:
type
View* = ref object of QObject
delegate: io_interface.AccessInterface
gifColumnAModel: GifColumnModel
gifColumnBModel: GifColumnModel
gifColumnCModel: GifColumnModel
gifLoading: bool
proc delete*(self: View) =
self.QObject.delete
self.gifColumnAModel.delete
self.gifColumnBModel.delete
self.gifColumnCModel.delete
proc newView*(delegate: io_interface.AccessInterface): View =
new(result, delete)
result.QObject.setup
result.delegate = delegate
result.gifColumnAModel = newGifColumnModel()
result.gifColumnBModel = newGifColumnModel()
result.gifColumnCModel = newGifColumnModel()
result.gifLoading = false
proc load*(self: View) =
self.delegate.viewDidLoad()
proc gifLoaded*(self: View) {.signal.}
proc getGifColumnA*(self: View): QVariant {.slot.} =
result = newQVariant(self.gifColumnAModel)
QtProperty[QVariant] gifColumnA:
read = getGifColumnA
notify = gifLoaded
proc getGifColumnB*(self: View): QVariant {.slot.} =
result = newQVariant(self.gifColumnBModel)
QtProperty[QVariant] gifColumnB:
read = getGifColumnB
notify = gifLoaded
proc getGifColumnC*(self: View): QVariant {.slot.} =
result = newQVariant(self.gifColumnCModel)
QtProperty[QVariant] gifColumnC:
read = getGifColumnC
notify = gifLoaded
proc updateGifColumns*(self: View, data: seq[GifDto]) =
var columnAData: seq[GifDto] = @[]
var columnAHeight = 0
var columnBData: seq[GifDto] = @[]
var columnBHeight = 0
var columnCData: seq[GifDto] = @[]
var columnCHeight = 0
for item in data:
if columnAHeight <= columnBHeight:
columnAData.add(item)
columnAHeight += item.height
elif columnBHeight <= columnCHeight:
columnBData.add(item)
columnBHeight += item.height
else:
columnCData.add(item)
columnCHeight += item.height
self.gifColumnAModel.setNewData(columnAData)
self.gifColumnBModel.setNewData(columnBData)
self.gifColumnCModel.setNewData(columnCData)
self.gifLoaded()
proc gifLoadingChanged*(self: View) {.signal.}
proc setGifLoading*(self: View, value: bool) =
self.gifLoading = value
self.gifLoadingChanged()
proc getGifLoading*(self: View): bool {.slot.} =
result = self.gifLoading
QtProperty[bool] gifLoading:
read = getGifLoading
notify = gifLoadingChanged
proc searchGifs*(self: View, query: string) {.slot.} =
self.delegate.searchGifs(query)
proc getTrendingsGifs*(self: View) {.slot.} =
self.delegate.getTrendingsGifs()
proc getRecentsGifs*(self: View) {.slot.} =
let data = self.delegate.getRecentsGifs()
if data.len > 0:
self.updateGifColumns(data)
return
# recent gifs were not loaded yet, so we do it now
self.delegate.loadRecentGifs()
proc getFavoritesGifs*(self: View) {.slot.} =
let data = self.delegate.getFavoritesGifs()
if data.len > 0:
self.updateGifColumns(data)
return
# favorite gifs were not loaded yet, so we do it now
self.delegate.loadFavoriteGifs()
proc findGifDto(self: View, id: string): GifDto =
for item in self.gifColumnAModel.gifs:
if item.id == id:
return item
for item in self.gifColumnBModel.gifs:
if item.id == id:
return item
for item in self.gifColumnCModel.gifs:
if item.id == id:
return item
raise newException(ValueError, "Invalid id " & $id)
proc toggleFavoriteGif*(self: View, id: string, reload: bool = false) {.slot.} =
let gifItem = self.findGifDto(id)
self.delegate.toggleFavoriteGif(gifItem)
if reload:
self.getFavoritesGifs()
proc addToRecentsGif*(self: View, id: string) {.slot.} =
let gifItem = self.findGifDto(id)
self.delegate.addToRecentsGif(gifItem)
proc isFavorite*(self: View, id: string): bool {.slot.} =
let gifItem = self.findGifDto(id)
return self.delegate.isFavorite(gifItem)

View File

@ -6,7 +6,6 @@ import app_service/service/contacts/service as contacts_service
import app_service/service/chat/service as chat_service
import app_service/service/community/service as community_service
import app_service/service/message/service as message_service
import app_service/service/gif/service as gif_service
import app_service/service/mailservers/service as mailservers_service
import app_service/service/community_tokens/service as community_token_service
import app_service/service/wallet_account/service as wallet_account_service
@ -39,7 +38,6 @@ method load*(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service)
{.base.} =
raise newException(ValueError, "No implementation available")
@ -59,6 +57,9 @@ method appSearchDidLoad*(self: AccessInterface) {.base.} =
method stickersDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method gifsDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method activityCenterDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
@ -93,7 +94,6 @@ method onChannelGroupsLoaded*(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,
@ -112,7 +112,6 @@ method onCommunityDataLoaded*(
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,
@ -164,7 +163,6 @@ method communityJoined*(self: AccessInterface, community: CommunityDto, events:
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,

View File

@ -20,6 +20,7 @@ import browser_section/module as browser_section_module
import profile_section/module as profile_section_module
import app_search/module as app_search_module
import stickers/module as stickers_module
import gifs/module as gifs_module
import activity_center/module as activity_center_module
import communities/module as communities_module
import node_section/module as node_section_module
@ -105,6 +106,7 @@ type
browserSectionModule: browser_section_module.AccessInterface
profileSectionModule: profile_section_module.AccessInterface
stickersModule: stickers_module.AccessInterface
gifsModule: gifs_module.AccessInterface
activityCenterModule: activity_center_module.AccessInterface
communitiesModule: communities_module.AccessInterface
appSearchModule: app_search_module.AccessInterface
@ -226,6 +228,7 @@ proc newModule*[T](
)
result.stickersModule = stickers_module.newModule(result, events, stickersService, settingsService, walletAccountService,
networkService, tokenService, keycardService)
result.gifsModule = gifs_module.newModule(result, events, gifService)
result.activityCenterModule = activity_center_module.newModule(result, events, activityCenterService, contactsService,
messageService, chatService, communityService)
result.communitiesModule = communities_module.newModule(result, events, communityService, contactsService, communityTokensService,
@ -240,6 +243,7 @@ method delete*[T](self: Module[T]) =
self.controller.delete
self.profileSectionModule.delete
self.stickersModule.delete
self.gifsModule.delete
self.activityCenterModule.delete
self.communitiesModule.delete
for cModule in self.channelGroupModules.values:
@ -468,7 +472,6 @@ method load*[T](
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
) =
singletonInstance.engine.setRootContextProperty("mainModule", self.viewVariant)
@ -587,6 +590,7 @@ method load*[T](
self.browserSectionModule.load()
self.profileSectionModule.load()
self.stickersModule.load()
self.gifsModule.load()
self.activityCenterModule.load()
self.communitiesModule.load()
self.appSearchModule.load()
@ -629,7 +633,6 @@ method onChannelGroupsLoaded*[T](
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,
@ -657,7 +660,6 @@ method onChannelGroupsLoaded*[T](
chatService,
communityService,
messageService,
gifService,
mailserversService,
walletAccountService,
tokenService,
@ -692,7 +694,6 @@ method onCommunityDataLoaded*[T](
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,
@ -713,7 +714,6 @@ method onCommunityDataLoaded*[T](
chatService,
communityService,
messageService,
gifService,
mailserversService,
walletAccountService,
tokenService,
@ -751,6 +751,9 @@ proc checkIfModuleDidLoad [T](self: Module[T]) =
if(not self.stickersModule.isLoaded()):
return
if not self.gifsModule.isLoaded():
return
if(not self.activityCenterModule.isLoaded()):
return
@ -778,6 +781,9 @@ method appSearchDidLoad*[T](self: Module[T]) =
method stickersDidLoad*[T](self: Module[T]) =
self.checkIfModuleDidLoad()
method gifsDidLoad*[T](self: Module[T]) =
self.checkIfModuleDidLoad()
method activityCenterDidLoad*[T](self: Module[T]) =
self.checkIfModuleDidLoad()
@ -971,7 +977,6 @@ method communityJoined*[T](
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
gifService: gif_service.Service,
mailserversService: mailservers_service.Service,
walletAccountService: wallet_account_service.Service,
tokenService: token_service.Service,
@ -997,7 +1002,6 @@ method communityJoined*[T](
chatService,
communityService,
messageService,
gifService,
mailserversService,
walletAccountService,
tokenService,

View File

@ -14,7 +14,7 @@ Pane {
}
QtObject {
id: chatSectionChatContentInputArea
id: gifsModule
}
QtObject {

View File

@ -73,50 +73,49 @@ QtObject {
globalUtils.copyToClipboard(text)
}
property var chatSectionChatContentInputAreaInst: typeof chatSectionChatContentInputArea !== "undefined" ? chatSectionChatContentInputArea
: null
property var gifColumnA: chatSectionChatContentInputAreaInst ? chatSectionChatContentInputArea.gifColumnA
property var gifsModuleInst: typeof gifsModule !== "undefined" ? gifsModule : null
property var gifColumnA: gifsModuleInst ? gifsModuleInst.gifColumnA
: null
property var gifColumnB: chatSectionChatContentInputAreaInst ? chatSectionChatContentInputArea.gifColumnB
property var gifColumnB: gifsModuleInst ? gifsModuleInst.gifColumnB
: null
property var gifColumnC: chatSectionChatContentInputAreaInst ? chatSectionChatContentInputArea.gifColumnC
property var gifColumnC: gifsModuleInst ? gifsModuleInst.gifColumnC
: null
property bool gifLoading: chatSectionChatContentInputAreaInst ? chatSectionChatContentInputArea.gifLoading
property bool gifLoading: gifsModuleInst ? gifsModuleInst.gifLoading
: false
function searchGifs(query) {
if (chatSectionChatContentInputAreaInst)
chatSectionChatContentInputAreaInst.searchGifs(query)
if (gifsModuleInst)
gifsModuleInst.searchGifs(query)
}
function getTrendingsGifs() {
if (chatSectionChatContentInputAreaInst)
chatSectionChatContentInputAreaInst.getTrendingsGifs()
if (gifsModuleInst)
gifsModuleInst.getTrendingsGifs()
}
function getRecentsGifs() {
if (chatSectionChatContentInputAreaInst)
chatSectionChatContentInputAreaInst.getRecentsGifs()
if (gifsModuleInst)
gifsModuleInst.getRecentsGifs()
}
function getFavoritesGifs() {
return chatSectionChatContentInputAreaInst ? chatSectionChatContentInputAreaInst.getFavoritesGifs()
return gifsModuleInst ? gifsModuleInst.getFavoritesGifs()
: null
}
function isFavorite(id) {
return chatSectionChatContentInputAreaInst ? chatSectionChatContentInputAreaInst.isFavorite(id)
return gifsModuleInst ? gifsModuleInst.isFavorite(id)
: null
}
function toggleFavoriteGif(id, reload) {
if (chatSectionChatContentInputAreaInst)
chatSectionChatContentInputAreaInst.toggleFavoriteGif(id, reload)
if (gifsModuleInst)
gifsModuleInst.toggleFavoriteGif(id, reload)
}
function addToRecentsGif(id) {
if (chatSectionChatContentInputAreaInst)
chatSectionChatContentInputAreaInst.addToRecentsGif(id)
if (gifsModuleInst)
gifsModuleInst.addToRecentsGif(id)
}
function getPasswordStrengthScore(password) {