├── .gitignore ├── Classes ├── FolderListController.xib ├── MessageDetailController.xib ├── MessageListController.xib ├── NSData+Base64.h ├── NSData+Base64.m ├── NSExtensions.h ├── NSExtensions.m ├── NSURLExtensions.h ├── NSURLExtensions.m ├── SFHFKeychainUtils.h ├── SFHFKeychainUtils.m ├── TextEntryController.xib ├── UIExtensions.h ├── UIExtensions.m ├── UIViewPositioningExtension.h ├── UIViewPositioningExtension.m ├── VBXActivityLabel.h ├── VBXActivityLabel.m ├── VBXAnnotation.h ├── VBXAnnotation.m ├── VBXAppDelegate.h ├── VBXAppDelegate.m ├── VBXAppURL.h ├── VBXAppURL.m ├── VBXAudioControl.h ├── VBXAudioControl.m ├── VBXAudioPlaybackController.h ├── VBXAudioPlaybackController.m ├── VBXButtonCell.h ├── VBXButtonCell.m ├── VBXCache.h ├── VBXCache.m ├── VBXCallerIdController.h ├── VBXCallerIdController.m ├── VBXCellDataSource.h ├── VBXCellDataSource.m ├── VBXConfigAccessor.h ├── VBXConfigAccessor.m ├── VBXConfiguration.h ├── VBXConfiguration.m ├── VBXDataSource.h ├── VBXDataSource.m ├── VBXDialerAccessor.h ├── VBXDialerAccessor.m ├── VBXDialerController.h ├── VBXDialerController.m ├── VBXDimOverlay.h ├── VBXDimOverlay.m ├── VBXFolderDetail.h ├── VBXFolderDetail.m ├── VBXFolderList.h ├── VBXFolderList.m ├── VBXFolderListAccessor.h ├── VBXFolderListAccessor.m ├── VBXFolderListCell.h ├── VBXFolderListCell.m ├── VBXFolderListController.h ├── VBXFolderListController.m ├── VBXFolderSummary.h ├── VBXFolderSummary.m ├── VBXFooterTextCell.h ├── VBXFooterTextCell.m ├── VBXGlobal.h ├── VBXGlobal.m ├── VBXLicenseController.h ├── VBXLicenseController.m ├── VBXLoadMoreCell.h ├── VBXLoadMoreCell.m ├── VBXLoginController.h ├── VBXLoginController.m ├── VBXMaskedImageView.h ├── VBXMaskedImageView.m ├── VBXMessageAttribute.h ├── VBXMessageAttribute.m ├── VBXMessageAttributeAccessor.h ├── VBXMessageAttributeAccessor.m ├── VBXMessageAttributeController.h ├── VBXMessageAttributeController.m ├── VBXMessageDetail.h ├── VBXMessageDetail.m ├── VBXMessageDetailAccessor.h ├── VBXMessageDetailAccessor.m ├── VBXMessageDetailController.h ├── VBXMessageDetailController.m ├── VBXMessageListAccessor.h ├── VBXMessageListAccessor.m ├── VBXMessageListCell.h ├── VBXMessageListCell.m ├── VBXMessageListController.h ├── VBXMessageListController.m ├── VBXMessageSummary.h ├── VBXMessageSummary.m ├── VBXNavigationController.h ├── VBXNavigationController.m ├── VBXObjectBuilder.h ├── VBXObjectBuilder.m ├── VBXOutgoingPhone.h ├── VBXOutgoingPhone.m ├── VBXPerfTimer.h ├── VBXPerfTimer.m ├── VBXResourceLoader.h ├── VBXResourceLoader.m ├── VBXResourceRequest.h ├── VBXResourceRequest.m ├── VBXResult.h ├── VBXResult.m ├── VBXSectionedDataSource.h ├── VBXSectionedDataSource.m ├── VBXSecurityAlertController.h ├── VBXSecurityAlertController.m ├── VBXSendTextController.h ├── VBXSendTextController.m ├── VBXSessionExpiredController.h ├── VBXSessionExpiredController.m ├── VBXSetNumberController.h ├── VBXSetNumberController.m ├── VBXSetServerController.h ├── VBXSetServerController.m ├── VBXSettingsController.h ├── VBXSettingsController.m ├── VBXStatefulTableViewController.h ├── VBXStatefulTableViewController.m ├── VBXStringPartLabel.h ├── VBXStringPartLabel.m ├── VBXSublist.h ├── VBXSublist.m ├── VBXTableStatusView.h ├── VBXTableStatusView.m ├── VBXTableView.h ├── VBXTableView.m ├── VBXTableViewCell.h ├── VBXTableViewCell.m ├── VBXTableViewController.h ├── VBXTableViewController.m ├── VBXTextEntryController.h ├── VBXTextEntryController.m ├── VBXTextFieldCell.h ├── VBXTextFieldCell.m ├── VBXTicketStatus.h ├── VBXTicketStatus.m ├── VBXTrustHelper.h ├── VBXTrustHelper.m ├── VBXURLLoader.h ├── VBXURLLoader.m ├── VBXUser.h ├── VBXUser.m ├── VBXViewCell.h ├── VBXViewCell.m ├── VBXViewController.h └── VBXViewController.m ├── Default.png ├── Entitlements.plist ├── Icon-settings.png ├── Icon.png ├── LICENSE ├── NSDictionary+merge.h ├── NSDictionary+merge.m ├── OpenVBX-Info.plist ├── OpenVBX.xcodeproj └── project.pbxproj ├── OpenVBX_Prefix.pch ├── PCRE ├── README ├── include │ ├── pcre.h │ ├── pcre_internal.h │ ├── pcre_scanner.h │ ├── pcre_stringpiece.h │ ├── pcrecpp.h │ ├── pcrecpp_internal.h │ ├── pcrecpparg.h │ └── pcreposix.h ├── lib │ ├── libpcre.a │ ├── libpcrecpp.a │ └── libpcreposix.a ├── objpcre.h └── objpcre.m ├── README.md ├── Raw ├── Default.psd ├── barbutton.psd ├── dialer.psd ├── dropdown.psd ├── iphone-backspace-button.psd └── mailish-button.psd ├── Resources ├── barbutton.png ├── default-config.json ├── delivery-phone-icon-big.png ├── delivery-phone-icon.png ├── delivery-sms-icon-big.png ├── delivery-sms-icon.png ├── dialer-accessory-key-bg.png ├── dialer-backspace-icon-mask.png ├── dialer-call-bg.png ├── dialer-callerid-bg.png ├── dialer-contacts-icon-mask.png ├── dialer-number-middle-bg.png ├── dialer-number-side-bg.png ├── dialer-numberarea-bg.png ├── dropdown-highlighted.png ├── dropdown-normal.png ├── folder-icon-mask.png ├── gear.png ├── gray-play-button.png ├── inbox-icon-mask.png ├── iphone-call-icon.png ├── iphone-white-arrow.png ├── openvbx-logo.png ├── pause-button.png ├── pause-symbol.png ├── play-button.png ├── play-symbol.png ├── plus-icon.png ├── security-alert-background.png ├── shadow.png ├── stop-symbol.png ├── tableview-grouped-background.png ├── text-button-highlighted.png └── text-button.png ├── Settings.bundle ├── Root.plist └── en.lproj │ └── Root.strings ├── TrustTest.m ├── UnitTests-Info.plist ├── UnitTests └── SublistTest.m ├── VBXError.h ├── VBXError.m ├── VBXUserDefaultsKeys.h ├── VBXUserDefaultsKeys.m ├── VBXVersion.h ├── VBXVersion.m ├── YAJL ├── NSObject+YAJL.h ├── YAJL.h ├── YAJLDocument.h ├── YAJLGen.h ├── YAJLParser.h ├── libYAJLIPhone.a ├── yajl_common.h ├── yajl_gen.h └── yajl_parse.h ├── bump_version.sh ├── hideous-config.json ├── icon-57.png ├── license.html └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | OpenVBX.xcodeproj/*.mode1v3 2 | OpenVBX.xcodeproj/*.pbxuser 3 | build 4 | -------------------------------------------------------------------------------- /Classes/NSData+Base64.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Base64.h 3 | // base64 4 | // 5 | // Created by Matt Gallagher on 2009/06/03. 6 | // Copyright 2009 Matt Gallagher. All rights reserved. 7 | // 8 | // Permission is given to use this source code file, free of charge, in any 9 | // project, commercial or otherwise, entirely at your risk, with the condition 10 | // that any redistribution (in part or whole) of source code must retain 11 | // this copyright and permission notice. Attribution in compiled projects is 12 | // appreciated but not required. 13 | // 14 | 15 | #import 16 | 17 | void *NewBase64Decode( 18 | const char *inputBuffer, 19 | size_t length, 20 | size_t *outputLength); 21 | 22 | char *NewBase64Encode( 23 | const void *inputBuffer, 24 | size_t length, 25 | bool separateLines, 26 | size_t *outputLength); 27 | 28 | @interface NSData (Base64) 29 | 30 | + (NSData *)dataFromBase64String:(NSString *)aString; 31 | - (NSString *)base64EncodedString; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Classes/NSURLExtensions.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface NSURLRequest (Extensions) 25 | 26 | + (NSString *)nameForCachePolicy:(NSURLRequestCachePolicy)policy; 27 | 28 | - (NSString *)description; 29 | 30 | @end 31 | 32 | 33 | @interface NSURLResponse (Extensions) 34 | 35 | - (NSString *)detailedDescription; 36 | 37 | @end 38 | 39 | 40 | @interface NSHTTPURLResponse (Extensions) 41 | 42 | - (NSString *)description; 43 | 44 | - (NSString *)detailedDescription; 45 | 46 | @end 47 | 48 | 49 | @interface NSCachedURLResponse (Extensions) 50 | 51 | + (NSString *)nameForStoragePolicy:(NSURLCacheStoragePolicy)policy; 52 | 53 | - (NSString *)description; 54 | 55 | @end 56 | 57 | 58 | @interface NSURLCache (Extensions) 59 | 60 | - (NSString *)description; 61 | 62 | @end 63 | 64 | 65 | @interface NSURLProtectionSpace (Extensions) 66 | 67 | - (BOOL)matchesURL:(NSURL *)url; 68 | 69 | - (NSString *)description; 70 | 71 | @end 72 | 73 | 74 | @interface NSURLAuthenticationChallenge (Extensions) 75 | 76 | - (NSString *)description; 77 | 78 | @end 79 | 80 | 81 | @interface NSURLCredentialStorage (Extensions) 82 | 83 | - (NSArray *)protectionSpacesMatchingURL:(NSURL *)url realm:(NSString *)realm; 84 | - (NSArray *)usernamesForProtectionSpaces:(NSArray *)spaces; 85 | - (void)removeCredentialsForProtectionSpace:(NSURLProtectionSpace *)space; 86 | - (void)removeCredentialsForProtectionSpaces:(NSArray *)spaces; 87 | 88 | @end 89 | 90 | 91 | @interface NSHTTPCookieStorage (Extensions) 92 | 93 | - (void)deleteCookies:(NSArray *)cookies; 94 | - (void)deleteCookiesForURL:(NSURL *)url; 95 | 96 | @end 97 | 98 | @interface NSURL (Extensions) 99 | 100 | - (NSDictionary *)queryComponents; 101 | 102 | @end 103 | 104 | -------------------------------------------------------------------------------- /Classes/SFHFKeychainUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // SFHFKeychainUtils.h 3 | // 4 | // Created by Buzz Andersen on 10/20/08. 5 | // Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone. 6 | // Copyright 2008 Sci-Fi Hi-Fi. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | 33 | @interface SFHFKeychainUtils : NSObject { 34 | 35 | } 36 | 37 | + (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; 38 | + (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error; 39 | + (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; 40 | 41 | @end -------------------------------------------------------------------------------- /Classes/UIExtensions.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface UIColor (Extensions) 25 | 26 | - (id)initWithDictionary:(NSDictionary *)dictionary; 27 | - (NSString *)hexValue; 28 | - (UIColor *)rgbColor; 29 | 30 | @end 31 | 32 | 33 | @interface UIAlertView (Extensions) 34 | 35 | + (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message; 36 | 37 | + (void)showAlertViewWithErrorMessage:(NSString *)message; 38 | 39 | + (void)showAlertViewWithTitle:(NSString *)title forError:(NSError *)error; 40 | 41 | @end 42 | 43 | 44 | @interface UIBarButtonItem (Extensions) 45 | 46 | + (UIBarButtonItem *)itemWithCustomView:(UIView *)view; 47 | 48 | + (UIBarButtonItem *)flexibleSpace; 49 | 50 | @end 51 | 52 | 53 | @interface UIApplication (Extensions) 54 | 55 | - (void)setStatusBarStyleByName:(NSString *)name; 56 | 57 | @end 58 | 59 | 60 | @interface UIDevice (Extensions) 61 | 62 | - (NSString *)systemIdentifier; 63 | 64 | @end 65 | 66 | @interface UIView (FirstResponderExtensions) 67 | 68 | - (UIView *)findFirstResponder; 69 | 70 | @end -------------------------------------------------------------------------------- /Classes/UIViewPositioningExtension.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @interface UIView (Positioning) 24 | 25 | @property (nonatomic) CGFloat left; 26 | @property (nonatomic) CGFloat right; 27 | @property (nonatomic) CGFloat top; 28 | @property (nonatomic) CGFloat bottom; 29 | 30 | @property (nonatomic) CGFloat width; 31 | @property (nonatomic) CGFloat height; 32 | 33 | @property (nonatomic) CGSize size; 34 | 35 | @property (nonatomic) CGFloat centerX; 36 | @property (nonatomic) CGFloat centerY; 37 | 38 | - (void)centerHorizontallyInView:(UIView *)view; 39 | - (void)centerVerticallyInView:(UIView *)view; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Classes/VBXActivityLabel.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXActivityLabel : UIView { 25 | UIActivityIndicatorView *_activityIndicatorView; 26 | UILabel *_label; 27 | 28 | BOOL _parentHadUserInteractionEnabled; 29 | } 30 | 31 | @property (nonatomic, readonly) UILabel *label; 32 | 33 | - (id)initWithText:(NSString *)text; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Classes/VBXActivityLabel.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXActivityLabel.h" 22 | #import "UIViewPositioningExtension.h" 23 | #import "VBXConfiguration.h" 24 | 25 | @implementation VBXActivityLabel 26 | 27 | @synthesize label = _label; 28 | 29 | - (id)initWithText:(NSString *)text { 30 | if (self = [super initWithFrame:CGRectZero]) { 31 | _label = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; 32 | _label.text = text; 33 | _label.font = [UIFont systemFontOfSize:15.0]; 34 | _label.textColor = ThemedColor(@"activityLabelTextColor", ThemedColor(@"secondaryTextColor", [UIColor darkGrayColor])); 35 | _label.backgroundColor = [UIColor clearColor]; 36 | [_label sizeToFit]; 37 | 38 | _activityIndicatorView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease]; 39 | [_activityIndicatorView startAnimating]; 40 | [_activityIndicatorView sizeToFit]; 41 | 42 | [self addSubview:_label]; 43 | [self addSubview:_activityIndicatorView]; 44 | 45 | self.backgroundColor = ThemedColor(@"activityLabelBackgroundColor", ThemedColor(@"tableViewPlainBackgroundColor", [UIColor whiteColor])); 46 | // Swallow all touch events 47 | self.userInteractionEnabled = YES; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)dealloc { 53 | [super dealloc]; 54 | } 55 | 56 | - (void)layoutSubviews { 57 | const CGFloat spacing = 4; 58 | 59 | CGFloat totalWidth = _label.width + spacing + _activityIndicatorView.width; 60 | 61 | _activityIndicatorView.left = round((self.width / 2) - (totalWidth / 2)); 62 | _activityIndicatorView.top = round((self.height / 2) - (_activityIndicatorView.height / 2)); 63 | 64 | _label.left = _activityIndicatorView.right + spacing; 65 | _label.top = round((self.height / 2) - (_label.height / 2)); 66 | } 67 | 68 | - (void)willMoveToSuperview:(UIView *)newSuperview { 69 | // Take the size of our new parent. 70 | CGRect newFrame = newSuperview.frame; 71 | newFrame.origin.x = 0; 72 | newFrame.origin.y = 0; 73 | self.frame = newFrame; 74 | 75 | // Don't let our parent take our touch events. E.g. This is helpful 76 | // when we're overlayed on top of a UITableView 77 | _parentHadUserInteractionEnabled = newSuperview.userInteractionEnabled; 78 | newSuperview.userInteractionEnabled = NO; 79 | } 80 | 81 | - (void)removeFromSuperview { 82 | self.superview.userInteractionEnabled = _parentHadUserInteractionEnabled; 83 | [super removeFromSuperview]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Classes/VBXAnnotation.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXAnnotation : NSObject { 25 | NSString *_key; 26 | NSString *_messageKey; 27 | NSString *_type; 28 | NSString *_created; 29 | NSString *_userKey; 30 | NSString *_email; 31 | NSString *_firstName; 32 | NSString *_lastName; 33 | NSString *_description; 34 | } 35 | 36 | - (id)initWithDictionary:(NSDictionary *)dictionary; 37 | 38 | @property (nonatomic, retain) NSString *key; 39 | @property (nonatomic, retain) NSString *messageKey; 40 | @property (nonatomic, retain) NSString *type; 41 | @property (nonatomic, retain) NSString *created; 42 | @property (nonatomic, retain) NSString *userKey; 43 | @property (nonatomic, retain) NSString *email; 44 | @property (nonatomic, retain) NSString *firstName; 45 | @property (nonatomic, retain) NSString *lastName; 46 | @property (nonatomic, retain) NSString *description; 47 | 48 | - (NSString *)fullName; 49 | - (NSString *)displayName; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Classes/VBXAnnotation.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXAnnotation.h" 22 | #import "NSExtensions.h" 23 | 24 | 25 | @implementation VBXAnnotation 26 | 27 | - (id)initWithDictionary:(NSDictionary *)dictionary { 28 | if (self = [super init]) { 29 | self.key = [dictionary stringForKey:@"id"]; 30 | self.messageKey = [dictionary stringForKey:@"message_id"]; 31 | self.type = [dictionary stringForKey:@"annotation_type"]; 32 | self.created = [dictionary stringForKey:@"created"]; 33 | self.userKey = [dictionary stringForKey:@"user_id"]; 34 | self.email = [dictionary stringForKey:@"email"]; 35 | self.firstName = [dictionary stringForKey:@"first_name"]; 36 | self.lastName = [dictionary stringForKey:@"last_name"]; 37 | self.description = [dictionary stringForKey:@"description"]; 38 | } 39 | return self; 40 | } 41 | 42 | @synthesize key = _key; 43 | @synthesize messageKey = _messageKey; 44 | @synthesize type = _type; 45 | @synthesize created = _created; 46 | @synthesize userKey = _userKey; 47 | @synthesize email = _email; 48 | @synthesize firstName = _firstName; 49 | @synthesize lastName = _lastName; 50 | @synthesize description = _description; 51 | 52 | - (void)dealloc { 53 | self.key = nil; 54 | self.messageKey = nil; 55 | self.type = nil; 56 | self.created = nil; 57 | self.userKey = nil; 58 | self.email = nil; 59 | self.firstName = nil; 60 | self.lastName = nil; 61 | self.description = nil; 62 | [super dealloc]; 63 | } 64 | 65 | - (NSString *)fullName { 66 | NSMutableString *name = [NSMutableString string]; 67 | if (_firstName) [name appendString:_firstName]; 68 | [name appendString:@" "]; 69 | if (_lastName) [name appendString:_lastName]; 70 | return [name stringByTrimmingWhitespace]; 71 | } 72 | 73 | - (NSString *)displayName { 74 | NSMutableString *name = [NSMutableString stringWithString:[self fullName]]; 75 | if (_email.length > 0) [name appendFormat:@" <%@>", _email]; 76 | return [name stringByTrimmingWhitespace]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Classes/VBXAppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXNavigationController; 24 | @class VBXObjectBuilder; 25 | @class VBXConfigAccessor; 26 | 27 | @interface VBXAppDelegate : NSObject { 28 | UIWindow *_window; 29 | VBXNavigationController *_mainNavigationController; 30 | UINavigationController *_setupNavigationController; 31 | 32 | VBXObjectBuilder *_builder; 33 | NSInteger _outstandingLoads; 34 | 35 | VBXConfigAccessor *_configAccessor; 36 | 37 | BOOL _isHandlingAuthenticationChallenge; 38 | NSMutableArray *_authenticationChallenges; 39 | 40 | int _numberOfFailedLoginAttemptsWithCurrentCredentials; 41 | } 42 | 43 | @property (nonatomic, retain) UIWindow *window; 44 | @property (nonatomic, retain) VBXNavigationController *mainNavigationController; 45 | @property (nonatomic, retain) UINavigationController *setupNavigationController; 46 | 47 | - (void)showMainFlow; 48 | - (void)showSetupFlow; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Classes/VBXAppURL.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXAppURL : NSObject { 25 | 26 | NSString *_host; 27 | NSDictionary *_queryComponents; 28 | NSArray *_pathComponents; 29 | } 30 | 31 | @property (nonatomic, retain) NSString *host; 32 | @property (nonatomic, retain) NSDictionary *queryComponents; 33 | @property (nonatomic, retain) NSArray *pathComponents; 34 | 35 | + (NSDictionary*)route:(NSURL*)launchURL; 36 | - (NSArray*)routeMessages; 37 | - (NSArray*)routeSetup; 38 | - (void) _routeSetup; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Classes/VBXAudioControl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXAudioPlaybackController.h" 23 | 24 | @protocol VBXAudioControlDelegate; 25 | 26 | @interface VBXAudioControl : UIView { 27 | UIButton *_controlButton; 28 | UIActivityIndicatorView *_activityIndicator; 29 | 30 | id _delegate; 31 | id _context; 32 | 33 | BOOL _isPlayButton; 34 | BOOL _isPauseButton; 35 | BOOL _isStopButton; 36 | } 37 | 38 | @property (nonatomic, assign) id delegate; 39 | @property (nonatomic, retain) id context; 40 | 41 | - (void)showPlayButton; 42 | - (void)showPauseButton; 43 | - (void)showStopButton; 44 | 45 | @end 46 | 47 | @protocol VBXAudioControlDelegate 48 | - (void)audioControlDidPressControl:(VBXAudioControl *)audioControl; 49 | @end -------------------------------------------------------------------------------- /Classes/VBXAudioPlaybackController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import 23 | #import "VBXViewController.h" 24 | 25 | @class VBXURLLoader; 26 | @class VBXCache; 27 | @protocol VBXAudioPlaybackControllerDelegate; 28 | 29 | @interface VBXAudioPlaybackController : UIViewController { 30 | NSUserDefaults *userDefaults; 31 | NSString *contentURL; 32 | VBXURLLoader *soundLoader; 33 | VBXCache *cache; 34 | 35 | AVAudioPlayer *audioPlayer; 36 | BOOL interrupted; 37 | BOOL waitingToPlay; 38 | BOOL isPaused; 39 | 40 | BOOL shouldResumePlayOnSliderTouchUp; 41 | 42 | NSString *downloadErrorMessage; 43 | NSString *initErrorMessage; 44 | NSString *playErrorMessage; 45 | 46 | UIView *container; 47 | UIProgressView *progressView; 48 | UISlider *slider; 49 | 50 | id playbackDelegate; 51 | } 52 | 53 | @property (nonatomic, retain) NSString *contentURL; 54 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 55 | @property (nonatomic, retain) VBXCache *cache; 56 | 57 | @property (nonatomic, readonly) BOOL isPaused; 58 | @property (nonatomic, readonly) BOOL isPlaying; 59 | 60 | @property (nonatomic, assign) id playbackDelegate; 61 | 62 | - (void)refresh; 63 | 64 | - (void)play; 65 | - (void)pause; 66 | - (void)stop; 67 | 68 | - (void)setOutputToEarpiece; 69 | - (void)setOutputToSpeaker; 70 | 71 | - (IBAction)playOrPause; 72 | - (IBAction)sliderChanged; 73 | 74 | @end 75 | 76 | @protocol VBXAudioPlaybackControllerDelegate 77 | 78 | - (void)playbackDidPlayOrResume:(VBXAudioPlaybackController *)controller; 79 | - (void)playbackDidPauseOrFinish:(VBXAudioPlaybackController *)controller; 80 | 81 | @end 82 | 83 | -------------------------------------------------------------------------------- /Classes/VBXButtonCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewCell.h" 23 | 24 | @interface VBXButtonCell : VBXTableViewCell { 25 | UILabel *_buttonLabel; 26 | } 27 | 28 | @property (nonatomic, readonly) UILabel *buttonLabel; 29 | 30 | - (id)initwithText:(NSString *)text reuseIdentifier:(NSString *)reuseIdentifier; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/VBXButtonCell.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXButtonCell.h" 22 | #import "UIViewPositioningExtension.h" 23 | 24 | @implementation VBXButtonCell 25 | 26 | @synthesize buttonLabel = _buttonLabel; 27 | 28 | - (id)initwithText:(NSString *)text reuseIdentifier:(NSString *)reuseIdentifier { 29 | if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) { 30 | _buttonLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; 31 | _buttonLabel.text = text; 32 | _buttonLabel.font = [UIFont boldSystemFontOfSize:15.0]; 33 | _buttonLabel.backgroundColor = [UIColor clearColor]; 34 | 35 | [self.contentView addSubview:_buttonLabel]; 36 | [self applyConfig]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)dealloc { 42 | [super dealloc]; 43 | } 44 | 45 | - (void)layoutSubviews { 46 | CGSize size = self.contentView.frame.size; 47 | 48 | [_buttonLabel sizeToFit]; 49 | _buttonLabel.left = round(size.width / 2 - _buttonLabel.width / 2); 50 | _buttonLabel.top = round(size.height / 2 - _buttonLabel.height / 2); 51 | } 52 | 53 | - (void)applyConfig { 54 | [super applyConfig]; 55 | _buttonLabel.textColor = self.textLabel.textColor; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Classes/VBXCache.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @interface VBXCache : NSObject { 24 | NSFileManager *_fileManager; 25 | NSInteger _maxDiskEntries; 26 | NSInteger _numDiskEntries; 27 | NSString *_directoryPath; 28 | NSMutableDictionary *_dictionary; 29 | } 30 | 31 | - (id)initWithFileManager:(NSFileManager *)manager DirectoryPath:(NSString *)path; 32 | 33 | @property (nonatomic, assign) NSInteger maxDiskEntries; 34 | @property (nonatomic, readonly, getter=isEmpty) BOOL empty; 35 | 36 | - (NSData *)dataForKey:(NSString *)key; 37 | - (NSDate *)timestampForDataForKey:(NSString *)key; 38 | - (BOOL)hadTrustedCertificateForDataForKey:(NSString *)key; 39 | 40 | - (void)cacheData:(NSData *)data hadTrustedCertificate:(BOOL)hadTrustedCertificate forKey:(NSString *)key; 41 | - (void)removeDataForKey:(NSString *)key; 42 | - (void)removeAllObjects; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Classes/VBXCallerIdController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXStatefulTableViewController.h" 23 | 24 | @class VBXDialerAccessor; 25 | 26 | @interface VBXCallerIdController : VBXStatefulTableViewController { 27 | NSUserDefaults *_userDefaults; 28 | VBXDialerAccessor *_accessor; 29 | } 30 | 31 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 32 | @property (nonatomic, retain) VBXDialerAccessor *accessor; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Classes/VBXCellDataSource.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXCellDataSource : NSObject { 25 | NSMutableArray *_cells; 26 | } 27 | 28 | @property (nonatomic, retain) NSMutableArray *cells; 29 | 30 | - (id)initWithCells:(NSMutableArray *)cells; 31 | 32 | + (VBXCellDataSource *)dataSourceWithCells:(id)object,...; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Classes/VBXCellDataSource.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXCellDataSource.h" 22 | 23 | 24 | @implementation VBXCellDataSource 25 | 26 | @synthesize cells = _cells; 27 | 28 | + (VBXCellDataSource *)dataSourceWithCells:(id)object,... { 29 | NSMutableArray *cells = [NSMutableArray array]; 30 | va_list ap; 31 | va_start(ap, object); 32 | while (object) { 33 | [cells addObject:object]; 34 | object = va_arg(ap, id); 35 | } 36 | va_end(ap); 37 | 38 | return [[[self alloc] initWithCells:cells] autorelease]; 39 | } 40 | 41 | - (id)initWithCells:(NSMutableArray *)cells { 42 | if (self = [super init]) { 43 | self.cells = cells; 44 | } 45 | return self; 46 | } 47 | 48 | - (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section { 49 | return _cells.count; 50 | } 51 | 52 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 53 | return [_cells objectAtIndex:indexPath.row]; 54 | } 55 | 56 | @end 57 | 58 | -------------------------------------------------------------------------------- /Classes/VBXConfigAccessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXResourceLoader; 24 | @protocol VBXConfigAccessorDelegate; 25 | 26 | @interface VBXConfigAccessor : NSObject { 27 | VBXResourceLoader *_loader; 28 | id _delegate; 29 | } 30 | 31 | @property (nonatomic, retain) VBXResourceLoader *loader; 32 | @property (nonatomic, assign) id delegate; 33 | 34 | 35 | - (void)loadDefaultConfig; 36 | - (void)loadConfig; 37 | - (void)loadConfigUsingCache:(BOOL)usingCache; 38 | 39 | @end 40 | 41 | @protocol VBXConfigAccessorDelegate 42 | 43 | - (void)accessor:(VBXConfigAccessor *)accessor didLoadConfigDictionary:(NSDictionary *)dictionary hadTrustedCertificate:(BOOL)hadTrustedCertificate; 44 | - (void)accessor:(VBXConfigAccessor *)accessor loadFailedWithError:(NSError *)error; 45 | 46 | @end 47 | 48 | -------------------------------------------------------------------------------- /Classes/VBXConfigAccessor.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXConfigAccessor.h" 22 | #import "VBXResourceRequest.h" 23 | #import "VBXResourceLoader.h" 24 | #import "NSExtensions.h" 25 | #import "NSObject+YAJL.h" 26 | #import "NSDictionary+merge.h" 27 | #import "VBXGlobal.h" 28 | #import "VBXConfiguration.h" 29 | 30 | @implementation VBXConfigAccessor 31 | 32 | - (id)init { 33 | if (self = [super init]) { 34 | } 35 | return self; 36 | } 37 | 38 | @synthesize loader = _loader; 39 | @synthesize delegate = _delegate; 40 | 41 | - (void)dealloc { 42 | [_loader cancelAllRequests]; 43 | self.loader = nil; 44 | [super dealloc]; 45 | } 46 | 47 | - (NSDictionary *)defaultConfigDictionary { 48 | NSString* resourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"default-config.json"]; 49 | NSData *defaultConfigData = [NSData dataWithContentsOfFile:resourcePath]; 50 | 51 | NSError *error = nil; 52 | NSDictionary *dict = [defaultConfigData yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:&error]; 53 | 54 | return dict; 55 | } 56 | 57 | - (void)loadConfig { 58 | [self loadConfigUsingCache:YES]; 59 | } 60 | 61 | - (void)loadConfigUsingCache:(BOOL)usingCache { 62 | _loader.target = self; 63 | _loader.successAction = @selector(loader:didLoadObject:fromCache:hadTrustedCertificate:); 64 | [_loader loadRequest:[VBXResourceRequest requestWithResource:@"client?with_i18n=1&type=iphone"] usingCache:usingCache]; 65 | } 66 | 67 | - (void)loader:(VBXResourceLoader *)loader didLoadObject:(id)object fromCache:(BOOL)fromCache hadTrustedCertificate:(BOOL)hadTrustedCertificate { 68 | debug(@"%@", object); 69 | NSString *version = [object stringForKey:@"version"]; 70 | if(!version) 71 | version = @"0.0"; // Could not find version, lets make it as old as it can be. 72 | NSDictionary *serverConfig = [NSDictionary dictionaryWithObject:version forKey:@"version"]; 73 | 74 | if (_delegate != nil) { 75 | [_delegate accessor:self didLoadConfigDictionary:[NSDictionary dictionaryByMerging:serverConfig with:[self defaultConfigDictionary]] hadTrustedCertificate:(BOOL)hadTrustedCertificate]; 76 | } 77 | } 78 | 79 | - (void)loader:(VBXResourceLoader *)loader didFailWithError:(NSError *)error { 80 | debug(@"%@", [error detailedDescription]); 81 | 82 | if (_delegate != nil) { 83 | [_delegate accessor:self loadFailedWithError:error]; 84 | } 85 | } 86 | 87 | - (void)loadDefaultConfig { 88 | [[VBXConfiguration sharedConfiguration] loadConfigFromDictionary:[self defaultConfigDictionary] serverURL:nil hadTrustedCertificate:NO]; 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Classes/VBXConfiguration.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXGlobal.h" 23 | 24 | VBXHSL ThemedHSL(NSString *key, VBXHSL defaultHSL); 25 | UIColor *ThemedColor(NSString *key, UIColor *defaultValue); 26 | UIImage *ThemedImage(NSString *key, NSString *localFileName); 27 | 28 | /** 29 | * Just like NSLocalizedString, but pulls from our strings dictionary instead of using the normal localization 30 | * machinery. 31 | */ 32 | NSString *LocalizedString(NSString *str, NSString *comment); 33 | 34 | 35 | @protocol VBXConfigurable; 36 | 37 | @interface VBXConfiguration : NSObject { 38 | NSMutableArray *_observers; 39 | NSMutableDictionary *_dict; 40 | } 41 | 42 | + (VBXConfiguration *)sharedConfiguration; 43 | 44 | - (void)loadConfigFromDictionary:(NSDictionary *)dict serverURL:(NSString *)serverURL hadTrustedCertificate:(BOOL)hadTrustedCertificate; 45 | - (NSDictionary *)dictionary; 46 | 47 | /** 48 | * Adds the observer to a list of observers that will be notified whenever 49 | * a new configuration is loaded. 50 | */ 51 | - (void)addConfigObserver:(id)observer; 52 | 53 | /** 54 | * Removes the obeserver from the list of observers that get notified 55 | * when a new configuration is loaded. 56 | */ 57 | - (void)removeConfigObserver:(id)observer; 58 | 59 | - (NSString *)localizedStringForKey:(NSString *)key; 60 | - (NSString *)localizedStringForKey:(NSString *)key defaultValue:(NSString *)defaultValue; 61 | - (UIColor *)colorForKey:(NSString *)key; 62 | - (UIColor *)colorForKey:(NSString *)key defaultValue:(UIColor *)defaultValue; 63 | - (VBXHSL)HSLForKey:(NSString *)key defaultHSL:(VBXHSL)defaultHSL; 64 | - (UIStatusBarStyle)statusBarStyleForKey:(NSString *)key defaultValue:(UIStatusBarStyle)defaultValue; 65 | - (UITableViewCellSelectionStyle)tableViewCellSelectionStyleForKey:(NSString *)key defaultValue:(UIStatusBarStyle)defaultValue; 66 | - (UIImage *)imageForKey:(NSString *)key defaultImageFileName:(NSString *)defaultImageFileName; 67 | 68 | @end 69 | 70 | @protocol VBXConfigurable 71 | @required 72 | /** 73 | * Called after a new configuration has been loaded. Implementations should re-assign whatever 74 | * colors or style attributes they're using, as well as reload any strings. 75 | */ 76 | - (void)applyConfig; 77 | 78 | @end -------------------------------------------------------------------------------- /Classes/VBXDataSource.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXDataSource : NSObject { 25 | id _proxyToDelegate; 26 | } 27 | 28 | @property (nonatomic, assign) id proxyToDelegate; 29 | 30 | @end 31 | 32 | @protocol VBXVariableHeightCell 33 | - (CGFloat)heightForCell; 34 | @end -------------------------------------------------------------------------------- /Classes/VBXDialerAccessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXResult; 24 | @class VBXResourceLoader; 25 | 26 | @protocol VBXDialerAccessorDelegate; 27 | 28 | 29 | @interface VBXDialerAccessor : NSObject { 30 | NSUserDefaults *_userDefaults; 31 | VBXResult *_callerIDsResult; 32 | VBXResourceLoader *_callerIDsLoader; 33 | VBXResourceLoader *_callPoster; 34 | id _delegate; 35 | } 36 | 37 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 38 | @property (nonatomic, readonly, retain) VBXResult *callerIDsResult; 39 | @property (nonatomic, retain) VBXResourceLoader *callerIDsLoader; 40 | @property (nonatomic, retain) VBXResourceLoader *callPoster; 41 | @property (nonatomic, assign) id delegate; 42 | 43 | @property (nonatomic, readonly) BOOL hasCallbackNumber; 44 | @property (nonatomic, readonly) NSArray *callerIDs; 45 | 46 | - (void)loadCallerIDs; 47 | - (void)call:(NSString *)phone usingCallerID:(NSString *)callerID; 48 | 49 | @end 50 | 51 | 52 | @protocol VBXDialerAccessorDelegate 53 | 54 | @optional 55 | - (void)accessorDidPlaceCall:(VBXDialerAccessor *)accessor; 56 | - (void)accessor:(VBXDialerAccessor *)accessor callFailedWithError:(NSError *)error; 57 | 58 | - (void)accessorCallerIDsResponseArrived:(VBXDialerAccessor *)accessor fromCache:(BOOL)fromCache; 59 | - (void)accessor:(VBXDialerAccessor *)accessor failedToLoadCallerIDsWithError:(NSError *)error; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Classes/VBXDialerController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXViewController.h" 23 | 24 | void DialerBuildImages(); 25 | 26 | @class VBXDialerAccessor; 27 | @class CallerIdControl; 28 | @class NumberAreaView; 29 | 30 | @interface VBXDialerController : VBXViewController { 31 | NSUserDefaults *_userDefaults; 32 | VBXDialerAccessor *_accessor; 33 | NSMutableString *_phoneNumber; 34 | NSInteger _selectedCallerIDIndex; 35 | NSString *_callerIdNumber; 36 | 37 | CallerIdControl *_callerIdControl; 38 | NumberAreaView *_numberAreaView; 39 | 40 | UIView *_dialerView; 41 | 42 | BOOL _callIsBeingScheduled; 43 | NSString *_initialPhoneNumber; 44 | BOOL _callerIdPickerIsOpen; 45 | } 46 | 47 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 48 | @property (nonatomic, retain) VBXDialerAccessor *accessor; 49 | 50 | - (id)initWithPhone:(NSString *)phone; 51 | 52 | - (IBAction)numberPressed:(id)sender; 53 | - (IBAction)deletePressed; 54 | - (IBAction)callPressed; 55 | - (IBAction)chooseContactPressed; 56 | 57 | - (NSDictionary *)saveState; 58 | - (void)restoreState:(NSDictionary *)state; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Classes/VBXDimOverlay.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXDimOverlay : UIView { 25 | BOOL _parentHadUserInteractionEnabled; 26 | } 27 | 28 | + (VBXDimOverlay *)overlay; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Classes/VBXDimOverlay.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXDimOverlay.h" 22 | #import "VBXConfiguration.h" 23 | 24 | @implementation VBXDimOverlay 25 | 26 | + (VBXDimOverlay *)overlay { 27 | return [[[VBXDimOverlay alloc] initWithFrame:CGRectZero] autorelease]; 28 | } 29 | 30 | - (id)initWithFrame:(CGRect)frame { 31 | if (self = [super initWithFrame:frame]) { 32 | self.backgroundColor = ThemedColor(@"dimOverlayBackgroundColor", [UIColor colorWithWhite:0 alpha:0.4]); 33 | } 34 | return self; 35 | } 36 | 37 | - (void)drawRect:(CGRect)rect { 38 | // Drawing code 39 | } 40 | 41 | - (void)willMoveToSuperview:(UIView *)newSuperview { 42 | // Take the size of our new paren 43 | self.frame = newSuperview.bounds; 44 | 45 | // Don't let our parent take our touch events. E.g. This is helpful 46 | // when we're overlayed on top of a UITableView 47 | _parentHadUserInteractionEnabled = newSuperview.userInteractionEnabled; 48 | newSuperview.userInteractionEnabled = NO; 49 | 50 | self.alpha = 0.0; 51 | } 52 | 53 | - (void)didMoveToSuperview { 54 | [UIView beginAnimations:@"FadeIn" context:nil]; 55 | [UIView setAnimationDuration:0.5]; 56 | 57 | self.alpha = 1.0; 58 | 59 | [UIView commitAnimations]; 60 | } 61 | 62 | - (void)removeFromSuperview { 63 | self.superview.userInteractionEnabled = _parentHadUserInteractionEnabled; 64 | [super removeFromSuperview]; 65 | } 66 | 67 | - (void)dealloc { 68 | [super dealloc]; 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Classes/VBXFolderDetail.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXSublist; 24 | 25 | 26 | @interface VBXFolderDetail : NSObject { 27 | NSString *_key; 28 | NSString *_name; 29 | NSInteger _new; 30 | NSInteger _read; 31 | NSInteger _archived; 32 | VBXSublist *_messages; 33 | 34 | NSInteger _archivingMessageIndex; 35 | } 36 | 37 | - (id)initWithDictionary:(NSDictionary *)dictionary; 38 | 39 | @property (nonatomic, retain) NSString *key; 40 | @property (nonatomic, retain) NSString *name; 41 | @property (nonatomic, assign) NSInteger new; 42 | @property (nonatomic, assign) NSInteger read; 43 | @property (nonatomic, assign) NSInteger archived; 44 | @property (nonatomic, retain) VBXSublist *messages; 45 | 46 | @property (nonatomic, assign) NSInteger archivingMessageIndex; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Classes/VBXFolderDetail.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXFolderDetail.h" 22 | #import "VBXSublist.h" 23 | #import "VBXMessageSummary.h" 24 | #import "NSExtensions.h" 25 | 26 | 27 | @implementation VBXFolderDetail 28 | 29 | - (id)initWithDictionary:(NSDictionary *)dictionary { 30 | if (self = [super init]) { 31 | self.key = [dictionary stringForKey:@"id"]; 32 | self.name = [dictionary stringForKey:@"name"]; 33 | self.new = [dictionary intForKey:@"new"]; 34 | self.read = [dictionary intForKey:@"read"]; 35 | self.archived = [dictionary intForKey:@"archived"]; 36 | self.messages = [dictionary sublistForKey:@"messages" class:[VBXMessageSummary class]]; 37 | } 38 | return self; 39 | } 40 | 41 | @synthesize key = _key; 42 | @synthesize name = _name; 43 | @synthesize new = _new; 44 | @synthesize read = _read; 45 | @synthesize archived = _archived; 46 | @synthesize messages = _messages; 47 | 48 | @synthesize archivingMessageIndex = _archivingMessageIndex; 49 | 50 | - (void)dealloc { 51 | self.key = nil; 52 | self.name = nil; 53 | self.messages = nil; 54 | [super dealloc]; 55 | } 56 | 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Classes/VBXFolderList.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXFolderList : NSObject { 25 | NSArray *_folders; 26 | } 27 | 28 | - (id)initWithDictionary:(NSDictionary *)dictionary; 29 | 30 | @property (nonatomic, retain) NSArray *folders; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/VBXFolderList.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXFolderList.h" 22 | #import "VBXFolderSummary.h" 23 | #import "NSExtensions.h" 24 | 25 | 26 | @implementation VBXFolderList 27 | 28 | - (id)initWithDictionary:(NSDictionary *)dictionary { 29 | if (self = [super init]) { 30 | self.folders = [dictionary arrayOfModelsForKey:@"folders" class:[VBXFolderSummary class]]; 31 | } 32 | return self; 33 | } 34 | 35 | @synthesize folders = _folders; 36 | 37 | - (void)dealloc { 38 | self.folders = nil; 39 | [super dealloc]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Classes/VBXFolderListAccessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXFolderList; 24 | @class VBXResourceLoader; 25 | 26 | @protocol VBXFolderListAccessorDelegate; 27 | 28 | 29 | @interface VBXFolderListAccessor : NSObject { 30 | VBXFolderList *_model; 31 | VBXResourceLoader *_loader; 32 | id _delegate; 33 | } 34 | 35 | @property (nonatomic, readonly, retain) VBXFolderList *model; 36 | @property (nonatomic, retain) VBXResourceLoader *loader; 37 | @property (nonatomic, assign) id delegate; 38 | 39 | - (void)loadUsingCache:(BOOL)usingCache; 40 | 41 | - (NSDate *)timestampOfCachedData; 42 | 43 | @end 44 | 45 | @protocol VBXFolderListAccessorDelegate 46 | 47 | - (void)accessorDidLoadData:(VBXFolderListAccessor *)accessor fromCache:(BOOL)fromCache; 48 | - (void)accessor:(VBXFolderListAccessor *)accessor loadDidFailWithError:(NSError *)error; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Classes/VBXFolderListAccessor.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXFolderListAccessor.h" 22 | #import "VBXFolderList.h" 23 | #import "VBXResourceRequest.h" 24 | #import "VBXResourceLoader.h" 25 | #import "VBXCache.h" 26 | 27 | 28 | @interface VBXFolderListAccessor () 29 | 30 | @property (nonatomic, retain) VBXFolderList *model; 31 | 32 | @end 33 | 34 | 35 | @implementation VBXFolderListAccessor 36 | 37 | @synthesize model = _model; 38 | @synthesize loader = _loader; 39 | @synthesize delegate = _delegate; 40 | 41 | - (void)dealloc { 42 | [_loader cancelAllRequests]; 43 | [_model release]; 44 | [_loader release]; 45 | [super dealloc]; 46 | } 47 | 48 | - (NSDate *)timestampOfCachedData { 49 | NSString *key = [_loader keyForRequest:[_loader URLRequestForRequest:[VBXResourceRequest requestWithResource:@"messages/inbox"]]]; 50 | return [_loader.cache timestampForDataForKey:key]; 51 | } 52 | 53 | - (void)loadUsingCache:(BOOL)usingCache { 54 | _loader.target = self; 55 | [_loader loadRequest:[VBXResourceRequest requestWithResource:@"messages/inbox"] usingCache:usingCache]; 56 | } 57 | 58 | - (void)loader:(VBXResourceLoader *)loader didLoadObject:(id)object fromCache:(BOOL)fromCache { 59 | self.model = [[[VBXFolderList alloc] initWithDictionary:object] autorelease]; 60 | [_delegate accessorDidLoadData:self fromCache:fromCache]; 61 | } 62 | 63 | - (void)loader:(VBXResourceLoader *)loader didFailWithError:(NSError *)error { 64 | [_delegate accessor:self loadDidFailWithError:error]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Classes/VBXFolderListCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewCell.h" 23 | 24 | @class RoundedNumberView; 25 | @class VBXMaskedImageView; 26 | @class VBXFolderSummary; 27 | @class VBXConfiguration; 28 | 29 | @interface VBXFolderListCell : VBXTableViewCell { 30 | VBXConfiguration *_configuration; 31 | 32 | UILabel *_label; 33 | VBXMaskedImageView *_icon; 34 | RoundedNumberView *_numberView; 35 | NSInteger _number; 36 | } 37 | @property (nonatomic, retain) VBXConfiguration *configuration; 38 | @property (nonatomic, retain) UILabel *label; 39 | @property (nonatomic, retain) VBXMaskedImageView *icon; 40 | 41 | - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier; 42 | - (void)showFolderSummary:(VBXFolderSummary *)folderSummary; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Classes/VBXFolderListController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXStatefulTableViewController.h" 23 | 24 | @class VBXFolderListAccessor; 25 | @class VBXObjectBuilder; 26 | @class VBXStringPartLabel; 27 | 28 | @interface VBXFolderListController : VBXStatefulTableViewController { 29 | NSUserDefaults *_userDefaults; 30 | VBXFolderListAccessor *_accessor; 31 | VBXObjectBuilder *_builder; 32 | NSString *_selectedFolderKey; 33 | 34 | UIBarButtonItem *_refreshButton; 35 | UIBarButtonItem *_dialerButton; 36 | UIView *_footerView; 37 | UILabel *_footerLabel; 38 | UIActivityIndicatorView *_spinny; 39 | VBXStringPartLabel *_statusLabel; 40 | } 41 | 42 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 43 | @property (nonatomic, retain) VBXFolderListAccessor *accessor; 44 | @property (nonatomic, assign) VBXObjectBuilder *builder; 45 | 46 | @property (nonatomic, retain) IBOutlet UIBarButtonItem *refreshButton; 47 | @property (nonatomic, retain) IBOutlet UIBarButtonItem *dialerButton; 48 | @property (nonatomic, retain) IBOutlet UIView *footerView; 49 | @property (nonatomic, retain) IBOutlet UILabel *footerLabel; 50 | @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *spinny; 51 | 52 | - (IBAction)refresh; 53 | - (IBAction)dialerPressed; 54 | 55 | - (NSDictionary *)saveState; 56 | - (void)restoreState:(NSDictionary *)state; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Classes/VBXFolderSummary.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXFolderSummary : NSObject { 25 | NSString *_key; 26 | NSString *_name; 27 | NSInteger _total; 28 | NSInteger _new; 29 | NSInteger _read; 30 | NSInteger _archived; 31 | } 32 | 33 | - (id)initWithDictionary:(NSDictionary *)dictionary; 34 | 35 | @property (nonatomic, retain) NSString *key; 36 | @property (nonatomic, retain) NSString *name; 37 | @property (nonatomic, assign) NSInteger total; 38 | @property (nonatomic, assign) NSInteger new; 39 | @property (nonatomic, assign) NSInteger read; 40 | @property (nonatomic, assign) NSInteger archived; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Classes/VBXFolderSummary.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXFolderSummary.h" 22 | #import "NSExtensions.h" 23 | 24 | 25 | @implementation VBXFolderSummary 26 | 27 | - (id)initWithDictionary:(NSDictionary *)dictionary { 28 | if (self = [super init]) { 29 | self.key = [dictionary stringForKey:@"id"]; 30 | self.name = [dictionary stringForKey:@"name"]; 31 | self.total = [dictionary intForKey:@"total"]; 32 | self.new = [dictionary intForKey:@"new"]; 33 | self.read = [dictionary intForKey:@"read"]; 34 | self.archived = [dictionary intForKey:@"archived"]; 35 | } 36 | return self; 37 | } 38 | 39 | @synthesize key = _key; 40 | @synthesize name = _name; 41 | @synthesize total = _total; 42 | @synthesize new = _new; 43 | @synthesize read = _read; 44 | @synthesize archived = _archived; 45 | 46 | - (void)dealloc { 47 | self.key = nil; 48 | self.name = nil; 49 | [super dealloc]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Classes/VBXFooterTextCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXDataSource.h" 23 | #import "VBXTableViewCell.h" 24 | 25 | /** 26 | * Mimics the style of text you get UITableView footers. 27 | */ 28 | @interface VBXFooterTextCell : VBXTableViewCell { 29 | UILabel *_label; 30 | UIEdgeInsets _contentInsets; 31 | } 32 | 33 | @property (nonatomic, readonly) UILabel *label; 34 | @property (nonatomic, assign) UIEdgeInsets contentInsets; 35 | 36 | @end 37 | 38 | -------------------------------------------------------------------------------- /Classes/VBXLicenseController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXViewController.h" 23 | 24 | @interface VBXLicenseController : VBXViewController { 25 | NSString *_summary; 26 | UIWebView *_textView; 27 | } 28 | 29 | - (id)initWithDictionary:(NSDictionary *)dictionary; 30 | 31 | @property (nonatomic, retain) NSString *summary; 32 | @property (nonatomic, retain) UIWebView *webView; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Classes/VBXLicenseController.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXLicenseController.h" 22 | #import "NSExtensions.h" 23 | #import "VBXGlobal.h" 24 | 25 | @implementation VBXLicenseController 26 | 27 | @synthesize summary = _summary; 28 | @synthesize webView = _webView; 29 | 30 | - (id)init { 31 | self.navigationItem.title = LocalizedString(@"License Information", @"License Information: title"); 32 | if (self = [super init]) { 33 | NSString *path =[[NSBundle mainBundle] pathForResource:@"license" ofType:@"html"]; 34 | self.summary = [[NSString alloc] initWithContentsOfFile:path 35 | encoding:NSUTF8StringEncoding 36 | error:[NSError twilioErrorWithCode:VBXErrorLoadingFile underlyingError:NSErrorFailingURLStringKey]]; 37 | 38 | 39 | //[[VBXConfiguration sharedConfiguration] addConfigObserver:self]; 40 | //[self applyConfig]; 41 | 42 | } 43 | 44 | return self; 45 | } 46 | 47 | - (void)loadView { 48 | [super loadView]; 49 | 50 | _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 120)]; 51 | [_webView loadHTMLString:self.summary baseURL:[NSURL URLWithString:@"http://openvbx.org/"]]; 52 | 53 | //[self.view addSubview:_textView]; 54 | self.view = _webView; 55 | 56 | [self applyConfig]; 57 | } 58 | 59 | 60 | - (void)dealloc { 61 | [[VBXConfiguration sharedConfiguration] removeConfigObserver:self]; 62 | self.summary = nil; 63 | [super dealloc]; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Classes/VBXLoadMoreCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewCell.h" 23 | 24 | @interface VBXLoadMoreCell : VBXTableViewCell { 25 | UILabel *_titleLabel; 26 | UILabel *_descriptionLabel; 27 | UIActivityIndicatorView *_spinner; 28 | } 29 | 30 | @property (nonatomic, readonly) UILabel *titleLabel; 31 | @property (nonatomic, readonly) UILabel *descriptionLabel; 32 | @property (nonatomic, readonly) UIActivityIndicatorView *spinner; 33 | 34 | - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier; 35 | 36 | @end 37 | 38 | -------------------------------------------------------------------------------- /Classes/VBXLoginController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @class VBXResourceLoader; 25 | @class VBXSectionedCellDataSource; 26 | @class VBXTextFieldCell; 27 | 28 | @interface VBXLoginController : VBXTableViewController { 29 | NSUserDefaults *_userDefaults; 30 | VBXResourceLoader *_loader; 31 | NSURLCredentialStorage *_credentialStorage; 32 | 33 | VBXSectionedCellDataSource *_cellDataSource; 34 | 35 | VBXTextFieldCell *_emailField; 36 | VBXTextFieldCell *_passwordField; 37 | } 38 | 39 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 40 | @property (nonatomic, retain) VBXResourceLoader *loader; 41 | @property (nonatomic, retain) NSURLCredentialStorage *credentialStorage; 42 | 43 | @end -------------------------------------------------------------------------------- /Classes/VBXMaskedImageView.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXMaskedImageView : UIView { 25 | UIImage *_image; 26 | UIColor *_startColor; 27 | UIColor *_endColor; 28 | } 29 | 30 | @property (nonatomic, retain) UIImage *image; 31 | @property (nonatomic, retain) UIColor *startColor; 32 | @property (nonatomic, retain) UIColor *endColor; 33 | 34 | - (id)init; 35 | - (id)initWithImage:(UIImage *)anImage; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Classes/VBXMessageAttribute.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXMessageDetail; 24 | 25 | 26 | @interface VBXMessageAttribute : NSObject { 27 | VBXMessageDetail *_messageDetail; 28 | NSString *_key; 29 | NSString *_name; 30 | NSArray *_options; 31 | 32 | SEL _valueGetter; 33 | SEL _valueSetter; 34 | id _pendingValue; 35 | 36 | SEL _titleSelector; 37 | SEL _detailSelector; 38 | SEL _keySelector; 39 | } 40 | 41 | + (VBXMessageAttribute *)assignedUserAttributeForMessage:(VBXMessageDetail *)detail name:(NSString *)name; 42 | + (VBXMessageAttribute *)ticketStatusAttributeForMessage:(VBXMessageDetail *)detail name:(NSString *)name; 43 | 44 | @property (nonatomic, retain) VBXMessageDetail *messageDetail; 45 | @property (nonatomic, retain) NSString *key; 46 | @property (nonatomic, retain) NSString *name; 47 | @property (nonatomic, retain) NSArray *options; 48 | 49 | @property (nonatomic, assign) SEL valueGetter; 50 | @property (nonatomic, assign) SEL valueSetter; 51 | @property (nonatomic, retain) id pendingValue; 52 | 53 | @property (nonatomic, assign) SEL titleSelector; 54 | @property (nonatomic, assign) SEL detailSelector; 55 | @property (nonatomic, assign) SEL keySelector; 56 | 57 | @property (nonatomic, retain) id value; 58 | @property (nonatomic, readonly) NSInteger selectedIndex; 59 | @property (nonatomic, readonly) BOOL hasDetail; 60 | 61 | - (NSString *)titleForValue:(id)value; 62 | - (NSString *)detailForValue:(id)value; 63 | - (NSString *)keyForValue:(id)value; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Classes/VBXMessageAttributeAccessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | #import 21 | 22 | @class VBXMessageAttribute; 23 | @class VBXResourceLoader; 24 | 25 | @protocol VBXMessageAttributeAccessorDelegate; 26 | 27 | 28 | @interface VBXMessageAttributeAccessor : NSObject { 29 | VBXMessageAttribute *_attribute; 30 | VBXResourceLoader *_valuePoster; 31 | id _delegate; 32 | } 33 | 34 | - (id)initWithAttribute:(VBXMessageAttribute *)attribute; 35 | 36 | @property (nonatomic, retain) VBXResourceLoader *valuePoster; 37 | @property (nonatomic, assign) id delegate; 38 | 39 | - (void)setValue:(id)value; 40 | 41 | @end 42 | 43 | 44 | @protocol VBXMessageAttributeAccessorDelegate 45 | 46 | - (void)accessorDidSetValue:(VBXMessageAttributeAccessor *)accessor; 47 | - (void)accessor:(VBXMessageAttributeAccessor *)accessor setValueDidFailWithError:(NSError *)error; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Classes/VBXMessageAttributeAccessor.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXMessageAttributeAccessor.h" 22 | #import "VBXMessageDetail.h" 23 | #import "VBXMessageAttribute.h" 24 | #import "VBXResourceLoader.h" 25 | #import "VBXResourceRequest.h" 26 | #import "NSExtensions.h" 27 | 28 | 29 | @implementation VBXMessageAttributeAccessor 30 | 31 | - (id)initWithAttribute:(VBXMessageAttribute *)attr { 32 | if (self = [super init]) { 33 | _attribute = [attr retain]; 34 | } 35 | return self; 36 | } 37 | 38 | @synthesize valuePoster = _valuePoster; 39 | @synthesize delegate = _delegate; 40 | 41 | - (void)dealloc { 42 | [_attribute release]; 43 | self.valuePoster = nil; 44 | [super dealloc]; 45 | } 46 | 47 | - (void)setValue:(id)value { 48 | _attribute.pendingValue = value; 49 | 50 | NSString *resource = [@"messages/details/" stringByAppendingString:_attribute.messageDetail.key]; 51 | VBXResourceRequest *request = [VBXResourceRequest requestWithResource:resource method:@"POST"]; 52 | [request.params setObject:[_attribute keyForValue:value] forKey:_attribute.key]; 53 | 54 | [_valuePoster setTarget:self successAction:@selector(loader:didSetValue:)]; 55 | [_valuePoster loadRequest:request]; 56 | } 57 | 58 | - (void)loader:(VBXResourceLoader *)loader didSetValue:(id)response { 59 | _attribute.value = _attribute.pendingValue; 60 | _attribute.pendingValue = nil; 61 | [_delegate accessorDidSetValue:self]; 62 | } 63 | 64 | - (void)loader:(VBXResourceLoader *)loader didFailWithError:(NSError *)error { 65 | _attribute.pendingValue = nil; 66 | [_delegate accessor:self setValueDidFailWithError:error]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Classes/VBXMessageAttributeController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @class VBXMessageAttribute; 25 | @class VBXMessageAttributeAccessor; 26 | 27 | 28 | @interface VBXMessageAttributeController : VBXTableViewController { 29 | VBXMessageAttribute *_attribute; 30 | VBXMessageAttributeAccessor *_accessor; 31 | } 32 | 33 | @property (nonatomic, retain) VBXMessageAttribute *attribute; 34 | @property (nonatomic, retain) VBXMessageAttributeAccessor *accessor; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Classes/VBXMessageDetail.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXSublist; 24 | @class VBXUser; 25 | @class VBXMessageAttribute; 26 | @class VBXTicketStatus; 27 | 28 | @interface VBXMessageDetail : NSObject { 29 | NSString *_key; 30 | NSString *_caller; 31 | NSString *_called; 32 | NSString *_folder; 33 | NSString *_assignedUserKey; 34 | NSString *_status; 35 | NSString *_ticketStatusKey; 36 | NSString *_recordingURL; 37 | NSString *_recordingLength; 38 | NSString *_summary; 39 | NSString *_receivedTime; 40 | NSString *_lastUpdated; 41 | BOOL _unread; 42 | BOOL _callback; 43 | BOOL _archived; 44 | NSArray *_activeUsers; 45 | VBXSublist *_annotations; 46 | } 47 | 48 | - (id)initWithDictionary:(NSDictionary *)dictionary; 49 | 50 | @property (nonatomic, retain) NSString *key; 51 | @property (nonatomic, retain) NSString *caller; 52 | @property (nonatomic, retain) NSString *called; 53 | @property (nonatomic, retain) NSString *folder; 54 | @property (nonatomic, retain) NSString *assignedUserKey; 55 | @property (nonatomic, retain) NSString *status; 56 | @property (nonatomic, retain) NSString *ticketStatusKey; 57 | @property (nonatomic, retain) NSString *recordingURL; 58 | @property (nonatomic, retain) NSString *recordingLength; 59 | @property (nonatomic, retain) NSString *summary; 60 | @property (nonatomic, retain) NSString *receivedTime; 61 | @property (nonatomic, retain) NSString *lastUpdated; 62 | @property (nonatomic, assign) BOOL unread; 63 | @property (nonatomic, assign) BOOL callback; 64 | @property (nonatomic, assign) BOOL archived; 65 | @property (nonatomic, retain) NSArray *activeUsers; 66 | @property (nonatomic, retain) VBXSublist *annotations; 67 | 68 | @property (nonatomic, retain) VBXUser *assignedUser; 69 | 70 | @property (nonatomic, readonly) BOOL isSms; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Classes/VBXMessageDetailAccessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXMessageDetail; 24 | @class VBXResourceLoader; 25 | 26 | @protocol VBXMessageDetailAccessorDelegate; 27 | 28 | 29 | @interface VBXMessageDetailAccessor : NSObject { 30 | NSString *_messageKey; 31 | NSInteger _pageSize; 32 | VBXMessageDetail *_model; 33 | BOOL _modelIsFromCache; 34 | VBXResourceLoader *_detailLoader; 35 | VBXResourceLoader *_annotationsLoader; 36 | VBXResourceLoader *_notePoster; 37 | VBXResourceLoader *_archivePoster; 38 | id _delegate; 39 | } 40 | 41 | - (id)initWithKey:(NSString *)key; 42 | 43 | @property (nonatomic, assign) NSInteger pageSize; 44 | @property (nonatomic, retain, readonly) VBXMessageDetail *model; 45 | @property (nonatomic, assign, readonly) BOOL modelIsFromCache; 46 | @property (nonatomic, retain) VBXResourceLoader *detailLoader; 47 | @property (nonatomic, retain) VBXResourceLoader *annotationsLoader; 48 | @property (nonatomic, retain) VBXResourceLoader *notePoster; 49 | @property (nonatomic, retain) VBXResourceLoader *archivePoster; 50 | @property (nonatomic, assign) id delegate; 51 | 52 | - (void)loadUsingCache:(BOOL)usingCache; 53 | - (void)loadMoreAnnotations; 54 | - (void)addNote:(NSString *)text; 55 | 56 | - (NSDate *)timestampOfCachedData; 57 | 58 | - (void)archiveMessage; 59 | 60 | @end 61 | 62 | 63 | @protocol VBXMessageDetailAccessorDelegate 64 | 65 | - (void)accessorDidLoadData:(VBXMessageDetailAccessor *)accessor fromCache:(BOOL)fromCache; 66 | - (void)accessor:(VBXMessageDetailAccessor *)accessor loadDidFailWithError:(NSError *)error; 67 | 68 | - (void)accessor:(VBXMessageDetailAccessor *)accessor didAddNote:(id)annotation; 69 | - (void)accessor:(VBXMessageDetailAccessor *)accessor addNoteDidFailWithError:(NSError *)error; 70 | 71 | - (void)accessorDidArchiveMessage:(VBXMessageDetailAccessor *)accessor; 72 | - (void)accessor:(VBXMessageDetailAccessor *)accessor archiveDidFailWithError:(NSError *)error; 73 | 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Classes/VBXMessageListAccessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXFolderDetail; 24 | @class VBXResourceLoader; 25 | 26 | @protocol VBXMessageListAccessorDelegate; 27 | 28 | @interface VBXMessageListAccessor : NSObject { 29 | NSString *_folderKey; 30 | NSInteger _pageSize; 31 | VBXFolderDetail *_model; 32 | VBXResourceLoader *_loader; 33 | VBXResourceLoader *_archivePoster; 34 | id _delegate; 35 | } 36 | 37 | - (id)initWithKey:(NSString *)key; 38 | 39 | @property (nonatomic, readonly) NSString *folderKey; 40 | @property (nonatomic, assign) NSInteger pageSize; 41 | @property (nonatomic, readonly, retain) VBXFolderDetail *model; 42 | @property (nonatomic, retain) VBXResourceLoader *loader; 43 | @property (nonatomic, retain) VBXResourceLoader *archivePoster; 44 | @property (nonatomic, assign) id delegate; 45 | 46 | - (void)loadUsingCache:(BOOL)usingCache; 47 | - (void)loadMore; 48 | - (void)archiveMessageAtIndex:(NSInteger)index; 49 | 50 | - (NSDate *)timestampOfCachedData; 51 | 52 | - (void)removeMessageFromModelAtIndex:(NSInteger)index; 53 | 54 | @end 55 | 56 | 57 | @protocol VBXMessageListAccessorDelegate 58 | 59 | - (void)accessorDidLoadData:(VBXMessageListAccessor *)accessor fromCache:(BOOL)fromCache; 60 | - (void)accessor:(VBXMessageListAccessor *)accessor loadDidFailWithError:(NSError *)error; 61 | 62 | - (void)accessor:(VBXMessageListAccessor *)accessor didArchiveMessageAtIndex:(NSInteger)index; 63 | - (void)accessor:(VBXMessageListAccessor *)accessor archiveDidFailWithError:(NSError *)error; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Classes/VBXMessageListCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewCell.h" 23 | 24 | @class VBXMessageSummary; 25 | @class VBXAudioControl; 26 | @class VBXStringPartLabel; 27 | @class VBXMessageListController; 28 | @class VBXMaskedImageView; 29 | 30 | @interface VBXMessageListCell : VBXTableViewCell { 31 | VBXMessageListController *_messageListController; 32 | VBXMessageSummary *_messageSummary; 33 | 34 | UIView *_container; 35 | UILabel *_titleLabel; 36 | VBXStringPartLabel *_timestampLabel; 37 | UILabel *_bodyLabel; 38 | UILabel *_folderLabel; 39 | 40 | VBXMaskedImageView *_deliveryMethodView; 41 | 42 | UIView *_playerView; 43 | 44 | VBXAudioControl *_audioControl; 45 | } 46 | 47 | @property (nonatomic, retain) VBXMessageListController *messageListController; 48 | @property (nonatomic, retain) VBXMessageSummary *messageSummary; 49 | @property (nonatomic, retain) UIView *playerView; 50 | @property (nonatomic, readonly) VBXAudioControl *audioControl; 51 | 52 | - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier; 53 | 54 | - (void)showMessageSummary:(VBXMessageSummary *)messageSummary showFolder:(BOOL)showFolder; 55 | 56 | - (void)showPlayerView:(UIView *)playerView; 57 | - (void)hidePlayerView; 58 | 59 | @end 60 | 61 | -------------------------------------------------------------------------------- /Classes/VBXMessageListController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXStatefulTableViewController.h" 23 | 24 | @class VBXAudioPlaybackController; 25 | @class VBXMessageListAccessor; 26 | @class VBXObjectBuilder; 27 | @class VBXStringPartLabel; 28 | @class VBXLoadMoreCell; 29 | 30 | @interface VBXMessageListController : VBXStatefulTableViewController { 31 | NSUserDefaults *_userDefaults; 32 | VBXAudioPlaybackController *_playbackController; 33 | VBXMessageListAccessor *_accessor; 34 | NSBundle *_bundle; 35 | VBXObjectBuilder *_builder; 36 | NSIndexPath *_selectedMessageIndexPath; 37 | NSString *_selectedMessageKey; 38 | NSString *_selectedMessageRecordingURL; 39 | NSIndexPath *_playbackControllerIndexPath; 40 | 41 | UIBarButtonItem *_refreshButton; 42 | UIBarButtonItem *_dialerButton; 43 | VBXLoadMoreCell *_loadMoreView; 44 | VBXStringPartLabel *_statusLabel; 45 | 46 | BOOL _selectedMessageWasArchivedFromDetailsPage; 47 | } 48 | 49 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 50 | @property (nonatomic, retain) VBXMessageListAccessor *accessor; 51 | @property (nonatomic, retain) NSBundle *bundle; 52 | @property (nonatomic, assign) VBXObjectBuilder *builder; 53 | 54 | @property (nonatomic, retain) IBOutlet UIBarButtonItem *refreshButton; 55 | @property (nonatomic, retain) IBOutlet UIBarButtonItem *dialerButton; 56 | 57 | - (IBAction)loadMore; 58 | - (IBAction)refresh; 59 | - (IBAction)dialerPressed; 60 | 61 | /** 62 | * Called by the MessageDetailController when we've archived a message 63 | * from the details page. 64 | */ 65 | - (void)didArchiveSelectedMessage; 66 | 67 | - (NSDictionary *)saveState; 68 | - (void)restoreState:(NSDictionary *)state; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Classes/VBXMessageSummary.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXMessageSummary : NSObject { 25 | NSString *_key; 26 | NSString *_caller; 27 | NSString *_called; 28 | NSString *_assigned; 29 | NSString *_recordingURL; 30 | NSString *_shortSummary; 31 | NSString *_receivedTime; 32 | NSString *_lastUpdated; 33 | NSString *_folder; 34 | BOOL _archived; 35 | BOOL _unread; 36 | BOOL _archiving; 37 | 38 | NSString *_relativeReceivedTime; 39 | } 40 | 41 | - (id)initWithDictionary:(NSDictionary *)dictionary; 42 | 43 | @property (nonatomic, retain) NSString *key; 44 | @property (nonatomic, retain) NSString *caller; 45 | @property (nonatomic, retain) NSString *called; 46 | @property (nonatomic, retain) NSString *assigned; 47 | @property (nonatomic, retain) NSString *recordingURL; 48 | @property (nonatomic, retain) NSString *shortSummary; 49 | @property (nonatomic, retain) NSString *receivedTime; 50 | @property (nonatomic, retain) NSString *lastUpdated; 51 | @property (nonatomic, retain) NSString *folder; 52 | @property (nonatomic, assign, getter=isArchived) BOOL archived; 53 | @property (nonatomic, assign, getter=isUnread) BOOL unread; 54 | @property (nonatomic, assign, getter=isArchiving) BOOL archiving; 55 | 56 | @property (nonatomic, readonly) BOOL isSms; 57 | @property (nonatomic, retain) NSString *relativeReceivedTime; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Classes/VBXMessageSummary.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXMessageSummary.h" 22 | #import "NSExtensions.h" 23 | #import "VBXGlobal.h" 24 | 25 | @implementation VBXMessageSummary 26 | 27 | - (id)initWithDictionary:(NSDictionary *)dictionary { 28 | if (self = [super init]) { 29 | self.key = [dictionary stringForKey:@"id"]; 30 | self.caller = [dictionary stringForKey:@"caller"]; 31 | self.called = [dictionary stringForKey:@"called"]; 32 | self.assigned = [dictionary stringForKey:@"assigned"]; 33 | self.recordingURL = [dictionary stringForKey:@"recording_url"]; 34 | self.shortSummary = [dictionary stringForKey:@"short_summary"]; 35 | self.receivedTime = [dictionary stringForKey:@"received_time"]; 36 | self.lastUpdated = [dictionary stringForKey:@"last_updated"]; 37 | self.archived = [dictionary boolForKey:@"archived"]; 38 | self.unread = [dictionary boolForKey:@"unread"]; 39 | self.folder = [dictionary stringForKey:@"folder"]; 40 | 41 | self.relativeReceivedTime = VBXDateToRelativeTime(VBXParseISODateString(_receivedTime)); 42 | } 43 | return self; 44 | } 45 | 46 | @synthesize key = _key; 47 | @synthesize caller = _caller; 48 | @synthesize called = _called; 49 | @synthesize assigned = _assigned; 50 | @synthesize recordingURL = _recordingURL; 51 | @synthesize shortSummary = _shortSummary; 52 | @synthesize receivedTime = _receivedTime; 53 | @synthesize lastUpdated = _lastUpdated; 54 | @synthesize folder = _folder; 55 | @synthesize archived = _archived; 56 | @synthesize unread = _unread; 57 | @synthesize archiving = _archiving; 58 | @synthesize relativeReceivedTime = _relativeReceivedTime; 59 | 60 | @dynamic isSms; 61 | 62 | - (void)dealloc { 63 | self.key = nil; 64 | self.caller = nil; 65 | self.called = nil; 66 | self.assigned = nil; 67 | self.recordingURL = nil; 68 | self.shortSummary = nil; 69 | self.receivedTime = nil; 70 | self.lastUpdated = nil; 71 | self.folder = nil; 72 | self.relativeReceivedTime = nil; 73 | [super dealloc]; 74 | } 75 | 76 | - (BOOL)isSms { 77 | return (_recordingURL == nil || _recordingURL.length == 0); 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Classes/VBXNavigationController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXObjectBuilder; 24 | @class VBXDialerController; 25 | @class VBXSendTextController; 26 | 27 | @interface VBXNavigationController : UINavigationController { 28 | VBXObjectBuilder *_builder; 29 | 30 | BOOL _dialerIsShown; 31 | BOOL _sendTextIsShown; 32 | 33 | VBXDialerController *_dialerController; 34 | VBXSendTextController *_sendTextController; 35 | } 36 | 37 | @property (nonatomic, retain) VBXObjectBuilder *builder; 38 | 39 | @property (nonatomic, readonly) BOOL dialerIsShown; 40 | @property (nonatomic, readonly) BOOL sendTextIsShown; 41 | @property (nonatomic, readonly) VBXDialerController *dialerController; 42 | @property (nonatomic, readonly) VBXSendTextController *sendTextController; 43 | 44 | - (void)showDialOrTextActionSheet; 45 | 46 | - (void)showDialer; 47 | - (void)showSendText; 48 | - (void)showDialerWithState:(NSDictionary *)state animated:(BOOL)animated; 49 | - (void)showSendTextWithState:(NSDictionary *)state animated:(BOOL)animated; 50 | 51 | - (NSDictionary *)saveState; 52 | - (void)restoreState:(NSDictionary *)state; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Classes/VBXOutgoingPhone.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXOutgoingPhone : NSObject { 25 | NSString *_key; 26 | NSString *_name; 27 | NSString *_phone; 28 | } 29 | 30 | - (id)initWithDictionary:(NSDictionary *)dictionary; 31 | 32 | @property (nonatomic, retain) NSString *key; 33 | @property (nonatomic, retain) NSString *name; 34 | @property (nonatomic, retain) NSString *phone; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Classes/VBXOutgoingPhone.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXOutgoingPhone.h" 22 | #import "NSExtensions.h" 23 | 24 | 25 | @implementation VBXOutgoingPhone 26 | 27 | - (id)initWithDictionary:(NSDictionary *)dictionary { 28 | if (self = [super init]) { 29 | self.key = [dictionary stringForKey:@"id"]; 30 | self.name = [dictionary stringForKey:@"name"]; 31 | self.phone = [dictionary stringForKey:@"phone"]; 32 | } 33 | return self; 34 | } 35 | 36 | @synthesize key = _key; 37 | @synthesize name = _name; 38 | @synthesize phone = _phone; 39 | 40 | - (void)dealloc { 41 | self.key = nil; 42 | self.name = nil; 43 | self.phone = nil; 44 | [super dealloc]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Classes/VBXPerfTimer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXPerfTimer : NSObject { 25 | NSTimeInterval _start; 26 | } 27 | 28 | + (VBXPerfTimer *) startTimer; 29 | 30 | - (id)initWithStartTime:(NSTimeInterval)start; 31 | 32 | @property (nonatomic, readonly) NSTimeInterval start; 33 | 34 | - (NSTimeInterval)elapsed; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Classes/VBXPerfTimer.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXPerfTimer.h" 22 | 23 | 24 | @implementation VBXPerfTimer 25 | 26 | + (VBXPerfTimer *) startTimer { 27 | return [[[VBXPerfTimer alloc] init] autorelease]; 28 | } 29 | 30 | - (id)init { 31 | return [self initWithStartTime:[NSDate timeIntervalSinceReferenceDate]]; 32 | } 33 | 34 | - (id)initWithStartTime:(NSTimeInterval)s { 35 | if (self = [super init]) { 36 | _start = s; 37 | } 38 | return self; 39 | } 40 | 41 | @synthesize start = _start; 42 | 43 | - (NSTimeInterval)elapsed { 44 | return [NSDate timeIntervalSinceReferenceDate] - _start; 45 | } 46 | 47 | - (NSString *)description { 48 | return [NSString stringWithFormat:@"%gs", [self elapsed]]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Classes/VBXResourceLoader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXResourceRequest; 24 | @class VBXCache; 25 | 26 | @interface VBXResourceLoader : NSObject { 27 | NSMutableArray *_urlLoaders; 28 | id _target; 29 | SEL _successAction; 30 | SEL _errorAction; 31 | BOOL _answersAuthChallenges; 32 | VBXCache *_cache; 33 | NSUserDefaults *_userDefaults; 34 | NSURL *_baseURL; 35 | } 36 | 37 | + (VBXResourceLoader *)loader; 38 | 39 | @property (nonatomic, assign) id target; 40 | @property (nonatomic, assign) SEL successAction; 41 | @property (nonatomic, assign) SEL errorAction; 42 | @property (nonatomic, assign) BOOL answersAuthChallenges; 43 | @property (nonatomic, retain) VBXCache *cache; 44 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 45 | @property (nonatomic, retain) NSURL *baseURL; 46 | 47 | - (void)setTarget:(id)target successAction:(SEL)successAction; 48 | - (void)setTarget:(id)target successAction:(SEL)successAction errorAction:(SEL)errorAction; 49 | 50 | - (void)loadRequest:(VBXResourceRequest *)request; 51 | - (void)loadRequest:(VBXResourceRequest *)request usingCache:(BOOL)usingCache; 52 | - (void)cancelAllRequests; 53 | 54 | - (NSURLRequest *)URLRequestForRequest:(VBXResourceRequest *)request; 55 | - (NSString *)keyForRequest:(NSURLRequest *)request; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Classes/VBXResourceRequest.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXResourceRequest : NSObject { 25 | NSString *_resource; 26 | NSString *_method; 27 | NSMutableDictionary *_params; 28 | } 29 | 30 | + (VBXResourceRequest *)requestWithResource:(NSString *)resource; 31 | + (VBXResourceRequest *)requestWithResource:(NSString *)resource method:(NSString*)method; 32 | 33 | - (id)initWithResource:(NSString *)resource method:(NSString*)method; 34 | 35 | @property (nonatomic, readonly) NSString *resource; 36 | @property (nonatomic, readonly) NSString *method; 37 | @property (nonatomic, readonly) NSMutableDictionary *params; 38 | 39 | - (BOOL)isGet; 40 | - (BOOL)isPost; 41 | - (BOOL)isDelete; 42 | 43 | - (NSMutableURLRequest *)URLRequestWithBaseURL:(NSURL *)baseURL; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Classes/VBXResult.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXResult : NSObject { 25 | BOOL _success; 26 | id _object; 27 | NSError *_error; 28 | } 29 | 30 | + (VBXResult *)resultWithObject:(id)object; 31 | 32 | + (VBXResult *)resultWithError:(NSError*)error; 33 | 34 | - (id)initWithSuccess:(BOOL)success object:(id)object error:(NSError*)error; 35 | 36 | @property (nonatomic, readonly, getter=isSuccess) BOOL success; 37 | @property (nonatomic, readonly) id object; 38 | @property (nonatomic, readonly) NSError *error; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Classes/VBXResult.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXResult.h" 22 | 23 | 24 | @implementation VBXResult 25 | 26 | + (VBXResult *)resultWithObject:(id)object { 27 | return [[[VBXResult alloc] initWithSuccess:YES object:object error:nil] autorelease]; 28 | } 29 | 30 | + (VBXResult *)resultWithError:(NSError *)error { 31 | return [[[VBXResult alloc] initWithSuccess:NO object:nil error:error] autorelease]; 32 | } 33 | 34 | - (id)initWithSuccess:(BOOL)s object:(id)o error:(NSError *)e { 35 | if (self = [super init]) { 36 | _success = s; 37 | _object = [o retain]; 38 | _error = [e retain]; 39 | } 40 | return self; 41 | } 42 | 43 | @synthesize success = _success; 44 | @synthesize object = _object; 45 | @synthesize error = _error; 46 | 47 | - (NSString *)description { 48 | NSString *contents = _success ? [_object description] : [NSString stringWithFormat:@"error: %@", _error]; 49 | return [NSString stringWithFormat:@"", contents]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Classes/VBXSectionedDataSource.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXDataSource.h" 23 | 24 | @interface VBXSectionedCellDataSource : VBXDataSource { 25 | NSMutableArray *_headers; 26 | NSMutableArray *_footers; 27 | NSMutableArray *_sections; 28 | } 29 | 30 | @property (nonatomic, retain) NSMutableArray *headers; 31 | @property (nonatomic, retain) NSMutableArray *footers; 32 | @property (nonatomic, retain) NSMutableArray *sections; 33 | 34 | - (id)initWithHeaders:(NSMutableArray *)headers footers:(NSMutableArray *)footers sections:(NSMutableArray *)sections; 35 | 36 | + (VBXSectionedCellDataSource *)dataSourceWithHeadersCellsAndFooters:(id)object,...; 37 | + (VBXSectionedCellDataSource *)dataSourceWithArray:(NSArray *)array; 38 | 39 | @end 40 | 41 | -------------------------------------------------------------------------------- /Classes/VBXSecurityAlertController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXViewController.h" 23 | 24 | @class VBXObjectBuilder; 25 | @protocol VBXSecurityAlertControllerDelegate; 26 | 27 | @interface VBXSecurityAlertController : VBXViewController { 28 | VBXObjectBuilder *_builder; 29 | 30 | id _delegate; 31 | NSInteger _tag; 32 | 33 | NSString *_headingText; 34 | NSString *_descriptionText; 35 | 36 | NSDictionary *_userInfo; 37 | } 38 | 39 | @property (nonatomic, retain) VBXObjectBuilder *builder; 40 | @property (nonatomic, assign) id delegate; 41 | @property (nonatomic, assign) NSInteger tag; 42 | 43 | @property (nonatomic, retain) NSString *headingText; 44 | @property (nonatomic, retain) NSString *descriptionText; 45 | @property (nonatomic, retain) NSDictionary *userInfo; 46 | 47 | @end 48 | 49 | @protocol VBXSecurityAlertControllerDelegate 50 | - (void)securityAlertDidAccept:(VBXSecurityAlertController *)securityAlert; 51 | - (void)securityAlertDidReject:(VBXSecurityAlertController *)securityAlert; 52 | @end 53 | -------------------------------------------------------------------------------- /Classes/VBXSendTextController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @class VBXSectionedCellDataSource; 25 | @class VBXResourceLoader; 26 | @class CallerIdCell; 27 | @class ToCell; 28 | @class BodyCell; 29 | 30 | @interface VBXSendTextController : VBXTableViewController { 31 | NSUserDefaults *_userDefaults; 32 | VBXResourceLoader *_sendTextPoster; 33 | VBXSectionedCellDataSource *_dataSource; 34 | 35 | CallerIdCell *_callerIdCell; 36 | ToCell *_toCell; 37 | BodyCell *_bodyCell; 38 | 39 | NSString *_initialPhoneNumber; 40 | BOOL _callerIdPickerIsOpen; 41 | } 42 | 43 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 44 | @property (nonatomic, retain) VBXResourceLoader *sendTextPoster; 45 | 46 | - (id)initWithPhone:(NSString *)phone; 47 | 48 | - (NSDictionary *)saveState; 49 | - (void)restoreState:(NSDictionary *)state; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Classes/VBXSessionExpiredController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @class VBXObjectBuilder; 25 | @class VBXSectionedCellDataSource; 26 | @class VBXTextFieldCell; 27 | @class VBXButtonCell; 28 | @protocol VBXSessionExpiredControllerDelegate; 29 | 30 | @interface VBXSessionExpiredController : VBXTableViewController { 31 | NSUserDefaults *_userDefaults; 32 | VBXObjectBuilder *_builder; 33 | 34 | VBXSectionedCellDataSource *_cellDataSource; 35 | 36 | VBXTextFieldCell *_emailField; 37 | VBXTextFieldCell *_passwordField; 38 | VBXButtonCell *_logoutButton; 39 | 40 | id _delegate; 41 | NSDictionary *_userInfo; 42 | } 43 | 44 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 45 | @property (nonatomic, retain) VBXObjectBuilder *builder; 46 | @property (nonatomic, assign) id delegate; 47 | @property (nonatomic, retain) NSDictionary *userInfo; 48 | 49 | @end 50 | 51 | @protocol VBXSessionExpiredControllerDelegate 52 | - (void)sessionExpiredController:(VBXSessionExpiredController *)controller loginWithEmail:(NSString *)email password:(NSString *)password; 53 | @end -------------------------------------------------------------------------------- /Classes/VBXSetNumberController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | 25 | @class VBXTextFieldCell; 26 | @class VBXSectionedCellDataSource; 27 | 28 | @interface VBXSetNumberController : VBXTableViewController { 29 | NSUserDefaults *_userDefaults; 30 | 31 | VBXSectionedCellDataSource *_cellDataSource; 32 | 33 | VBXTextFieldCell *_numberField; 34 | 35 | id _finishedTarget; 36 | SEL _finishedAction; 37 | } 38 | 39 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 40 | @property (nonatomic, assign) id finishedTarget; 41 | @property (nonatomic, assign) SEL finishedAction; 42 | @property (nonatomic, assign) NSString *finishedButtonText; 43 | 44 | @end -------------------------------------------------------------------------------- /Classes/VBXSetServerController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @class VBXConfigAccessor; 25 | @class VBXTextFieldCell; 26 | @class VBXSectionedCellDataSource; 27 | 28 | @interface VBXSetServerController : VBXTableViewController { 29 | NSUserDefaults *_userDefaults; 30 | NSHTTPCookieStorage *_cookieStorage; 31 | NSURLCredentialStorage *_credentialStorage; 32 | NSArray *_allCaches; 33 | VBXConfigAccessor *_configAccessor; 34 | 35 | VBXSectionedCellDataSource *_cellDataSource; 36 | 37 | VBXTextFieldCell *_serverField; 38 | 39 | NSURLAuthenticationChallenge *_challenge; 40 | NSURLProtectionSpace *_protectionSpace; 41 | } 42 | 43 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 44 | @property (nonatomic, retain) NSHTTPCookieStorage *cookieStorage; 45 | @property (nonatomic, retain) NSURLCredentialStorage *credentialStorage; 46 | @property (nonatomic, retain) NSArray *allCaches; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Classes/VBXSettingsController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @class VBXObjectBuilder; 25 | @class VBXConfigAccessor; 26 | @class VBXTextFieldCell; 27 | @class VBXButtonCell; 28 | @class VBXFooterTextCell; 29 | @class VBXDataSource; 30 | @class VBXSectionedCellDataSource; 31 | 32 | @interface VBXSettingsController : VBXTableViewController { 33 | NSUserDefaults *_userDefaults; 34 | VBXObjectBuilder *_builder; 35 | VBXConfigAccessor *_configAccessor; 36 | 37 | VBXSectionedCellDataSource *_cellDataSource; 38 | 39 | UITableViewCell *_callbackPhoneField; 40 | VBXButtonCell *_logoutButton; 41 | VBXButtonCell *_licenseButton; 42 | 43 | } 44 | 45 | @property (nonatomic, retain) NSUserDefaults *userDefaults; 46 | @property (nonatomic, retain) VBXObjectBuilder *builder; 47 | @property (nonatomic, retain) VBXConfigAccessor *configAccessor; 48 | 49 | @end -------------------------------------------------------------------------------- /Classes/VBXStatefulTableViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewController.h" 23 | 24 | @interface VBXStatefulTableViewController : VBXTableViewController { 25 | 26 | } 27 | 28 | - (UIView *)loadingView; 29 | - (UIView *)emptyView; 30 | - (UIView *)errorView; 31 | 32 | - (void)showLoadingState; 33 | - (void)showErrorState; 34 | - (void)showEmptyState; 35 | - (void)showLoadedState; 36 | - (void)showRefreshingState; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Classes/VBXStatefulTableViewController.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXStatefulTableViewController.h" 22 | #import "VBXActivityLabel.h" 23 | #import "VBXTableStatusView.h" 24 | #import "VBXConfiguration.h" 25 | 26 | @implementation VBXStatefulTableViewController 27 | 28 | - (UIView *)loadingView { 29 | VBXActivityLabel *label = [[[VBXActivityLabel alloc] initWithText:LocalizedString(@"Loading...", @"StatefulTableViewController: Title shown for loading view.")] autorelease]; 30 | return label; 31 | } 32 | 33 | - (UIView *)emptyView { 34 | VBXTableStatusView *statusView = [[[VBXTableStatusView alloc] initWithFrame:CGRectZero] autorelease]; 35 | [statusView setTitle:LocalizedString(@"Empty", @"StatefulTableViewController: Title shown table is empty.")]; 36 | [statusView setDescription:LocalizedString(@"There are no items to show here.", @"StatefulTableViewController: Description shown when table is empty.")]; 37 | return statusView; 38 | } 39 | 40 | - (UIView *)errorView { 41 | VBXTableStatusView *statusView = [[[VBXTableStatusView alloc] initWithFrame:CGRectZero] autorelease]; 42 | [statusView setTitle:LocalizedString(@"Error", @"StatefulTableViewController: Title shown when there is an error loading table content.")]; 43 | [statusView setDescription:LocalizedString(@"Something went wrong!", @"StatefulTableViewController: Description shown when there is an error loading content.")]; 44 | return statusView; 45 | } 46 | 47 | - (void)showErrorState { 48 | trace(); 49 | [self clearOverlayView]; 50 | [self setOverlayView:[self errorView]]; 51 | } 52 | 53 | - (void)showEmptyState { 54 | trace(); 55 | [self clearOverlayView]; 56 | [self setOverlayView:[self emptyView]]; 57 | } 58 | 59 | - (void)showLoadedState { 60 | trace(); 61 | [self clearOverlayView]; 62 | } 63 | 64 | - (void)showRefreshingState { 65 | trace(); 66 | [self clearOverlayView]; 67 | } 68 | 69 | - (void)showLoadingState { 70 | trace(); 71 | [self clearOverlayView]; 72 | [self setOverlayView:[self loadingView]]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Classes/VBXStringPartLabel.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @interface VBXStringPart : NSObject { 24 | NSString *_text; 25 | UIFont *_font; 26 | } 27 | 28 | @property (nonatomic, retain) NSString *text; 29 | @property (nonatomic, retain) UIFont *font; 30 | 31 | + (VBXStringPart *)partWithText:(NSString *)text font:(UIFont *)font; 32 | 33 | @end 34 | 35 | @interface VBXStringPartLabel : UIView { 36 | UIColor *_textColor; 37 | CGSize _shadowOffset; 38 | UIColor *_shadowColor; 39 | NSArray *_parts; 40 | UITextAlignment _textAlignment; 41 | } 42 | 43 | @property (nonatomic, retain) UIColor *textColor; 44 | @property (nonatomic, assign) CGSize shadowOffset; 45 | @property (nonatomic, retain) UIColor *shadowColor; 46 | @property (nonatomic, retain) NSArray *parts; 47 | @property (nonatomic, assign) UITextAlignment textAlignment; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Classes/VBXSublist.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXSublist : NSObject { 25 | NSInteger _offset; 26 | NSInteger _total; 27 | NSMutableArray *_items; 28 | } 29 | 30 | - (id)initWithDictionary:(NSDictionary *)dictionary class:(Class)class; 31 | 32 | @property (nonatomic, assign) NSInteger offset; 33 | @property (nonatomic, assign) NSInteger total; 34 | @property (nonatomic, copy) NSArray *items; 35 | @property (nonatomic, readonly) NSInteger last; 36 | @property (nonatomic, readonly) BOOL hasMore; 37 | 38 | - (id)objectAtIndex:(NSInteger)index; 39 | - (NSArray *)sublistWithRange:(NSRange)range; 40 | - (void)insertObject:(id)object atIndex:(NSInteger)index; 41 | - (void)removeObjectAtIndex:(NSInteger)index; 42 | 43 | - (void)mergeItemsFromBeginning:(VBXSublist *)sublist; 44 | - (void)mergeItemsFromEnd:(VBXSublist *)sublist; 45 | - (void)mergeItemsFrom:(VBXSublist *)sublist; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Classes/VBXSublist.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXSublist.h" 22 | #import "NSExtensions.h" 23 | 24 | 25 | @implementation VBXSublist 26 | 27 | - (id)initWithDictionary:(NSDictionary *)dictionary class:(Class)class { 28 | if (self = [super init]) { 29 | self.offset = [dictionary intForKey:@"offset"]; 30 | self.total = [dictionary intForKey:@"total"]; 31 | self.items = [dictionary arrayOfModelsForKey:@"items" class:class]; 32 | } 33 | return self; 34 | } 35 | 36 | @synthesize offset = _offset; 37 | @synthesize total = _total; 38 | @synthesize items = _items; 39 | 40 | - (void)setItems:(NSArray *)items { 41 | if (_items != items) { 42 | [_items release]; 43 | _items = [[NSMutableArray alloc] initWithArray:items]; 44 | } 45 | } 46 | 47 | - (void)dealloc { 48 | self.items = nil; 49 | [super dealloc]; 50 | } 51 | 52 | - (NSInteger)last { 53 | return _offset + [_items count]; 54 | } 55 | 56 | - (BOOL)hasMore { 57 | return _total > self.last; 58 | } 59 | 60 | - (id)objectAtIndex:(NSInteger)index { 61 | index -= _offset; 62 | return [_items objectAtIndex:index]; 63 | } 64 | 65 | - (NSArray *)sublistWithRange:(NSRange)range { 66 | range.location -= _offset; 67 | return [_items subarrayWithRange:range]; 68 | } 69 | 70 | - (void)insertObject:(id)object atIndex:(NSInteger)index { 71 | index -= _offset; 72 | [_items insertObject:object atIndex:index]; 73 | _total++; 74 | } 75 | 76 | - (void)removeObjectAtIndex:(NSInteger)index { 77 | index -= _offset; 78 | [_items removeObjectAtIndex:index]; 79 | _total--; 80 | } 81 | 82 | - (void)mergeItemsFromBeginning:(VBXSublist *)sublist { 83 | if (sublist.last < self.offset) return; // list is disjoint 84 | NSInteger length = self.offset - sublist.offset; 85 | if (length < 1) return; // nothing to do 86 | NSRange range = NSMakeRange(sublist.offset, length); 87 | NSMutableArray *newItems = [NSMutableArray arrayWithArray:[sublist sublistWithRange:range]]; 88 | [newItems addObjectsFromArray:_items]; 89 | self.items = newItems; 90 | self.offset = sublist.offset; 91 | } 92 | 93 | - (void)mergeItemsFromEnd:(VBXSublist *)sublist { 94 | if (sublist.offset > self.last) return; // list is disjoint 95 | NSInteger length = sublist.last - self.last; 96 | if (length < 1) return; // nothing to do 97 | NSArray *newItems = [sublist sublistWithRange:NSMakeRange(self.last, length)]; 98 | [_items addObjectsFromArray:newItems]; 99 | } 100 | 101 | - (void)mergeItemsFrom:(VBXSublist *)sublist { 102 | [self mergeItemsFromBeginning:sublist]; 103 | [self mergeItemsFromEnd:sublist]; 104 | } 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /Classes/VBXTableStatusView.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXTableStatusView : UIView { 25 | UIImageView *_imageView; 26 | UILabel *_titleLabel; 27 | UILabel *_descriptionLabel; 28 | 29 | BOOL _parentHadUserInteractionEnabled; 30 | } 31 | 32 | - (void)setImage:(UIImage *)image; 33 | - (void)setTitle:(NSString *)title; 34 | - (void)setDescription:(NSString *)description; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Classes/VBXTableView.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | UIColor *VBXTableViewGroupedBackgroundColor(); 24 | 25 | @interface VBXTableView : UITableView { 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Classes/VBXTableView.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXTableView.h" 22 | #import "VBXGlobal.h" 23 | #import "VBXConfiguration.h" 24 | 25 | UIColor *VBXTableViewGroupedBackgroundColor() { 26 | VBXHSL hsl = ThemedHSL(@"tableViewGroupedBackgroundTintHSL", VBXHSLMake(255, 15, 240)); 27 | UIImage *tintedImage = VBXAdjustImageWithPhotoshopHSLWithCache([NSUserDefaults standardUserDefaults], @"tableview-grouped-background.png", @"normal", hsl); 28 | return [[[UIColor alloc] initWithPatternImage:[tintedImage stretchableImageWithLeftCapWidth:0 topCapHeight:1]] autorelease]; 29 | } 30 | 31 | @interface VBXTableView (Private) 32 | @end 33 | 34 | @implementation VBXTableView 35 | 36 | - (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { 37 | if (self = [super initWithFrame:frame style:style]) { 38 | [[VBXConfiguration sharedConfiguration] addConfigObserver:self]; 39 | [self applyConfig]; 40 | } 41 | return self; 42 | } 43 | 44 | - (void)dealloc { 45 | [[VBXConfiguration sharedConfiguration] removeConfigObserver:self]; 46 | [super dealloc]; 47 | } 48 | 49 | - (void)applyConfig { 50 | if (self.style == UITableViewStyleGrouped) { 51 | self.backgroundColor = VBXTableViewGroupedBackgroundColor(); 52 | self.separatorColor = ThemedColor(@"tableViewGroupedSeparatorColor", RGBHEXCOLOR(0xa9abae)); 53 | } else { 54 | self.backgroundColor = ThemedColor(@"tableViewPlainBackgroundColor", RGBHEXCOLOR(0xffffff)); 55 | self.separatorColor = ThemedColor(@"tableViewPlainSeparatorColor", RGBHEXCOLOR(0xe6e6e6)); 56 | } 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Classes/VBXTableViewCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXConfiguration.h" 23 | 24 | @interface VBXTableViewCell : UITableViewCell { 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Classes/VBXTableViewCell.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXTableViewCell.h" 22 | 23 | 24 | @implementation VBXTableViewCell 25 | 26 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 27 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 28 | [[VBXConfiguration sharedConfiguration] addConfigObserver:self]; 29 | [self applyConfig]; 30 | } 31 | return self; 32 | } 33 | 34 | - (void)dealloc { 35 | [[VBXConfiguration sharedConfiguration] removeConfigObserver:self]; 36 | [super dealloc]; 37 | } 38 | 39 | - (void)applyConfig { 40 | self.backgroundColor = ThemedColor(@"tableViewCellBackgroundColor", ThemedColor(@"tableViewPlainBackgroundColor", [UIColor whiteColor])); 41 | self.textLabel.textColor = ThemedColor(@"tableViewCellTitleColor", ThemedColor(@"primaryTextColor", [UIColor blackColor])); 42 | self.detailTextLabel.textColor = ThemedColor(@"tableViewCellValueColor", RGBHEXCOLOR(0x385487)); 43 | self.selectionStyle = [[VBXConfiguration sharedConfiguration] tableViewCellSelectionStyleForKey:@"tableViewCellSelectionStyle" defaultValue:UITableViewCellSelectionStyleBlue]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Classes/VBXTableViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXViewController.h" 23 | #import "VBXTableView.h" 24 | 25 | 26 | @interface VBXTableViewController : VBXViewController { 27 | UITableViewStyle _tableStyle; 28 | VBXTableView *_tableView; 29 | 30 | BOOL _autoRefocusOnSelectedCell; 31 | } 32 | 33 | @property (nonatomic, retain) VBXTableView *tableView; 34 | @property (nonatomic, assign) BOOL autoRefocusOnSelectedCell; 35 | 36 | - (id)initWithStyle:(UITableViewStyle)style; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Classes/VBXTextEntryController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXViewController.h" 23 | 24 | @interface VBXTextEntryController : UIViewController { 25 | id _target; 26 | SEL _action; 27 | NSString *_navTitle; 28 | NSString *_initialText; 29 | UINavigationBar *_navBar; 30 | UITextView *_textView; 31 | } 32 | 33 | @property (nonatomic, assign) id target; 34 | @property (nonatomic, assign) SEL action; 35 | @property (nonatomic, retain) NSString *navTitle; 36 | @property (nonatomic, retain) NSString *initialText; 37 | @property (nonatomic, retain) IBOutlet UINavigationBar *navBar; 38 | @property (nonatomic, retain) IBOutlet UITextView *textView; 39 | 40 | - (IBAction)save; 41 | - (IBAction)cancel; 42 | 43 | - (NSDictionary *)saveState; 44 | - (void)restoreState:(NSDictionary *)state; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Classes/VBXTextFieldCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXTableViewCell.h" 23 | 24 | @interface VBXTextFieldCell : VBXTableViewCell { 25 | UILabel *_label; 26 | UILabel *_helpLabel; 27 | UITextField *_textField; 28 | 29 | } 30 | 31 | @property (nonatomic, readonly) UILabel *label; 32 | @property (nonatomic, readonly) UILabel *helpLabel; 33 | @property (nonatomic, readonly) UITextField *textField; 34 | 35 | - (id)initWithReuseIdentifier:(NSString *)reuseIdentifer; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /Classes/VBXTicketStatus.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXTicketStatus : NSObject { 25 | NSString *_value; 26 | } 27 | 28 | + (VBXTicketStatus *)ticketStatusWithValue:(NSString *)value; 29 | - (id)initWithTicketStatus:(NSString *)value; 30 | 31 | - (NSString *)key; 32 | - (NSString *)title; 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /Classes/VBXTicketStatus.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXTicketStatus.h" 22 | #import "VBXConfiguration.h" 23 | 24 | @implementation VBXTicketStatus 25 | 26 | + (VBXTicketStatus *)ticketStatusWithValue:(NSString *)value { 27 | return [[[VBXTicketStatus alloc] initWithTicketStatus:value] autorelease]; 28 | } 29 | 30 | - (id)initWithTicketStatus:(NSString *)value { 31 | if (self = [super init]) { 32 | _value = [value retain]; 33 | } 34 | return self; 35 | } 36 | 37 | - (void)dealloc { 38 | [_value release]; 39 | [super dealloc]; 40 | } 41 | 42 | - (NSString *)key { 43 | return _value; 44 | } 45 | 46 | - (NSString *)title { 47 | if ([_value isEqualToString:@"open"]) { 48 | return LocalizedString(@"Open", @"Friendly label for open state"); 49 | } else if ([_value isEqualToString:@"closed"]) { 50 | return LocalizedString(@"Closed", @"Friendly label for closed state"); 51 | } else if ([_value isEqualToString:@"pending"]) { 52 | return LocalizedString(@"Pending", @"Friendly label for pending state"); 53 | } else { 54 | return _value; 55 | } 56 | } 57 | 58 | - (BOOL)isEqual:(id)object { 59 | if ([object isKindOfClass:[VBXTicketStatus class]]) { 60 | return [[self key] isEqualToString:[((VBXTicketStatus *) object) key]]; 61 | } else { 62 | return NO; 63 | } 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Classes/VBXTrustHelper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import 23 | 24 | typedef enum { 25 | PostSetupTrustActionDenyWithGenericError, 26 | PostSetupTrustActionDenyWithSecureModeAlert, 27 | PostSetupTrustActionPromptWithCertificateIsNowUntrustedAlert, 28 | PostSetupTrustActionPromptWithUntrustedCertificateHasChangedAlert, 29 | PostSetupTrustActionAllow, 30 | } PostSetupTrustAction; 31 | 32 | typedef enum { 33 | SetupTrustActionDenyWithGenericError, 34 | SetupTrustActionDenyWithTrustedCertRequiredAlert, 35 | SetupTrustActionPromptWithUntrustedCertAlert, 36 | SetupTrustActionAllow, 37 | } SetupTrustAction; 38 | 39 | @interface VBXTrustHelper : NSObject { 40 | } 41 | 42 | + (PostSetupTrustAction)actionForPostSetupCertificateIssueWithOSStatus:(OSStatus)osStatus 43 | secTrustResultType:(SecTrustResultType)secTrustResultType 44 | certData:(NSData *)certData 45 | requireTrustedCertForThisURL:(BOOL)requireTrustedCertForThisURL 46 | lastAcceptedCertWasTrusted:(BOOL)lastAcceptedCertWasTrusted 47 | lastAcceptedCertData:(NSData *)lastAcceptedCertificateData; 48 | 49 | + (SetupTrustAction)actionForSetupTrustIssueWithOSStatus:(OSStatus)osStatus 50 | secTrustResultType:(SecTrustResultType)secTrustResultType 51 | requireTrustedCertForThisURL:(BOOL)requireTrustedCertForThisURL; 52 | 53 | + (BOOL)serverURLRequiresTrustedCertificate:(NSString *)serverURL; 54 | 55 | + (void)acceptCertificateAndRecordCertificateInfoWithChallenge:(NSURLAuthenticationChallenge *)challenge serverTrust:(SecTrustRef)serverTrust; 56 | 57 | + (NSData *)dataForFirstCertificate:(SecTrustRef)serverTrust; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Classes/VBXURLLoader.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @class VBXPerfTimer; 24 | 25 | @protocol VBXURLLoaderDelegate; 26 | 27 | extern NSString *VBXURLLoaderDidStartLoading; 28 | extern NSString *VBXURLLoaderDidFinishLoading; 29 | extern NSString *VBXURLLoaderDidReceiveAuthenticationChallenge; 30 | 31 | @interface VBXURLLoader : NSObject { 32 | NSURLRequest *_request; 33 | NSURLConnection *_connection; 34 | NSURLResponse *_response; 35 | NSMutableData *_data; 36 | NSInteger _contentLength; 37 | VBXPerfTimer *_perfTimer; 38 | BOOL _answersAuthChallenges; 39 | id _delegate; 40 | } 41 | 42 | + (VBXURLLoader *)loadRequest:(NSURLRequest *)request andInform:(id)delegate answerAuthChallenges:(BOOL)answerAuthChallenges; 43 | + (VBXURLLoader *)loadRequestWithURLString:(NSString *)string andInform:(id)delegate; 44 | 45 | - (id)initWithURLRequest:(NSURLRequest *)request; 46 | 47 | @property (nonatomic, readonly) NSURLRequest *request; 48 | @property (nonatomic, readonly) NSData *data; 49 | @property (nonatomic, readonly) NSInteger contentLength; 50 | @property (nonatomic, readonly) NSInteger bytesReceived; 51 | @property (nonatomic, readonly) float downloadProgress; 52 | @property (nonatomic, assign) BOOL answersAuthChallenges; 53 | @property (nonatomic, assign) id delegate; 54 | @property (nonatomic, readonly) BOOL hadTrustedCertificate; 55 | 56 | - (void)load; 57 | - (void)cancel; 58 | 59 | @end 60 | 61 | 62 | @protocol VBXURLLoaderDelegate 63 | 64 | - (void)loader:(VBXURLLoader *)loader didFinishWithData:(NSData *)data; 65 | 66 | @optional 67 | - (void)loaderDidReceiveData:(VBXURLLoader *)loader; 68 | - (void)loader:(VBXURLLoader *)loader didFailWithError:(NSError *)error; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Classes/VBXUser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | 24 | @interface VBXUser : NSObject { 25 | NSString *_key; 26 | NSString *_firstName; 27 | NSString *_lastName; 28 | NSString *_email; 29 | } 30 | 31 | - (id)initWithDictionary:(NSDictionary *)dictionary; 32 | 33 | @property (nonatomic, retain) NSString *key; 34 | @property (nonatomic, retain) NSString *firstName; 35 | @property (nonatomic, retain) NSString *lastName; 36 | @property (nonatomic, retain) NSString *email; 37 | 38 | - (NSString *)fullName; 39 | - (NSString *)displayName; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Classes/VBXUser.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXUser.h" 22 | #import "NSExtensions.h" 23 | 24 | 25 | @implementation VBXUser 26 | 27 | - (id)initWithDictionary:(NSDictionary *)dictionary { 28 | if (self = [super init]) { 29 | self.key = [dictionary stringForKey:@"id"]; 30 | self.firstName = [dictionary stringForKey:@"first_name"]; 31 | self.lastName = [dictionary stringForKey:@"last_name"]; 32 | self.email = [dictionary stringForKey:@"email"]; 33 | } 34 | return self; 35 | } 36 | 37 | @synthesize key = _key; 38 | @synthesize firstName = _firstName; 39 | @synthesize lastName = _lastName; 40 | @synthesize email = _email; 41 | 42 | - (void)dealloc { 43 | self.key = nil; 44 | self.firstName = nil; 45 | self.lastName = nil; 46 | self.email = nil; 47 | [super dealloc]; 48 | } 49 | 50 | - (NSString *)fullName { 51 | NSMutableString *name = [NSMutableString string]; 52 | if (_firstName) [name appendString:_firstName]; 53 | [name appendString:@" "]; 54 | if (_lastName) [name appendString:_lastName]; 55 | return [name stringByTrimmingWhitespace]; 56 | } 57 | 58 | - (NSString *)displayName { 59 | NSMutableString *name = [NSMutableString stringWithString:[self fullName]]; 60 | if (_email.length > 0) [name appendFormat:@" <%@>", _email]; 61 | return [name stringByTrimmingWhitespace]; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Classes/VBXViewCell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXDataSource.h" 23 | #import "VBXTableViewCell.h" 24 | 25 | @interface VBXViewCell : VBXTableViewCell { 26 | UIView *_view; 27 | BOOL _showBackground; 28 | UIEdgeInsets _contentInsets; 29 | } 30 | 31 | @property (nonatomic, retain) UIView *view; 32 | @property (nonatomic, assign) BOOL showBackground; 33 | @property (nonatomic, assign) UIEdgeInsets contentInsets; 34 | 35 | - (id)initWithView:(UIView *)view reuseIdentifier:(NSString *)reuseIdentifier; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Classes/VBXViewCell.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXViewCell.h" 22 | #import "UIViewPositioningExtension.h" 23 | 24 | @implementation VBXViewCell 25 | 26 | @synthesize view = _view; 27 | @synthesize showBackground = _showBackground; 28 | @synthesize contentInsets = _contentInsets; 29 | 30 | - (id)initWithView:(UIView *)aView reuseIdentifier:(NSString *)reuseIdentifier { 31 | if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) { 32 | self.view = aView; 33 | self.showBackground = YES; 34 | self.selectionStyle = UITableViewCellSelectionStyleNone; 35 | self.contentInsets = UIEdgeInsetsZero; 36 | } 37 | return self; 38 | } 39 | 40 | - (void)setView:(UIView *)newView { 41 | if (_view != newView) { 42 | [_view removeFromSuperview]; 43 | [_view release]; 44 | _view = [newView retain]; 45 | [self.contentView addSubview:_view]; 46 | 47 | [self setNeedsLayout]; 48 | } 49 | } 50 | 51 | - (void)layoutSubviews { 52 | [super layoutSubviews]; 53 | 54 | self.view.left = _contentInsets.left; 55 | self.view.top = _contentInsets.top; 56 | } 57 | 58 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 59 | } 60 | 61 | - (void)setBackgroundView:(UIView *)backgroundView { 62 | if (_showBackground) { 63 | [super setBackgroundView:backgroundView]; 64 | } 65 | } 66 | 67 | - (void)dealloc { 68 | self.view = nil; 69 | [super dealloc]; 70 | } 71 | 72 | - (CGFloat)heightForCell { 73 | return _view.height + _contentInsets.top + _contentInsets.bottom; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Classes/VBXViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | #import "VBXConfiguration.h" 23 | 24 | @class VBXConfiguration; 25 | 26 | @interface VBXViewController : UIViewController { 27 | UIView *_overlayView; 28 | BOOL _viewIsDimmed; 29 | 30 | UIWindow *_pseudoModalWindow; 31 | UINavigationController *_pseudoNavigationController; 32 | } 33 | 34 | - (void)setOverlayView:(UIView *)view; 35 | - (void)clearOverlayView; 36 | 37 | - (void)keyboardWillShow:(NSNotification *)notification; 38 | - (void)keyboardWillHide:(NSNotification *)notification; 39 | 40 | - (void)setPromptAndDimView:(NSString *)title; 41 | - (void)unsetPromptAndUndim; 42 | 43 | - (void)presentAsPseudoModalViewController; 44 | - (void)dismissPseudoModalViewController; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Default.png -------------------------------------------------------------------------------- /Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | get-task-allow 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Icon-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Icon-settings.png -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Icon.png -------------------------------------------------------------------------------- /NSDictionary+merge.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | @interface NSDictionary (Merge) 24 | 25 | + (NSDictionary *) dictionaryByMerging: (NSDictionary *) dict1 with: (NSDictionary *) dict2; 26 | - (NSDictionary *) dictionaryByMergingWith: (NSDictionary *) dict; 27 | - (BOOL)containsSomethingForKey:(id)key; 28 | 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /NSDictionary+merge.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "NSDictionary+merge.h" 22 | 23 | @implementation NSDictionary (merge) 24 | 25 | + (NSDictionary *) dictionaryByMerging: (NSDictionary *) dict1 with: (NSDictionary *) dict2 { 26 | NSMutableDictionary * result = [NSMutableDictionary dictionary]; 27 | 28 | [dict2 enumerateKeysAndObjectsUsingBlock: ^(id key, id obj, BOOL *stop) { 29 | // If object is a dictionary and dict1 contains key with a value, set the object 30 | if ([obj isKindOfClass: [NSDictionary class]] && [dict1 containsSomethingForKey: key]) { 31 | NSDictionary * newVal = [[dict1 objectForKey: key] dictionaryByMergingWith: (NSDictionary *) obj]; 32 | [result setObject: newVal forKey: key]; 33 | } else if (![dict1 containsSomethingForKey: key]) { 34 | [result setObject: obj forKey: key]; 35 | } else { 36 | [result setObject: [dict1 objectForKey: key] forKey: key]; 37 | } 38 | }]; 39 | 40 | return (NSDictionary *) [[result mutableCopy] autorelease]; 41 | } 42 | 43 | - (NSDictionary *) dictionaryByMergingWith: (NSDictionary *) dict { 44 | return [[self class] dictionaryByMerging: self with: dict]; 45 | } 46 | 47 | - (BOOL)containsSomethingForKey:(id)key 48 | { 49 | return ([self stringForKey:key] != nil); 50 | } 51 | 52 | 53 | @end -------------------------------------------------------------------------------- /OpenVBX-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleDisplayName 10 | ${PRODUCT_NAME} 11 | CFBundleExecutable 12 | ${EXECUTABLE_NAME} 13 | CFBundleIconFiles 14 | 15 | Icon.png 16 | 17 | CFBundleIdentifier 18 | org.openvbx.iphone 19 | CFBundleInfoDictionaryVersion 20 | 6.0 21 | CFBundleName 22 | ${PRODUCT_NAME} 23 | CFBundlePackageType 24 | APPL 25 | CFBundleShortVersionString 26 | 1.0.2 27 | CFBundleSignature 28 | ???? 29 | CFBundleURLTypes 30 | 31 | 32 | CFBundleURLName 33 | com.twilio.OpenVBX 34 | CFBundleURLSchemes 35 | 36 | openvbx 37 | 38 | 39 | 40 | CFBundleVersion 41 | 1.0.2 42 | LSRequiresIPhoneOS 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /OpenVBX_Prefix.pch: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | // 22 | // Prefix header for all source files of the 'Twilio' target in the 'Twilio' project 23 | // 24 | 25 | #ifdef __OBJC__ 26 | #import 27 | #import 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /PCRE/README: -------------------------------------------------------------------------------- 1 | Shigeya's PCRE build script made this really painless: 2 | http://github.com/shigeyas/build-pcre-iphone -------------------------------------------------------------------------------- /PCRE/include/pcrecpp_internal.h: -------------------------------------------------------------------------------- 1 | /************************************************* 2 | * Perl-Compatible Regular Expressions * 3 | *************************************************/ 4 | 5 | /* 6 | Copyright (c) 2005, Google Inc. 7 | All rights reserved. 8 | 9 | ----------------------------------------------------------------------------- 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | 13 | * Redistributions of source code must retain the above copyright notice, 14 | this list of conditions and the following disclaimer. 15 | 16 | * Redistributions in binary form must reproduce the above copyright 17 | notice, this list of conditions and the following disclaimer in the 18 | documentation and/or other materials provided with the distribution. 19 | 20 | * Neither the name of the University of Cambridge nor the names of its 21 | contributors may be used to endorse or promote products derived from 22 | this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 28 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | POSSIBILITY OF SUCH DAMAGE. 35 | ----------------------------------------------------------------------------- 36 | */ 37 | 38 | 39 | #ifndef PCRECPP_INTERNAL_H 40 | #define PCRECPP_INTERNAL_H 41 | 42 | /* When compiling a DLL for Windows, the exported symbols have to be declared 43 | using some MS magic. I found some useful information on this web page: 44 | http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the 45 | information there, using __declspec(dllexport) without "extern" we have a 46 | definition; with "extern" we have a declaration. The settings here override the 47 | setting in pcre.h. We use: 48 | 49 | PCRECPP_EXP_DECL for declarations 50 | PCRECPP_EXP_DEFN for definitions of exported functions 51 | 52 | */ 53 | 54 | #ifndef PCRECPP_EXP_DECL 55 | # ifdef _WIN32 56 | # ifndef PCRE_STATIC 57 | # define PCRECPP_EXP_DECL extern __declspec(dllexport) 58 | # define PCRECPP_EXP_DEFN __declspec(dllexport) 59 | # else 60 | # define PCRECPP_EXP_DECL extern 61 | # define PCRECPP_EXP_DEFN 62 | # endif 63 | # else 64 | # define PCRECPP_EXP_DECL extern 65 | # define PCRECPP_EXP_DEFN 66 | # endif 67 | #endif 68 | 69 | #endif /* PCRECPP_INTERNAL_H */ 70 | 71 | /* End of pcrecpp_internal.h */ 72 | -------------------------------------------------------------------------------- /PCRE/lib/libpcre.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/PCRE/lib/libpcre.a -------------------------------------------------------------------------------- /PCRE/lib/libpcrecpp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/PCRE/lib/libpcrecpp.a -------------------------------------------------------------------------------- /PCRE/lib/libpcreposix.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/PCRE/lib/libpcreposix.a -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenVBX iPhone App 2 | ------------------ 3 | Mobilize the troops! 4 | 5 | # Requirements 6 | ----------------------------- 7 | * OpenVBX 0.90 or higher 8 | * an iPhone or iPod touch 9 | 10 | # Install 11 | ----------------------------- 12 | http://itunes.com/app/OpenVBX 13 | 14 | # Bug Reporting Guidelines 15 | ----------------------------- 16 | Report issues to: 17 | https://github.com/twilio/openvbx-iphone/issues 18 | 19 | # Trademarks 20 | ----------------------------- 21 | "OpenVBX" and "Twilio" are trademarks of Twilio, Inc., all rights 22 | reserved. If you want to say something like "Powered by Twilio" or 23 | "Powered by OpenVBX" we'd be honored. If you want to redistribute 24 | OpenVBX or this iPhone app, you must come up with your own product name. 25 | Use of the Twilio trademarks in your product name requires Twilio's 26 | written permission. 27 | 28 | # More Information 29 | ----------------------------- 30 | Visit http://openvbx.org/iphone 31 | 32 | 33 | Please remember that your use of OpenVBX in connection with the Twilio 34 | website and services is subject to the Twilio Terms of Service. 35 | Remember that you bear sole responsibility for adequate security, 36 | protection and backup of your content, software, servers and systems in 37 | connection with your use of OpenVBX and the Twilio services. We strongly 38 | encourage you to use encryption and other customary security technology 39 | to protect your content, software, servers and systems from unauthorized 40 | access or use and to routinely archive and back-up your content and 41 | other materials. Twilio will have no liability or responsibility for any 42 | unauthorized access or use, corruption, deletion, destruction or loss of 43 | any of your content, software, servers or systems. You acknowledge that 44 | you are responsible for any charges incurred by virtue of your use (or 45 | any other use under your account) of the Twilio applications and 46 | services, whether or not authorized and whether or not the application 47 | acted in error. 48 | 49 | 50 | -------------------------------------------------------------------------------- /Raw/Default.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Raw/Default.psd -------------------------------------------------------------------------------- /Raw/barbutton.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Raw/barbutton.psd -------------------------------------------------------------------------------- /Raw/dialer.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Raw/dialer.psd -------------------------------------------------------------------------------- /Raw/dropdown.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Raw/dropdown.psd -------------------------------------------------------------------------------- /Raw/iphone-backspace-button.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Raw/iphone-backspace-button.psd -------------------------------------------------------------------------------- /Raw/mailish-button.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Raw/mailish-button.psd -------------------------------------------------------------------------------- /Resources/barbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/barbutton.png -------------------------------------------------------------------------------- /Resources/delivery-phone-icon-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/delivery-phone-icon-big.png -------------------------------------------------------------------------------- /Resources/delivery-phone-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/delivery-phone-icon.png -------------------------------------------------------------------------------- /Resources/delivery-sms-icon-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/delivery-sms-icon-big.png -------------------------------------------------------------------------------- /Resources/delivery-sms-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/delivery-sms-icon.png -------------------------------------------------------------------------------- /Resources/dialer-accessory-key-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-accessory-key-bg.png -------------------------------------------------------------------------------- /Resources/dialer-backspace-icon-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-backspace-icon-mask.png -------------------------------------------------------------------------------- /Resources/dialer-call-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-call-bg.png -------------------------------------------------------------------------------- /Resources/dialer-callerid-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-callerid-bg.png -------------------------------------------------------------------------------- /Resources/dialer-contacts-icon-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-contacts-icon-mask.png -------------------------------------------------------------------------------- /Resources/dialer-number-middle-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-number-middle-bg.png -------------------------------------------------------------------------------- /Resources/dialer-number-side-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-number-side-bg.png -------------------------------------------------------------------------------- /Resources/dialer-numberarea-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dialer-numberarea-bg.png -------------------------------------------------------------------------------- /Resources/dropdown-highlighted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dropdown-highlighted.png -------------------------------------------------------------------------------- /Resources/dropdown-normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/dropdown-normal.png -------------------------------------------------------------------------------- /Resources/folder-icon-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/folder-icon-mask.png -------------------------------------------------------------------------------- /Resources/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/gear.png -------------------------------------------------------------------------------- /Resources/gray-play-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/gray-play-button.png -------------------------------------------------------------------------------- /Resources/inbox-icon-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/inbox-icon-mask.png -------------------------------------------------------------------------------- /Resources/iphone-call-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/iphone-call-icon.png -------------------------------------------------------------------------------- /Resources/iphone-white-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/iphone-white-arrow.png -------------------------------------------------------------------------------- /Resources/openvbx-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/openvbx-logo.png -------------------------------------------------------------------------------- /Resources/pause-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/pause-button.png -------------------------------------------------------------------------------- /Resources/pause-symbol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/pause-symbol.png -------------------------------------------------------------------------------- /Resources/play-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/play-button.png -------------------------------------------------------------------------------- /Resources/play-symbol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/play-symbol.png -------------------------------------------------------------------------------- /Resources/plus-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/plus-icon.png -------------------------------------------------------------------------------- /Resources/security-alert-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/security-alert-background.png -------------------------------------------------------------------------------- /Resources/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/shadow.png -------------------------------------------------------------------------------- /Resources/stop-symbol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/stop-symbol.png -------------------------------------------------------------------------------- /Resources/tableview-grouped-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/tableview-grouped-background.png -------------------------------------------------------------------------------- /Resources/text-button-highlighted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/text-button-highlighted.png -------------------------------------------------------------------------------- /Resources/text-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Resources/text-button.png -------------------------------------------------------------------------------- /Settings.bundle/Root.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | Title 9 | About OpenVBX 10 | Type 11 | PSGroupSpecifier 12 | 13 | 14 | DefaultValue 15 | 1.0.2.25.4692:4724M 16 | Key 17 | XXXX 18 | Title 19 | Version 20 | Type 21 | PSTitleValueSpecifier 22 | 23 | 24 | StringsTable 25 | Root 26 | 27 | 28 | -------------------------------------------------------------------------------- /Settings.bundle/en.lproj/Root.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/Settings.bundle/en.lproj/Root.strings -------------------------------------------------------------------------------- /UnitTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.twilio.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0.2 19 | 20 | 21 | -------------------------------------------------------------------------------- /VBXError.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | extern NSString *VBXErrorDomain; 24 | 25 | typedef enum { 26 | VBXErrorUnknown, 27 | VBXErrorNoNetwork, 28 | VBXErrorBadHost, 29 | VBXErrorLoginRequired, 30 | VBXErrorHTTPResponse, 31 | VBXErrorBadJSON, 32 | VBXErrorBadAudioData, 33 | VBXErrorServerErrorMessage, 34 | VBXErrorLoadingFile, 35 | } VBXErrorCode; 36 | 37 | extern NSString *VBXErrorHTTPResponseKey; 38 | extern NSString *VBXErrorBadJSONStringKey; 39 | extern NSString *VBXErrorServerErrorMessageKey; 40 | -------------------------------------------------------------------------------- /VBXError.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXError.h" 22 | 23 | 24 | NSString *VBXErrorDomain = @"TwilioErrorDomain"; 25 | 26 | NSString *VBXErrorHTTPResponseKey = @"TwilioErrorHTTPResponseKey"; 27 | NSString *VBXErrorBadJSONStringKey = @"TwilioErrorBadJSONStringKey"; 28 | NSString *VBXErrorServerErrorMessageKey = @"TwilioErrorServerErrorMessageKey"; 29 | -------------------------------------------------------------------------------- /VBXUserDefaultsKeys.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | extern NSString *VBXUserDefaultsBaseURL; 24 | extern NSString *VBXUserDefaultsAuthenticationRealm; 25 | extern NSString *VBXUserDefaultsCallbackPhone; 26 | extern NSString *VBXUserDefaultsApplicationState; 27 | extern NSString *VBXUserDefaultsSplashScreenImageURL; 28 | extern NSString *VBXUserDefaultsCompletedSetup; 29 | extern NSString *VBXUserDefaultsSpeakerMode; 30 | extern NSString *VBXUserDefaultsCallerId; 31 | extern NSString *VBXUserDefaultsEmailAddress; 32 | extern NSString *VBXUserDefaultsSecureURLs; 33 | extern NSString *VBXUserDefaultsLastAcceptedCertificateWasTrusted; 34 | extern NSString *VBXUserDefaultsLastAcceptedCertificateData; 35 | extern NSString *VBXUserDefaultsMessageKeysReadSinceLastLoad; 36 | extern NSString *VBXUserDefaultsApplicationLaunchURL; 37 | extern NSString *VBXUserDefaultsAutoconfigure; -------------------------------------------------------------------------------- /VBXUserDefaultsKeys.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXUserDefaultsKeys.h" 22 | 23 | NSString *VBXUserDefaultsBaseURL = @"UserDefaultsBaseURL"; 24 | NSString *VBXUserDefaultsAuthenticationRealm = @"UserDefaultsAuthenticationRealm"; 25 | NSString *VBXUserDefaultsCallbackPhone = @"UserDefaultsCallbackPhone"; 26 | NSString *VBXUserDefaultsApplicationState = @"UserDefaultsApplicationState"; 27 | NSString *VBXUserDefaultsSplashScreenImageURL = @"UserDefaultsSplashScreenImageURL"; 28 | NSString *VBXUserDefaultsCompletedSetup = @"UserDefaultsCompletedSetup"; 29 | NSString *VBXUserDefaultsSpeakerMode = @"UserDefaultsSpeakerMode"; 30 | NSString *VBXUserDefaultsCallerId = @"UserDefaultsCallerId"; 31 | NSString *VBXUserDefaultsEmailAddress = @"UserDefaultsEmailAddress"; 32 | NSString *VBXUserDefaultsSecureURLs = @"UserDefaultsSecureURLs"; 33 | NSString *VBXUserDefaultsLastAcceptedCertificateWasTrusted = @"UserDefaultsLastAcceptedCertificateWasTrusted"; 34 | NSString *VBXUserDefaultsLastAcceptedCertificateData = @"UserDefaultsLastAcceptedCertificateData"; 35 | NSString *VBXUserDefaultsMessageKeysReadSinceLastLoad = @"UserDefaultsMessageKeysReadSinceLastLoad"; 36 | NSString *VBXUserDefaultsApplicationLaunchURL = @"UserDefaultsApplicationLaunchURL"; 37 | NSString *VBXUserDefaultsAutoconfigure = @"UserDefaultsAutoconfigure"; -------------------------------------------------------------------------------- /VBXVersion.h: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | typedef enum { 24 | MAJOR_EQUAL = 1, 25 | MAJOR_GREATER = 1 << 1, 26 | MAJOR_LESSER = 1 << 2, 27 | 28 | MINOR_EQUAL = 1 << 3, 29 | MINOR_GREATER = 1 << 4, 30 | MINOR_LESSER = 1 << 5, 31 | 32 | PATCHLEVEL_EQUAL = 1 << 6, 33 | PATCHLEVEL_GREATER = 1 << 7, 34 | PATCHLEVEL_LESSER = 1 << 8 35 | } VBXVersionComparison; 36 | 37 | @interface VBXVersion : NSObject { 38 | 39 | int _major; 40 | int _minor; 41 | int _patchlevel; 42 | 43 | } 44 | 45 | @property (nonatomic) int major; 46 | @property (nonatomic) int minor; 47 | @property (nonatomic) int patchlevel; 48 | 49 | + (VBXVersion *)fromString:(NSString *)versionString; 50 | - (VBXVersionComparison)compareVersion:(NSString *)comparedVersionString; 51 | 52 | @end -------------------------------------------------------------------------------- /VBXVersion.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import "VBXVersion.h" 22 | 23 | 24 | @implementation VBXVersion 25 | 26 | @synthesize patchlevel = _patchlevel; 27 | @synthesize major = _major; 28 | @synthesize minor = _minor; 29 | 30 | - (VBXVersion *)initWith:(int) major minor:(int) minor patchlevel:(int) patchlevel { 31 | if (self = [super init]) { 32 | self.major = major; 33 | self.minor = minor; 34 | self.patchlevel = patchlevel; 35 | } 36 | 37 | return self; 38 | } 39 | 40 | + (VBXVersion *)fromString:(NSString *)versionString { 41 | const char *vstr, *vend; 42 | int i = 0, versions[3] = {0, 0, 0}; 43 | 44 | if(![versionString length]) { 45 | [NSException raise:NSGenericException format:@"Expected versionString more than zero characters long ???"]; 46 | } 47 | 48 | vstr = [versionString cStringUsingEncoding:NSASCIIStringEncoding]; 49 | 50 | /* strtol converts up until the first non-numeric character, which is pointed to by vend. 51 | we use this to walk along the version string. */ 52 | 53 | do { 54 | versions[i++] = strtol(vstr, &vend, 10); 55 | 56 | if( !*vend ) 57 | break; 58 | 59 | vstr = vend + 1; 60 | } while( i < (sizeof(versions) / sizeof(int)) ); 61 | 62 | if( !i ) 63 | [NSException raise:NSGenericException format:@"No numeric values in versionString"]; 64 | 65 | return [[VBXVersion alloc] initWith:versions[0] minor:versions[1] patchlevel:versions[2]]; 66 | } 67 | 68 | - (VBXVersionComparison)compareVersion:(NSString *)comparedVersionString { 69 | VBXVersion *compareTo = [[VBXVersion fromString:comparedVersionString] autorelease]; 70 | VBXVersionComparison ret = 0; 71 | int comparison; 72 | 73 | #define COMPARE(prop, uprop)\ 74 | if( (comparison = (self.prop - compareTo.prop)) ) {\ 75 | if( comparison > 0 )\ 76 | ret |= uprop##_GREATER;\ 77 | else\ 78 | ret |= uprop##_LESSER;\ 79 | } else\ 80 | ret |= uprop##_EQUAL; 81 | 82 | COMPARE(major, MAJOR); 83 | COMPARE(minor, MINOR); 84 | COMPARE(patchlevel, PATCHLEVEL); 85 | 86 | #undef COMPARE 87 | 88 | return ret; 89 | } 90 | 91 | 92 | @end -------------------------------------------------------------------------------- /YAJL/YAJL.h: -------------------------------------------------------------------------------- 1 | // 2 | // YAJL.h 3 | // YAJL 4 | // 5 | // Created by Gabriel Handford on 7/23/09. 6 | // Copyright 2009. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #import "YAJLParser.h" 31 | #import "YAJLDocument.h" 32 | #import "YAJLGen.h" 33 | #import "NSObject+YAJL.h" 34 | -------------------------------------------------------------------------------- /YAJL/YAJLGen.h: -------------------------------------------------------------------------------- 1 | // 2 | // YAJLGen.h 3 | // YAJL 4 | // 5 | // Created by Gabriel Handford on 7/19/09. 6 | // Copyright 2009. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person 9 | // obtaining a copy of this software and associated documentation 10 | // files (the "Software"), to deal in the Software without 11 | // restriction, including without limitation the rights to use, 12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the 14 | // Software is furnished to do so, subject to the following 15 | // conditions: 16 | // 17 | // The above copyright notice and this permission notice shall be 18 | // included in all copies or substantial portions of the Software. 19 | // 20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | // OTHER DEALINGS IN THE SOFTWARE. 28 | // 29 | 30 | #include "yajl_gen.h" 31 | 32 | extern NSString *const YAJLGenInvalidObjectException; 33 | 34 | /*! 35 | @enum Generate options 36 | @constant YAJLGenOptionsBeautify 37 | */ 38 | enum { 39 | YAJLGenOptionsNone = 0, 40 | YAJLGenOptionsBeautify = 1 << 0, 41 | YAJLGenOptionsIgnoreUnknownTypes = 1 << 1, // Ignore unknown types (will use null value) 42 | YAJLGenOptionsIncludeUnsupportedTypes = 1 << 2, // Handle non-JSON types (including NSDate, NSData, NSURL) 43 | }; 44 | typedef NSUInteger YAJLGenOptions; 45 | 46 | /*! 47 | YAJL JSON string generator. 48 | Supports the following types: 49 | - NSArray 50 | - NSDictionary 51 | - NSString 52 | - NSNumber 53 | - NSNull 54 | 55 | We also support the following types (if using YAJLGenOptionsIncludeUnsupportedTypes option), 56 | by converting to JSON supported types: 57 | - NSDate -> number representing number of milliseconds since (1970) epoch 58 | - NSData -> Base64 encoded string 59 | - NSURL -> URL (absolute) string 60 | */ 61 | @interface YAJLGen : NSObject { 62 | yajl_gen gen_; 63 | 64 | YAJLGenOptions genOptions_; 65 | } 66 | 67 | - (id)initWithGenOptions:(YAJLGenOptions)genOptions indentString:(NSString *)indentString; 68 | 69 | - (void)object:(id)obj; 70 | 71 | - (void)null; 72 | 73 | - (void)bool:(BOOL)b; 74 | 75 | - (void)number:(NSNumber *)number; 76 | 77 | - (void)string:(NSString *)s; 78 | 79 | - (void)startDictionary; 80 | - (void)endDictionary; 81 | 82 | - (void)startArray; 83 | 84 | - (void)endArray; 85 | 86 | - (void)clear; 87 | 88 | - (NSString *)buffer; 89 | 90 | @end 91 | 92 | 93 | /*! 94 | Custom objects can support manual JSON encoding. 95 | */ 96 | @protocol YAJLCoding 97 | 98 | /*! 99 | Provide custom and/or encodable object to parse to JSON string. 100 | @result Object encodable as JSON such as NSDictionary, NSArray, etc 101 | */ 102 | - (id)JSON; 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /YAJL/libYAJLIPhone.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/YAJL/libYAJLIPhone.a -------------------------------------------------------------------------------- /YAJL/yajl_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, Lloyd Hilaiel. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. Neither the name of Lloyd Hilaiel nor the names of its 17 | * contributors may be used to endorse or promote products derived 18 | * from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef __YAJL_COMMON_H__ 34 | #define __YAJL_COMMON_H__ 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #define YAJL_MAX_DEPTH 128 41 | 42 | /* msft dll export gunk. To build a DLL on windows, you 43 | * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared 44 | * DLL, you must define YAJL_SHARED and WIN32 */ 45 | #if defined(WIN32) && defined(YAJL_SHARED) 46 | # ifdef YAJL_BUILD 47 | # define YAJL_API __declspec(dllexport) 48 | # else 49 | # define YAJL_API __declspec(dllimport) 50 | # endif 51 | #else 52 | # define YAJL_API 53 | #endif 54 | 55 | /** pointer to a malloc function, supporting client overriding memory 56 | * allocation routines */ 57 | typedef void * (*yajl_malloc_func)(void *ctx, unsigned int sz); 58 | 59 | /** pointer to a free function, supporting client overriding memory 60 | * allocation routines */ 61 | typedef void (*yajl_free_func)(void *ctx, void * ptr); 62 | 63 | /** pointer to a realloc function which can resize an allocation. */ 64 | typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, unsigned int sz); 65 | 66 | /** A structure which can be passed to yajl_*_alloc routines to allow the 67 | * client to specify memory allocation functions to be used. */ 68 | typedef struct 69 | { 70 | /** pointer to a function that can allocate uninitialized memory */ 71 | yajl_malloc_func malloc; 72 | /** pointer to a function that can resize memory allocations */ 73 | yajl_realloc_func realloc; 74 | /** pointer to a function that can free memory allocated using 75 | * reallocFunction or mallocFunction */ 76 | yajl_free_func free; 77 | /** a context pointer that will be passed to above allocation routines */ 78 | void * ctx; 79 | } yajl_alloc_funcs; 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /bump_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd `dirname $0` 4 | 5 | SETTINGS_PLIST=`pwd`/Settings.bundle/Root.plist 6 | 7 | agvtool bump 8 | 9 | MARKETING_VERSION=`agvtool what-marketing-version -terse | grep OpenVBX | sed "s/[^=]*=//"` 10 | BUILD_NUMBER=`agvtool what-version -terse` 11 | REV=`svnversion -n` 12 | 13 | VERSION_STRING="$MARKETING_VERSION.$BUILD_NUMBER.$REV" 14 | 15 | echo "Version: $VERSION_STRING" 16 | 17 | # PlistBuddy makes it easy for us to edit nested values w/in plists. It seems to come 18 | # standard with Mac OS X, but maybe it comes from the Dev Tools. Not sure. 19 | /usr/libexec/PlistBuddy -c "Set PreferenceSpecifiers:1:DefaultValue $VERSION_STRING" Settings.bundle/Root.plist 20 | -------------------------------------------------------------------------------- /icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/twilio/OpenVBX-iPhone/90749e39325e208372b35ad344cac734b2c20797/icon-57.png -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * "The contents of this file are subject to the Mozilla Public License 3 | * Version 1.1 (the "License"); you may not use this file except in 4 | * compliance with the License. You may obtain a copy of the License at 5 | * http://www.mozilla.org/MPL/ 6 | 7 | * Software distributed under the License is distributed on an "AS IS" 8 | * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 9 | * License for the specific language governing rights and limitations 10 | * under the License. 11 | 12 | * The Original Code is OpenVBX, released February 18, 2011. 13 | 14 | * The Initial Developer of the Original Code is Twilio Inc. 15 | * Portions created by Twilio Inc. are Copyright (C) 2010. 16 | * All Rights Reserved. 17 | 18 | * Contributor(s): 19 | **/ 20 | 21 | #import 22 | 23 | int main(int argc, char *argv[]) { 24 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 25 | int retVal = UIApplicationMain(argc, argv, nil, @"VBXAppDelegate"); 26 | [pool release]; 27 | return retVal; 28 | } 29 | --------------------------------------------------------------------------------