This commit is contained in:
23
src/ios.m
23
src/ios.m
@@ -199,9 +199,12 @@ static void _start_initial_load(WKWebView* web_view)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication*)application continueUserActivity:(NSUserActivity*)activity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>>*))restorationHandler
|
- (BOOL)application:(UIApplication*)application
|
||||||
|
continueUserActivity:(NSUserActivity*)activity
|
||||||
|
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>>*))restorationHandler
|
||||||
{
|
{
|
||||||
if ([activity.activityType isEqual:CSSearchableItemActionType]) {
|
if ([activity.activityType isEqual:CSSearchableItemActionType])
|
||||||
|
{
|
||||||
const char* identifier = [[activity.userInfo valueForKey:CSSearchableItemActivityIdentifier] UTF8String];
|
const char* identifier = [[activity.userInfo valueForKey:CSSearchableItemActivityIdentifier] UTF8String];
|
||||||
tf_printf("Jumping to search result: %s.\n", identifier);
|
tf_printf("Jumping to search result: %s.\n", identifier);
|
||||||
|
|
||||||
@@ -210,7 +213,9 @@ static void _start_initial_load(WKWebView* web_view)
|
|||||||
tf_printf("Navigating to %s.", url);
|
tf_printf("Navigating to %s.", url);
|
||||||
ViewController* view_controller = (ViewController*)self.window.rootViewController;
|
ViewController* view_controller = (ViewController*)self.window.rootViewController;
|
||||||
[view_controller.web_view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithUTF8String:url]]]];
|
[view_controller.web_view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithUTF8String:url]]]];
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tf_printf("no search\n");
|
tf_printf("no search\n");
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
@@ -223,11 +228,15 @@ void tf_notify_message_added_ios(const char* identifier, const char* title, cons
|
|||||||
CSSearchableItemAttributeSet* attribute_set = [[CSSearchableItemAttributeSet alloc] initWithContentType:UTTypeText];
|
CSSearchableItemAttributeSet* attribute_set = [[CSSearchableItemAttributeSet alloc] initWithContentType:UTTypeText];
|
||||||
attribute_set.title = [NSString stringWithUTF8String:content];
|
attribute_set.title = [NSString stringWithUTF8String:content];
|
||||||
attribute_set.contentDescription = [NSString stringWithUTF8String:title];
|
attribute_set.contentDescription = [NSString stringWithUTF8String:title];
|
||||||
CSSearchableItem* item = [[CSSearchableItem alloc] initWithUniqueIdentifier:[NSString stringWithUTF8String:identifier] domainIdentifier:@"com.unprompted.tildefriends.messages" attributeSet:attribute_set];
|
CSSearchableItem* item = [[CSSearchableItem alloc] initWithUniqueIdentifier:[NSString stringWithUTF8String:identifier] domainIdentifier:@"com.unprompted.tildefriends.messages"
|
||||||
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[item] completionHandler:^(NSError* _Nullable error) {
|
attributeSet:attribute_set];
|
||||||
if (error) {
|
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[ item ] completionHandler:^(NSError* _Nullable error) {
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
tf_printf("indexing error: %s.\n", [error.localizedDescription UTF8String]);
|
tf_printf("indexing error: %s.\n", [error.localizedDescription UTF8String]);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tf_printf("indexed successfully.\n");
|
tf_printf("indexed successfully.\n");
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user