You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							38 lines
						
					
					
						
							994 B
						
					
					
				
			
		
		
	
	
							38 lines
						
					
					
						
							994 B
						
					
					
				#include <clipboard/clipboard_plugin.h> | 
						|
#include <flutter/method-channel.h> | 
						|
#include <sys/utsname.h> | 
						|
 | 
						|
void ClipboardPlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) | 
						|
{ | 
						|
    registrar.RegisterMethodChannel("clipboard", | 
						|
                                    MethodCodecType::Standard, | 
						|
                                    [this](const MethodCall &call) { this->onMethodCall(call); }); | 
						|
} | 
						|
 | 
						|
void ClipboardPlugin::onMethodCall(const MethodCall &call) | 
						|
{ | 
						|
    const auto &method = call.GetMethod(); | 
						|
 | 
						|
    if (method == "getPlatformVersion") { | 
						|
        onGetPlatformVersion(call); | 
						|
        return; | 
						|
    } | 
						|
 | 
						|
    unimplemented(call); | 
						|
} | 
						|
 | 
						|
void ClipboardPlugin::onGetPlatformVersion(const MethodCall &call) | 
						|
{ | 
						|
    utsname uname_data{}; | 
						|
    uname(&uname_data); | 
						|
 | 
						|
    std::string preamble = "Aurora (Linux): "; | 
						|
    std::string version = preamble + uname_data.version; | 
						|
 | 
						|
    call.SendSuccessResponse(version); | 
						|
} | 
						|
 | 
						|
void ClipboardPlugin::unimplemented(const MethodCall &call) | 
						|
{ | 
						|
    call.SendSuccessResponse(nullptr); | 
						|
}
 | 
						|
 |