Skip to content

Commit

Permalink
feat: Exported getHistorySyncProgress function
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Nov 15, 2022
1 parent 968fca2 commit 02ee36d
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/whatsapp/functions/getHistorySyncProgress.ts
@@ -0,0 +1,30 @@
/*!
* Copyright 2022 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { exportModule } from '../exportModule';

/**
* @whatsapp 649959 >= 2.2244.5
*/
export declare function getHistorySyncProgress(): any;

exportModule(
exports,
{
getHistorySyncProgress: 'getHistorySyncProgress',
},
(m) => m.getHistorySyncProgress
);
1 change: 1 addition & 0 deletions src/whatsapp/functions/index.ts
Expand Up @@ -32,6 +32,7 @@ export * from './generateVideoThumbsAndDuration';
export * from './genMinimalLinkPreview';
export * from './getFanOutList';
export * from './getGroupSenderKeyList';
export * from './getHistorySyncProgress';
export * from './getSearchContext';
export * from './groupParticipants';
export * from './handleAck';
Expand Down
76 changes: 76 additions & 0 deletions src/whatsapp/models/HistorySyncProgressModel.ts
@@ -0,0 +1,76 @@
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import * as webpack from '../../webpack';
import { exportModule } from '../exportModule';
import { getHistorySyncProgress } from '../functions';
import {
Model,
ModelOptions,
ModelPropertiesContructor,
ModelProxy,
} from './Model';

interface Props {}

interface Session {}

interface Derived {
progress: number | null;
paused: boolean;
inProgress: boolean;
}

/**
* @whatsapp 649959 >= 2.2244.5
*/
export declare interface HistorySyncProgressModel
extends ModelProxy<Props, Session, Derived> {}

/**
* @whatsapp 649959 >= 2.2244.5
*/
export declare class HistorySyncProgressModel extends Model {
constructor(
proterties?: ModelPropertiesContructor<HistorySyncProgressModel>,
options?: ModelOptions
);
setInProgress(inProgress: boolean): void;
setPaused(paused: boolean): void;
setProgress(progress: number): void;
}

exportModule(
exports,
{
HistorySyncProgressModel: 'HistorySyncProgressModel',
},
(m) => m.HistorySyncProgressModel
);

const fallback = {};

// Lazy load
Object.defineProperty(fallback, 'HistorySyncProgressModel', {
configurable: true,
enumerable: true,
get() {
const sync = getHistorySyncProgress();
return sync.constructor;
},
});

webpack.injectFallbackModule('HistorySyncProgressModel', fallback);
1 change: 1 addition & 0 deletions src/whatsapp/models/index.ts
Expand Up @@ -32,6 +32,7 @@ export * from './ContactModel';
export * from './ConversionTupleModel';
export * from './EmojiVariantModel';
export * from './GroupMetadataModel';
export * from './HistorySyncProgressModel';
export * from './LabelItemModel';
export * from './LabelModel';
export * from './LiveLocationModel';
Expand Down

0 comments on commit 02ee36d

Please sign in to comment.