Skip to content

Commit

Permalink
fix: only allow one instance of sendToChat()
Browse files Browse the repository at this point in the history
the old dialog is replaced by the new one

closes #3281
  • Loading branch information
Simon-Laux committed Jun 21, 2023
1 parent 3e78a39 commit f1da44a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Fixed
- fix: if systemPreferences.askForMediaAccess is not available, then don't call it (broke qr scan under linux (and maybe also under windows, was not tested))
- fix: only allow one instance of `sendToChat()` (the old one is now replaced by the new one) #3281

<a id="1_38_0"></a>

Expand Down
16 changes: 12 additions & 4 deletions src/renderer/ScreenController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default class ScreenController extends Component {
onShowKeybindings: any
onShowSettings: any
selectedAccountId: number | undefined
openSendToDialogId?: number

constructor(public props: {}) {
super(props)
Expand Down Expand Up @@ -165,10 +166,17 @@ export default class ScreenController extends Component {

runtime.onOpenQrUrl = processOpenQrUrl
runtime.onWebxcSendToChat = (file, text) => {
;(this.openDialog as OpenDialogFunctionType)(WebxdcSaveToChatDialog, {
messageText: text,
file,
})
if (this.openSendToDialogId) {
this.closeDialog(this.openSendToDialogId)
this.openSendToDialogId = undefined
}
this.openSendToDialogId = (this.openDialog as OpenDialogFunctionType)(
WebxdcSaveToChatDialog,
{
messageText: text,
file,
}
)
}
runtime.onResumeFromSleep = debounce(() => {
log.info('onResumeFromSleep')
Expand Down

0 comments on commit f1da44a

Please sign in to comment.