Skip to content

Commit

Permalink
Update activity on main queue
Browse files Browse the repository at this point in the history
  • Loading branch information
jhersh committed Mar 21, 2015
1 parent b6a4d01 commit 6ba4640
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Example/Podfile.lock
@@ -1,6 +1,6 @@
PODS:
- MXGSynchronizeTest (1.1.0)
- SPLUserActivity (0.1.1)
- SPLUserActivity (0.1.2)

DEPENDENCIES:
- MXGSynchronizeTest
Expand All @@ -12,6 +12,6 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
MXGSynchronizeTest: 8f2f041ca6896caec74463ab43743d97d3dc8c18
SPLUserActivity: 1b3a885c0ce38ef9ff8d1c4e85d8e022e9a5c154
SPLUserActivity: 32c59c4dbb0fdbbf428f3ee46d02e609ab2e3119

COCOAPODS: 0.35.0
COCOAPODS: 0.36.0
2 changes: 1 addition & 1 deletion SPLUserActivity.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SPLUserActivity"
s.version = "0.1.1"
s.version = "0.1.2"
s.summary = "Easily adopt Handoff for different types of activities."
s.homepage = "https://github.com/splinesoft/SPLUserActivity"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
20 changes: 11 additions & 9 deletions SPLUserActivity/SPLWebActivity.m
Expand Up @@ -82,15 +82,17 @@ - (void)invalidate {
- (void)userActivityWillSave:(NSUserActivity *)userActivity {
[super userActivityWillSave:userActivity];

if (self.webKitWebView) {
self.userActivity.webpageURL = self.webKitWebView.URL;
self.userActivity.title = self.webKitWebView.title;
}

if (self.webView) {
self.userActivity.webpageURL = self.webView.request.URL;
self.userActivity.title = [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
dispatch_async(dispatch_get_main_queue(), ^{
if (self.webKitWebView) {
self.userActivity.webpageURL = self.webKitWebView.URL;
self.userActivity.title = self.webKitWebView.title;
}

if (self.webView) {
self.userActivity.webpageURL = self.webView.request.URL;
self.userActivity.title = [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
});
}

#pragma mark - KVO
Expand Down

0 comments on commit 6ba4640

Please sign in to comment.