feat: control auto-loading of files + fixed method setDisplayName (#2295)
* fixing the setPushname function * Adding functions that change the media autoloading * Checking against raw data * fixed * fixed merge * ESLint * Update src/util/Injected.js Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com> --------- Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com> Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
This commit is contained in:
parent
104b05d36f
commit
04175063ce
1 changed files with 88 additions and 2 deletions
|
|
@ -1047,8 +1047,8 @@ class Client extends EventEmitter {
|
|||
if(!window.Store.Conn.canSetMyPushname()) return false;
|
||||
|
||||
if(window.Store.MDBackend) {
|
||||
// TODO
|
||||
return false;
|
||||
await window.Store.Settings.setPushname(displayName);
|
||||
return true;
|
||||
} else {
|
||||
const res = await window.Store.Wap.setPushname(displayName);
|
||||
return !res.status || res.status === 200;
|
||||
|
|
@ -1597,6 +1597,67 @@ class Client extends EventEmitter {
|
|||
return await window.WWebJS.membershipRequestAction(groupId, 'Reject', requesterIds, sleep);
|
||||
}, groupId, options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setting autoload download audio
|
||||
* @param {boolean} flag true/false
|
||||
*/
|
||||
async setAutoDownloadAudio(flag) {
|
||||
await this.pupPage.evaluate(async flag => {
|
||||
const autoDownload = window.Store.Settings.getAutoDownloadAudio();
|
||||
if (autoDownload === flag) {
|
||||
return flag;
|
||||
}
|
||||
await window.Store.Settings.setAutoDownloadAudio(flag);
|
||||
return flag;
|
||||
}, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting autoload download documents
|
||||
* @param {boolean} flag true/false
|
||||
*/
|
||||
async setAutoDownloadDocuments(flag) {
|
||||
await this.pupPage.evaluate(async flag => {
|
||||
const autoDownload = window.Store.Settings.getAutoDownloadDocuments();
|
||||
if (autoDownload === flag) {
|
||||
return flag;
|
||||
}
|
||||
await window.Store.Settings.setAutoDownloadDocuments(flag);
|
||||
return flag;
|
||||
}, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting autoload download photos
|
||||
* @param {boolean} flag true/false
|
||||
*/
|
||||
async setAutoDownloadPhotos(flag) {
|
||||
await this.pupPage.evaluate(async flag => {
|
||||
const autoDownload = window.Store.Settings.getAutoDownloadPhotos();
|
||||
if (autoDownload === flag) {
|
||||
return flag;
|
||||
}
|
||||
await window.Store.Settings.setAutoDownloadPhotos(flag);
|
||||
return flag;
|
||||
}, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting autoload download videos
|
||||
* @param {boolean} flag true/false
|
||||
*/
|
||||
async setAutoDownloadVideos(flag) {
|
||||
await this.pupPage.evaluate(async flag => {
|
||||
const autoDownload = window.Store.Settings.getAutoDownloadVideos();
|
||||
if (autoDownload === flag) {
|
||||
return flag;
|
||||
}
|
||||
await window.Store.Settings.setAutoDownloadVideos(flag);
|
||||
return flag;
|
||||
}, flag);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
|
|
|
|||
Loading…
Reference in a new issue