Browse files

ignore

  • Loading branch information...
1 parent 7cfa864 commit dc1a54edf38830189a261ed1936d6ad84c73c62d @vestige committed Oct 10, 2012
Showing with 0 additions and 29,361 deletions.
  1. +0 −48 build/iphone/Classes/AFOpenFlow/AFItemView.h
  2. +0 −97 build/iphone/Classes/AFOpenFlow/AFItemView.m
  3. +0 −33 build/iphone/Classes/AFOpenFlow/AFOpenFlowConstants.h
  4. +0 −87 build/iphone/Classes/AFOpenFlow/AFOpenFlowView.h
  5. +0 −474 build/iphone/Classes/AFOpenFlow/AFOpenFlowView.m
  6. +0 −37 build/iphone/Classes/AFOpenFlow/AFUIImageReflection.h
  7. +0 −102 build/iphone/Classes/AFOpenFlow/AFUIImageReflection.m
  8. +0 −38 build/iphone/Classes/AFOpenFlow/UIImageExtras.h
  9. +0 −80 build/iphone/Classes/AFOpenFlow/UIImageExtras.m
  10. +0 −17 build/iphone/Classes/APIModule.h
  11. +0 −119 build/iphone/Classes/APIModule.m
  12. +0 −104 build/iphone/Classes/AQRecorder.h
  13. +0 −361 build/iphone/Classes/AQRecorder.mm
  14. +0 −35 build/iphone/Classes/ASI/ASIAuthenticationDialog.h
  15. +0 −493 build/iphone/Classes/ASI/ASIAuthenticationDialog.m
  16. +0 −103 build/iphone/Classes/ASI/ASICacheDelegate.h
  17. +0 −42 build/iphone/Classes/ASI/ASIDataCompressor.h
  18. +0 −219 build/iphone/Classes/ASI/ASIDataCompressor.m
  19. +0 −41 build/iphone/Classes/ASI/ASIDataDecompressor.h
  20. +0 −218 build/iphone/Classes/ASI/ASIDataDecompressor.m
  21. +0 −46 build/iphone/Classes/ASI/ASIDownloadCache.h
  22. +0 −514 build/iphone/Classes/ASI/ASIDownloadCache.m
  23. +0 −76 build/iphone/Classes/ASI/ASIFormDataRequest.h
  24. +0 −361 build/iphone/Classes/ASI/ASIFormDataRequest.m
  25. +0 −1,019 build/iphone/Classes/ASI/ASIHTTPRequest.h
  26. +0 −5,210 build/iphone/Classes/ASI/ASIHTTPRequest.m
  27. +0 −37 build/iphone/Classes/ASI/ASIHTTPRequestConfig.h
  28. +0 −35 build/iphone/Classes/ASI/ASIHTTPRequestDelegate.h
  29. +0 −26 build/iphone/Classes/ASI/ASIInputStream.h
  30. +0 −138 build/iphone/Classes/ASI/ASIInputStream.m
  31. +0 −108 build/iphone/Classes/ASI/ASINetworkQueue.h
  32. +0 −343 build/iphone/Classes/ASI/ASINetworkQueue.m
  33. +0 −38 build/iphone/Classes/ASI/ASIProgressDelegate.h
  34. +0 −193 build/iphone/Classes/ASI/Reachability.h
  35. +0 −817 build/iphone/Classes/ASI/Reachability.m
  36. +0 −19 build/iphone/Classes/AccelerometerModule.h
  37. +0 −48 build/iphone/Classes/AccelerometerModule.m
  38. +0 −23 build/iphone/Classes/AnalyticsModule.h
  39. +0 −716 build/iphone/Classes/AnalyticsModule.mm
  40. +0 −57 build/iphone/Classes/AppModule.h
  41. +0 −509 build/iphone/Classes/AppModule.m
  42. +0 −17 build/iphone/Classes/ApplicationDefaults.h
  43. +0 −21 build/iphone/Classes/ApplicationDefaults.m
  44. +0 −11 build/iphone/Classes/ApplicationMods.h
  45. +0 −15 build/iphone/Classes/ApplicationMods.m
  46. +0 −10 build/iphone/Classes/ApplicationRouting.h
  47. +0 −19 build/iphone/Classes/ApplicationRouting.m
  48. +0 −690 build/iphone/Classes/AsyncSocket.h
  49. +0 −4,368 build/iphone/Classes/AsyncSocket.m
  50. +0 −366 build/iphone/Classes/AsyncUdpSocket.h
  51. +0 −2,343 build/iphone/Classes/AsyncUdpSocket.m
  52. +0 −139 build/iphone/Classes/AudioStreamer/AudioStreamer.h
  53. +0 −182 build/iphone/Classes/AudioStreamer/AudioStreamer.m
  54. +0 −109 build/iphone/Classes/AudioStreamer/AudioStreamerCUR.h
  55. +0 −1,863 build/iphone/Classes/AudioStreamer/AudioStreamerCUR.m
  56. +0 −232 build/iphone/Classes/Base64Transcoder.c
  57. +0 −44 build/iphone/Classes/Base64Transcoder.h
  58. +0 −36 build/iphone/Classes/Bridge.h
  59. +0 −84 build/iphone/Classes/Bridge.m
  60. +0 −94 build/iphone/Classes/CADebugMacros.cpp
  61. +0 −443 build/iphone/Classes/CADebugMacros.h
  62. +0 −74 build/iphone/Classes/CAMath.h
  63. +0 −554 build/iphone/Classes/CAStreamBasicDescription.cpp
  64. +0 −312 build/iphone/Classes/CAStreamBasicDescription.h
  65. +0 −56 build/iphone/Classes/CAXException.cpp
  66. +0 −218 build/iphone/Classes/CAXException.h
  67. +0 −42 build/iphone/Classes/CodecModule.h
  68. +0 −351 build/iphone/Classes/CodecModule.m
  69. +0 −50 build/iphone/Classes/ContactsModule.h
  70. +0 −458 build/iphone/Classes/ContactsModule.m
  71. +0 −26 build/iphone/Classes/DatabaseModule.h
  72. +0 −52 build/iphone/Classes/DatabaseModule.m
  73. +0 −25 build/iphone/Classes/FBConnect/FBConnect.h
  74. +0 −166 build/iphone/Classes/FBConnect/FBDialog.h
  75. +0 −688 build/iphone/Classes/FBConnect/FBDialog.m
  76. +0 −75 build/iphone/Classes/FBConnect/FBFrictionlessRequestSettings.h
  77. +0 −163 build/iphone/Classes/FBConnect/FBFrictionlessRequestSettings.m
  78. +0 −41 build/iphone/Classes/FBConnect/FBLoginButton.h
  79. +0 −92 build/iphone/Classes/FBConnect/FBLoginButton.m
  80. +0 −47 build/iphone/Classes/FBConnect/FBLoginDialog.h
  81. +0 −115 build/iphone/Classes/FBConnect/FBLoginDialog.m
  82. +0 −142 build/iphone/Classes/FBConnect/FBRequest.h
  83. +0 −382 build/iphone/Classes/FBConnect/FBRequest.m
  84. +0 −165 build/iphone/Classes/FBConnect/Facebook.h
  85. +0 −855 build/iphone/Classes/FBConnect/Facebook.m
  86. +0 −45 build/iphone/Classes/FacebookModule.h
Sorry, we could not display the entire diff because too many files (1,755) changed.
View
48 build/iphone/Classes/AFOpenFlow/AFItemView.h
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-#import <UIKit/UIKit.h>
-
-
-@interface AFItemView : UIView {
- UIImageView *imageView;
- int number;
- CGFloat horizontalPosition;
- CGFloat verticalPosition;
- CGFloat originalImageHeight;
-}
-
-@property int number;
-@property (nonatomic, readonly) CGFloat horizontalPosition;
-@property (nonatomic, readonly) CGFloat verticalPosition;
-@property (nonatomic, readonly) UIImageView *imageView;
-
-- (void)setImage:(UIImage *)newImage originalImageHeight:(CGFloat)imageHeight reflectionFraction:(CGFloat)reflectionFraction;
-- (CGSize)calculateNewSize:(CGSize)originalImageSize boundingBox:(CGSize)boundingBox;
-
-@end
-
-#endif
View
97 build/iphone/Classes/AFOpenFlow/AFItemView.m
@@ -1,97 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-#import "AFItemView.h"
-#import <QuartzCore/QuartzCore.h>
-#import "AFOpenFlowConstants.h"
-
-
-@implementation AFItemView
-@synthesize imageView, horizontalPosition, verticalPosition;
-
-- (id)initWithFrame:(CGRect)frame {
- if (self = [super initWithFrame:frame]) {
- self.opaque = YES;
- self.backgroundColor = NULL;
- verticalPosition = 0;
- horizontalPosition = 0;
-
- // Image View
- imageView = [[UIImageView alloc] initWithFrame:frame];
- imageView.opaque = YES;
- [self addSubview:imageView];
- }
-
- return self;
-}
-
-- (void)setImage:(UIImage *)newImage originalImageHeight:(CGFloat)imageHeight reflectionFraction:(CGFloat)reflectionFraction {
- [imageView setImage:newImage];
- verticalPosition = imageHeight * reflectionFraction / 2;
- originalImageHeight = imageHeight;
- self.frame = CGRectMake(0, 0, newImage.size.width, newImage.size.height);
-}
-
-- (int)number {
- return number;
-}
-
-- (void)setNumber:(int)newNumber {
- horizontalPosition = COVER_SPACING * newNumber;
- number = newNumber;
-}
-
-- (CGSize)calculateNewSize:(CGSize)baseImageSize boundingBox:(CGSize)boundingBox {
- CGFloat boundingRatio = boundingBox.width / boundingBox.height;
- CGFloat originalImageRatio = baseImageSize.width / baseImageSize.height;
-
- CGFloat newWidth;
- CGFloat newHeight;
- if (originalImageRatio > boundingRatio) {
- newWidth = boundingBox.width;
- newHeight = boundingBox.width * baseImageSize.height / baseImageSize.width;
- } else {
- newHeight = boundingBox.height;
- newWidth = boundingBox.height * baseImageSize.width / baseImageSize.height;
- }
-
- return CGSizeMake(newWidth, newHeight);
-}
-
-- (void)setFrame:(CGRect)newFrame {
- [super setFrame:newFrame];
- [imageView setFrame:newFrame];
-}
-
-- (void)dealloc {
- [imageView release];
-
- [super dealloc];
-}
-
-@end
-
-#endif
View
33 build/iphone/Classes/AFOpenFlow/AFOpenFlowConstants.h
@@ -1,33 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-// For OpenFlow
-#define COVER_SPACING 40
-#define CENTER_COVER_OFFSET 70
-#define SIDE_COVER_ANGLE .79
-#define SIDE_COVER_ZPOSITION -80
-
-#endif
View
87 build/iphone/Classes/AFOpenFlow/AFOpenFlowView.h
@@ -1,87 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-#import <UIKit/UIKit.h>
-#import "AFItemView.h"
-#import <QuartzCore/QuartzCore.h>
-
-
-@protocol AFOpenFlowViewDataSource;
-@protocol AFOpenFlowViewDelegate;
-
-@interface AFOpenFlowView : UIView {
- id <AFOpenFlowViewDataSource> dataSource;
- id <AFOpenFlowViewDelegate> viewDelegate;
- NSMutableSet *offscreenCovers;
- NSMutableDictionary *onscreenCovers;
- NSMutableDictionary *coverImages;
- NSMutableDictionary *coverImageHeights;
- UIImage *defaultImage;
- CGFloat defaultImageHeight;
-
- UIScrollView *scrollView;
- int lowerVisibleCover;
- int upperVisibleCover;
- int numberOfImages;
- int beginningCover;
-
- AFItemView *selectedCoverView;
-
- CATransform3D leftTransform, rightTransform;
-
- CGFloat halfScreenHeight;
- CGFloat halfScreenWidth;
-
- Boolean isSingleTap;
- Boolean isDoubleTap;
- Boolean isDraggingACover;
- CGFloat startPosition;
-}
-
-@property (nonatomic, assign) id <AFOpenFlowViewDataSource> dataSource;
-@property (nonatomic, assign) id <AFOpenFlowViewDelegate> viewDelegate;
-@property (nonatomic, retain) UIImage *defaultImage;
-@property (nonatomic) int numberOfImages;
-
-- (void)setSelectedCover:(int)newSelectedCover;
-- (void)centerOnSelectedCover:(BOOL)animated;
-- (void)setImage:(UIImage *)image forIndex:(int)index;
-- (void)updateLayout;
-
-@end
-
-@protocol AFOpenFlowViewDelegate <NSObject>
-@optional
-- (void)openFlowView:(AFOpenFlowView *)openFlowView click:(int)index;
-- (void)openFlowView:(AFOpenFlowView *)openFlowView selectionDidChange:(int)index;
-@end
-
-@protocol AFOpenFlowViewDataSource <NSObject>
-- (void)openFlowView:(AFOpenFlowView *)openFlowView requestImageForIndex:(int)index;
-- (UIImage *)defaultImage;
-@end
-
-#endif
View
474 build/iphone/Classes/AFOpenFlow/AFOpenFlowView.m
@@ -1,474 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-#import "AFOpenFlowView.h"
-#import "AFOpenFlowConstants.h"
-#import "AFUIImageReflection.h"
-
-
-@interface AFOpenFlowView (hidden)
-
-- (void)setUpInitialState;
-- (AFItemView *)coverForIndex:(int)coverIndex;
-- (void)updateCoverImage:(AFItemView *)aCover;
-- (AFItemView *)dequeueReusableCover;
-- (void)layoutCovers:(int)selected fromCover:(int)lowerBound toCover:(int)upperBound;
-- (void)layoutCover:(AFItemView *)aCover selectedCover:(int)selectedIndex animated:(Boolean)animated;
-- (AFItemView *)findCoverOnscreen:(CALayer *)targetLayer;
-
-@end
-
-@implementation AFOpenFlowView (hidden)
-
-const static CGFloat kReflectionFraction = 0.85;
-
-- (void)setUpInitialState {
- // Set up the default image for the coverflow.
- self.defaultImage = [self.dataSource defaultImage];
-
- // Create data holders for onscreen & offscreen covers & UIImage objects.
- coverImages = [[NSMutableDictionary alloc] init];
- coverImageHeights = [[NSMutableDictionary alloc] init];
- offscreenCovers = [[NSMutableSet alloc] init];
- onscreenCovers = [[NSMutableDictionary alloc] init];
-
- scrollView = [[UIScrollView alloc] initWithFrame:self.frame];
- scrollView.userInteractionEnabled = NO;
- scrollView.multipleTouchEnabled = NO;
- scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- [self addSubview:scrollView];
-
- self.multipleTouchEnabled = NO;
- self.userInteractionEnabled = YES;
- self.autoresizesSubviews = YES;
- self.layer.position=CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);
-
- // Initialize the visible and selected cover range.
- lowerVisibleCover = upperVisibleCover = -1;
- selectedCoverView = nil;
-
- // Set up the cover's left & right transforms.
- leftTransform = CATransform3DTranslate(CATransform3DIdentity, 0, 0, SIDE_COVER_ZPOSITION);
- leftTransform = CATransform3DRotate(leftTransform, SIDE_COVER_ANGLE, 0.0f, 1.0f, 0.0f);
- rightTransform = CATransform3DTranslate(CATransform3DIdentity, 0, 0, SIDE_COVER_ZPOSITION);
- rightTransform = CATransform3DRotate(rightTransform, SIDE_COVER_ANGLE, 0.0f, -1.0f, 0.0f);
-
- // Set some perspective
- CATransform3D sublayerTransform = CATransform3DIdentity;
- sublayerTransform.m34 = -0.01;
- [scrollView.layer setSublayerTransform:sublayerTransform];
-
- [self updateLayout];
-}
-
-- (AFItemView *)coverForIndex:(int)coverIndex {
- AFItemView *coverView = [self dequeueReusableCover];
- if (!coverView)
- coverView = [[[AFItemView alloc] initWithFrame:CGRectZero] autorelease];
-
- coverView.number = coverIndex;
-
- return coverView;
-}
-
-- (void)updateCoverImage:(AFItemView *)aCover {
- NSNumber *coverNumber = [NSNumber numberWithInt:aCover.number];
- UIImage *coverImage = (UIImage *)[coverImages objectForKey:coverNumber];
- if (coverImage) {
- NSNumber *coverImageHeightNumber = (NSNumber *)[coverImageHeights objectForKey:coverNumber];
- if (coverImageHeightNumber)
- [aCover setImage:coverImage originalImageHeight:[coverImageHeightNumber floatValue] reflectionFraction:kReflectionFraction];
- } else {
- // Bugfix for invalid defaultImage - SPT
- UIImage* cover = defaultImage;
- if (cover == nil) {
- cover = [self.dataSource defaultImage];
- }
- [aCover setImage:cover originalImageHeight:defaultImageHeight reflectionFraction:kReflectionFraction];
- [self.dataSource openFlowView:self requestImageForIndex:aCover.number];
- }
-}
-
-- (AFItemView *)dequeueReusableCover {
- AFItemView *aCover = [offscreenCovers anyObject];
- if (aCover) {
- [[aCover retain] autorelease];
- [offscreenCovers removeObject:aCover];
- }
- return aCover;
-}
-
-- (void)layoutCover:(AFItemView *)aCover selectedCover:(int)selectedIndex animated:(Boolean)animated {
- int coverNumber = aCover.number;
- CATransform3D newTransform;
- CGPoint newPosition;
-
- newPosition.x = halfScreenWidth + aCover.horizontalPosition;
- newPosition.y = halfScreenHeight + aCover.verticalPosition;
- if (coverNumber < selectedIndex) {
- newPosition.x -= CENTER_COVER_OFFSET;
- newTransform = leftTransform;
- } else if (coverNumber > selectedIndex) {
- newPosition.x += CENTER_COVER_OFFSET;
- newTransform = rightTransform;
- } else {
- newTransform = CATransform3DIdentity;
- }
-
- if (animated) {
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
- [UIView setAnimationBeginsFromCurrentState:YES];
- }
-
- aCover.layer.transform = newTransform;
- aCover.layer.position = newPosition;
-
- if (animated) {
- [UIView commitAnimations];
- }
-}
-
-- (void)layoutCovers:(int)selected fromCover:(int)lowerBound toCover:(int)upperBound {
- AFItemView *cover;
- NSNumber *coverNumber;
- for (int i = lowerBound; i <= upperBound; i++) {
- coverNumber = [[NSNumber alloc] initWithInt:i];
- cover = (AFItemView *)[onscreenCovers objectForKey:coverNumber];
- [coverNumber release];
- [self layoutCover:cover selectedCover:selected animated:YES];
- }
-}
-
-- (AFItemView *)findCoverOnscreen:(CALayer *)targetLayer {
- // See if this layer is one of our covers.
- NSEnumerator *coverEnumerator = [onscreenCovers objectEnumerator];
- AFItemView *aCover = nil;
- while (aCover = (AFItemView *)[coverEnumerator nextObject])
- if ([[aCover.imageView layer] isEqual:targetLayer])
- break;
-
- return aCover;
-}
-@end
-
-
-@implementation AFOpenFlowView
-@synthesize dataSource, viewDelegate, numberOfImages, defaultImage;
-
-#define COVER_BUFFER 6
-
-- (void)awakeFromNib {
- [self setUpInitialState];
-}
-
-- (id)initWithFrame:(CGRect)frame {
- if (self = [super initWithFrame:frame]) {
- [self setUpInitialState];
- }
-
- return self;
-}
-
-- (void)dealloc {
- [defaultImage release];
- [scrollView release];
-
- [coverImages release];
- [coverImageHeights release];
- [offscreenCovers removeAllObjects];
- [offscreenCovers release];
-
- [onscreenCovers removeAllObjects];
- [onscreenCovers release];
-
- [super dealloc];
-}
-
-- (void)updateLayout
-{
- halfScreenWidth = self.bounds.size.width / 2;
- halfScreenHeight = self.bounds.size.height / 2;
-
- int lowerBound = MAX(-1, selectedCoverView.number - COVER_BUFFER);
- int upperBound = MIN(self.numberOfImages - 1, selectedCoverView.number + COVER_BUFFER);
-
- [self layoutCovers:selectedCoverView.number fromCover:lowerBound toCover:upperBound];
- [self centerOnSelectedCover:NO];
-}
-
-- (void)setFrame:(CGRect)newSize {
- [super setFrame:newSize];
- [self updateLayout];
-}
-
-- (void)setBounds:(CGRect)newSize {
- [super setBounds:newSize];
- scrollView.contentSize = CGSizeMake(numberOfImages * COVER_SPACING + self.bounds.size.width, self.bounds.size.height);
- [self updateLayout];
-}
-
-- (void)setNumberOfImages:(int)newNumberOfImages {
- numberOfImages = newNumberOfImages;
- scrollView.contentSize = CGSizeMake(newNumberOfImages * COVER_SPACING + self.bounds.size.width, self.bounds.size.height);
-
- int lowerBound = MAX(0, selectedCoverView.number - COVER_BUFFER);
- int upperBound = MIN(self.numberOfImages - 1, selectedCoverView.number + COVER_BUFFER);
-
- if (selectedCoverView)
- [self layoutCovers:selectedCoverView.number fromCover:lowerBound toCover:upperBound];
- else
- [self setSelectedCover:0];
-
- [self centerOnSelectedCover:NO];
-}
-
-- (void)setDefaultImage:(UIImage *)newDefaultImage {
- [defaultImage release];
- if (newDefaultImage)
- {
- defaultImageHeight = newDefaultImage.size.height;
- defaultImage = [AddImageReflection(newDefaultImage,kReflectionFraction) retain];
- }
-}
-
-- (void)setImage:(UIImage *)image forIndex:(int)index {
- if (image==nil) return;
- // Create a reflection for this image.
- UIImage *imageWithReflection = AddImageReflection(image,kReflectionFraction);
- NSNumber *coverNumber = [NSNumber numberWithInt:index];
- [coverImages setObject:imageWithReflection forKey:coverNumber];
- [coverImageHeights setObject:[NSNumber numberWithFloat:image.size.height] forKey:coverNumber];
-
- // If this cover is onscreen, set its image and call layoutCover.
- AFItemView *aCover = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:index]];
- if (aCover) {
- [aCover setImage:imageWithReflection originalImageHeight:image.size.height reflectionFraction:kReflectionFraction];
- [self layoutCover:aCover selectedCover:selectedCoverView.number animated:NO];
- }
-}
-
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
- CGPoint startPoint = [[touches anyObject] locationInView:self];
- isDraggingACover = NO;
-
- // Which cover did the user tap?
- CALayer *targetLayer = (CALayer *)[scrollView.layer hitTest:startPoint];
- AFItemView *targetCover = [self findCoverOnscreen:targetLayer];
- isDraggingACover = (targetCover != nil);
-
- beginningCover = selectedCoverView.number;
- // Make sure the user is tapping on a cover.
- startPosition = (startPoint.x / 1.5) + scrollView.contentOffset.x;
-
- if (isSingleTap)
- isDoubleTap = YES;
-
- isSingleTap = ([touches count] == 1);
-}
-
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
- isSingleTap = NO;
- isDoubleTap = NO;
-
- // Only scroll if the user started on a cover.
- if (!isDraggingACover)
- return;
-
- CGPoint movedPoint = [[touches anyObject] locationInView:self];
- CGFloat offset = startPosition - (movedPoint.x / 1.5);
- CGPoint newPoint = CGPointMake(offset, 0);
- scrollView.contentOffset = newPoint;
- int newCover = offset / COVER_SPACING;
- if (newCover != selectedCoverView.number) {
- if (newCover < 0)
- [self setSelectedCover:0];
- else if (newCover >= self.numberOfImages)
- [self setSelectedCover:self.numberOfImages - 1];
- else
- [self setSelectedCover:newCover];
- }
-}
-
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
- if (isSingleTap) {
- // Which cover did the user tap?
- CGPoint targetPoint = [[touches anyObject] locationInView:self];
- CALayer *targetLayer = (CALayer *)[scrollView.layer hitTest:targetPoint];
- AFItemView *targetCover = [self findCoverOnscreen:targetLayer];
- if (targetCover && (targetCover.number != selectedCoverView.number))
- [self setSelectedCover:targetCover.number];
-
- //jhaynie: modification to send click events on single taps
- if ([self.viewDelegate respondsToSelector:@selector(openFlowView:click:)])
- {
- [self.viewDelegate openFlowView:self click:selectedCoverView.number];
- }
- }
- [self centerOnSelectedCover:YES];
-
- // And send the delegate the newly selected cover message.
- if (beginningCover != selectedCoverView.number)
- if ([self.viewDelegate respondsToSelector:@selector(openFlowView:selectionDidChange:)])
- [self.viewDelegate openFlowView:self selectionDidChange:selectedCoverView.number];
-}
-
-- (void)centerOnSelectedCover:(BOOL)animated {
- CGPoint selectedOffset = CGPointMake(COVER_SPACING * selectedCoverView.number, 0);
- animated &= (self.frame.size.width > 0);
- [scrollView setContentOffset:selectedOffset animated:animated];
-}
-
-- (void)setSelectedCover:(int)newSelectedCover {
- if (selectedCoverView && (newSelectedCover == selectedCoverView.number))
- return;
-
- AFItemView *cover;
- int newLowerBound = MAX(0, newSelectedCover - COVER_BUFFER);
- int newUpperBound = MIN(self.numberOfImages - 1, newSelectedCover + COVER_BUFFER);
- if (!selectedCoverView) {
- // Allocate and display covers from newLower to newUpper bounds.
- for (int i=newLowerBound; i <= newUpperBound; i++) {
- cover = [self coverForIndex:i];
- [onscreenCovers setObject:cover forKey:[NSNumber numberWithInt:i]];
- [self updateCoverImage:cover];
- [scrollView.layer addSublayer:cover.layer];
- [self layoutCover:cover selectedCover:newSelectedCover animated:NO];
- }
-
- lowerVisibleCover = newLowerBound;
- upperVisibleCover = newUpperBound;
- selectedCoverView = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:newSelectedCover]];
-
- return;
- }
-
- // Check to see if the new & current ranges overlap.
- if ((newLowerBound > upperVisibleCover) || (newUpperBound < lowerVisibleCover)) {
- // They do not overlap at all.
- // This does not animate--assuming it's programmatically set from view controller.
- // Recycle all onscreen covers.
- AFItemView *cover;
- for (int i = lowerVisibleCover; i <= upperVisibleCover; i++) {
- cover = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:i]];
- [offscreenCovers addObject:cover];
- [cover.layer removeFromSuperlayer];
- [onscreenCovers removeObjectForKey:[NSNumber numberWithInt:cover.number]];
- }
-
- // Move all available covers to new location.
- for (int i=newLowerBound; i <= newUpperBound; i++) {
- cover = [self coverForIndex:i];
- [onscreenCovers setObject:cover forKey:[NSNumber numberWithInt:i]];
- [self updateCoverImage:cover];
- [scrollView.layer addSublayer:cover.layer];
- }
-
- lowerVisibleCover = newLowerBound;
- upperVisibleCover = newUpperBound;
- selectedCoverView = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:newSelectedCover]];
- [self layoutCovers:newSelectedCover fromCover:newLowerBound toCover:newUpperBound];
-
- return;
- } else if (newSelectedCover > selectedCoverView.number) {
- // Move covers that are now out of range on the left to the right side,
- // but only if appropriate (within the range set by newUpperBound).
- for (int i=lowerVisibleCover; i < newLowerBound; i++) {
- cover = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:i]];
- if (upperVisibleCover < newUpperBound) {
- // Tack it on the right side.
- upperVisibleCover++;
- cover.number = upperVisibleCover;
- [self updateCoverImage:cover];
- [onscreenCovers setObject:cover forKey:[NSNumber numberWithInt:cover.number]];
- [self layoutCover:cover selectedCover:newSelectedCover animated:NO];
- } else {
- // Recycle this cover.
- [offscreenCovers addObject:cover];
- [cover.layer removeFromSuperlayer];
- }
- [onscreenCovers removeObjectForKey:[NSNumber numberWithInt:i]];
- }
- lowerVisibleCover = newLowerBound;
-
- // Add in any missing covers on the right up to the newUpperBound.
- for (int i=upperVisibleCover + 1; i <= newUpperBound; i++) {
- cover = [self coverForIndex:i];
- [onscreenCovers setObject:cover forKey:[NSNumber numberWithInt:i]];
- [self updateCoverImage:cover];
- [scrollView.layer addSublayer:cover.layer];
- [self layoutCover:cover selectedCover:newSelectedCover animated:NO];
- }
- upperVisibleCover = newUpperBound;
- } else {
- // Move covers that are now out of range on the right to the left side,
- // but only if appropriate (within the range set by newLowerBound).
- for (int i=upperVisibleCover; i > newUpperBound; i--) {
- cover = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:i]];
- if (lowerVisibleCover > newLowerBound) {
- // Tack it on the left side.
- lowerVisibleCover --;
- cover.number = lowerVisibleCover;
- [self updateCoverImage:cover];
- [onscreenCovers setObject:cover forKey:[NSNumber numberWithInt:lowerVisibleCover]];
- [self layoutCover:cover selectedCover:newSelectedCover animated:NO];
- } else {
- // Recycle this cover.
- [offscreenCovers addObject:cover];
- [cover.layer removeFromSuperlayer];
- }
- [onscreenCovers removeObjectForKey:[NSNumber numberWithInt:i]];
- }
- upperVisibleCover = newUpperBound;
-
- // Add in any missing covers on the left down to the newLowerBound.
- for (int i=lowerVisibleCover - 1; i >= newLowerBound; i--) {
- cover = [self coverForIndex:i];
- [onscreenCovers setObject:cover forKey:[NSNumber numberWithInt:i]];
- [self updateCoverImage:cover];
- [scrollView.layer addSublayer:cover.layer];
- [self layoutCover:cover selectedCover:newSelectedCover animated:NO];
- }
- lowerVisibleCover = newLowerBound;
- }
-
- if (selectedCoverView.number > newSelectedCover)
- [self layoutCovers:newSelectedCover fromCover:newSelectedCover toCover:selectedCoverView.number];
- else if (newSelectedCover > selectedCoverView.number)
- [self layoutCovers:newSelectedCover fromCover:selectedCoverView.number toCover:newSelectedCover];
-
- selectedCoverView = (AFItemView *)[onscreenCovers objectForKey:[NSNumber numberWithInt:newSelectedCover]];
-}
-
--(void)layoutSubviews
-{
- [self centerOnSelectedCover:NO];
- [super layoutSubviews];
-}
-
-@end
-
-#endif
View
37 build/iphone/Classes/AFOpenFlow/AFUIImageReflection.h
@@ -1,37 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-#import <UIKit/UIKit.h>
-
-// Toteka modification note:
-// using categories with static libraries don't seem to work
-// right on device with iphone - probably a symbol issue
-// turn this into a static function (from what was a category to UIImage
-// originally)
-
-UIImage* AddImageReflection(UIImage *src, CGFloat reflectionFraction);
-
-#endif
View
102 build/iphone/Classes/AFOpenFlow/AFUIImageReflection.m
@@ -1,102 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#if defined(USE_TI_UIIOSCOVERFLOWVIEW) || defined(USE_TI_UICOVERFLOWVIEW)
-
-#import "AFUIImageReflection.h"
-
-
-// Toteka modification note:
-// using categories with static libraries don't seem to work
-// right on device with iphone - probably a symbol issue
-// turn this into a static function (from what was a category to UIImage
-// originally)
-
-UIImage* AddImageReflection(UIImage *image, CGFloat reflectionFraction)
-{
- int reflectionHeight = ceilf(image.size.height * reflectionFraction);
-
- // create a 2 bit CGImage containing a gradient that will be used for masking the
- // main view content to create the 'fade' of the reflection. The CGImageCreateWithMask
- // function will stretch the bitmap image as required, so we can create a 1 pixel wide gradient
- CGImageRef gradientMaskImage = NULL;
-
- // gradient is always black-white and the mask must be in the gray colorspace
- CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
-
- // create the bitmap context
- CGContextRef gradientBitmapContext = CGBitmapContextCreate(nil, 1, reflectionHeight,
- 8, 0, colorSpace, kCGImageAlphaNone);
-
- // define the start and end grayscale values (with the alpha, even though
- // our bitmap context doesn't support alpha the gradient requires it)
- CGFloat colors[] = {0.0, 1.0, 1.0, 1.0};
-
- // create the CGGradient and then release the gray color space
- CGGradientRef grayScaleGradient = CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2);
- CGColorSpaceRelease(colorSpace);
-
- // create the start and end points for the gradient vector (straight down)
- CGPoint gradientStartPoint = CGPointMake(0, reflectionHeight);
- CGPoint gradientEndPoint = CGPointZero;
-
- // draw the gradient into the gray bitmap context
- CGContextDrawLinearGradient(gradientBitmapContext, grayScaleGradient, gradientStartPoint,
- gradientEndPoint, kCGGradientDrawsAfterEndLocation);
- CGGradientRelease(grayScaleGradient);
-
- // add a black fill with 50% opacity
- CGContextSetGrayFillColor(gradientBitmapContext, 0.0, 0.5);
- CGContextFillRect(gradientBitmapContext, CGRectMake(0, 0, 1, reflectionHeight));
-
- // convert the context into a CGImageRef and release the context
- gradientMaskImage = CGBitmapContextCreateImage(gradientBitmapContext);
- CGContextRelease(gradientBitmapContext);
-
- // create an image by masking the bitmap of the mainView content with the gradient view
- // then release the pre-masked content bitmap and the gradient bitmap
- if((image.CGImage == NULL) || (gradientMaskImage == NULL))
- {
- CGImageRelease(gradientMaskImage);
- return nil;
- }
- CGImageRef reflectionImage = CGImageCreateWithMask(image.CGImage, gradientMaskImage);
- CGImageRelease(gradientMaskImage);
-
- CGSize size = CGSizeMake(image.size.width, image.size.height + reflectionHeight);
-
- UIGraphicsBeginImageContextWithOptions(size, NO, image.scale);
-
- [image drawAtPoint:CGPointZero];
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGContextDrawImage(context, CGRectMake(0, image.size.height, image.size.width, reflectionHeight), reflectionImage);
-
- UIImage* result = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- CGImageRelease(reflectionImage);
-
- return result;
-}
-
-#endif
View
38 build/iphone/Classes/AFOpenFlow/UIImageExtras.h
@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#import <UIKit/UIKit.h>
-
-/**
- * Convenience methods to help with resizing images retrieved from the
- * ObjectiveFlickr library.
- */
-@interface UIImage (OpenFlowExtras)
-
-- (UIImage *)rescaleImageToSize:(CGSize)size;
-- (UIImage *)cropImageToRect:(CGRect)cropRect;
-- (CGSize)calculateNewSizeForCroppingBox:(CGSize)croppingBox;
-- (UIImage *)cropCenterAndScaleImageToSize:(CGSize)cropSize;
-
-@end
View
80 build/iphone/Classes/AFOpenFlow/UIImageExtras.m
@@ -1,80 +0,0 @@
-/**
- * Copyright (c) 2009 Alex Fajkowski, Apparent Logic LLC
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-#import "UIImageExtras.h"
-
-
-@implementation UIImage (OpenFlowExtras)
-
-- (UIImage *)rescaleImageToSize:(CGSize)size {
- CGRect rect = CGRectMake(0.0, 0.0, size.width, size.height);
- UIGraphicsBeginImageContextWithOptions(rect.size, NO, self.scale);
- [self drawInRect:rect]; // scales image to rect
- UIImage *resImage = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return resImage;
-}
-
-- (UIImage *)cropImageToRect:(CGRect)cropRect {
- // Begin the drawing (again)
- UIGraphicsBeginImageContextWithOptions(cropRect.size, NO, self.scale);
- CGContextRef ctx = UIGraphicsGetCurrentContext();
-
- // Tanslate and scale upside-down to compensate for Quartz's inverted coordinate system
- CGContextTranslateCTM(ctx, 0.0, cropRect.size.height);
- CGContextScaleCTM(ctx, 1.0, -1.0);
-
- // Draw view into context
- CGRect drawRect = CGRectMake(-cropRect.origin.x, cropRect.origin.y - (self.size.height - cropRect.size.height) , self.size.width, self.size.height);
- CGContextDrawImage(ctx, drawRect, self.CGImage);
-
- // Create the new UIImage from the context
- UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
-
- // End the drawing
- UIGraphicsEndImageContext();
-
- return newImage;
-}
-
-- (CGSize)calculateNewSizeForCroppingBox:(CGSize)croppingBox {
- // Make the shortest side be equivalent to the cropping box.
- CGFloat newHeight, newWidth;
- if (self.size.width < self.size.height) {
- newWidth = croppingBox.width;
- newHeight = (self.size.height / self.size.width) * croppingBox.width;
- } else {
- newHeight = croppingBox.height;
- newWidth = (self.size.width / self.size.height) *croppingBox.height;
- }
-
- return CGSizeMake(newWidth, newHeight);
-}
-
-- (UIImage *)cropCenterAndScaleImageToSize:(CGSize)cropSize {
- UIImage *scaledImage = [self rescaleImageToSize:[self calculateNewSizeForCroppingBox:cropSize]];
- return [scaledImage cropImageToRect:CGRectMake((scaledImage.size.width-cropSize.width)/2, (scaledImage.size.height-cropSize.height)/2, cropSize.width, cropSize.height)];
-}
-
-@end
View
17 build/iphone/Classes/APIModule.h
@@ -1,17 +0,0 @@
-/**
- * Appcelerator Titanium Mobile
- * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
- * Licensed under the terms of the Apache Public License
- * Please see the LICENSE included with this distribution for details.
- *
- * WARNING: This is generated code. Modify at your own risk and without support.
- */
-#import "TiModule.h"
-
-@interface APIModule : TiModule {
-
-}
-
--(void)logMessage:(NSArray*)messages severity:(NSString*)severity; // Used by TiConsole
-
-@end
View
119 build/iphone/Classes/APIModule.m
@@ -1,119 +0,0 @@
-/**
- * Appcelerator Titanium Mobile
- * Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
- * Licensed under the terms of the Apache Public License
- * Please see the LICENSE included with this distribution for details.
- *
- * WARNING: This is generated code. Modify at your own risk and without support.
- */
-#import "APIModule.h"
-#import "TiUtils.h"
-#import "TiBase.h"
-#import "TiApp.h"
-#import "TiDebugger.h"
-
-@implementation APIModule
-
--(void)logMessage:(NSArray*)args severity:(NSString*)severity
-{
- NSMutableString* message = [NSMutableString string];
-
- if ([[TiApp app] debugMode]) {
- NSString* lcSeverity = [severity lowercaseString];
- DebuggerLogLevel level = OUT;
- NSMutableArray* messages = [NSMutableArray arrayWithArray:args];
-
- if ([lcSeverity isEqualToString:@"warn"]) {
- level = WARN;
- }
- else if ([lcSeverity isEqualToString:@"error"] ||
- [lcSeverity isEqualToString:@"critical"] ||
- [lcSeverity isEqualToString:@"fatal"]) {
- level = ERR;
- }
- else if ([lcSeverity isEqualToString:@"trace"]) {
- level = TRACE;
- }
- else if ([lcSeverity isEqualToString:@"debug"]) {
- level = LOG_DEBUG;
- }
- else if (![lcSeverity isEqualToString:@"info"]) { // Custom severity, or just a badly-formed log; either way, debugger treats it as info
- [messages insertObject:[NSString stringWithFormat:@"[%@]", severity] atIndex:0];
- }
-
- TiDebuggerLogMessage(level, [messages componentsJoinedByString:@" "]);
- }
- else {
- NSLog(@"[%@] %@", [severity uppercaseString], [args componentsJoinedByString:@" "]);
- fflush(stderr);
- }
-}
-
--(id)transform:(id)arg
-{
- return [TiUtils exceptionMessage:arg];
-}
-
--(void)debug:(NSArray*)args
-{
- [self logMessage:args severity:@"debug"];
-}
-
--(void)info:(NSArray*)args
-{
- [self logMessage:args severity:@"info"];
-}
-
--(void)warn:(NSArray*)args
-{
- [self logMessage:args severity:@"warn"];
-}
-
--(void)error:(NSArray*)args
-{
- [self logMessage:args severity:@"error"];
-}
-
--(void)trace:(NSArray*)args
-{
- [self logMessage:args severity:@"trace"];
-}
-
--(void)timestamp:(NSArray*)args
-{
- NSLog(@"[TIMESTAMP] %f %@", [NSDate timeIntervalSinceReferenceDate], [self transform:[args objectAtIndex:0]]);
- fflush(stderr);
-}
-
--(void)notice:(NSArray*)args
-{
- [self logMessage:args severity:@"info"];
-}
-
--(void)critical:(NSArray*)args
-{
- [self logMessage:args severity:@"error"];
-}
-
--(void)log:(NSArray*)args
-{
- if ([args count] > 1) {
- [self logMessage:[args subarrayWithRange:NSMakeRange(1, [args count]-1)] severity:[args objectAtIndex:0]];
- }
- else {
- [self logMessage:args severity:@"info"];
- }
-}
-
--(void)reportUnhandledException:(NSArray*)args
-{
- id lineNumber = [args objectAtIndex:0];
- id source = [args objectAtIndex:1];
- id message = [args objectAtIndex:2];
-
- NSLog(@"[ERROR] %@:%@ %@",source,lineNumber,message);
- fflush(stderr);
-}
-
-
-@end
View
104 build/iphone/Classes/AQRecorder.h
@@ -1,104 +0,0 @@
-/*
-
- File: AQRecorder.h
- Abstract: Helper class for recording audio files via the AudioQueue
- Version: 2.4
-
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
- Inc. ("Apple") in consideration of your agreement to the following
- terms, and your use, installation, modification or redistribution of
- this Apple software constitutes acceptance of these terms. If you do
- not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and
- subject to these terms, Apple grants you a personal, non-exclusive
- license, under Apple's copyrights in this original Apple software (the
- "Apple Software"), to use, reproduce, modify and redistribute the Apple
- Software, with or without modifications, in source and/or binary forms;
- provided that if you redistribute the Apple Software in its entirety and
- without modifications, you must retain this notice and the following
- text and disclaimers in all such redistributions of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may
- be used to endorse or promote products derived from the Apple Software
- without specific prior written permission from Apple. Except as
- expressly stated in this notice, no other rights or licenses, express or
- implied, are granted by Apple herein, including but not limited to any
- patent rights that may be infringed by your derivative works or by other
- works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE
- MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
- OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
- MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
- AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
- STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- Copyright (C) 2009 Apple Inc. All Rights Reserved.
-
-
- */
-
-#ifdef USE_TI_MEDIA
-
-#include <AudioToolbox/AudioToolbox.h>
-#include <Foundation/Foundation.h>
-#include <libkern/OSAtomic.h>
-
-#include "CAStreamBasicDescription.h"
-#include "CAXException.h"
-
-#define kNumberRecordBuffers 3
-#define kBufferDurationSeconds .5
-
-class AQRecorder
-{
-public:
- AQRecorder();
- ~AQRecorder();
-
- UInt32 GetNumberChannels() const { return mRecordFormat.NumberChannels(); }
- CFStringRef GetFileName() const { return mFileName; }
- AudioQueueRef Queue() const { return mQueue; }
- CAStreamBasicDescription DataFormat() const { return mRecordFormat; }
-
- void StartRecord(CFStringRef inRecordFile,UInt32 fileFormatID);
- void PauseRecord(); //JGH: added
- void ResumeRecord(); //JGH: added
- void StopRecord();
- Boolean IsRunning() const { return mIsRunning; }
- Boolean IsPaused() const { return mIsPaused; } //JGH: added
- void SetupAudioFormat(UInt32 inFormatID);
-
- UInt64 startTime;
-
-private:
- CFStringRef mFileName;
- AudioQueueRef mQueue;
- AudioQueueBufferRef mBuffers[kNumberRecordBuffers];
- AudioFileID mRecordFile;
- SInt64 mRecordPacket; // current packet number in record file
- CAStreamBasicDescription mRecordFormat;
- Boolean mIsRunning;
- Boolean mIsPaused; //JGH: added
-
- void CopyEncoderCookieToFile();
- int ComputeRecordBufferSize(const AudioStreamBasicDescription *format, float seconds);
-
- static void MyInputBufferHandler( void * inUserData,
- AudioQueueRef inAQ,
- AudioQueueBufferRef inBuffer,
- const AudioTimeStamp * inStartTime,
- UInt32 inNumPackets,
- const AudioStreamPacketDescription* inPacketDesc);
-};
-
-#endif
View
361 build/iphone/Classes/AQRecorder.mm
@@ -1,361 +0,0 @@
-/*
-
- File: AQRecorder.mm
- Abstract: n/a
- Version: 2.4
-
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
- Inc. ("Apple") in consideration of your agreement to the following
- terms, and your use, installation, modification or redistribution of
- this Apple software constitutes acceptance of these terms. If you do
- not agree with these terms, please do not use, install, modify or
- redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and
- subject to these terms, Apple grants you a personal, non-exclusive
- license, under Apple's copyrights in this original Apple software (the
- "Apple Software"), to use, reproduce, modify and redistribute the Apple
- Software, with or without modifications, in source and/or binary forms;
- provided that if you redistribute the Apple Software in its entirety and
- without modifications, you must retain this notice and the following
- text and disclaimers in all such redistributions of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may
- be used to endorse or promote products derived from the Apple Software
- without specific prior written permission from Apple. Except as
- expressly stated in this notice, no other rights or licenses, express or
- implied, are granted by Apple herein, including but not limited to any
- patent rights that may be infringed by your derivative works or by other
- works in which the Apple Software may be incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE
- MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
- THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
- OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
- MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
- AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
- STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- Copyright (C) 2009 Apple Inc. All Rights Reserved.
-
-
- */
-#ifdef USE_TI_MEDIA
-
-#include "AQRecorder.h"
-
-// ____________________________________________________________________________________
-// Determine the size, in bytes, of a buffer necessary to represent the supplied number
-// of seconds of audio data.
-int AQRecorder::ComputeRecordBufferSize(const AudioStreamBasicDescription *format, float seconds)
-{
- int packets, frames, bytes = 0;
- try {
- frames = (int)ceil(seconds * format->mSampleRate);
-
- if (format->mBytesPerFrame > 0)
- bytes = frames * format->mBytesPerFrame;
- else {
- UInt32 maxPacketSize;
- if (format->mBytesPerPacket > 0)
- maxPacketSize = format->mBytesPerPacket; // constant packet size
- else {
- UInt32 propertySize = sizeof(maxPacketSize);
- XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_MaximumOutputPacketSize, &maxPacketSize,
- &propertySize), "couldn't get queue's maximum output packet size");
- }
- if (format->mFramesPerPacket > 0)
- packets = frames / format->mFramesPerPacket;
- else
- packets = frames; // worst-case scenario: 1 frame in a packet
- if (packets == 0) // sanity check
- packets = 1;
- bytes = packets * maxPacketSize;
- }
- } catch (CAXException e) {
- char buf[256];
- fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
- return 0;
- }
- return bytes;
-}
-
-// ____________________________________________________________________________________
-// AudioQueue callback function, called when an input buffers has been filled.
-void AQRecorder::MyInputBufferHandler( void * inUserData,
- AudioQueueRef inAQ,
- AudioQueueBufferRef inBuffer,
- const AudioTimeStamp * inStartTime,
- UInt32 inNumPackets,
- const AudioStreamPacketDescription* inPacketDesc)
-{
- AQRecorder *aqr = (AQRecorder *)inUserData;
-
- try
- {
- if (inNumPackets > 0 && !aqr->IsPaused()) //JGH check for pause
- {
- // write packets to file
- XThrowIfError(AudioFileWritePackets(aqr->mRecordFile, FALSE, inBuffer->mAudioDataByteSize,
- inPacketDesc, aqr->mRecordPacket, &inNumPackets, inBuffer->mAudioData),
- "AudioFileWritePackets failed");
- aqr->mRecordPacket += inNumPackets;
- }
-
- // if we're not stopping, re-enqueue the buffe so that it gets filled again
- if (aqr->IsRunning())
- {
- XThrowIfError(AudioQueueEnqueueBuffer(inAQ, inBuffer, 0, NULL), "AudioQueueEnqueueBuffer failed");
- }
- }
- catch (CAXException e)
- {
- char buf[256];
- fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
- }
-}
-
-AQRecorder::AQRecorder()
-{
- mIsRunning = false;
- mIsPaused = false;
- mRecordPacket = 0;
-}
-
-AQRecorder::~AQRecorder()
-{
- if (mQueue!=NULL)
- {
- AudioQueueDispose(mQueue, TRUE);
- mQueue = NULL;
- }
- if (mRecordFile!=NULL)
- {
- AudioFileClose(mRecordFile);
- mRecordFile = NULL;
- }
- if (mFileName)
- {
- CFRelease(mFileName);
- mFileName = NULL;
- }
-}
-
-// ____________________________________________________________________________________
-// Copy a queue's encoder's magic cookie to an audio file.
-void AQRecorder::CopyEncoderCookieToFile()
-{
- UInt32 propertySize;
- // get the magic cookie, if any, from the converter
- OSStatus err = AudioQueueGetPropertySize(mQueue, kAudioQueueProperty_MagicCookie, &propertySize);
-
- // we can get a noErr result and also a propertySize == 0
- // -- if the file format does support magic cookies, but this file doesn't have one.
- if (err == noErr && propertySize > 0) {
- Byte *magicCookie = new Byte[propertySize];
- UInt32 magicCookieSize;
- XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_MagicCookie, magicCookie, &propertySize), "get audio converter's magic cookie");
- magicCookieSize = propertySize; // the converter lies and tell us the wrong size
-
- // now set the magic cookie on the output file
- UInt32 willEatTheCookie = false;
- // the converter wants to give us one; will the file take it?
- err = AudioFileGetPropertyInfo(mRecordFile, kAudioFilePropertyMagicCookieData, NULL, &willEatTheCookie);
- if (err == noErr && willEatTheCookie) {
- err = AudioFileSetProperty(mRecordFile, kAudioFilePropertyMagicCookieData, magicCookieSize, magicCookie);
- XThrowIfError(err, "set audio file's magic cookie");
- }
- delete[] magicCookie;
- }
-}
-
-void AQRecorder::SetupAudioFormat(UInt32 inFormatID)
-{
- memset(&mRecordFormat, 0, sizeof(mRecordFormat));
-
- UInt32 size = sizeof(mRecordFormat.mSampleRate);
- XThrowIfError(AudioSessionGetProperty( kAudioSessionProperty_CurrentHardwareSampleRate,
- &size,
- &mRecordFormat.mSampleRate), "couldn't get hardware sample rate");
-
- size = sizeof(mRecordFormat.mChannelsPerFrame);
-
- // WORKAROUND FOR APPLE BUG #8933998
- // Catch the exceptions thrown by XThrowIfError, and put our faith in Mighty Apple that there will be an appropriate
- // hardware check somewhere down the line...
- try {
- XThrowIfError(AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareInputNumberChannels,
- &size,
- &mRecordFormat.mChannelsPerFrame), "couldn't get input channel count");
- }
- catch (CAXException& e) {
- char buf[256];
- fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
- }
-
- mRecordFormat.mFormatID = inFormatID;
-
- switch(inFormatID)
- {
- case kAudioFormatLinearPCM:
- {
- mRecordFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
- mRecordFormat.mBitsPerChannel = 16;
- mRecordFormat.mChannelsPerFrame = 1;
- mRecordFormat.mBytesPerFrame = 2;
- mRecordFormat.mFramesPerPacket = 1;
- mRecordFormat.mSampleRate = 44100.0;
- mRecordFormat.mBytesPerPacket = 2;
- break;
- }
- case kAudioFormatALaw:
- case kAudioFormatULaw:
- {
- mRecordFormat.mSampleRate = 8000.0;
- mRecordFormat.mFormatFlags = 0;
- mRecordFormat.mFramesPerPacket = 1;
- mRecordFormat.mChannelsPerFrame = 1;
- mRecordFormat.mBitsPerChannel = 8;
- mRecordFormat.mBytesPerPacket = 1;
- mRecordFormat.mBytesPerFrame = 1;
- break;
- }
- case kAudioFormatAppleIMA4:
- {
- mRecordFormat.mSampleRate = 44100.0;
- mRecordFormat.mFormatFlags = 0;
- mRecordFormat.mChannelsPerFrame = 1;
- mRecordFormat.mBitsPerChannel = 0;
- mRecordFormat.mFramesPerPacket = 64;
- mRecordFormat.mBytesPerPacket = 68;
- break;
- }
- case kAudioFormatAppleLossless:
- {
- mRecordFormat.mFormatFlags = 0;
- mRecordFormat.mSampleRate = 44100.0;
- mRecordFormat.mBitsPerChannel = 0;
- mRecordFormat.mFramesPerPacket = 4096;
- mRecordFormat.mBytesPerFrame = 0;
- mRecordFormat.mChannelsPerFrame = 1;
- mRecordFormat.mBytesPerPacket = 0;
- break;
- }
- case kAudioFormatMPEG4AAC:
- {
- mRecordFormat.mFormatFlags = 0;
- mRecordFormat.mBitsPerChannel = 0;
- mRecordFormat.mSampleRate = 44100.0;
- mRecordFormat.mChannelsPerFrame = 1;
- mRecordFormat.mBytesPerPacket = 0;
- mRecordFormat.mBytesPerFrame = 0;
- mRecordFormat.mFramesPerPacket = 1024;
- break;
- }
- }
-}
-
-void AQRecorder::PauseRecord()
-{
- if (!mIsPaused && mIsRunning) {
- XThrowIfError(AudioQueuePause(mQueue),"unable to pause audio queue");
- mIsPaused = true;
- }
-}
-
-void AQRecorder::ResumeRecord()
-{
- if (mIsPaused && mIsRunning) {
- mIsPaused = false;
- XThrowIfError(AudioQueueStart(mQueue,NULL),"unable to resume audio queue");
- }
-}
-
-void AQRecorder::StartRecord(CFStringRef inRecordFile, UInt32 fileFormatID)
-{
- int i, bufferByteSize;
- UInt32 size;
- CFURLRef url;
-
- mIsPaused = false;
-
- try {
- mFileName = CFStringCreateCopy(kCFAllocatorDefault, inRecordFile);
-
- // create the queue
- XThrowIfError(AudioQueueNewInput(
- &mRecordFormat,
- MyInputBufferHandler,
- this /* userData */,
- NULL /* run loop */, NULL /* run loop mode */,
- 0 /* flags */, &mQueue), "AudioQueueNewInput failed");
-
- // get the record format back from the queue's audio converter --
- // the file may require a more specific stream description than was necessary to create the encoder.
- mRecordPacket = 0;
-
- size = sizeof(mRecordFormat);
- XThrowIfError(AudioQueueGetProperty(mQueue, kAudioQueueProperty_StreamDescription,
- &mRecordFormat, &size), "couldn't get queue's format");
-
- //NSString *recordFile = [NSTemporaryDirectory() stringByAppendingPathComponent: (NSString*)inRecordFile];
-
- url = CFURLCreateWithString(kCFAllocatorDefault, (CFStringRef)mFileName, NULL);
-
- // create the audio file
- XThrowIfError(AudioFileCreateWithURL(url, fileFormatID, &mRecordFormat, kAudioFileFlags_EraseFile,
- &mRecordFile), "AudioFileCreateWithURL failed");
- CFRelease(url);
-
- // copy the cookie first to give the file object as much info as we can about the data going in
- // not necessary for pcm, but required for some compressed audio
- CopyEncoderCookieToFile();
-
- // allocate and enqueue buffers
- bufferByteSize = ComputeRecordBufferSize(&mRecordFormat, kBufferDurationSeconds); // enough bytes for half a second
- for (i = 0; i < kNumberRecordBuffers; ++i) {
- XThrowIfError(AudioQueueAllocateBuffer(mQueue, bufferByteSize, &mBuffers[i]),
- "AudioQueueAllocateBuffer failed");
- XThrowIfError(AudioQueueEnqueueBuffer(mQueue, mBuffers[i], 0, NULL),
- "AudioQueueEnqueueBuffer failed");
- }
- // start the queue
- mIsRunning = true;
- XThrowIfError(AudioQueueStart(mQueue, NULL), "AudioQueueStart failed");
- }
- catch (CAXException &e) {
- char buf[256];
- fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
- }
- catch (...) {
- fprintf(stderr, "An unknown error occurred\n");
- }
-
-}
-
-void AQRecorder::StopRecord()
-{
- // end recording
- mIsRunning = false;
- mIsPaused = false;
- XThrowIfError(AudioQueueStop(mQueue, true), "AudioQueueStop failed");
- // a codec may update its cookie at the end of an encoding session, so reapply it to the file now
- CopyEncoderCookieToFile();
- if (mFileName)
- {
- CFRelease(mFileName);
- mFileName = NULL;
- }
- AudioQueueDispose(mQueue, true);
- mQueue = NULL;
- AudioFileClose(mRecordFile);
- mRecordFile = NULL;
-}
-
-#endif
View
35 build/iphone/Classes/ASI/ASIAuthenticationDialog.h
@@ -1,35 +0,0 @@
-//
-// ASIAuthenticationDialog.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 21/08/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-@class ASIHTTPRequest;
-
-typedef enum _ASIAuthenticationType {
- ASIStandardAuthenticationType = 0,
- ASIProxyAuthenticationType = 1
-} ASIAuthenticationType;
-
-@interface ASIAutorotatingViewController : UIViewController
-@end
-
-@interface ASIAuthenticationDialog : ASIAutorotatingViewController <UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource> {
- ASIHTTPRequest *request;
- ASIAuthenticationType type;
- UITableView *tableView;
- UIViewController *presentingController;
- BOOL didEnableRotationNotifications;
-}
-+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)request;
-+ (void)dismiss;
-
-@property (retain) ASIHTTPRequest *request;
-@property (assign) ASIAuthenticationType type;
-@property (assign) BOOL didEnableRotationNotifications;
-@property (retain, nonatomic) UIViewController *presentingController;
-@end
View
493 build/iphone/Classes/ASI/ASIAuthenticationDialog.m
@@ -1,493 +0,0 @@
-//
-// ASIAuthenticationDialog.m
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 21/08/2009.
-// Copyright 2009 All-Seeing Interactive. All rights reserved.
-//
-
-#import "ASIAuthenticationDialog.h"
-#import "ASIHTTPRequest.h"
-#import <QuartzCore/QuartzCore.h>
-
-static ASIAuthenticationDialog *sharedDialog = nil;
-BOOL isDismissing = NO;
-static NSMutableArray *requestsNeedingAuthentication = nil;
-
-static const NSUInteger kUsernameRow = 0;
-static const NSUInteger kUsernameSection = 0;
-static const NSUInteger kPasswordRow = 1;
-static const NSUInteger kPasswordSection = 0;
-static const NSUInteger kDomainRow = 0;
-static const NSUInteger kDomainSection = 1;
-
-
-@implementation ASIAutorotatingViewController
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
-{
- return YES;
-}
-
-@end
-
-
-@interface ASIAuthenticationDialog ()
-- (void)showTitle;
-- (void)show;
-- (NSArray *)requestsRequiringTheseCredentials;
-- (void)presentNextDialog;
-- (void)keyboardWillShow:(NSNotification *)notification;
-- (void)orientationChanged:(NSNotification *)notification;
-- (void)cancelAuthenticationFromDialog:(id)sender;
-- (void)loginWithCredentialsFromDialog:(id)sender;
-@property (retain) UITableView *tableView;
-@end
-
-@implementation ASIAuthenticationDialog
-
-#pragma mark init / dealloc
-
-+ (void)initialize
-{
- if (self == [ASIAuthenticationDialog class]) {
- requestsNeedingAuthentication = [[NSMutableArray array] retain];
- }
-}
-
-+ (void)presentAuthenticationDialogForRequest:(ASIHTTPRequest *)theRequest
-{
- // No need for a lock here, this will always be called on the main thread
- if (!sharedDialog) {
- sharedDialog = [[self alloc] init];
- [sharedDialog setRequest:theRequest];
- if ([theRequest authenticationNeeded] == ASIProxyAuthenticationNeeded) {
- [sharedDialog setType:ASIProxyAuthenticationType];
- } else {
- [sharedDialog setType:ASIStandardAuthenticationType];
- }
- [sharedDialog show];
- } else {
- [requestsNeedingAuthentication addObject:theRequest];
- }
-}
-
-- (id)init
-{
- if ((self = [self initWithNibName:nil bundle:nil])) {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
-#endif
- if (![UIDevice currentDevice].generatesDeviceOrientationNotifications) {
- [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
- [self setDidEnableRotationNotifications:YES];
- }
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- }
-#endif
- }
- return self;
-}
-
-- (void)dealloc
-{
- if ([self didEnableRotationNotifications]) {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
- }
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
-
- [request release];
- [tableView release];
- [presentingController.view removeFromSuperview];
- [presentingController release];
- [super dealloc];
-}
-
-#pragma mark keyboard notifications
-
-- (void)keyboardWillShow:(NSNotification *)notification
-{
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
-#endif
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_2
- NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey];
-#else
- NSValue *keyboardBoundsValue = [[notification userInfo] objectForKey:UIKeyboardBoundsUserInfoKey];
-#endif
- CGRect keyboardBounds;
- [keyboardBoundsValue getValue:&keyboardBounds];
- UIEdgeInsets e = UIEdgeInsetsMake(0, 0, keyboardBounds.size.height, 0);
- [[self tableView] setScrollIndicatorInsets:e];
- [[self tableView] setContentInset:e];
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- }
-#endif
-}
-
-// Manually handles orientation changes on iPhone
-- (void)orientationChanged:(NSNotification *)notification
-{
- [self showTitle];
-
- UIInterfaceOrientation o = (UIInterfaceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
- CGFloat angle = 0;
- switch (o) {
- case UIDeviceOrientationLandscapeLeft: angle = 90; break;
- case UIDeviceOrientationLandscapeRight: angle = -90; break;
- case UIDeviceOrientationPortraitUpsideDown: angle = 180; break;
- default: break;
- }
-
- CGRect f = [[UIScreen mainScreen] applicationFrame];
-
- // Swap the frame height and width if necessary
- if (UIDeviceOrientationIsLandscape(o)) {
- CGFloat t;
- t = f.size.width;
- f.size.width = f.size.height;
- f.size.height = t;
- }
-
- CGAffineTransform previousTransform = self.view.layer.affineTransform;
- CGAffineTransform newTransform = CGAffineTransformMakeRotation((CGFloat)(angle * M_PI / 180.0));
-
- // Reset the transform so we can set the size
- self.view.layer.affineTransform = CGAffineTransformIdentity;
- self.view.frame = (CGRect){ { 0, 0 }, f.size};
-
- // Revert to the previous transform for correct animation
- self.view.layer.affineTransform = previousTransform;
-
- [UIView beginAnimations:nil context:NULL];
- [UIView setAnimationDuration:0.3];
-
- // Set the new transform
- self.view.layer.affineTransform = newTransform;
-
- // Fix the view origin
- self.view.frame = (CGRect){ { f.origin.x, f.origin.y },self.view.frame.size};
- [UIView commitAnimations];
-}
-
-#pragma mark utilities
-
-- (UIViewController *)presentingController
-{
- if (!presentingController) {
- presentingController = [[ASIAutorotatingViewController alloc] initWithNibName:nil bundle:nil];
-
- // Attach to the window, but don't interfere.
- UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];
- [window addSubview:[presentingController view]];
- [[presentingController view] setFrame:CGRectZero];
- [[presentingController view] setUserInteractionEnabled:NO];
- }
-
- return presentingController;
-}
-
-- (UITextField *)textFieldInRow:(NSUInteger)row section:(NSUInteger)section
-{
- return [[[[[self tableView] cellForRowAtIndexPath:
- [NSIndexPath indexPathForRow:row inSection:section]]
- contentView] subviews] objectAtIndex:0];
-}
-
-- (UITextField *)usernameField
-{
- return [self textFieldInRow:kUsernameRow section:kUsernameSection];
-}
-
-- (UITextField *)passwordField
-{
- return [self textFieldInRow:kPasswordRow section:kPasswordSection];
-}
-
-- (UITextField *)domainField
-{
- return [self textFieldInRow:kDomainRow section:kDomainSection];
-}
-
-#pragma mark show / dismiss
-
-+ (void)dismiss
-{
- if ([sharedDialog respondsToSelector:@selector(presentingViewController)])
- [[sharedDialog presentingViewController] dismissModalViewControllerAnimated:YES];
- else
- [[sharedDialog parentViewController] dismissModalViewControllerAnimated:YES];
-}
-
-- (void)viewDidDisappear:(BOOL)animated
-{
- [self retain];
- [sharedDialog release];
- sharedDialog = nil;
- [self performSelector:@selector(presentNextDialog) withObject:nil afterDelay:0];
- [self release];
-}
-
-- (void)dismiss
-{
- if (self == sharedDialog) {
- [[self class] dismiss];
- } else {
- if ([self respondsToSelector:@selector(presentingViewController)])
- [[self presentingViewController] dismissModalViewControllerAnimated:YES];
- else
- [[self parentViewController] dismissModalViewControllerAnimated:YES];
- }
-}
-
-- (void)showTitle
-{
- UINavigationBar *navigationBar = [[[self view] subviews] objectAtIndex:0];
- UINavigationItem *navItem = [[navigationBar items] objectAtIndex:0];
- if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
- // Setup the title
- if ([self type] == ASIProxyAuthenticationType) {
- [navItem setPrompt:@"Login to this secure proxy server."];
- } else {
- [navItem setPrompt:@"Login to this secure server."];
- }
- } else {
- [navItem setPrompt:nil];
- }
- [navigationBar sizeToFit];
- CGRect f = [[self view] bounds];
- f.origin.y = [navigationBar frame].size.height;
- f.size.height -= f.origin.y;
- [[self tableView] setFrame:f];
-}
-
-- (void)show
-{
- // Remove all subviews
- UIView *v;
- while ((v = [[[self view] subviews] lastObject])) {
- [v removeFromSuperview];
- }
-
- // Setup toolbar
- UINavigationBar *bar = [[[UINavigationBar alloc] init] autorelease];
- [bar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
-
- UINavigationItem *navItem = [[[UINavigationItem alloc] init] autorelease];
- bar.items = [NSArray arrayWithObject:navItem];
-
- [[self view] addSubview:bar];
-
- [self showTitle];
-
- // Setup toolbar buttons
- if ([self type] == ASIProxyAuthenticationType) {
- [navItem setTitle:[[self request] proxyHost]];
- } else {
- [navItem setTitle:[[[self request] url] host]];
- }
-
- [navItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelAuthenticationFromDialog:)] autorelease]];
- [navItem setRightBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:@"Login" style:UIBarButtonItemStyleDone target:self action:@selector(loginWithCredentialsFromDialog:)] autorelease]];
-
- // We show the login form in a table view, similar to Safari's authentication dialog
- [bar sizeToFit];
- CGRect f = [[self view] bounds];
- f.origin.y = [bar frame].size.height;
- f.size.height -= f.origin.y;
-
- [self setTableView:[[[UITableView alloc] initWithFrame:f style:UITableViewStyleGrouped] autorelease]];
- [[self tableView] setDelegate:self];
- [[self tableView] setDataSource:self];
- [[self tableView] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
- [[self view] addSubview:[self tableView]];
-
- // Force reload the table content, and focus the first field to show the keyboard
- [[self tableView] reloadData];
- [[[[[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].contentView subviews] objectAtIndex:0] becomeFirstResponder];
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
- [self setModalPresentationStyle:UIModalPresentationFormSheet];
- }
-#endif
-
- [[self presentingController] presentModalViewController:self animated:YES];
-}
-
-#pragma mark button callbacks
-
-- (void)cancelAuthenticationFromDialog:(id)sender
-{
- for (ASIHTTPRequest *theRequest in [self requestsRequiringTheseCredentials]) {
- [theRequest cancelAuthentication];
- [requestsNeedingAuthentication removeObject:theRequest];
- }
- [self dismiss];
-}
-
-- (NSArray *)requestsRequiringTheseCredentials
-{
- NSMutableArray *requestsRequiringTheseCredentials = [NSMutableArray array];
- NSURL *requestURL = [[self request] url];
- for (ASIHTTPRequest *otherRequest in requestsNeedingAuthentication) {
- NSURL *theURL = [otherRequest url];
- if (([otherRequest authenticationNeeded] == [[self request] authenticationNeeded]) && [[theURL host] isEqualToString:[requestURL host]] && ([theURL port] == [requestURL port] || ([requestURL port] && [[theURL port] isEqualToNumber:[requestURL port]])) && [[theURL scheme] isEqualToString:[requestURL scheme]] && ((![otherRequest authenticationRealm] && ![[self request] authenticationRealm]) || ([otherRequest authenticationRealm] && [[self request] authenticationRealm] && [[[self request] authenticationRealm] isEqualToString:[otherRequest authenticationRealm]]))) {
- [requestsRequiringTheseCredentials addObject:otherRequest];
- }
- }
- [requestsRequiringTheseCredentials addObject:[self request]];
- return requestsRequiringTheseCredentials;
-}
-
-- (void)presentNextDialog
-{
- if ([requestsNeedingAuthentication count]) {
- ASIHTTPRequest *nextRequest = [requestsNeedingAuthentication objectAtIndex:0];
- [requestsNeedingAuthentication removeObjectAtIndex:0];
- [[self class] presentAuthenticationDialogForRequest:nextRequest];
- }
-}
-
-
-- (void)loginWithCredentialsFromDialog:(id)sender
-{
- for (ASIHTTPRequest *theRequest in [self requestsRequiringTheseCredentials]) {
-
- NSString *username = [[self usernameField] text];
- NSString *password = [[self passwordField] text];
-
- if (username == nil) { username = @""; }
- if (password == nil) { password = @""; }
-
- if ([self type] == ASIProxyAuthenticationType) {
- [theRequest setProxyUsername:username];
- [theRequest setProxyPassword:password];
- } else {
- [theRequest setUsername:username];
- [theRequest setPassword:password];
- }
-
- // Handle NTLM domains
- NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
- if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
- NSString *domain = [[self domainField] text];
- if ([self type] == ASIProxyAuthenticationType) {
- [theRequest setProxyDomain:domain];
- } else {
- [theRequest setDomain:domain];
- }
- }
-
- [theRequest retryUsingSuppliedCredentials];
- [requestsNeedingAuthentication removeObject:theRequest];
- }
- [self dismiss];
-}
-
-#pragma mark table view data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView
-{
- NSString *scheme = ([self type] == ASIStandardAuthenticationType) ? [[self request] authenticationScheme] : [[self request] proxyAuthenticationScheme];
- if ([scheme isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeNTLM]) {
- return 2;
- }
- return 1;
-}
-
-- (CGFloat)tableView:(UITableView *)aTableView heightForFooterInSection:(NSInteger)section
-{
- if (section == [self numberOfSectionsInTableView:aTableView]-1) {
- return 30;
- }
- return 0;
-}
-
-- (CGFloat)tableView:(UITableView *)aTableView heightForHeaderInSection:(NSInteger)section
-{
- if (section == 0) {
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
- return 54;
- }
-#endif
- return 30;
- }
- return 0;
-}
-
-- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
-{
- if (section == 0) {
- return [[self request] authenticationRealm];
- }
- return nil;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0
- UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
-#else
- UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0,0,0,0) reuseIdentifier:nil] autorelease];
-#endif
-
- [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
-
- CGRect f = CGRectInset([cell bounds], 10, 10);
- UITextField *textField = [[[UITextField alloc] initWithFrame:f] autorelease];
- [textField setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
- [textField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
- [textField setAutocorrectionType:UITextAutocorrectionTypeNo];
-
- NSUInteger s = [indexPath section];
- NSUInteger r = [indexPath row];
-
- if (s == kUsernameSection && r == kUsernameRow) {
- [textField setPlaceholder:@"User"];
- } else if (s == kPasswordSection && r == kPasswordRow) {
- [textField setPlaceholder:@"Password"];
- [textField setSecureTextEntry:YES];
- } else if (s == kDomainSection && r == kDomainRow) {
- [textField setPlaceholder:@"Domain"];
- }
- [cell.contentView addSubview:textField];
-
- return cell;
-}
-
-- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section
-{
- if (section == 0) {
- return 2;
- } else {
- return 1;
- }
-}
-
-- (NSString *)tableView:(UITableView *)aTableView titleForFooterInSection:(NSInteger)section
-{
- if (section == [self numberOfSectionsInTableView:aTableView]-1) {
- // If we're using Basic authentication and the connection is not using SSL, we'll show the plain text message
- if ([[[self request] authenticationScheme] isEqualToString:(NSString *)kCFHTTPAuthenticationSchemeBasic] && ![[[[self request] url] scheme] isEqualToString:@"https"]) {
- return @"Password will be sent in the clear.";
- // We are using Digest, NTLM, or any scheme over SSL
- } else {
- return @"Password will be sent securely.";
- }
- }
- return nil;
-}
-
-#pragma mark -
-
-@synthesize request;
-@synthesize type;
-@synthesize tableView;
-@synthesize didEnableRotationNotifications;
-@synthesize presentingController;
-@end
View
103 build/iphone/Classes/ASI/ASICacheDelegate.h
@@ -1,103 +0,0 @@
-//
-// ASICacheDelegate.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 01/05/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-@class ASIHTTPRequest;
-
-// Cache policies control the behaviour of a cache and how requests use the cache
-// When setting a cache policy, you can use a combination of these values as a bitmask
-// For example: [request setCachePolicy:ASIAskServerIfModifiedCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy|ASIDoNotWriteToCacheCachePolicy];
-// Note that some of the behaviours below are mutally exclusive - you cannot combine ASIAskServerIfModifiedWhenStaleCachePolicy and ASIAskServerIfModifiedCachePolicy, for example.
-typedef enum _ASICachePolicy {
-
- // The default cache policy. When you set a request to use this, it will use the cache's defaultCachePolicy
- // ASIDownloadCache's default cache policy is 'ASIAskServerIfModifiedWhenStaleCachePolicy'
- ASIUseDefaultCachePolicy = 0,
-
- // Tell the request not to read from the cache
- ASIDoNotReadFromCacheCachePolicy = 1,
-
- // The the request not to write to the cache
- ASIDoNotWriteToCacheCachePolicy = 2,
-
- // Ask the server if there is an updated version of this resource (using a conditional GET) ONLY when the cached data is stale
- ASIAskServerIfModifiedWhenStaleCachePolicy = 4,
-
- // Always ask the server if there is an updated version of this resource (using a conditional GET)
- ASIAskServerIfModifiedCachePolicy = 8,
-
- // If cached data exists, use it even if it is stale. This means requests will not talk to the server unless the resource they are requesting is not in the cache
- ASIOnlyLoadIfNotCachedCachePolicy = 16,
-
- // If cached data exists, use it even if it is stale. If cached data does not exist, stop (will not set an error on the request)
- ASIDontLoadCachePolicy = 32,
-
- // Specifies that cached data may be used if the request fails. If cached data is used, the request will succeed without error. Usually used in combination with other options above.
- ASIFallbackToCacheIfLoadFailsCachePolicy = 64
-} ASICachePolicy;
-
-// Cache storage policies control whether cached data persists between application launches (ASICachePermanentlyCacheStoragePolicy) or not (ASICacheForSessionDurationCacheStoragePolicy)
-// Calling [ASIHTTPRequest clearSession] will remove any data stored using ASICacheForSessionDurationCacheStoragePolicy
-typedef enum _ASICacheStoragePolicy {
- ASICacheForSessionDurationCacheStoragePolicy = 0,
- ASICachePermanentlyCacheStoragePolicy = 1
-} ASICacheStoragePolicy;
-
-
-@protocol ASICacheDelegate <NSObject>
-
-@required
-
-// Should return the cache policy that will be used when requests have their cache policy set to ASIUseDefaultCachePolicy
-- (ASICachePolicy)defaultCachePolicy;
-
-// Returns the date a cached response should expire on. Pass a non-zero max age to specify a custom date.
-- (NSDate *)expiryDateForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Updates cached response headers with a new expiry date. Pass a non-zero max age to specify a custom date.
-- (void)updateExpiryForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Looks at the request's cache policy and any cached headers to determine if the cache data is still valid
-- (BOOL)canUseCachedDataForRequest:(ASIHTTPRequest *)request;
-
-// Removes cached data for a particular request
-- (void)removeCachedDataForRequest:(ASIHTTPRequest *)request;
-
-// Should return YES if the cache considers its cached response current for the request
-// Should return NO is the data is not cached, or (for example) if the cached headers state the request should have expired
-- (BOOL)isCachedDataCurrentForRequest:(ASIHTTPRequest *)request;
-
-// Should store the response for the passed request in the cache
-// When a non-zero maxAge is passed, it should be used as the expiry time for the cached response
-- (void)storeResponseForRequest:(ASIHTTPRequest *)request maxAge:(NSTimeInterval)maxAge;
-
-// Removes cached data for a particular url
-- (void)removeCachedDataForURL:(NSURL *)url;
-
-// Should return an NSDictionary of cached headers for the passed URL, if it is stored in the cache
-- (NSDictionary *)cachedResponseHeadersForURL:(NSURL *)url;
-
-// Should return the cached body of a response for the passed URL, if it is stored in the cache
-- (NSData *)cachedResponseDataForURL:(NSURL *)url;
-
-// Returns a path to the cached response data, if it exists
-- (NSString *)pathToCachedResponseDataForURL:(NSURL *)url;
-
-// Returns a path to the cached response headers, if they url
-- (NSString *)pathToCachedResponseHeadersForURL:(NSURL *)url;
-
-// Returns the location to use to store cached response headers for a particular request
-- (NSString *)pathToStoreCachedResponseHeadersForRequest:(ASIHTTPRequest *)request;
-
-// Returns the location to use to store a cached response body for a particular request
-- (NSString *)pathToStoreCachedResponseDataForRequest:(ASIHTTPRequest *)request;
-
-// Clear cached data stored for the passed storage policy
-- (void)clearCachedResponsesForStoragePolicy:(ASICacheStoragePolicy)cachePolicy;
-
-@end
View
42 build/iphone/Classes/ASI/ASIDataCompressor.h
@@ -1,42 +0,0 @@
-//
-// ASIDataCompressor.h
-// Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
-//
-// Created by Ben Copsey on 17/08/2010.
-// Copyright 2010 All-Seeing Interactive. All rights reserved.
-//
<