Fixes NSUserActivityDelegate that was called on a background thread thus not working.
This commit is contained in:
parent
76efee675f
commit
c23b4a48ec
1 changed files with 15 additions and 12 deletions
|
@ -38,6 +38,7 @@
|
||||||
[currentActivity_ setWebpageURL:webpageURL];
|
[currentActivity_ setWebpageURL:webpageURL];
|
||||||
[currentActivity_ setDelegate: self];
|
[currentActivity_ setDelegate: self];
|
||||||
[currentActivity_ becomeCurrent];
|
[currentActivity_ becomeCurrent];
|
||||||
|
[currentActivity_ setNeedsSave:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUserActivity*)getCurrentActivity {
|
- (NSUserActivity*)getCurrentActivity {
|
||||||
|
@ -58,26 +59,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateUserActivityState:(NSUserActivity *)userActivity {
|
- (void)userActivityWillSave:(NSUserActivity *)userActivity {
|
||||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
std::unique_ptr<base::DictionaryValue> user_info =
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
std::unique_ptr<base::DictionaryValue> user_info =
|
||||||
|
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
||||||
|
|
||||||
atom::Browser* browser = atom::Browser::Get();
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
browser->UpdateUserActivityState(activity_type, *user_info);
|
browser->UpdateUserActivityState(activity_type, *user_info);
|
||||||
|
});
|
||||||
[userActivity setNeedsSave:YES];
|
[userActivity setNeedsSave:YES];
|
||||||
[super updateUserActivityState:userActivity];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)userActivityWasContinued:(NSUserActivity *)userActivity {
|
- (void)userActivityWasContinued:(NSUserActivity *)userActivity {
|
||||||
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
std::unique_ptr<base::DictionaryValue> user_info =
|
std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType));
|
||||||
|
std::unique_ptr<base::DictionaryValue> user_info =
|
||||||
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
atom::NSDictionaryToDictionaryValue(userActivity.userInfo);
|
||||||
|
|
||||||
atom::Browser* browser = atom::Browser::Get();
|
atom::Browser* browser = atom::Browser::Get();
|
||||||
|
|
||||||
browser->UserActivityWasContinued(activity_type, *user_info);
|
browser->UserActivityWasContinued(activity_type, *user_info);
|
||||||
|
});
|
||||||
[userActivity setNeedsSave:YES];
|
[userActivity setNeedsSave:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue