Permalink
Browse files

rename all BVMLinkOpenManager stuff to CDZLinkOpenManager

  • Loading branch information...
1 parent 43ccf7e commit 9bae8b40adee36c8ea505a3323b3914770004862 @cdzombak committed Mar 29, 2013
@@ -53,8 +53,8 @@
93ADFEE1168F487F00F8256C /* BVMAddEditServerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93ADFEE0168F487F00F8256C /* BVMAddEditServerViewController.m */; };
93BADD411683C19900B0CD6F /* UIColor+BVMColors.m in Sources */ = {isa = PBXBuildFile; fileRef = 93BADD401683C19900B0CD6F /* UIColor+BVMColors.m */; };
93BADD481684DE9D00B0CD6F /* BVMAPIResponseParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 93BADD471684DE9D00B0CD6F /* BVMAPIResponseParser.m */; };
- 93E5D84416EE727B00C57111 /* BVMBrowserSelectorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93E5D84316EE727A00C57111 /* BVMBrowserSelectorViewController.m */; };
- 93E5D84716EE73D400C57111 /* BVMLinkOpenManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 93E5D84616EE73D200C57111 /* BVMLinkOpenManager.m */; };
+ 93E5D84416EE727B00C57111 /* CDZBrowserSelectorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93E5D84316EE727A00C57111 /* CDZBrowserSelectorViewController.m */; };
+ 93E5D84716EE73D400C57111 /* CDZLinkOpenManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 93E5D84616EE73D200C57111 /* CDZLinkOpenManager.m */; };
93E5D84916EE83EA00C57111 /* 072-Settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93E5D84816EE83EA00C57111 /* 072-Settings@2x.png */; };
93E5D84B16EE83FE00C57111 /* 072-Settings.png in Resources */ = {isa = PBXBuildFile; fileRef = 93E5D84A16EE83FE00C57111 /* 072-Settings.png */; };
/* End PBXBuildFile section */
@@ -133,10 +133,10 @@
93BADD491684E47A00B0CD6F /* NSError+BVMErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+BVMErrors.h"; sourceTree = "<group>"; };
93BADD4A1684E47A00B0CD6F /* NSError+BVMErrors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError+BVMErrors.m"; sourceTree = "<group>"; };
93BADD4C1684E60A00B0CD6F /* BVMErrorDomain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVMErrorDomain.h; sourceTree = "<group>"; };
- 93E5D84216EE727900C57111 /* BVMBrowserSelectorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVMBrowserSelectorViewController.h; sourceTree = "<group>"; };
- 93E5D84316EE727A00C57111 /* BVMBrowserSelectorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVMBrowserSelectorViewController.m; sourceTree = "<group>"; };
- 93E5D84516EE73D200C57111 /* BVMLinkOpenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVMLinkOpenManager.h; sourceTree = "<group>"; };
- 93E5D84616EE73D200C57111 /* BVMLinkOpenManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVMLinkOpenManager.m; sourceTree = "<group>"; };
+ 93E5D84216EE727900C57111 /* CDZBrowserSelectorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDZBrowserSelectorViewController.h; sourceTree = "<group>"; };
+ 93E5D84316EE727A00C57111 /* CDZBrowserSelectorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDZBrowserSelectorViewController.m; sourceTree = "<group>"; };
+ 93E5D84516EE73D200C57111 /* CDZLinkOpenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDZLinkOpenManager.h; sourceTree = "<group>"; };
+ 93E5D84616EE73D200C57111 /* CDZLinkOpenManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDZLinkOpenManager.m; sourceTree = "<group>"; };
93E5D84816EE83EA00C57111 /* 072-Settings@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "072-Settings@2x.png"; sourceTree = "<group>"; };
93E5D84A16EE83FE00C57111 /* 072-Settings.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "072-Settings.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -203,8 +203,8 @@
937CCC441684F5B70075BD01 /* BVMErrorDomain.m */,
93270A031682726F0013DEB5 /* BVMHumanValueTransformer.h */,
93270A041682726F0013DEB5 /* BVMHumanValueTransformer.m */,
- 93E5D84516EE73D200C57111 /* BVMLinkOpenManager.h */,
- 93E5D84616EE73D200C57111 /* BVMLinkOpenManager.m */,
+ 93E5D84516EE73D200C57111 /* CDZLinkOpenManager.h */,
+ 93E5D84616EE73D200C57111 /* CDZLinkOpenManager.m */,
935FEECF1682BC3700BE3892 /* BVMServersManager.h */,
935FEED01682BC3700BE3892 /* BVMServersManager.m */,
938662D81691F7F60049D6A1 /* CDZViewControllerModalDismissal.h */,
@@ -262,8 +262,8 @@
937CCC70168533700075BD01 /* BVMAboutSettingsViewController.m */,
935FEED51682C87300BE3892 /* BVMAddEditServerViewController.h */,
93ADFEE0168F487F00F8256C /* BVMAddEditServerViewController.m */,
- 93E5D84216EE727900C57111 /* BVMBrowserSelectorViewController.h */,
- 93E5D84316EE727A00C57111 /* BVMBrowserSelectorViewController.m */,
+ 93E5D84216EE727900C57111 /* CDZBrowserSelectorViewController.h */,
+ 93E5D84316EE727A00C57111 /* CDZBrowserSelectorViewController.m */,
9382C96F16E3F36B00191302 /* BVMEmptyDetailViewController.h */,
9382C97016E3F36B00191302 /* BVMEmptyDetailViewController.m */,
9382C97116E3F36B00191302 /* BVMEmptyDetailViewController.xib */,
@@ -445,8 +445,8 @@
93ADFEDD168EB82C00F8256C /* KCMutableDictionary.m in Sources */,
93ADFEE1168F487F00F8256C /* BVMAddEditServerViewController.m in Sources */,
9382C97216E3F36B00191302 /* BVMEmptyDetailViewController.m in Sources */,
- 93E5D84416EE727B00C57111 /* BVMBrowserSelectorViewController.m in Sources */,
- 93E5D84716EE73D400C57111 /* BVMLinkOpenManager.m in Sources */,
+ 93E5D84416EE727B00C57111 /* CDZBrowserSelectorViewController.m in Sources */,
+ 93E5D84716EE73D400C57111 /* CDZLinkOpenManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1,6 +1,6 @@
#import "BVMAboutSettingsViewController.h"
-#import "BVMLinkOpenManager.h"
-#import "BVMBrowserSelectorViewController.h"
+#import "CDZLinkOpenManager.h"
+#import "CDZBrowserSelectorViewController.h"
#import "UIColor+BVMColors.h"
typedef NS_ENUM(NSUInteger, BVMAboutSettingsTableViewSections) {
@@ -89,25 +89,25 @@ - (void)viewDidLoad
- (void)reportIssue
{
NSString *url = @"https://github.com/cdzombak/BuyVMManager-iOS/issues/new";
- [BVMLinkOpenManager openURLString:url];
+ [CDZLinkOpenManager openURLString:url];
}
- (void)openGithubProject
{
NSString *url = @"https://github.com/cdzombak/BuyVMManager-iOS/";
- [BVMLinkOpenManager openURLString:url];
+ [CDZLinkOpenManager openURLString:url];
}
- (void)openStallion
{
NSString *url = @"https://manage.buyvm.net";
- [BVMLinkOpenManager openURLString:url];
+ [CDZLinkOpenManager openURLString:url];
}
- (void)openClientArea
{
NSString *url = @"https://my.frantech.ca";
- [BVMLinkOpenManager openURLString:url];
+ [CDZLinkOpenManager openURLString:url];
}
- (void)doneButtonTapped
@@ -118,7 +118,7 @@ - (void)doneButtonTapped
- (void)pushToBrowserSelector
{
- UIViewController *browserSelector = [[BVMBrowserSelectorViewController alloc] init];
+ UIViewController *browserSelector = [[CDZBrowserSelectorViewController alloc] init];
[self.navigationController pushViewController:browserSelector animated:YES];
}
@@ -1,107 +0,0 @@
-#import "BVMLinkOpenManager.h"
-
-static NSString *kBVMBrowserPrefsKey = @"BVMBrowserPrefsKey";
-
-static NSString *kBVMBrowserNames[BVMNumBrowsers];
-static NSURL *kBVMBrowserTestURLs[BVMNumBrowsers];
-
-__attribute__((constructor)) static void __BVMBrowserConstantsInit(void)
-{
- @autoreleasepool {
- kBVMBrowserNames[BVMBrowserSafari] = NSLocalizedString(@"Safari", nil);
- kBVMBrowserNames[BVMBrowserOnePassword] = NSLocalizedString(@"1Password", nil);
- kBVMBrowserNames[BVMBrowserChrome] = NSLocalizedString(@"Google Chrome", nil);
-
- kBVMBrowserTestURLs[BVMBrowserSafari] = [NSURL URLWithString:@"http://google.com"];
- kBVMBrowserTestURLs[BVMBrowserChrome] = [NSURL URLWithString:@"googlechrome://google.com"];
- kBVMBrowserTestURLs[BVMBrowserOnePassword] = [NSURL URLWithString:@"onepassword://search"];
- }
-}
-
-@implementation BVMLinkOpenManager
-
-#pragma mark Browser availability
-
-+ (BOOL)browserAvailable:(BVMBrowser)browser
-{
- if (browser >= BVMNumBrowsers || browser < 0) {
- NSLog(@"Unknown browser %d in %s", browser, __PRETTY_FUNCTION__);
- return NO;
- }
-
- NSURL *testURL = kBVMBrowserTestURLs[browser];
- return [[UIApplication sharedApplication] canOpenURL:testURL];
-}
-
-#pragma mark Default browser management
-
-+ (BVMBrowser)selectedBrowser {
- // note: if not set, this falls back to 0 == BVMBrowserSafari
- return [[NSUserDefaults standardUserDefaults] integerForKey:kBVMBrowserPrefsKey];
-}
-
-+ (void)setSelectedBrowser:(BVMBrowser)browser
-{
- NSParameterAssert(browser >= 0 && browser < BVMNumBrowsers);
-
- [[NSUserDefaults standardUserDefaults] setInteger:browser forKey:kBVMBrowserPrefsKey];
-}
-
-#pragma mark URL Actions
-
-+ (void)openURL:(NSURL *)url
-{
- NSString *replacementScheme = [BVMLinkOpenManager replacementSchemeForScheme:url.scheme];
-
- if (replacementScheme) {
- // https://developers.google.com/chrome/mobile/docs/ios-links
- NSString *absoluteString = [url absoluteString];
- NSRange rangeForScheme = [absoluteString rangeOfString:@":"];
- NSString *urlNoScheme = [absoluteString substringFromIndex:rangeForScheme.location];
- NSString *replacedURLString = [replacementScheme stringByAppendingString:urlNoScheme];
- url = [NSURL URLWithString:replacedURLString];
- }
-
- [[UIApplication sharedApplication] openURL:url];
-}
-
-+ (void)openURLString:(NSString *)urlString
-{
- [BVMLinkOpenManager openURL:[NSURL URLWithString:urlString]];
-}
-
-+ (NSString *)replacementSchemeForScheme:(NSString *)scheme
-{
- NSString *urlScheme = [scheme lowercaseString];
- NSString *replacementScheme = nil;
-
- BVMBrowser selectedBrowser = [BVMLinkOpenManager selectedBrowser];
- if (selectedBrowser == BVMBrowserSafari) return nil;
-
- if (selectedBrowser == BVMBrowserChrome && ![BVMLinkOpenManager browserAvailable:BVMBrowserChrome]) return nil;
- if (selectedBrowser == BVMBrowserOnePassword && ![BVMLinkOpenManager browserAvailable:BVMBrowserOnePassword]) return nil;
-
- if ([urlScheme isEqualToString:@"http"]) {
- if (selectedBrowser == BVMBrowserOnePassword) replacementScheme = @"ophttp";
- else if (selectedBrowser == BVMBrowserChrome) replacementScheme = @"googlechrome";
- } else if ([urlScheme isEqualToString:@"https"]) {
- if (selectedBrowser == BVMBrowserOnePassword) replacementScheme = @"ophttps";
- else if (selectedBrowser == BVMBrowserChrome) replacementScheme = @"googlechromes";
- }
-
- return replacementScheme;
-}
-
-#pragma mark UI/Naming
-
-+ (NSString *)nameForBrowser:(BVMBrowser)browser
-{
- if (browser >= BVMNumBrowsers || browser < 0) {
- NSLog(@"Unknown browser %d in %s", browser, __PRETTY_FUNCTION__);
- return nil;
- }
-
- return kBVMBrowserNames[browser];
-}
-
-@end
@@ -1,17 +1,17 @@
#import <UIKit/UIKit.h>
-#import "BVMLinkOpenManager.h"
+#import "CDZLinkOpenManager.h"
-typedef void (^BVMBrowserSelectedBlock)(BVMBrowser browser);
+typedef void (^CDZBrowserSelectedBlock)(CDZBrowser browser);
-@interface BVMBrowserSelectorViewController : UITableViewController
+@interface CDZBrowserSelectorViewController : UITableViewController
/**
* This block will be called when the user selects a browser.
*
* You might take this opportunity to dismiss a popover or pop your
* navigation controller, for example.
*/
-@property (nonatomic, copy) BVMBrowserSelectedBlock browserSelectedBlock;
+@property (nonatomic, copy) CDZBrowserSelectedBlock browserSelectedBlock;
/**
* You can customize the UItableView's cell selection style here.
@@ -1,13 +1,13 @@
-#import "BVMBrowserSelectorViewController.h"
+#import "CDZBrowserSelectorViewController.h"
#import "UIColor+BVMColors.h"
-@interface BVMBrowserSelectorViewController ()
+@interface CDZBrowserSelectorViewController ()
@property (nonatomic, strong) NSIndexPath *previouslySelectedIndexPath;
@end
-@implementation BVMBrowserSelectorViewController
+@implementation CDZBrowserSelectorViewController
- (id)init
{
@@ -29,28 +29,28 @@ - (void)viewDidLoad
self.tableViewCellSelectionStyle = UITableViewCellSelectionStyleGray;
CDZWeakSelf weakSelf = self;
- self.browserSelectedBlock = ^(BVMBrowser browser) {
+ self.browserSelectedBlock = ^(CDZBrowser browser) {
[weakSelf.navigationController popViewControllerAnimated:YES];
};
- self.contentSizeForViewInPopover = CGSizeMake(320, 44*BVMNumBrowsers + 20);
+ self.contentSizeForViewInPopover = CGSizeMake(320, 44*CDZNumBrowsers + 20);
}
#pragma mark UI Help
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
- cell.textLabel.text = [BVMLinkOpenManager nameForBrowser:indexPath.row];
+ cell.textLabel.text = [CDZLinkOpenManager nameForBrowser:indexPath.row];
- if ([BVMLinkOpenManager browserAvailable:indexPath.row]) {
+ if ([CDZLinkOpenManager browserAvailable:indexPath.row]) {
cell.textLabel.textColor = [UIColor darkTextColor];
cell.selectionStyle = self.tableViewCellSelectionStyle;
} else {
cell.textLabel.textColor = [UIColor lightGrayColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
- if ([BVMLinkOpenManager selectedBrowser] == indexPath.row) {
+ if ([CDZLinkOpenManager selectedBrowser] == indexPath.row) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
@@ -66,7 +66,7 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
- return BVMNumBrowsers;
+ return CDZNumBrowsers;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -85,8 +85,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
- BVMBrowser selectedBrowser = indexPath.row;
- [BVMLinkOpenManager setSelectedBrowser:selectedBrowser];
+ CDZBrowser selectedBrowser = indexPath.row;
+ [CDZLinkOpenManager setSelectedBrowser:selectedBrowser];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
@@ -104,9 +104,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// hack:
- self.previouslySelectedIndexPath = [NSIndexPath indexPathForRow:[BVMLinkOpenManager selectedBrowser] inSection:0];
+ self.previouslySelectedIndexPath = [NSIndexPath indexPathForRow:[CDZLinkOpenManager selectedBrowser] inSection:0];
- if ([BVMLinkOpenManager browserAvailable:indexPath.row]) return indexPath;
+ if ([CDZLinkOpenManager browserAvailable:indexPath.row]) return indexPath;
else return nil;
}
@@ -1,28 +1,28 @@
#import <Foundation/Foundation.h>
-typedef NS_ENUM(NSInteger, BVMBrowser) {
- BVMBrowserSafari = 0,
- BVMBrowserChrome,
- BVMBrowserOnePassword,
- BVMNumBrowsers
+typedef NS_ENUM(NSInteger, CDZBrowser) {
+ CDZBrowserSafari = 0,
+ CDZBrowserChrome,
+ CDZBrowserOnePassword,
+ CDZNumBrowsers
};
-@interface BVMLinkOpenManager : NSObject
+@interface CDZLinkOpenManager : NSObject
/**
* Returns YES if the given browser is available on this device.
*/
-+ (BOOL)browserAvailable:(BVMBrowser)browser;
++ (BOOL)browserAvailable:(CDZBrowser)browser;
/**
* Returns the user's selected default browser.
*/
-+ (BVMBrowser)selectedBrowser;
++ (CDZBrowser)selectedBrowser;
/**
* Sets the user's selected default browser.
*/
-+ (void)setSelectedBrowser:(BVMBrowser)browser;
++ (void)setSelectedBrowser:(CDZBrowser)browser;
/**
* Opens the given URL.
@@ -35,6 +35,6 @@ typedef NS_ENUM(NSInteger, BVMBrowser) {
/**
* Returns the human-friendly name for the given browser.
*/
-+ (NSString *)nameForBrowser:(BVMBrowser)browser;
++ (NSString *)nameForBrowser:(CDZBrowser)browser;
@end
Oops, something went wrong.

0 comments on commit 9bae8b4

Please sign in to comment.