Jump to content

ToddFrankson

Members
  • Content Count

    40
  • Joined

  • Last visited

  • Days Won

    1

ToddFrankson last won the day on November 29 2024

ToddFrankson had the most liked content!

Community Reputation

3 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ToddFrankson

    Android/IOS push notifications...

    I'm confused now....The Docs say there's no title and body, but you are saying there is, or did you just type the JSON up? Or was this sent thru FCMRebooted?
  2. ToddFrankson

    Android/IOS push notifications...

    So what does PushService.StartupNotifications contain when the App cold starts?
  3. ToddFrankson

    Android/IOS push notifications...

    @Dave Nottage I noticed this in the documentation: Note: The push notification title and body are not available in DataObject when the application is launched (coldstart) by tapping the notification in the Notification Center. So there is no way to display the notification, on a cold start, within the App??
  4. ToddFrankson

    Android/IOS push notifications...

    I was looking to keep track of notifications for the user to be able to look back at them.
  5. ToddFrankson

    Android/IOS push notifications...

    If the App isn't running, and receives the notification, can I, for example, add it to a text file at that point?
  6. ToddFrankson

    Uploading photos to a web host.

    I expect you don't have an SSLHandler, which is required if you are using SSL by setting TLS to Explicit.
  7. ToddFrankson

    Meta-Delphi question about web hosting..

    Not true. most Windows servers run Plesk, which is far better than cpanel.
  8. ToddFrankson

    Android/IOS push notifications...

    I have Push Notifications working just fine....... What I want to do now is the following: When the user taps the notification and the App is closed, I want the App to open and display the Notification within the app(in a TText for example). My problem seems to be that when the notification is tapped, and the app launches, the notification is cleared before the app can open. Is there a way to do what I want?
  9. ToddFrankson

    How to solve System Out of Resources in TScrollBox

    I use an In memory table (TFDMemtable) for somethings I am working on, assigning only the records that will be visible on the screen at any given time. So if I will see 20 -30 items, I reuse the controls, just change the data in them as someone "scrolls" . It's an illusion, but visually it seems extremely fast, and low memory overhead due to only a set number of visual components
  10. ToddFrankson

    MACOS "setDesktopImageURL"

    I think you posted it....I may be mistaken. Here is 1 variation: procedure SetDesktopBackground(const ImagePath: string; const FillColor: TAlphaColor); var Err: NSError; Options: NSMutableDictionary; ImageURL: NSURL; FillColorObj: NSColor; begin // Convert the image file path to NSURL ImageURL := TNSURL.Wrap(TNSURL.OCClass.fileURLWithPath(NSStr(ImagePath))); if ImageURL = nil then begin Showmessage('Failed to create NSURL for the image file.'); Exit; end; // Create a dictionary for desktop image options Options := TNSMutableDictionary.Wrap(TNSMutableDictionary.OCClass.dictionary); // Set the desktop image fill color FillColorObj := TNSColor.Wrap(TNSColor.OCClass.colorWithCalibratedRed( TAlphaColorRec(FillColor).R / 255, TAlphaColorRec(FillColor).G / 255, TAlphaColorRec(FillColor).B / 255, TAlphaColorRec(FillColor).A / 255)); Options.setObject(FillColorObj, NSWorkspaceDesktopImageFillColorKey); // Set the desktop image scaling to none Options.setObject(TNSNumber.Wrap(TNSNumber.OCClass.numberWithInt(NSImageScaleProportionallyUpOrDown)), NSWorkspaceDesktopImageScalingKey); // Set the desktop image for the main screen if not TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace).setDesktopImageURL(ImageURL, TNSScreen.Wrap(TNSScreen.OCClass.mainScreen), Options, @Err) then begin if Err <> nil then Writeln(Format('Error setting desktop background: %s', [NSStrToStr(Err.localizedDescription)])); end; end; It hangs here: Options.setObject(FillColorObj, NSWorkspaceDesktopImageFillColorKey); Here is another: procedure SetDesktopColor(const Color: TAlphaColor); var Err: NSError; Options: NSMutableDictionary; URL: NSURL; TempFile: string; begin // Create a temporary file path for the color image TempFile := TPath.Combine(TPath.GetTempPath, 'SolidColorDesktop.png'); // Create a solid color image CreateSolidColorImage(Color, TempFile); // Load the image as an NSURL URL := TNSURL.Wrap(TNSURL.OCClass.fileURLWithPath(NSStr(TempFile))); if URL = nil then begin Showmessage('Failed to create NSURL for the temporary file.'); Exit; end; // Create a mutable dictionary for desktop image options Options := TNSMutableDictionary.Wrap(TNSMutableDictionary.OCClass.dictionary); // Set the desktop image fill color (not used in this case) Options.setObject(TNSColor.Wrap(TNSColor.OCClass.whiteColor), NSWorkspaceDesktopImageFillColorKey); // Set the desktop image scaling Options.setObject(TNSNumber.Wrap(TNSNumber.OCClass.numberWithInt(NSImageScaleNone)), NSWorkspaceDesktopImageScalingKey); // Set the desktop image for the main screen if not TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace).setDesktopImageURL(URL, TNSScreen.Wrap(TNSScreen.OCClass.mainScreen), Options, @Err) then begin if Err <> nil then Showmessage(Format('Error setting desktop color: %s', [NSStrToStr(Err.localizedDescription)])); end; end; I have tried using NSDictionary in place of NSMutableDictionary, and used the SetValue method. That gives me an Exception in the onButtonUp event deep in FMX code. I tried this to get the current settings: function GetCurrentDesktopImageOptions: TDictionary<string, string>; var Options: NSDictionary; KeyEnumerator: NSEnumerator; Key: Pointer; OptionKey: string; OptionValue: string; ResultDict: TDictionary<string, string>; begin ResultDict := TDictionary<string, string>.Create; try Options := TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace) .desktopImageOptionsForScreen(TNSScreen.Wrap(TNSScreen.OCClass.mainScreen)); if Options <> nil then begin KeyEnumerator := Options.keyEnumerator; while True do begin Key := KeyEnumerator.nextObject; if Key = nil then Break; OptionKey := NSStrToStr(TNSString.Wrap(Key)); OptionValue := NSStrToStr(TNSString.Wrap(Options.objectForKey(Key))); ResultDict.Add(OptionKey, OptionValue); end; end; Result := ResultDict; except ResultDict.Free; raise; end; end; This returns absolutely nothing. What am I doing wrong? I'd love to pass the dictionary with the Scaled image, and background color in the dictionary. Apple documentation gives me a headache. I'm surprised I got this far.....
  11. ToddFrankson

    MACOS "setDesktopImageURL"

    So I have the ability to set the MACOS wallpaper on the current screen using this code (I believe Dave Nottage posted it). procedure SetDesktopBackground(const ImagePath: string; const FillColor: TAlphaColor); var NSFileURL: NSURL; NSWorkspace1: NSWorkspace; MainScreen: NSScreen; Error: NSError; begin try // Convert Delphi file path to NSURL NSFileURL := TNSURL.Wrap(TNSURL.OCClass.fileURLWithPath(StrToNSStr(ImagePath))); NSWorkspace1 := TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace); MainScreen := TNSScreen.Wrap(TNSScreen.OCClass.mainScreen); // Set the desktop image for the main screen if not NSWorkspace1.setDesktopImageURL(NSFileURL, MainScreen, nil, @Error) then begin ShowMessage('Failed to set desktop image: ' + NSStrToStr(Error.localizedDescription)); end; except on E: Exception do begin ShowMessage('Error setting desktop image: ' + E.Message); end; end; end; My problem has been the 3rd parameter in SetDesktopImageURL..... Evidently it takes an NSDictionary. I have spent 3 days attempting to get this part to work with various attempts at translating ObjectiveC and swift code, using my brain and even several AI coding websites. Nothing I seem to do actually builds the dictionary. Can anyone lend me a hand? I have managed to find the following constants (Not defined in Delphi BTW): const NSImageScaleNone = 0; NSImageScaleAxesIndependently = 1; NSImageScaleProportionallyUpOrDown = 2; NSImageScaleProportionallyDown = 3; Here's the Dictionary documentation : https://developer.apple.com/documentation/foundation/nsdictionary?language=objc And the Documentation on the keys in the dictionary(Defined in the constants above): https://developer.apple.com/documentation/appkit/nsworkspace/desktopimageoptionkey?language=objc Thanks If someone could help me understand this, so I can get past it, I'd appreciate it.
  12. ToddFrankson

    Looking for a certain component

    Explain how else you display a sum to the user, without displaying the data in a control This will be good to learn.
  13. ToddFrankson

    TRestRequest and IOS...

    And just like that, Response code of 0 with ZERO code changes. Even the Postman App on IOS fails following the instructions from the website. There's something fishy with REST and IOS
  14. ToddFrankson

    TRestRequest and IOS...

    Got it. It seems IOS had to have a slightly different URL............ The API provider needs better documentation. All is good in the universe again. Thanks for helping me brainstorm
  15. ToddFrankson

    TRestRequest and IOS...

    1-It should be, bu tit is not. Content=''.- Works on all platforms but IOS-I used the REST Debugger to generate the objects. 2-On all other platforms it is, but not on IOS 3- the response code is 0- i have been digging into the HTTPClient in the rest Request. It seems on IOS it's doing a handoff to the OS with a callback. Line 517-522 of System.Net.HTTPClient.mac is where it fails on IOS Emulator (So I can step through the code) LResponse.FDone := False; FDataTasks.AddTask(LRequest.FDataTask, LResponse); try LRequest.FDataTask.resume; while not LResponse.FDone do InternalWaitMessage(0.01); --> This procedure Located at 330-338: procedure InternalWaitMessage(AInterval: Single); var TimeoutDate: NSDate; begin TimeoutDate := TNSDate.Wrap(TNSDate.OCClass.dateWithTimeIntervalSinceNow(AInterval)); TNSRunLoop.Wrap(TNSRunLoop.OCClass.currentRunLoop).runMode(NSDefaultRunLoopMode, TimeoutDate); if TThread.CurrentThread.ThreadID <> MainThreadID then Sleep(Trunc(AInterval * 1000)); end; Lines 1309-on in System.Net.HTTPCLient is where the LResponse.Cancelled is set to true: if LRequest.FCancelled then----->Cancelled is false; Exit; LExecResult := DoExecuteRequest(LRequest, LResponse, AContentStream); if LRequest.FCancelled then--------------Cancelled is true Exit; case LExecResult of TExecutionResult.Success: ------>Status is success, but the exit above spits us out begin if not SameText(LRequest.FMethodString, sHTTPMethodHead) and (LResponse.FStream <> nil) then LResponse.DoReadData(LResponse.FStream); if LRequest.FCancelled then Exit; Status := LResponse.GetStatusCode;------------Status code is 200 but Cancelled set to true means we've exited case Status of 200: begin Break; end; 401: ...... And today I get an SSL error at line 529 of System.Net.HTTPClient.mac: else if LResponse.FError <> nil then-------------------------> raise ENetHTTPClientException.CreateResFmt(@SNetHttpClientErrorAccessing, [LResponse.FError.code, LRequest.FURL.ToString, NSStrToStr(LResponse.FError.localizedDescription)]) End;
×