Jump to content

Dave Nottage

Members
  • Content Count

    818
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Dave Nottage

  1. Dave Nottage

    Detect shake gesture on IOS

    I've created a gist here, but also including it in this post: unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Controls.Presentation, System.TypInfo, Macapi.ObjectiveC, Macapi.Helpers, iOSapi.UIKit, iOSapi.Foundation; type IShakeView = interface(UIView) ['{21B0BCE6-8D07-40BA-943C-DC4B1A99D3CA}'] function canBecomeFirstResponder: Boolean; cdecl; procedure motionBegan(motion: UIEventSubtype; withEvent: UIEvent); cdecl; procedure motionEnded(motion: UIEventSubtype; withEvent: UIEvent); cdecl; end; TShakeView = class(TOCLocal) private FOnShake: TNotifyEvent; procedure DoShake; function GetView: UIView; procedure InitView; protected function GetObjectiveCClass: PTypeInfo; override; public { IShakeView } function canBecomeFirstResponder: Boolean; cdecl; procedure motionBegan(motion: UIEventSubtype; withEvent: UIEvent); cdecl; procedure motionEnded(motion: UIEventSubtype; withEvent: UIEvent); cdecl; public constructor Create; procedure BecomeFirstResponder; property View: UIView read GetView; property OnShake: TNotifyEvent read FOnShake write FOnShake; end; TForm1 = class(TForm) Label1: TLabel; Button1: TButton; procedure Button1Click(Sender: TObject); private FShakeView: TShakeView; procedure ShakeViewShakeHandler(Sender: TObject); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; var Form1: TForm1; implementation {$R *.fmx} uses FMX.Platform.iOS; { TShakeView } constructor TShakeView.Create; begin inherited; InitView; end; procedure TShakeView.InitView; var LView: Pointer; begin // Using a zero-sized rect because this view won't actually be seen LView := GetView.initWithFrame(CGRectFromRect(TRectF.Empty)); if GetObjectID <> LView then UpdateObjectID(LView); end; procedure TShakeView.BecomeFirstResponder; begin GetView.becomeFirstResponder; end; function TShakeView.canBecomeFirstResponder: Boolean; begin Result := True; end; procedure TShakeView.DoShake; begin if Assigned(FOnShake) then FOnShake(Self); end; function TShakeView.GetObjectiveCClass: PTypeInfo; begin Result := TypeInfo(IShakeView); end; function TShakeView.GetView: UIView; begin Result := UIView(Super); end; procedure TShakeView.motionBegan(motion: UIEventSubtype; withEvent: UIEvent); begin // end; procedure TShakeView.motionEnded(motion: UIEventSubtype; withEvent: UIEvent); begin if withEvent.subtype = UIEventSubtypeMotionShake then DoShake; end; { TForm1 } constructor TForm1.Create(AOwner: TComponent); begin inherited; FShakeView := TShakeView.Create; FShakeView.OnShake := ShakeViewShakeHandler; WindowHandleToPlatform(Handle).View.addSubview(FShakeView.View); Button1Click(Button1); end; destructor TForm1.Destroy; begin FShakeView.Free; inherited; end; procedure TForm1.Button1Click(Sender: TObject); begin FShakeView.BecomeFirstResponder; Label1.Text := 'Waiting for shake'; end; procedure TForm1.ShakeViewShakeHandler(Sender: TObject); begin Label1.Text := 'Shaked me!'; end; end.
  2. Dave Nottage

    After Update 11.2 libsqlite.a not found IOS

    Please read Darian's answer. It applies to any of the featured files for simulator.
  3. Dave Nottage

    Enable immersive mode on Android 11

    WindowInsetsControllerCompat is part of AndroidX: https://developer.android.com/reference/androidx/core/view/WindowInsetsControllerCompat Being able to use AndroidX with Delphi 10.4.2 would be an immense task - I started down that road, and ended up abandoning the idea. Delphi 11 supports AndroidX, however you would still need to import (e.g. using Java2OP) the WindowInsetsControllerCompat class as it is not in the Android RTL units in Delphi 11. Given the example you linked to, you'd also need to import ViewCompat, and perhaps other classes as well.
  4. Dave Nottage

    Delphi 11 for iOS 16 ?

    You appear to be using an Intel-based Mac. Support for iOS Simulator is for M1 or M2 based Macs only.
  5. Dave Nottage

    Delphi 11 for iOS 16 ?

    As Steve said, try a blank app. Either way, use a debugger to see if you can find where the crash occurs
  6. Dave Nottage

    Can Rad Studio 11.1 and 11.2 coexist?

    I'm interested to know how, since they both use the same folder, i.e.: Program Files (x86)\Embarcadero\Studio\22.0, same registry root etc
  7. Dave Nottage

    Delphi 11 for iOS 16 ?

    Delphi 11.2, Xcode 14, iOS 16 SDK. PAServer 13.2.11.7
  8. Dave Nottage

    Delphi 11 for iOS 16 ?

    A blank app starts fine, here. You could try using the debugger?
  9. Dave Nottage

    post image base64 to whatsapp api

    Is it failing? If so, what's the response? Also, please show how you are encoding the image to base64. If using TNetEncoding.Base64, you may encounter problems because it inserts line breaks by default, which may not be what the API is expecting.
  10. Dave Nottage

    Error Message after Update to 11.2

    The uninstall didn't remove the AppData\Roaming\Embarcadero\BDS\22.0 folder. Delete the AndroidManifest.xml file in that folder, and restart Delphi. You'll also need to delete the AndroidManifest.template.xml file from your project, and rebuild.
  11. Dave Nottage

    The Delphi 11.2 release thread

    Well, I guess you could decide not to cross the street in case the Wonder Of The Seas passes through
  12. Dave Nottage

    The Delphi 11.2 release thread

    Given my experience, I would trust it. The times where there has been a binary compatibility issue between updates has been very rare, and rectified soon after, if it happened at all.
  13. Dave Nottage

    The Delphi 11.2 release thread

    {$IF Declared(RTLVersion111)} {$IF Declared(RTLVersion112)}
  14. Dave Nottage

    Kastri cross-platform library

    There was a "quick fix", however my preference is for something long-term, which I happen to be working on right now. You could try adding this jar to the Android Libraries in the project, however bear in mind the app may still fail depending on what other resources Delphi might deploy.
  15. Dave Nottage

    TTimer limit..

    I'm wondering what happens if your machine goes down or restarts during the timer interval.
  16. Dave Nottage

    Kastri cross-platform library

    Please refer to the updated readme: https://github.com/DelphiWorlds/Kastri/tree/master/Demos/Biometric#readme
  17. Dave Nottage

    Kastri cross-platform library

    You mean Delphi 11.1? Delphi 11.2 is yet to be released. I just checked on my Android 9 device - it appears there is an issue. I'll repost again after I've found a solution. Because it needs to be added to Android 32-bit only. It will apply to both.
  18. Dave Nottage

    Kastri cross-platform library

    There are no such instructions in the readme for that demo project. Doing so is what has caused your problem, as it has re-enabled the jars that need to be disabled. Please re-load the original version of the demo project (BiometricD11)
  19. Dave Nottage

    Execute external program/command and capture output

    I don't have any concrete examples as yet, however there is this: https://github.com/DelphiWorlds/Kastri/blob/master/Core/DW.RunProcess.Mac.pas
  20. Dave Nottage

    Android API31 Rad 11.1

    About 4 weeks ago I submitted an update to an app for review on Google Play Store and it took 4 days. After 2 days I queried the delay (which was unusual because the previous updates were available within hours) and they replied that such delays occur from time to time.
  21. Dave Nottage

    Android API31 Rad 11.1

    Exactly. There should be an option in the Version Info to override what the IDE defaults to (currently 30). I've now added this report to the Quality Portal: https://quality.embarcadero.com/browse/RSP-38976
  22. I'd like to be able to remove a dependency on OpenSSL, which is being used in this routine (original context here😞 class function TgoSSLHelper.Sign_RSASHA256(const AData: TBytes; const APrivateKey: TBytes; out ASignature: TBytes): Boolean; var BIOPrivateKey: PBIO; PrivateKey: PEVP_PKEY; Ctx: PEVP_MD_CTX; SHA256: PEVP_MD; Size: Cardinal; begin BIOPrivateKey := BIO_new_mem_buf(@APrivateKey[0], Length(APrivateKey)); PrivateKey := PEM_read_bio_PrivateKey(BIOPrivateKey, nil, nil, nil); Ctx := EVP_MD_CTX_create; try SHA256 := EVP_sha256; if (EVP_DigestSignInit(Ctx, nil, SHA256, nil, PrivateKey) > 0) and (EVP_DigestUpdate(Ctx, @AData[0], Length(AData)) > 0) and (EVP_DigestSignFinal(Ctx, nil, Size) > 0) then begin SetLength(ASignature, Size); Result := EVP_DigestSignFinal(Ctx, @ASignature[0], Size) > 0; end else Result := False; finally EVP_MD_CTX_destroy(Ctx); end; end; I'm a bit green when it comes to cryptography routines, so I'm not exactly sure what it is doing, and the OpenSSL docs are quite verbose, however my goal is to be able to use another library like LockBox, or DCPCrypt (if it can handle it) so as to remove the dependency on OpenSSL. Can someone help replicate it using LockBox3 or perhaps some other (non-commercial) library, or at least point to which classes should be used?
  23. Thanks, however I'm after something that is cross-platform.
  24. Dave Nottage

    Android API31 Rad 11.1

    The message would be that you need to target API level 31 or more. As pcplayer99 inferred, you will need to modify your AndroidManifest.template.xml, by replacing %targetSdkVersion% with the value: 31. You will also need to add an android:exported="true" attribute to the application node in the same file, so that it looks like this: <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:exported="true" android:launchMode="singleTask"> If you changed your SDK settings in Delphi SDK Manager to use API level 31, you should change them back to API level 30 unless you want to be stuck with other problems in the manifest (when compiling the app)
  25. Dave Nottage

    Run a form on application exit??

    Use OnCloseQuery in the main form, and prevent the main form from closing unless the "exit" form has already been shown. If it hasn't been shown, show it 🙂
×