ios: Expose post text to Core Spotlight search.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 17m54s

This commit is contained in:
2025-11-11 21:40:17 -05:00
parent 0edb76b678
commit 50b2c0c7f4
3 changed files with 65 additions and 3 deletions

View File

@@ -716,6 +716,29 @@ static void _tf_ssb_db_store_message_after_work(tf_ssb_t* ssb, int status, void*
tf_trace_end(trace);
}
#if TARGET_OS_IPHONE
JSContext* context = tf_ssb_get_context(ssb);
JSValue content = JS_ParseJSON(context, store->content, strlen(store->content), NULL);
if (JS_IsObject(content))
{
JSValue type_value = JS_GetPropertyStr(context, content, "type");
const char* type = JS_ToCString(context, type_value);
if (type && strcmp(type, "post") == 0)
{
JSValue text_value = JS_GetPropertyStr(context, content, "text");
const char* text = JS_ToCString(context, text_value);
void tf_notify_message_added_ios(const char* identifier, const char* title, const char* content);
tf_notify_message_added_ios(store->id, type, text);
JS_FreeCString(context, text);
JS_FreeValue(context, text_value);
}
JS_FreeCString(context, type);
JS_FreeValue(context, type_value);
}
JS_FreeValue(context, content);
#endif
if (store->callback)
{
store->callback(store->id, store->out_stored, store->user_data);