Skip to content

Commit

Permalink
fix: Fixed compatibility with WhatsApp >= 2.2243.5
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Nov 8, 2022
1 parent e617fe5 commit 018ab61
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 91 deletions.
20 changes: 4 additions & 16 deletions src/conn/functions/getAuthCode.ts
Expand Up @@ -14,19 +14,18 @@
* limitations under the License.
*/

import { Base64, Browser, Conn } from '../../whatsapp';
import { getOrGenerate } from '../../whatsapp/functions';
import { Base64, Conn } from '../../whatsapp';
import { adv, waNoiseInfo, waSignalStore } from '../../whatsapp/multidevice';
import { AuthCode } from '..';
import { isAuthenticated, isMultiDevice } from '.';
import { isAuthenticated, isMultiDevice, isRegistered } from '.';

/**
* Return the current auth code
*
* @return {Promise<AuthCode>}[return description]
*/
export async function getAuthCode(): Promise<AuthCode | null> {
if (!Conn.ref || Conn.connected || isAuthenticated()) {
if (!Conn.ref || Conn.connected || isAuthenticated() || isRegistered()) {
return null;
}

Expand Down Expand Up @@ -54,16 +53,5 @@ export async function getAuthCode(): Promise<AuthCode | null> {
};
}

const keyPair = getOrGenerate();
const browserId = Browser.id();

const fullCode = [ref, keyPair, browserId].join(',');

return {
type: 'single',
ref,
keyPair,
browserId,
fullCode,
};
return null;
}
2 changes: 1 addition & 1 deletion src/whatsapp/collections/GroupMetadataCollection.ts
Expand Up @@ -28,5 +28,5 @@ export declare class GroupMetadataCollection extends BaseCollection<GroupMetadat
exportModule(
exports,
{ GroupMetadataCollection: 'default.constructor' },
(m) => typeof m.default.handlePendingInvite === 'function'
(m) => typeof m.default.onParentGroupChange === 'function'
);
37 changes: 0 additions & 37 deletions src/whatsapp/collections/StarredStickerCollection.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/whatsapp/collections/index.ts
Expand Up @@ -54,7 +54,6 @@ export * from './ReactionsSendersCollection';
export * from './RecentEmojiCollection';
export * from './RecentStickerCollection';
export * from './StarredMsgCollection';
export * from './StarredStickerCollection';
export * from './StatusCollection';
export * from './StatusV3Collection';
export * from './StickerCollection';
Expand Down
32 changes: 0 additions & 32 deletions src/whatsapp/functions/getOrGenerate.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/whatsapp/functions/index.ts
Expand Up @@ -32,7 +32,6 @@ export * from './generateVideoThumbsAndDuration';
export * from './genMinimalLinkPreview';
export * from './getFanOutList';
export * from './getGroupSenderKeyList';
export * from './getOrGenerate';
export * from './getSearchContext';
export * from './groupParticipants';
export * from './handleAck';
Expand Down
3 changes: 0 additions & 3 deletions src/whatsapp/stores.ts
Expand Up @@ -110,8 +110,6 @@ export declare const RecentStickerStore: collections.RecentStickerCollection;
* @whatsapp 719011 >= 2.2222.8
*/
export declare const StarredMsgStore: collections.StarredMsgCollection;
/** @whatsapp 16774 */
export declare const StarredStickerStore: collections.StarredStickerCollection;
/** @whatsapp 46133 */
export declare const StatusStore: collections.StatusCollection;
/** @whatsapp 59387
Expand Down Expand Up @@ -154,7 +152,6 @@ const storeNames = [
'QuickReplyStore',
'ReactionsStore',
'RecentEmojiStore',
'StarredStickerStore',
'StatusStore',
'StatusV3Store',
'StickerStore',
Expand Down

0 comments on commit 018ab61

Please sign in to comment.