Jump to content

Joe Sansalone

Members
  • Content Count

    92
  • Joined

  • Last visited

Posts posted by Joe Sansalone


  1. I'm simply doing a 

       aRequestInfo.PostStream.Position := 0;

       StringList.LoadFromStream(aRequestInfo.POstStream, TEncoding.UTF8);

     

    to get the content into a string list.

     

    Then, I'll be looping through each line of the stringlist looking for

    Content-Disposition: form-data; name="xxx" and getting the NAME of the parameter (i.e. xxx).

    Then skipping a line and taking every line until --XYzZY, to get the VALUE of the name parameter.

     

    I think it will work for anything without attachments.


  2. Hi,

     

    I have a Indy HTTP server application.

    Currently receiving requests in the format: application/x-www-form-urlencoded.

    (everything works fine, I use the parsed params).

     

    I'm now also receiving Posts from SendGrid: "the post will be multipart/form-data with the email content URL encoded, but the attachments will be in multipart/form-data".

     

    Using the TIdHTTPRequestInfo.PostStream, I'm able to view the payload that they are sending me.

     

    1. Do I need to URLDecode the email content or is it already decoded?

     

    2. Are there any functions/classes to help parse the form-data?

     it looks like this:

     

    --XYzZY

    Content-Disposition: form-data; name="from"

     

    Joe S. <joes1234@gmail.com>

    --XYzZY

    Content-Disposition: form-data; name="text"

     

    Hello,

     

    I'm testing this email.

    Joe

    --XYzZY

    Content-Disposition: form-data; name="to"

     

    mb12345@parsetest.projectone.ca

    --XYzZY

    Content-Disposition: form-data; name="subject"

     

    Subject123

     

     


  3. OK, I got it to work via:

     

    tempBody := 'Param1=' + value1 + '&' + 'Param2=' + value2 + '&' ... etc;  // build the parameters with & in-between each parameter

     

    RestRequest.Params.AddItem('Body1234', tempBody, pkREQUESTBODY, [poDoNotEncode]);

     

    // notice that there needs to be a unique name even for the entire body of parameters.  

     

     


  4. I'm trying to add the same parameter name multiple times with different values (using POST).

    It seems like separating values via semi-colon ; and using poFlatArray only works for a GET request.

     

    FRestRequest.Params.AddItem('MediaUrl', values , TRestRequestParameterKind.pkGETorPOST, [poFlatArray]);

     

    Simply doing multiple AddItem erases previous entry if the parameter name is the same.

    So, How do I add the same parameter multiple times?  

     

     


  5. Hi,

     

    If I set a subscription active in a transaction and then 

    execute "Select * from Table1", how do I check if a field has been updated, 

    or row has been deleted or inserted (other than using IS Updated, or IS Inserted in the SQL).

     

    Is it a new property of TDataSet or TField??

     

    Joe


  6. Hi, I'm looking to use InApp purchase in an iOS and Android app created with Delphi.

     

    According to ChatGPT, the code below will work and also work with for a subscription based purchase.

     

    IS THIS CORRECT?  

     

    uses
      FMX.InAppPurchase;

    var
      InAppPurchase: TInAppPurchase;
      ProductIdentifier: string;

    begin
      InAppPurchase := TInAppPurchase.Create;
      try
        // Set up the product identifier for the consumable IAP
        ProductIdentifier := 'com.yourcompany.yourproduct.consumable';  // <-- if subscription, 'com.yourcompany.yourproduct.subscription';

        // Request product information from the App Store
        InAppPurchase.RequestProductInfo(ProductIdentifier);

        // Wait for the product information to be returned
        while not InAppPurchase.ProductInfoReceived do
        begin
          Application.ProcessMessages;
          Sleep(100);
        end;

        // Check if the product is valid and available for purchase
        if InAppPurchase.ProductValid then
        begin
          // Show the purchase dialog to the user
          InAppPurchase.PurchaseProduct(ProductIdentifier);

          // Wait for the purchase to complete
          while not InAppPurchase.PurchaseComplete do
          begin
            Application.ProcessMessages;
            Sleep(100);
          end;

          // Check if the purchase was successful
          if InAppPurchase.PurchaseSuccess then
          begin
            // Grant the user access to the purchased content
            // or Add the item to the user inventory or  do whatever you want after the purchase
          end
          else
            ShowMessage('Purchase failed');
        end
        else
          ShowMessage('Product not available');
      finally
        InAppPurchase.Free;
      end;
    end;

     

     

    Joe

     


     


  7. Hi,

     

    I remember something in the most recent versions of Delphi, that we can enable iOS mobile 

    app to also include the top statusbar on iPhone ... make it same color like form.

     

    Do we need to set a global var in project source file?  

    If so, what is it?  I totally forgot.

     

    Thanks,

    Joe

     


  8. Hi,

     

    Using Delphi 11.2.

     

    Installed Radiant Shapes from GetIt.  

    Clicking on a class type (ex: TRadiantShape) in code does NOT bring me to the source.

     

    So I put the source location in the Browsing Path.  Still doesn't work.

    I could put the location in the Library Path but then it will compile the units every time.

     

    Isn't the Browsing Path used for jumping into source via editor when the library path has the *.dcu file location?

    This way compiles faster because using DCUs and still can look at source because in Browsing Path.

     

    Is this a 11.2 bug?

     

    Joe

     

     

×