Platform specific service to execute task on the main/UI thread

Property definitions

app :: http_request $ App :: run_on_ui_thread
	# Platform specific service to execute `task` on the main/UI thread
	fun run_on_ui_thread(task: Task) is abstract
lib/app/http_request.nit:44,2--45,45

linux :: http_request $ App :: run_on_ui_thread
	redef fun run_on_ui_thread(task) do gdk_threads_add_idle task
lib/linux/http_request.nit:23,2--62

ios :: http_request $ App :: run_on_ui_thread
	redef fun run_on_ui_thread(task) import Task.main in "ObjC" `{
		Task_incr_ref(task);
		dispatch_async(dispatch_get_main_queue(), ^{
			Task_main(task);
			Task_decr_ref(task);
		});
	`}
lib/ios/http_request.nit:23,2--29,3

android :: http_request $ App :: run_on_ui_thread
	redef fun run_on_ui_thread(task)
	do
		if app.activities.not_empty then
			app.native_activity.run_on_ui_thread task
		else
			# There is no UI, it must be a service, run on the caller thread
			task.main
		end
	end
lib/android/http_request.nit:33,2--41,4