git » sdk » commit 6e089c8

Expose Notificatio to C++

author Stephen Paul Weber
2025-05-12 13:28:09 UTC
committer Stephen Paul Weber
2025-05-12 13:36:16 UTC
parent 2df1c55cce1008ca247b6674a39ea00800253451

Expose Notificatio to C++

snikket/Notification.hx +25 -14

diff --git a/snikket/Notification.hx b/snikket/Notification.hx
index 774ab5f..8a7add3 100644
--- a/snikket/Notification.hx
+++ b/snikket/Notification.hx
@@ -4,21 +4,30 @@ import snikket.ChatMessage;
 import snikket.JID;
 import snikket.Message;
 
+#if cpp
+import HaxeCBridge;
+#end
+
 @:expose
+#if cpp
+@:build(HaxeCBridge.expose())
+@:build(HaxeSwiftBridge.expose())
+#end
 class Notification {
-	public var title (default, null) : String;
-	public var body (default, null) : String;
-	public var accountId (default, null) : String;
-	public var chatId (default, null) : String;
-	public var messageId (default, null) : String;
-	public var type (default, null) : MessageType;
-	public var callStatus (default, null) : Null<String>;
-	public var callSid (default, null) : Null<String>;
-	public var imageUri (default, null) : Null<String>;
-	public var lang (default, null) : Null<String>;
-	public var timestamp (default, null) : Null<String>;
+	public final title: String;
+	public final body: String;
+	public final accountId: String;
+	public final chatId: String;
+	public final messageId: String;
+	public final type: MessageType;
+	public final callStatus: Null<String>;
+	public final callSid: Null<String>;
+	public final imageUri: Null<String>;
+	public final lang: Null<String>;
+	public final timestamp: Null<String>;
 
-	public function new(title: String, body: String, accountId: String, chatId: String, messageId: String, type: MessageType, callStatus: Null<String>, callSid: Null<String>, imageUri: Null<String>, lang: Null<String>, timestamp: Null<String>) {
+	@:allow(snikket)
+	private function new(title: String, body: String, accountId: String, chatId: String, messageId: String, type: MessageType, callStatus: Null<String>, callSid: Null<String>, imageUri: Null<String>, lang: Null<String>, timestamp: Null<String>) {
 		this.title = title;
 		this.body = body;
 		this.accountId = accountId;
@@ -32,7 +41,8 @@ class Notification {
 		this.timestamp = timestamp;
 	}
 
-	public static function fromChatMessage(m: ChatMessage) {
+	@:allow(snikket)
+	private static function fromChatMessage(m: ChatMessage) {
 		var imageUri = null;
 		final attachment = m.attachments[0];
 		if (attachment != null) {
@@ -55,7 +65,8 @@ class Notification {
 
 	// Sometimes a stanza has not much in it, so make something generic
 	// Assume it is an incoming message of some kind
-	public static function fromThinStanza(stanza: Stanza) {
+	@:allow(snikket)
+	private static function fromThinStanza(stanza: Stanza) {
 		return new Notification(
 			"New Message",
 			"",