| 1 |
{%MainUnit castleopendocument.pas} |
| 2 |
{ |
| 3 |
Copyright 2012-2024 Michalis Kamburelis and Lazarus developers. |
| 4 |
|
| 5 |
This file is part of "Castle Game Engine". |
| 6 |
|
| 7 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 8 |
included in this distribution, for details about the copyright. |
| 9 |
Parts of this file are based on Lazarus LCL code, which has |
| 10 |
exactly the same license as our "Castle Game Engine": |
| 11 |
LGPL with static linking exception, see COPYING.txt for details. |
| 12 |
|
| 13 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 16 |
|
| 17 |
---------------------------------------------------------------------------- |
| 18 |
} |
| 19 |
|
| 20 |
{ OpenUrl and OpenDocument implementation using CastleMessaging messages. |
| 21 |
This assumes the application is compiled with a service |
| 22 |
(available for Android or iOS, see |
| 23 |
https://castle-engine.io/android_services |
| 24 |
https://castle-engine.io/ios_services ) |
| 25 |
that receives the message and acts on it. } |
| 26 |
|
| 27 |
{$ifdef read_implementation} |
| 28 |
|
| 29 |
function OpenUrl(AUrl: String): Boolean; |
| 30 |
begin |
| 31 |
Messaging.Send(['view-url', AUrl]); |
| 32 |
Result := true; |
| 33 |
end; |
| 34 |
|
| 35 |
function OpenDocument(APath: String): Boolean; |
| 36 |
begin |
| 37 |
Result := OpenUrl(FilenameToUriSafe(APath)); |
| 38 |
end; |
| 39 |
|
| 40 |
{$endif read_implementation} |