Merge pull request #9869 from rafaelnobrepd/handoff-enhancements
Exposes more Handoff related APIs to Electron
This commit is contained in:
commit
07840906dd
9 changed files with 275 additions and 4 deletions
|
@ -584,6 +584,18 @@ void App::OnAccessibilitySupportChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
void App::OnWillContinueUserActivity(
|
||||||
|
bool* prevent_default,
|
||||||
|
const std::string& type) {
|
||||||
|
*prevent_default = Emit("will-continue-activity", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::OnDidFailToContinueUserActivity(
|
||||||
|
const std::string& type,
|
||||||
|
const std::string& error) {
|
||||||
|
Emit("continue-activity-error", type, error);
|
||||||
|
}
|
||||||
|
|
||||||
void App::OnContinueUserActivity(
|
void App::OnContinueUserActivity(
|
||||||
bool* prevent_default,
|
bool* prevent_default,
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
|
@ -591,10 +603,22 @@ void App::OnContinueUserActivity(
|
||||||
*prevent_default = Emit("continue-activity", type, user_info);
|
*prevent_default = Emit("continue-activity", type, user_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void App::OnUserActivityWasContinued(
|
||||||
|
const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {
|
||||||
|
Emit("activity-was-continued", type, user_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::OnUpdateUserActivityState(
|
||||||
|
bool* prevent_default,
|
||||||
|
const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {
|
||||||
|
*prevent_default = Emit("update-activity-state", type, user_info);
|
||||||
|
}
|
||||||
|
|
||||||
void App::OnNewWindowForTab() {
|
void App::OnNewWindowForTab() {
|
||||||
Emit("new-window-for-tab");
|
Emit("new-window-for-tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void App::OnLogin(LoginHandler* login_handler,
|
void App::OnLogin(LoginHandler* login_handler,
|
||||||
|
@ -1139,6 +1163,10 @@ void App::BuildPrototype(
|
||||||
base::Bind(&Browser::SetUserActivity, browser))
|
base::Bind(&Browser::SetUserActivity, browser))
|
||||||
.SetMethod("getCurrentActivityType",
|
.SetMethod("getCurrentActivityType",
|
||||||
base::Bind(&Browser::GetCurrentActivityType, browser))
|
base::Bind(&Browser::GetCurrentActivityType, browser))
|
||||||
|
.SetMethod("invalidateCurrentActivity",
|
||||||
|
base::Bind(&Browser::InvalidateCurrentActivity, browser))
|
||||||
|
.SetMethod("updateCurrentActivity",
|
||||||
|
base::Bind(&Browser::UpdateCurrentActivity, browser))
|
||||||
.SetMethod("setAboutPanelOptions",
|
.SetMethod("setAboutPanelOptions",
|
||||||
base::Bind(&Browser::SetAboutPanelOptions, browser))
|
base::Bind(&Browser::SetAboutPanelOptions, browser))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -113,11 +113,23 @@ class App : public AtomBrowserClient::Delegate,
|
||||||
const base::DictionaryValue& request_details) override;
|
const base::DictionaryValue& request_details) override;
|
||||||
void OnAccessibilitySupportChanged() override;
|
void OnAccessibilitySupportChanged() override;
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
void OnWillContinueUserActivity(
|
||||||
|
bool* prevent_default,
|
||||||
|
const std::string& type) override;
|
||||||
|
void OnDidFailToContinueUserActivity(
|
||||||
|
const std::string& type,
|
||||||
|
const std::string& error) override;
|
||||||
void OnContinueUserActivity(
|
void OnContinueUserActivity(
|
||||||
bool* prevent_default,
|
bool* prevent_default,
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const base::DictionaryValue& user_info) override;
|
const base::DictionaryValue& user_info) override;
|
||||||
|
void OnUserActivityWasContinued(
|
||||||
|
const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) override;
|
||||||
|
void OnUpdateUserActivityState(
|
||||||
|
bool* prevent_default,
|
||||||
|
const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) override;
|
||||||
void OnNewWindowForTab() override;
|
void OnNewWindowForTab() override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -119,10 +119,32 @@ class Browser : public WindowListObserver {
|
||||||
// Returns the type name of the current user activity.
|
// Returns the type name of the current user activity.
|
||||||
std::string GetCurrentActivityType();
|
std::string GetCurrentActivityType();
|
||||||
|
|
||||||
|
// Invalidates the current user activity.
|
||||||
|
void InvalidateCurrentActivity();
|
||||||
|
|
||||||
|
// Updates the current user activity
|
||||||
|
void UpdateCurrentActivity(const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info);
|
||||||
|
|
||||||
|
// Indicates that an user activity is about to be resumed.
|
||||||
|
bool WillContinueUserActivity(const std::string& type);
|
||||||
|
|
||||||
|
// Indicates a failure to resume a Handoff activity.
|
||||||
|
void DidFailToContinueUserActivity(const std::string& type,
|
||||||
|
const std::string& error);
|
||||||
|
|
||||||
// Resumes an activity via hand-off.
|
// Resumes an activity via hand-off.
|
||||||
bool ContinueUserActivity(const std::string& type,
|
bool ContinueUserActivity(const std::string& type,
|
||||||
const base::DictionaryValue& user_info);
|
const base::DictionaryValue& user_info);
|
||||||
|
|
||||||
|
// Indicates that an activity was continued on another device.
|
||||||
|
void UserActivityWasContinued(const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info);
|
||||||
|
|
||||||
|
// Gives an oportunity to update the Handoff payload.
|
||||||
|
bool UpdateUserActivityState(const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info);
|
||||||
|
|
||||||
// Bounce the dock icon.
|
// Bounce the dock icon.
|
||||||
enum BounceType {
|
enum BounceType {
|
||||||
BOUNCE_CRITICAL = 0,
|
BOUNCE_CRITICAL = 0,
|
||||||
|
|
|
@ -144,6 +144,30 @@ std::string Browser::GetCurrentActivityType() {
|
||||||
return base::SysNSStringToUTF8(userActivity.activityType);
|
return base::SysNSStringToUTF8(userActivity.activityType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::InvalidateCurrentActivity() {
|
||||||
|
[[AtomApplication sharedApplication] invalidateCurrentActivity];
|
||||||
|
}
|
||||||
|
|
||||||
|
void Browser::UpdateCurrentActivity(const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {
|
||||||
|
[[AtomApplication sharedApplication]
|
||||||
|
updateCurrentActivity:base::SysUTF8ToNSString(type)
|
||||||
|
withUserInfo:DictionaryValueToNSDictionary(user_info)];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Browser::WillContinueUserActivity(const std::string& type) {
|
||||||
|
bool prevent_default = false;
|
||||||
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnWillContinueUserActivity(&prevent_default, type);
|
||||||
|
return prevent_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Browser::DidFailToContinueUserActivity(const std::string& type,
|
||||||
|
const std::string& error) {
|
||||||
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnDidFailToContinueUserActivity(type, error);
|
||||||
|
}
|
||||||
|
|
||||||
bool Browser::ContinueUserActivity(const std::string& type,
|
bool Browser::ContinueUserActivity(const std::string& type,
|
||||||
const base::DictionaryValue& user_info) {
|
const base::DictionaryValue& user_info) {
|
||||||
bool prevent_default = false;
|
bool prevent_default = false;
|
||||||
|
@ -152,6 +176,20 @@ bool Browser::ContinueUserActivity(const std::string& type,
|
||||||
return prevent_default;
|
return prevent_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Browser::UserActivityWasContinued(const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {
|
||||||
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnUserActivityWasContinued(type, user_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Browser::UpdateUserActivityState(const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {
|
||||||
|
bool prevent_default = false;
|
||||||
|
for (BrowserObserver& observer : observers_)
|
||||||
|
observer.OnUpdateUserActivityState(&prevent_default, type, user_info);
|
||||||
|
return prevent_default;
|
||||||
|
}
|
||||||
|
|
||||||
Browser::LoginItemSettings Browser::GetLoginItemSettings(
|
Browser::LoginItemSettings Browser::GetLoginItemSettings(
|
||||||
const LoginItemSettings& options) {
|
const LoginItemSettings& options) {
|
||||||
LoginItemSettings settings;
|
LoginItemSettings settings;
|
||||||
|
|
|
@ -56,12 +56,28 @@ class BrowserObserver {
|
||||||
virtual void OnAccessibilitySupportChanged() {}
|
virtual void OnAccessibilitySupportChanged() {}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
|
// The browser wants to report that an user activity will resume. (macOS only)
|
||||||
|
virtual void OnWillContinueUserActivity(
|
||||||
|
bool* prevent_default,
|
||||||
|
const std::string& type) {}
|
||||||
|
// The browser wants to report an user activity resuming error. (macOS only)
|
||||||
|
virtual void OnDidFailToContinueUserActivity(
|
||||||
|
const std::string& type,
|
||||||
|
const std::string& error) {}
|
||||||
// The browser wants to resume a user activity via handoff. (macOS only)
|
// The browser wants to resume a user activity via handoff. (macOS only)
|
||||||
virtual void OnContinueUserActivity(
|
virtual void OnContinueUserActivity(
|
||||||
bool* prevent_default,
|
bool* prevent_default,
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const base::DictionaryValue& user_info) {}
|
const base::DictionaryValue& user_info) {}
|
||||||
|
// The browser wants to notify that an user activity was resumed. (macOS only)
|
||||||
|
virtual void OnUserActivityWasContinued(
|
||||||
|
const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {}
|
||||||
|
// The browser wants to update an user activity payload. (macOS only)
|
||||||
|
virtual void OnUpdateUserActivityState(
|
||||||
|
bool* prevent_default,
|
||||||
|
const std::string& type,
|
||||||
|
const base::DictionaryValue& user_info) {}
|
||||||
// User clicked the native macOS new tab button. (macOS only)
|
// User clicked the native macOS new tab button. (macOS only)
|
||||||
virtual void OnNewWindowForTab() {}
|
virtual void OnNewWindowForTab() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,10 +6,13 @@
|
||||||
#import "base/mac/scoped_nsobject.h"
|
#import "base/mac/scoped_nsobject.h"
|
||||||
|
|
||||||
@interface AtomApplication : NSApplication<CrAppProtocol,
|
@interface AtomApplication : NSApplication<CrAppProtocol,
|
||||||
CrAppControlProtocol> {
|
CrAppControlProtocol,
|
||||||
|
NSUserActivityDelegate> {
|
||||||
@private
|
@private
|
||||||
BOOL handlingSendEvent_;
|
BOOL handlingSendEvent_;
|
||||||
base::scoped_nsobject<NSUserActivity> currentActivity_;
|
base::scoped_nsobject<NSUserActivity> currentActivity_;
|
||||||
|
NSCondition* handoffLock_;
|
||||||
|
BOOL updateReceived_;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (AtomApplication*)sharedApplication;
|
+ (AtomApplication*)sharedApplication;
|
||||||
|
@ -24,5 +27,8 @@
|
||||||
- (void)setCurrentActivity:(NSString*)type
|
- (void)setCurrentActivity:(NSString*)type
|
||||||
withUserInfo:(NSDictionary*)userInfo
|
withUserInfo:(NSDictionary*)userInfo
|
||||||
withWebpageURL:(NSURL*)webpageURL;
|
withWebpageURL:(NSURL*)webpageURL;
|
||||||
|
- (void)invalidateCurrentActivity;
|
||||||
|
- (void)updateCurrentActivity:(NSString*)type
|
||||||
|
withUserInfo:(NSDictionary*)userInfo;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -4,11 +4,23 @@
|
||||||
|
|
||||||
#import "atom/browser/mac/atom_application.h"
|
#import "atom/browser/mac/atom_application.h"
|
||||||
|
|
||||||
|
#include "atom/browser/mac/dict_util.h"
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "content/public/browser/browser_accessibility_state.h"
|
#include "content/public/browser/browser_accessibility_state.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
|
if ([NSThread isMainThread])
|
||||||
|
block();
|
||||||
|
else
|
||||||
|
dispatch_sync(dispatch_get_main_queue(), block);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
@implementation AtomApplication
|
@implementation AtomApplication
|
||||||
|
|
||||||
+ (AtomApplication*)sharedApplication {
|
+ (AtomApplication*)sharedApplication {
|
||||||
|
@ -35,19 +47,78 @@
|
||||||
[[NSUserActivity alloc] initWithActivityType:type]);
|
[[NSUserActivity alloc] initWithActivityType:type]);
|
||||||
[currentActivity_ setUserInfo:userInfo];
|
[currentActivity_ setUserInfo:userInfo];
|
||||||
[currentActivity_ setWebpageURL:webpageURL];
|
[currentActivity_ setWebpageURL:webpageURL];
|
||||||
|
[currentActivity_ setDelegate:self];
|
||||||
[currentActivity_ becomeCurrent];
|
[currentActivity_ becomeCurrent];
|
||||||
|
[currentActivity_ setNeedsSave:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUserActivity*)getCurrentActivity {
|
- (NSUserActivity*)getCurrentActivity {
|
||||||
return currentActivity_.get();
|
return currentActivity_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)invalidateCurrentActivity {
|
||||||
|
if (currentActivity_) {
|
||||||
|
[currentActivity_ invalidate];
|
||||||
|
currentActivity_.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)updateCurrentActivity:(NSString*)type
|
||||||
|
withUserInfo:(NSDictionary*)userInfo {
|
||||||
|
if (currentActivity_) {
|
||||||
|
[currentActivity_ addUserInfoEntriesFromDictionary:userInfo];
|
||||||
|
}
|
||||||
|
|
||||||
|
[handoffLock_ lock];
|
||||||
|
updateReceived_ = YES;
|
||||||
|
[handoffLock_ signal];
|
||||||
|
[handoffLock_ unlock];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)userActivityWillSave:(NSUserActivity *)userActivity {
|
||||||
|
__block BOOL shouldWait = NO;
|
||||||
|
dispatch_sync_main(^{
|
||||||
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
|
std::unique_ptr<base::DictionaryValue> user_info =
|
||||||
|
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
||||||
|
|
||||||
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
|
shouldWait = browser->UpdateUserActivityState(activity_type, *user_info) ? YES : NO;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (shouldWait) {
|
||||||
|
[handoffLock_ lock];
|
||||||
|
updateReceived_ = NO;
|
||||||
|
while (!updateReceived_) {
|
||||||
|
BOOL isSignaled = [handoffLock_ waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
|
||||||
|
if (!isSignaled) break;
|
||||||
|
}
|
||||||
|
[handoffLock_ unlock];
|
||||||
|
}
|
||||||
|
|
||||||
|
[userActivity setNeedsSave:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)userActivityWasContinued:(NSUserActivity *)userActivity {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
|
std::unique_ptr<base::DictionaryValue> user_info =
|
||||||
|
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
||||||
|
|
||||||
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
|
browser->UserActivityWasContinued(activity_type, *user_info);
|
||||||
|
});
|
||||||
|
[userActivity setNeedsSave:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
[[NSAppleEventManager sharedAppleEventManager]
|
[[NSAppleEventManager sharedAppleEventManager]
|
||||||
setEventHandler:self
|
setEventHandler:self
|
||||||
andSelector:@selector(handleURLEvent:withReplyEvent:)
|
andSelector:@selector(handleURLEvent:withReplyEvent:)
|
||||||
forEventClass:kInternetEventClass
|
forEventClass:kInternetEventClass
|
||||||
andEventID:kAEGetURL];
|
andEventID:kAEGetURL];
|
||||||
|
|
||||||
|
handoffLock_ = [NSCondition new];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleURLEvent:(NSAppleEventDescriptor*)event
|
- (void)handleURLEvent:(NSAppleEventDescriptor*)event
|
||||||
|
|
|
@ -118,6 +118,21 @@ continueUserActivity:(NSUserActivity*)userActivity
|
||||||
return browser->ContinueUserActivity(activity_type, *user_info) ? YES : NO;
|
return browser->ContinueUserActivity(activity_type, *user_info) ? YES : NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)application:(NSApplication*)application willContinueUserActivityWithType:(NSString*)userActivityType {
|
||||||
|
std::string activity_type(base::SysNSStringToUTF8(userActivityType));
|
||||||
|
|
||||||
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
|
return browser->WillContinueUserActivity(activity_type) ? YES : NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)application:(NSApplication*)application didFailToContinueUserActivityWithType:(NSString*)userActivityType error:(NSError*)error {
|
||||||
|
std::string activity_type(base::SysNSStringToUTF8(userActivityType));
|
||||||
|
std::string error_message(base::SysNSStringToUTF8([error localizedDescription]));
|
||||||
|
|
||||||
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
|
browser->DidFailToContinueUserActivity(activity_type, error_message);
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction)newWindowForTab:(id)sender {
|
- (IBAction)newWindowForTab:(id)sender {
|
||||||
atom::Browser::Get()->NewWindowForTab();
|
atom::Browser::Get()->NewWindowForTab();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,53 @@ ID as the activity's source app and that supports the activity's type.
|
||||||
Supported activity types are specified in the app's `Info.plist` under the
|
Supported activity types are specified in the app's `Info.plist` under the
|
||||||
`NSUserActivityTypes` key.
|
`NSUserActivityTypes` key.
|
||||||
|
|
||||||
|
### Event: 'will-continue-activity' _macOS_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `type` String - A string identifying the activity. Maps to
|
||||||
|
[`NSUserActivity.activityType`][activity-type].
|
||||||
|
|
||||||
|
Emitted during [Handoff][handoff] before an activity from a different device wants
|
||||||
|
to be resumed. You should call `event.preventDefault()` if you want to handle
|
||||||
|
this event.
|
||||||
|
|
||||||
|
### Event: 'continue-activity-error' _macOS_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `type` String - A string identifying the activity. Maps to
|
||||||
|
[`NSUserActivity.activityType`][activity-type].
|
||||||
|
* `error` String - A string with the error's localized description.
|
||||||
|
|
||||||
|
Emitted during [Handoff][handoff] when an activity from a different device
|
||||||
|
fails to be resumed.
|
||||||
|
|
||||||
|
### Event: 'activity-was-continued' _macOS_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `type` String - A string identifying the activity. Maps to
|
||||||
|
[`NSUserActivity.activityType`][activity-type].
|
||||||
|
* `userInfo` Object - Contains app-specific state stored by the activity.
|
||||||
|
|
||||||
|
Emitted during [Handoff][handoff] after an activity from this device was successfully
|
||||||
|
resumed on another one.
|
||||||
|
|
||||||
|
### Event: 'update-activity-state' _macOS_
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `event` Event
|
||||||
|
* `type` String - A string identifying the activity. Maps to
|
||||||
|
[`NSUserActivity.activityType`][activity-type].
|
||||||
|
* `userInfo` Object - Contains app-specific state stored by the activity.
|
||||||
|
|
||||||
|
Emitted when [Handoff][handoff] is about to be resumed on another device. If you need to update the state to be transferred, you should call `event.preventDefault()` immediatelly, construct a new `userInfo` dictionary and call `app.updateCurrentActiviy()` in a timely manner. Otherwise the operation will fail and `continue-activity-error` will be called.
|
||||||
|
|
||||||
### Event: 'new-window-for-tab' _macOS_
|
### Event: 'new-window-for-tab' _macOS_
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -748,6 +795,22 @@ is eligible for [Handoff][handoff] to another device afterward.
|
||||||
|
|
||||||
Returns `String` - The type of the currently running activity.
|
Returns `String` - The type of the currently running activity.
|
||||||
|
|
||||||
|
### `app.invalidateCurrentActivity()` _macOS_
|
||||||
|
|
||||||
|
* `type` String - Uniquely identifies the activity. Maps to
|
||||||
|
[`NSUserActivity.activityType`][activity-type].
|
||||||
|
|
||||||
|
Invalidates the current [Handoff][handoff] user activity.
|
||||||
|
|
||||||
|
### `app.updateCurrentActivity(type, userInfo)` _macOS_
|
||||||
|
|
||||||
|
* `type` String - Uniquely identifies the activity. Maps to
|
||||||
|
[`NSUserActivity.activityType`][activity-type].
|
||||||
|
* `userInfo` Object - App-specific state to store for use by another device.
|
||||||
|
|
||||||
|
Updates the current activity if its type matches `type`, merging the entries from
|
||||||
|
`userInfo` into its current `userInfo` dictionary.
|
||||||
|
|
||||||
### `app.setAppUserModelId(id)` _Windows_
|
### `app.setAppUserModelId(id)` _Windows_
|
||||||
|
|
||||||
* `id` String
|
* `id` String
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue