Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Add Open in DuckDuckGo support #278

Open
wants to merge 4 commits into
base: public
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 36 additions & 1 deletion Telegraph/TGOpenInBrowserItems.m
Expand Up @@ -22,6 +22,9 @@ @interface TGOpenInYandexItem : TGOpenInBrowserItem

@end

@interface TGOpenInDuckDuckGoItem : TGOpenInBrowserItem

@end

@interface TGOpenInBrowserItem ()

Expand All @@ -41,7 +44,8 @@ + (NSArray *)appItemsClasses
[TGOpenInChromeItem class],
[TGOpenInFirefoxItem class],
[TGOpenInOperaItem class],
[TGOpenInYandexItem class]
[TGOpenInYandexItem class],
[TGOpenInDuckDuckGoItem class]
];
});
return appItems;
Expand Down Expand Up @@ -258,3 +262,34 @@ + (NSString *)defaultURLScheme
}

@end

@implementation TGOpenInDuckDuckGoItem

- (NSString *)title
{
return @"DuckDuckGo";
}

- (NSInteger)storeIdentifier
{
return 663592361;
}

- (void)performOpenIn
{
NSURL *url = (NSURL *)self.object;
NSString *scheme = [url.scheme lowercaseString];

if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"])
return;

NSURL *openInURL = [NSURL URLWithString:[NSString stringWithFormat:@"ddgquicklink://%@", url.absoluteString]];
[TGOpenInBrowserItem openURL:openInURL];
}

+ (NSString *)defaultURLScheme
{
return @"ddgquicklink";
}

@end
1 change: 1 addition & 0 deletions Telegraph/Telegraph-Info.plist
Expand Up @@ -121,6 +121,7 @@
<string></string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>ddgquicklink</string>
<string>dbapi-3</string>
<string>instagram</string>
<string>googledrive</string>
Expand Down