Skip to content

Commit

Permalink
Update May 27, 2023
Browse files Browse the repository at this point in the history
- Removed asDataSet method (to be implemented in the near future)
  • Loading branch information
rafael-figueiredo-alves committed May 28, 2023
1 parent 9523afa commit 498373e
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Comandos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//auth := TeFirebase.New.Auth('AIzaSyCeUiXhD5rL0QgHoV1C8WkCg17n9n5teew').ChangeProfile('eyJhbGciOiJSUzI1NiIsImtpZCI6ImY4NzZiNzIxNDAwYmZhZmEyOWQ0MTFmZTYwODE2YmRhZWMyM2Iz' + 'ODIiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZXRhc2' + 'tzLWQ2OTg4IiwiYXVkIjoiZXRhc2tzLWQ2OTg4IiwiYXV0aF90aW1lIjoxNjc3NDU1NTEzLCJ1c2VyX2lkIjoiWDZ4bDJ' + 'iYzUwclRCVGpFZXZ4eVNoMVNRYU1iMiIsInN1YiI6Ilg2eGwyYmM1MHJUQlRqRWV2eHlTaDFTUWFNYjIiLCJ' + 'pYXQiOjE2Nzc0NTU1MTMsImV4cCI6MTY3NzQ1OTExMywiZW1haWwiOiJmYW1pbGlhLmFsdmVzMjAxM0BvdX' + 'Rsb29rLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiZmlyZWJhc2UiOnsiaWRlbnRpdGllcyI6eyJlbWFpbCI6WyJmYW1p' + 'bGlhLmFsdmVzMjAxM0BvdXRsb29rLmNvbSJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.V-ERTuN' + 'WPquSwO-LqRSeF_sUsboLOaKdFm7esq1A_8eSmXHBZIp1YlDWHJuxcylcbgSwn2vrQP5xJEQ_AqPIZ' + 'ZGLOLU0khIoW2VM90VZRdYWNbpbnaTr2Du3RswyvXFpOhguEsgehD45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zm4I5AcxczQAmQ' + 'RB3jU_hY8WLPHrhc1svHSx_Hm5difRKEILZlH3cNaoFpfZweC_1V2GCn2g99HbygBWjBSzs4zhby-x5oqYjBkFy9sGusySqX841vt4Y_QDp9r_IDvvgCa77DCHxfo4PEVB_hamDFK-NfiMfQgFE0t3vefZKUHO_Fbk6v1ULjMe6snUwJdiv3XAmCF-8tNkHDPXgEzQ9ACzCvm-lal1VlSr_wjgKul_w');
11 changes: 8 additions & 3 deletions Demos/Simple Demo/UnitMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ interface
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Memo.Types,
FMX.ScrollBox, FMX.Memo, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Edit,
FMX.Objects;
FMX.Objects, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
System.Rtti, FMX.Grid.Style, Data.Bind.EngExt, Fmx.Bind.DBEngExt,
Fmx.Bind.Grid, System.Bindings.Outputs, Fmx.Bind.Editors,
Data.Bind.Components, Data.Bind.Grid, Data.Bind.DBScope, FMX.Grid, Data.DB,
FireDAC.Comp.DataSet, FireDAC.Comp.Client, Datasnap.DBClient;

type
TForm2 = class(TForm)
Expand Down Expand Up @@ -48,8 +53,7 @@ procedure TForm2.Button1Click(Sender: TObject);
auth: ieFirebaseResponseAuth;
begin
auth := TeFirebase.New.Auth('AIzaSyCeUiXhD5rL0QgHoV1C8WkCg17n9n5teew').SignInWithEmailPassword('familia.alves2013@outlook.com', 'Roblox2023');
//auth := TeFirebase.New.Auth('AIzaSyCeUiXhD5rL0QgHoV1C8WkCg17n9n5teew').ChangeProfile('eyJhbGciOiJSUzI1NiIsImtpZCI6ImY4NzZiNzIxNDAwYmZhZmEyOWQ0MTFm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mZTYwODE2YmR' + 'hZWMyM2IzODIiLCJ0eXAiOiJKV1QifQ.eyJuYW1lIjoiRGV2ZWxvcGVycyBBY2NvdW' + '50IiwicGljdHVyZSI6IiIsImlzcyI6Imh0dHBzOi8vc2VjdXJldG9rZW4uZ29vZ2xlLmNvbS9ldGFza3MtZDY5ODgiLCJhdWQiOiJldGFza3MtZDY5ODgiL' + 'CJhdXRoX3RpbWUiOjE2Nzc5NzMxOTcsInVzZXJfaWQiOiJYNnhsMmJjNTByVEJUakVldnh5U2gxU1FhTWIyIiwic3ViIjoiWDZ4bDJiYz' + 'UwclRCVGpFZXZ4eVNoMVNRYU1iMiIsImlhdCI6MTY3Nzk3MzE5NywiZXhwIjoxNjc3OTc2Nzk3LCJlbWFpbCI6ImZhbWlsaWEuYWx2ZXMyMDEzQG91dGxvb2suY29tIiwiZ' + 'W1haWxfdmVyaWZpZWQiOmZhbHNlLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7ImVtYWlsIjpbImZhbWlsaWEuYWx2ZXMyMDEzQG91dGxvb2suY29tIl19LCJzaWduX2luX3Byb' + '3ZpZGVyIjoicGFzc3dvcmQifX0.pZFLjPm6zA7BaUiUVE05ghDNJVaC3WZXlFkrYcEFQAUCr6p18wAaKw8r7_M2XRD-IoYBGNZlPaBj1L8b4eJjTywPHyy6pWkSqvx32t27Qzm4I5AcxczQAmQ' + 'RB3jU_hY8WLPHrhc1svHSx_Hm5difRKEILZlH3cNaoFpfZweC_1V2GCn2g99HbygBWjBSzs4zhby-x5oqYjBkFy9sGusySqX841vt4Y_QDp9r_IDvvgCa77DCHxfo4PEVB_hamDFK-NfiMfQgFE0t3vefZKUHO_Fbk6v1ULjMe6snUwJdiv3XAmCF-8tNkHDPXgEzQ9ACzCvm-lal1VlSr_wjgKul_w');


if auth.StatusCode = 200 then
ShowMessage('Conta apagada com sucesso!');
Expand Down Expand Up @@ -157,6 +161,7 @@ procedure TForm2.Button5Click(Sender: TObject);
if arrJSON.Items[0].TryGetValue<string>('categoria', teste) then
Memo1.Lines.Add(teste);
arrJSON.DisposeOf;

end;

procedure TForm2.FormCreate(Sender: TObject);
Expand Down
37 changes: 37 additions & 0 deletions Demos/Simple Demo/UnitMain.vlb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[Memo1]
Coordinates=292,10,49,51

[Edit1]
Coordinates=129,10,40,51

[Button3]
Coordinates=10,146,53,51

[Label2]
Coordinates=10,10,46,51

[Button5]
Coordinates=148,78,53,51

[Image1]
Coordinates=217,78,49,51

[Button2]
Coordinates=79,78,53,51

[OpenDialog1]
Coordinates=266,155,77,33

[Button4]
Coordinates=10,78,53,51

[Button1]
Coordinates=284,78,53,51

[Label1]
Coordinates=79,146,46,51

[]
Coordinates=239,148,82,33
Visible=True

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ interface
function AsJSONstr: string;
function AsJSONObj: tJSONObject;
function AsJSONArray: TJSONArray;
function AsDataSet(out DataSet: tDataSet) : integer;
{TODO -oRafael -cImplementar : Implementar esta função no futuro, quando descobrir ponto que está dando Access Violation}
//function AsDataSet(out DataSet: tDataSet) : integer;
End;

implementation
Expand All @@ -33,6 +34,13 @@ implementation

{ TeFirebaseRealtimeResponse }

function RemoveQuotes(const text: string) : string;
begin
Result := text.Replace('"', '');
Result := Result.TrimLeft;
Result := Result.TrimRight;
end;

constructor TeFirebaseRealtimeResponse.Create(const Response: string; StatusCode: integer; eTag: string);
begin
fResponse := Response;
Expand Down Expand Up @@ -78,13 +86,6 @@ function TeFirebaseRealtimeResponse.AsJSONArray: TJSONArray;
NewObj : TJSONObject;
Par : integer;
Valor : TJsonObject;

function RemoveQuotes(const text: string) : string;
begin
Result := text.Replace('"', '');
Result := Result.TrimLeft;
Result := Result.TrimRight;
end;
begin
Obj := Self.AsJSONObj;
try
Expand All @@ -107,9 +108,50 @@ function TeFirebaseRealtimeResponse.AsJSONArray: TJSONArray;

end;

function TeFirebaseRealtimeResponse.AsDataSet(out DataSet: tDataSet) : integer;
{function TeFirebaseRealtimeResponse.AsDataSet(out DataSet: tDataSet) : integer;
var
arrJSON : TJSONArray;
Reg : TJSONObject;
I : integer;
Field : TField;
Item : Integer;
Valor : string;
teste : string;
teste1 : Array of TVarRec;
begin
Result := fStatusCode;
end;
arrJSON := AsJSONArray;
try
if (arrJSON.Count > 0) and Assigned(DataSet) then
begin
Reg := arrJSON.Items[0] as TJSONObject;
DataSet.Fields.Clear;
for I := 0 to Reg.Count - 1 do
begin
Field := TStringField.Create(nil);
Field.FieldKind := fkData;
Field.FieldName := RemoveQuotes(Reg.Pairs[i].JsonString.ToString);
DataSet.Fields.Add(Field);
end;
DataSet.Open;
for Item := 0 to arrJSON.Count - 1 do
begin
SetLength(teste1, Reg.Count);
for I := 0 to Reg.Count - 1 do
begin
Valor := EmptyStr;
arrJSON.Items[Item].TryGetValue<string>(RemoveQuotes(Reg.Pairs[i].JsonString.ToString), Valor);
teste1[i] := TVarRec(Valor);
end;
DataSet.AppendRecord(teste1);
end;
end;
finally
arrJSON.DisposeOf;
end;
end;}

end.
3 changes: 2 additions & 1 deletion source/eFirebase.Interfaces.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ interface
function AsJSONstr: string;
function AsJSONObj: tJSONObject;
function AsJSONArray: TJSONArray;
function AsDataSet(out DataSet: tDataSet) : integer;
{TODO -oRafael -cImplementar : Implementar esta função no futuro, quando descobrir ponto que está dando Access Violation}
//function AsDataSet(out DataSet: tDataSet) : integer;
end;
{$Endregion}

Expand Down
2 changes: 1 addition & 1 deletion source/eFirebase.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface
End;

const
eFirebase_VERSION = '0.0.12-a';
eFirebase_VERSION = '0.0.13-a';

implementation

Expand Down

0 comments on commit 498373e

Please sign in to comment.