From d4e111742747fff1a10f67e079750db402c5ceb4 Mon Sep 17 00:00:00 2001
From: marcelo-megaonline
<81028641+marcelo-megaonline@users.noreply.github.com>
Date: Wed, 1 Jun 2022 20:46:47 -0300
Subject: [PATCH] GetProfilePicThumb Alterado add ChatID
---
Demo/WPPConnectDemo.dpr | 3 +-
Demo/WPPConnectDemo.dproj | 111 +-------------------------
Demo/uFrDemo.dfm | 1 +
Demo/uFrDemo.pas | 20 ++++-
Demo/uFraGrupos.dfm | 24 ------
Demo/uFraLogin.dfm | 3 -
Source/Model/uTWPPConnect.Classes.pas | 28 ++++++-
Source/Services/uTWPPConnect.pas | 11 ++-
Source/View/uTWPPConnect.Console.pas | 2 +-
9 files changed, 55 insertions(+), 148 deletions(-)
diff --git a/Demo/WPPConnectDemo.dpr b/Demo/WPPConnectDemo.dpr
index f490786..ff6dba2 100644
--- a/Demo/WPPConnectDemo.dpr
+++ b/Demo/WPPConnectDemo.dpr
@@ -13,7 +13,8 @@ uses
uFrDemo in 'uFrDemo.pas' {frDemo},
uFraGrupos in 'uFraGrupos.pas' {frameGrupos: TFrame},
uFraMEnsagensRecebidas in 'uFraMEnsagensRecebidas.pas' {frameMensagensRecebidas: TFrame},
- uFraMensagensEnviadas in 'uFraMensagensEnviadas.pas' {frameMensagensEnviadas: TFrame};
+ uFraMensagensEnviadas in 'uFraMensagensEnviadas.pas' {frameMensagensEnviadas: TFrame},
+ u_Retorno_SendFileMensagem in 'u_Retorno_SendFileMensagem.pas';
{$R *.res}
diff --git a/Demo/WPPConnectDemo.dproj b/Demo/WPPConnectDemo.dproj
index ddf99df..4204e26 100644
--- a/Demo/WPPConnectDemo.dproj
+++ b/Demo/WPPConnectDemo.dproj
@@ -178,6 +178,7 @@
dfm
TFrame
+
Cfg_2
Base
@@ -243,20 +244,12 @@
classes
1
-
- classes
- 1
-
res\xml
1
-
- res\xml
- 1
-
@@ -269,10 +262,6 @@
library\lib\armeabi
1
-
- library\lib\armeabi
- 1
-
@@ -285,20 +274,12 @@
library\lib\mips
1
-
- library\lib\mips
- 1
-
library\lib\armeabi-v7a
1
-
- library\lib\arm64-v8a
- 1
-
@@ -311,200 +292,120 @@
res\drawable
1
-
- res\drawable
- 1
-
res\values
1
-
- res\values
- 1
-
res\values-v21
1
-
- res\values-v21
- 1
-
res\values
1
-
- res\values
- 1
-
res\drawable
1
-
- res\drawable
- 1
-
res\drawable-xxhdpi
1
-
- res\drawable-xxhdpi
- 1
-
res\drawable-ldpi
1
-
- res\drawable-ldpi
- 1
-
res\drawable-mdpi
1
-
- res\drawable-mdpi
- 1
-
res\drawable-hdpi
1
-
- res\drawable-hdpi
- 1
-
res\drawable-xhdpi
1
-
- res\drawable-xhdpi
- 1
-
res\drawable-mdpi
1
-
- res\drawable-mdpi
- 1
-
res\drawable-hdpi
1
-
- res\drawable-hdpi
- 1
-
res\drawable-xhdpi
1
-
- res\drawable-xhdpi
- 1
-
res\drawable-xxhdpi
1
-
- res\drawable-xxhdpi
- 1
-
res\drawable-xxxhdpi
1
-
- res\drawable-xxxhdpi
- 1
-
res\drawable-small
1
-
- res\drawable-small
- 1
-
res\drawable-normal
1
-
- res\drawable-normal
- 1
-
res\drawable-large
1
-
- res\drawable-large
- 1
-
res\drawable-xlarge
1
-
- res\drawable-xlarge
- 1
-
res\values
1
-
- res\values
- 1
-
@@ -593,9 +494,6 @@
0
-
- 0
-
0
@@ -1125,9 +1023,6 @@
1
-
- 1
-
@@ -1230,10 +1125,6 @@
library\lib\armeabi-v7a
1
-
- library\lib\arm64-v8a
- 1
-
1
diff --git a/Demo/uFrDemo.dfm b/Demo/uFrDemo.dfm
index 7cef869..c7837c7 100644
--- a/Demo/uFrDemo.dfm
+++ b/Demo/uFrDemo.dfm
@@ -1782,6 +1782,7 @@ object frDemo: TfrDemo
inherited memo_unReadMessage: TMemo
Width = 1008
Height = 418
+ ExplicitTop = 89
ExplicitWidth = 1008
ExplicitHeight = 418
end
diff --git a/Demo/uFrDemo.pas b/Demo/uFrDemo.pas
index 911e66f..2e73f67 100644
--- a/Demo/uFrDemo.pas
+++ b/Demo/uFrDemo.pas
@@ -70,7 +70,6 @@ TfrDemo = class(TForm)
procedure TWPPConnect1GetUnReadMessages(const Chats: TChatList);
procedure TWPPConnect1GetStatusMessage(const Result
: TResponseStatusMessage);
- procedure TWPPConnect1GetProfilePicThumb(Sender: TObject; Base64: string);
procedure btnAbrirZapClick(Sender: TObject);
procedure ctbtnCategories0Items3Click(Sender: TObject);
procedure ctbtnCategories0Items4Click(Sender: TObject);
@@ -78,6 +77,7 @@ TfrDemo = class(TForm)
procedure TWPPConnect1Get_sendFileMessage(const Mensagem: TMessagesClass);
procedure TWPPConnect1Get_sendListMessage(const Mensagem: TMessagesClass);
procedure TWPPConnect1Get_sendTextMessage(const Mensagem: TMessagesClass);
+ procedure TWPPConnect1GetProfilePicThumb(Sender: TObject; ProfilePicThumb: TResponseGetProfilePicThumb);
private
{ Private declarations }
@@ -498,14 +498,22 @@ procedure TfrDemo.TWPPConnect1GetMyNumber(Sender: TObject);
lblMeuNumero.Caption := 'Meu número: ' + TWPPConnect(Sender).MyNumber;
end;
-procedure TfrDemo.TWPPConnect1GetProfilePicThumb(Sender: TObject;
- Base64: string);
+procedure TfrDemo.TWPPConnect1GetProfilePicThumb(Sender: TObject; ProfilePicThumb: TResponseGetProfilePicThumb);
var
LInput: TMemoryStream;
LOutput: TMemoryStream;
AStr: TStringList;
lThread: TThread;
+ wlo_Celular, wlo_Base64: string;
begin
+ //Necessário Recompilar o Projeto
+
+ wlo_Base64 := ProfilePicThumb.Base64; // imagem
+ wlo_Celular := Copy(ProfilePicThumb.id,1, pos('@', ProfilePicThumb.id) -1); // nr telefone
+
+ //frameMensagensRecebidas1.memo_unReadMessage.Lines.add(wlo_Celular);
+ //frameMensagensRecebidas1.memo_unReadMessage.Lines.add(wlo_Base64);
+
lThread := TThread.CreateAnonymousThread(
procedure
begin
@@ -513,7 +521,7 @@ procedure TfrDemo.TWPPConnect1GetProfilePicThumb(Sender: TObject;
LInput := TMemoryStream.Create;
LOutput := TMemoryStream.Create;
AStr := TStringList.Create;
- AStr.Add(Base64);
+ AStr.Add(wlo_Base64);
AStr.SaveToStream(LInput);
LInput.Position := 0;
TNetEncoding.Base64.Decode( LInput, LOutput );
@@ -728,6 +736,10 @@ procedure TfrDemo.TWPPConnect1GetUnReadMessages(const Chats: TChatList);
frameMensagensRecebidas1.ed_profilePicThumbURL.Text :=
AChat.contact.profilePicThumb;
+ if frameMensagensRecebidas1.ed_profilePicThumbURL.Text <> '' then
+ TWPPConnect1.getProfilePicThumb(AChat.id);
+ //GetImagemProfile(AChat.contact.profilePicThumb, AChat.id);
+
TWPPConnect1.ReadMessages(AChat.id);
// if frameMensagensRecebidas1.chk_AutoResposta.Checked then
diff --git a/Demo/uFraGrupos.dfm b/Demo/uFraGrupos.dfm
index 5d64146..406a6ba 100644
--- a/Demo/uFraGrupos.dfm
+++ b/Demo/uFraGrupos.dfm
@@ -52,8 +52,6 @@ object frameGrupos: TframeGrupos
Top = 262
Width = 23
Height = 22
- ImageIndex = 11
- Images = ImageList1
Flat = True
OnClick = SpeedButton1Click
end
@@ -94,8 +92,6 @@ object frameGrupos: TframeGrupos
Height = 25
Align = alBottom
Caption = 'Criar Grupo'
- ImageIndex = 0
- Images = ImageList1
TabOrder = 2
OnClick = btnCriarGrupoClick
end
@@ -127,8 +123,6 @@ object frameGrupos: TframeGrupos
Height = 25
Align = alBottom
Caption = 'Entrar'
- ImageIndex = 1
- Images = ImageList1
TabOrder = 1
OnClick = btnEntrarLinkClick
end
@@ -177,8 +171,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Listar Grupos'
- ImageIndex = 10
- Images = ImageList1
TabOrder = 0
OnClick = btnListarGruposClick
end
@@ -199,8 +191,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Promover ADM'
- ImageIndex = 4
- Images = ImageList1
TabOrder = 0
OnClick = btnPromoverClick
end
@@ -212,8 +202,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Despromover ADM'
- ImageIndex = 5
- Images = ImageList1
TabOrder = 1
OnClick = btnDespromoverClick
end
@@ -225,8 +213,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Sair do Grupo'
- ImageIndex = 6
- Images = ImageList1
TabOrder = 2
OnClick = BitBtn5Click
end
@@ -238,8 +224,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Deletar Grupo'
- ImageIndex = 7
- Images = ImageList1
TabOrder = 3
OnClick = BitBtn6Click
end
@@ -251,8 +235,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Gerar Link de Convite'
- ImageIndex = 8
- Images = ImageList1
TabOrder = 4
OnClick = btnGerarLinkConviteClick
end
@@ -264,8 +246,6 @@ object frameGrupos: TframeGrupos
Height = 30
Align = alTop
Caption = 'Cancelar Link de Convite'
- ImageIndex = 9
- Images = ImageList1
TabOrder = 5
OnClick = btnCancelaLinkClick
end
@@ -363,8 +343,6 @@ object frameGrupos: TframeGrupos
Height = 32
Hint = 'Remover Participante'
Align = alTop
- ImageIndex = 3
- Images = ImageList1
ParentShowHint = False
ShowHint = True
TabOrder = 0
@@ -397,8 +375,6 @@ object frameGrupos: TframeGrupos
Height = 32
Hint = 'Adicionar Participante'
Align = alCustom
- ImageIndex = 2
- Images = ImageList1
ParentShowHint = False
ShowHint = True
TabOrder = 1
diff --git a/Demo/uFraLogin.dfm b/Demo/uFraLogin.dfm
index 50b40b8..aa175b7 100644
--- a/Demo/uFraLogin.dfm
+++ b/Demo/uFraLogin.dfm
@@ -1328,9 +1328,6 @@ object frameLogin: TframeLogin
Width = 185
Height = 47
Caption = 'Logout'
- HotImageIndex = 1
- ImageIndex = 0
- Images = ImageList1
TabOrder = 1
OnClick = SpeedButton3Click
end
diff --git a/Source/Model/uTWPPConnect.Classes.pas b/Source/Model/uTWPPConnect.Classes.pas
index 4f52338..463dc7b 100644
--- a/Source/Model/uTWPPConnect.Classes.pas
+++ b/Source/Model/uTWPPConnect.Classes.pas
@@ -165,10 +165,21 @@ TResponseCheckIsBeta = class(TClassPadrao)
end;
+ {TResponseGetProfilePicThumb = class(TClassPadrao)
+ private
+ fBase64: String;
+ Public
+ Property Base64 : String Read fBase64 Write fBase64;
+ constructor Create(pAJsonString: string);
+ destructor Destroy; override;
+ end;}
+ //Marcelo 01/06/2022
TResponseGetProfilePicThumb = class(TClassPadrao)
private
+ fID : String;
fBase64: String;
Public
+ Property ID : String read FID write FID;
Property Base64 : String Read fBase64 Write fBase64;
constructor Create(pAJsonString: string);
destructor Destroy; override;
@@ -1681,10 +1692,23 @@ constructor TResponseIsBeta.Create(pAJsonString: string);
{ TResponseGetProfilePicThumb }
-constructor TResponseGetProfilePicThumb.Create(pAJsonString: string);
+{constructor TResponseGetProfilePicThumb.Create(pAJsonString: string);
begin
Base64 := copy(pAJsonString, 34, length(pAJsonString) - 35);
- //Base64 := pAJsonString;
+end;}
+
+//Marcelo 01/06/2022
+constructor TResponseGetProfilePicThumb.Create(pAJsonString: string);
+var
+ lAJsonObj: TJSONValue;
+ v : String;
+begin
+ // TEMI
+// Base64 := copy(pAJsonString, 34, length(pAJsonString) - 35);
+ v := copy(pAJsonString, 11, length(pAJsonString) - 11);
+ inherited Create(v);
+ Base64 := copy(Base64, 23, length(Base64));
+
end;
destructor TResponseGetProfilePicThumb.Destroy;
diff --git a/Source/Services/uTWPPConnect.pas b/Source/Services/uTWPPConnect.pas
index ca06cb9..39e1eed 100644
--- a/Source/Services/uTWPPConnect.pas
+++ b/Source/Services/uTWPPConnect.pas
@@ -38,7 +38,11 @@ interface
TOnGetCheckIsConnected = Procedure(Sender : TObject; Connected: Boolean) of object;
TOnGetCheckIsValidNumber = Procedure(Sender : TObject; Number: String; IsValid: Boolean) of object;
- TOnGetProfilePicThumb = Procedure(Sender : TObject; Base64: String) of object;
+
+ //TOnGetProfilePicThumb = Procedure(Sender : TObject; Base64: String) of object;
+ //Alterado Marcelo 01/06/2022
+ TOnGetProfilePicThumb = Procedure(Sender : TObject; ProfilePicThumb: TResponseGetProfilePicThumb) of object;
+
TGetUnReadMessages = procedure(Const Chats: TChatList) of object;
TOnGetQrCode = procedure(Const Sender: Tobject; Const QrCode: TResultQRCodeClass) of object;
TOnAllContacts = procedure(Const AllContacts: TRetornoAllContacts) of object;
@@ -1408,8 +1412,9 @@ procedure TWPPConnect.Int_OnNotificationCenter(PTypeHeader: TTypeHeader; PValue:
Exit;
- FOnGetProfilePicThumb(Self,
- TResponseGetProfilePicThumb(PReturnClass).Base64);
+ //FOnGetProfilePicThumb(Self, TResponseGetProfilePicThumb(PReturnClass).Base64);
+ //MARCELO 01/06/2022
+ FOnGetProfilePicThumb(Self,TResponseGetProfilePicThumb(PReturnClass));
exit;
end;
diff --git a/Source/View/uTWPPConnect.Console.pas b/Source/View/uTWPPConnect.Console.pas
index f02091b..4110eb3 100644
--- a/Source/View/uTWPPConnect.Console.pas
+++ b/Source/View/uTWPPConnect.Console.pas
@@ -1876,7 +1876,7 @@ procedure TFrmConsole.FormShow(Sender: TObject);
begin
Lbl_Caption.Caption := 'WPPConnect '; //Text_FrmConsole_Caption;
Lbl_Caption.Caption := Lbl_Caption.Caption + ' CEF lib ' + uTWPPConnect.ConfigCEF.GlobalCEFApp.LibCefVersion + ' Chrome ' + uTWPPConnect.ConfigCEF.GlobalCEFApp.ChromeVersion; //+ ' TWPPConnect V. ' + TWPPConnectVersion;
- Lbl_Versao.Caption := 'V. 2.2.2' + ''; //TWPPConnectVersion;
+ Lbl_Versao.Caption := 'V. 2.4.1' + ''; //TWPPConnectVersion;
end;
procedure TFrmConsole.Form_Normal;