-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
176 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package pocketfhir | ||
|
||
import ( | ||
"log" | ||
) | ||
|
||
// Java Callbacks, make sure to register them before starting pocketbase | ||
// to expose any method to java, add that with FirstLetterCapital | ||
var nativeBridge NativeBridge | ||
|
||
// RegisterNativeBridgeCallback allows setting the NativeBridge interface for callbacks | ||
func RegisterNativeBridgeCallback(c NativeBridge) { | ||
nativeBridge = c | ||
} | ||
|
||
// Helper methods | ||
|
||
// NativeBridge interface to define the methods used for native callbacks | ||
type NativeBridge interface { | ||
handleCallback(string, string) string | ||
} | ||
|
||
// sendCommand sends command to native and returns the response | ||
func sendCommand(command string, data string) string { | ||
if nativeBridge != nil { | ||
log.Printf("[DEBUG] Sending command '%s' with data: %s", command, data) | ||
return nativeBridge.handleCallback(command, data) | ||
} | ||
log.Printf("[DEBUG] No NativeBridge defined. Command '%s' not sent.", command) | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.