#include "DADialog.h"
#include "DAAgent.h"
#include "DAMain.h"
#include <xpc/private.h>
static void __DADialogShow( DADiskRef disk, _DAAgentAction action )
{
xpc_object_t message;
message = xpc_dictionary_create( NULL, NULL, 0 );
if ( message )
{
xpc_connection_t connection;
connection = xpc_connection_create_mach_service( _kDAAgentName, NULL, 0 );
if ( connection )
{
CFDataRef serialization;
serialization = DADiskGetSerialization( disk );
xpc_dictionary_set_uint64( message, _kDAAgentActionKey, action );
xpc_dictionary_set_data( message, _kDAAgentDiskKey, CFDataGetBytePtr( serialization ), CFDataGetLength( serialization ) );
xpc_connection_set_event_handler( connection, ^( xpc_object_t object ) { } );
xpc_connection_set_target_uid( connection, gDAConsoleUserUID );
xpc_connection_resume( connection );
xpc_connection_send_message( connection, message );
xpc_release( connection );
}
xpc_release( message );
}
}
void DADialogShowDeviceRemoval( DADiskRef disk )
{
__DADialogShow( disk, _kDAAgentActionShowDeviceRemoval );
}
void DADialogShowDeviceUnreadable( DADiskRef disk )
{
__DADialogShow( disk, _kDAAgentActionShowDeviceUnreadable );
}
void DADialogShowDeviceUnrepairable( DADiskRef disk )
{
__DADialogShow( disk, _kDAAgentActionShowDeviceUnrepairable );
}