Skip to content

Commit

Permalink
Open Steam screenshot URLs in image viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Jul 5, 2014
1 parent b75af59 commit 1378fbd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
15 changes: 11 additions & 4 deletions IRCCloud/Classes/URLHandler.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
//
// URLHandler.h
// IRCCloud
//
// Created by Aditya KD on 03/07/14.
// Copyright (c) 2014 IRCCloud, Ltd. All rights reserved.
// Copyright (C) 2013 IRCCloud, Ltd.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>


@interface URLHandler : NSObject <UIAlertViewDelegate>

@property (nonatomic, copy) NSURL *appCallbackURL;
Expand Down
18 changes: 14 additions & 4 deletions IRCCloud/Classes/URLHandler.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
//
// URLHandler.m
// IRCCloud
//
// Created by Aditya KD on 03/07/14.
// Copyright (c) 2014 IRCCloud, Ltd. All rights reserved.
// Copyright (C) 2013 IRCCloud, Ltd.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import "URLHandler.h"
#import "AppDelegate.h"
Expand Down Expand Up @@ -37,11 +45,13 @@ @implementation URLHandler
&& ![url.path.lowercaseString isEqualToString:@"/robots.txt"] \
&& ![url.path.lowercaseString isEqualToString:@"/image"])

#define IS_STEAM(url) ([url.host.lowercaseString hasSuffix:@".steampowered.com"] && [url.path.lowercaseString hasPrefix:@"/ugc/"])

+ (BOOL)isImageURL:(NSURL *)url
{
NSString *l = [url.path lowercaseString];
// Use pre-processor macros instead of variables so conditions are still evaluated lazily
return (HAS_IMAGE_SUFFIX(l) || IS_IMGUR(url) || IS_FLICKR(url) || IS_INSTAGRAM(url) || IS_DROPLR(url) || IS_CLOUDAPP(url));
return (HAS_IMAGE_SUFFIX(l) || IS_IMGUR(url) || IS_FLICKR(url) || IS_INSTAGRAM(url) || IS_DROPLR(url) || IS_CLOUDAPP(url) || IS_STEAM(url));
}

- (void)launchURL:(NSURL *)url
Expand Down

0 comments on commit 1378fbd

Please sign in to comment.