Skip to content

Commit

Permalink
Update core 1.151.2 (#4373)
Browse files Browse the repository at this point in the history
* Update core to v1.51.2

* Ignore deprecated parameter description in webxdc.statusUpdate

resolves #4359

* Update webxdc-types => @webxdc/[email protected]
  • Loading branch information
nicodh authored Dec 2, 2024
1 parent 6c474ef commit 464d0a7
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 103 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- extend image max-height in messages
- Update `@deltachat/stdio-rpc-server` and `deltachat/jsonrpc-client` to `1.151.1`
- dev: inviteCode doesn't needs conversion any more #4363
- Update `@deltachat/stdio-rpc-server` and `deltachat/jsonrpc-client` to `1.151.2`
- description parameter in webxdc.sendUpdate is deprecated now #4359

## Fixed
- "Disappearing Messages" dialog not reflecting the actual current value #4327
Expand Down
2 changes: 1 addition & 1 deletion packages/target-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@
"mocha": "^10.7.0",
"rc": "^1.2.8",
"typescript": "catalog:",
"webxdc-types": "catalog:"
"@webxdc/types": "catalog:"
}
}
4 changes: 2 additions & 2 deletions packages/target-electron/src/deltachat/webxdc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ If you think that's a bug and you need that permission, then please open an issu
return await this.rpc.getWebxdcStatusUpdates(accountId, msgId, serial)
})

ipcMain.handle('webxdc.sendUpdate', async (event, update, description) => {
ipcMain.handle('webxdc.sendUpdate', async (event, update) => {
const key = Object.keys(open_apps).find(
key => open_apps[key].win.webContents === event.sender
)
Expand All @@ -493,7 +493,7 @@ If you think that's a bug and you need that permission, then please open an issu
accountId,
msgId,
update,
description
''
)
} catch (error) {
log.error('webxdc.sendUpdate failed:', error)
Expand Down
28 changes: 15 additions & 13 deletions packages/target-electron/static/webxdc-preload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('webxdc-types').RealtimeListener} RT
* @typedef {import('@webxdc/types').RealtimeListener} RT
* @type {RT}
*/
class RealtimeListener {
Expand Down Expand Up @@ -49,20 +49,20 @@ class RealtimeListener {
let is_ready = false

/**
* @type {Parameters<import('webxdc-types').Webxdc["setUpdateListener"]>[0]|null}
* @type {Parameters<import('@webxdc/types').Webxdc["setUpdateListener"]>[0]|null}
*/
let callback = null
/** @type {RT | null} */
let realtimeListener = null
var last_serial = 0
let last_serial = 0
let setUpdateListenerPromise = null
let is_running = false
let scheduled = false
const innerOnStatusUpdate = async () => {
const updates = JSON.parse(
await ipcRenderer.invoke('webxdc.getAllUpdates', last_serial)
)
for (let update of updates) {
for (const update of updates) {
last_serial = update.max_serial
callback(update)
}
Expand Down Expand Up @@ -100,7 +100,7 @@ class RealtimeListener {
})

/**
* @type {import('webxdc-types').Webxdc}
* @type {import('@webxdc/types').Webxdc}
*/
const api = {
selfAddr: '?Setup Missing?',
Expand Down Expand Up @@ -138,12 +138,14 @@ class RealtimeListener {
)
return Promise.resolve([])
},
sendUpdate: (update, description) =>
ipcRenderer.invoke(
'webxdc.sendUpdate',
JSON.stringify(update),
description
),
sendUpdate: (update, description) => {
if (description) {
console.error(
'parameter description in sendUpdate is deprecated and will be removed in the future'
)
}
ipcRenderer.invoke('webxdc.sendUpdate', JSON.stringify(update))
},
sendToChat: async content => {
if (!content.file && !content.text) {
return Promise.reject(
Expand All @@ -159,7 +161,7 @@ class RealtimeListener {
reader.onload = () => {
/** @type {string} */
//@ts-ignore
let data = reader.result
const data = reader.result
resolve(data.slice(data.indexOf(data_start) + data_start.length))
}
reader.onerror = () => reject(reader.error)
Expand Down Expand Up @@ -212,7 +214,7 @@ class RealtimeListener {
await ipcRenderer.invoke('webxdc.sendToChat', file, content.text)
},
importFiles: filters => {
var element = document.createElement('input')
const element = document.createElement('input')
element.type = 'file'
element.accept = [
...(filters.extensions || []),
Expand Down
Loading

0 comments on commit 464d0a7

Please sign in to comment.