Merge pull request #52540 from kyoz/3.x

Fix (iOS): Clipboard get/set missing implement
This commit is contained in:
Max Hilbrunner 2021-09-10 18:25:56 +02:00 committed by GitHub
commit 95162ca393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -109,6 +109,9 @@ public:
virtual String get_name() const;
virtual String get_model_name() const;
virtual void set_clipboard(const String &p_text);
virtual String get_clipboard() const;
Error shell_open(String p_uri);
String get_user_data_dir() const;

View File

@ -484,6 +484,16 @@ String OSIPhone::get_name() const {
return "iOS";
}
void OSIPhone::set_clipboard(const String &p_text) {
[UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:p_text.utf8()];
}
String OSIPhone::get_clipboard() const {
NSString *text = [UIPasteboard generalPasteboard].string;
return String::utf8([text UTF8String]);
}
String OSIPhone::get_model_name() const {
String model = ios->get_model();
if (model != "") {