Skip to content

Commit

Permalink
feat: Added sendStatusToDevice option to avoid app crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Feb 21, 2023
1 parent 66da31a commit d762d3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/config/Config.ts
Expand Up @@ -24,7 +24,8 @@
* deviceName: 'WPPConnect',
* liveLocationLimit: 10,
* disableGoogleAnalytics: false,
* googleAnalyticsId: 'G-XXXXXXXXXX'
* googleAnalyticsId: 'G-XXXXXXXXXX',
* sendStatusToDevice: true
* };
* ```
*/
Expand Down Expand Up @@ -68,4 +69,10 @@ export interface Config {
* Project name for google analytics
*/
poweredBy: string | null;

/**
* Send the status to your device, set it to false to avoid WhatsApp crashing
* @default false
*/
sendStatusToDevice: boolean;
}
1 change: 1 addition & 0 deletions src/config/defaultConfig.ts
Expand Up @@ -24,4 +24,5 @@ export const defaultConfig: Config = {
googleAnalyticsUserProperty: {},
linkPreviewApiServers: null,
poweredBy: 'WA-JS',
sendStatusToDevice: false,
};
5 changes: 4 additions & 1 deletion src/status/functions/updateParticipants.ts
Expand Up @@ -15,6 +15,7 @@
*/

import { assertWid } from '../../assert';
import { config } from '../../config';
import {
ContactStore,
functions,
Expand Down Expand Up @@ -60,7 +61,9 @@ export async function updateParticipants(
.map(assertWid)
.filter((c) => !c.equals(UserPrefs.getMaybeMeUser()));

// wids.push(UserPrefs.getMaybeMeUser());
if (config.sendStatusToDevice) {
wids.push(UserPrefs.getMaybeMeUser());
}

const participants = wids.map(
(id) =>
Expand Down

0 comments on commit d762d3a

Please sign in to comment.