mirror of
https://github.com/tauri-apps/tao.git
synced 2026-01-31 00:35:16 +01:00
fix(macos): Enable applicationSupportsSecureRestorableState = YES (#852)
This commit is contained in:
6
.changes/macos-secure-coding.md
Normal file
6
.changes/macos-secure-coding.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"tao": patch
|
||||
---
|
||||
|
||||
Enable macOS secure state restoration on OS versions that support it. This avoids
|
||||
'WARNING: Secure coding is not enabled for restorable state!' on macOS Sonoma.
|
||||
@@ -8,7 +8,7 @@ use cocoa::base::id;
|
||||
use cocoa::foundation::NSString;
|
||||
use objc::{
|
||||
declare::ClassDecl,
|
||||
runtime::{Class, Object, Sel},
|
||||
runtime::{Class, Object, Sel, BOOL},
|
||||
};
|
||||
use std::{
|
||||
cell::{RefCell, RefMut},
|
||||
@@ -54,6 +54,10 @@ lazy_static! {
|
||||
sel!(application:openURLs:),
|
||||
application_open_urls as extern "C" fn(&Object, Sel, id, id),
|
||||
);
|
||||
decl.add_method(
|
||||
sel!(applicationSupportsSecureRestorableState:),
|
||||
application_supports_secure_restorable_state as extern "C" fn(&Object, Sel, id) -> BOOL,
|
||||
);
|
||||
decl.add_ivar::<*mut c_void>(AUX_DELEGATE_STATE_NAME);
|
||||
|
||||
AppDelegateClass(decl.register())
|
||||
@@ -120,3 +124,9 @@ extern "C" fn application_open_urls(_: &Object, _: Sel, _: id, urls: id) -> () {
|
||||
AppState::open_urls(urls);
|
||||
trace!("Completed `application:openURLs:`");
|
||||
}
|
||||
|
||||
extern "C" fn application_supports_secure_restorable_state(_: &Object, _: Sel, _: id) -> BOOL {
|
||||
trace!("Triggered `applicationSupportsSecureRestorableState`");
|
||||
trace!("Completed `applicationSupportsSecureRestorableState`");
|
||||
objc::runtime::YES
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user