Permalink
Browse files

Updated for 1.4.1 release

  • Loading branch information...
nicklockwood committed Apr 3, 2012
1 parent 3c72830 commit db5884f1b0fc4dbad2fb56184d805fe76a7dbcdb
@@ -160,7 +160,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0420;
+ LastUpgradeCheck = 0430;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "iRateMac" */;
compatibilityVersion = "Xcode 3.2";
@@ -9,6 +9,9 @@
#import <Cocoa/Cocoa.h>
@interface iRateMacAppDelegate : NSObject <NSApplicationDelegate>
+{
+ NSWindow *window;
+}
@property (assign) IBOutlet NSWindow *window;
@@ -26,7 +26,7 @@ + (void)initialize
//but we need to test with an app that's actually on the store
[iRate sharedInstance].appStoreID = 355313284;
[iRate sharedInstance].applicationBundleID = @"com.charcoaldesign.rainbowblocks";
-
+
//enable debug mode
[iRate sharedInstance].debug = YES;
}
@@ -8,9 +8,7 @@
#import <UIKit/UIKit.h>
-@interface iRateViewController : UIViewController {
-
-}
+@interface iRateViewController : UIViewController
@end
@@ -10,57 +10,9 @@
@implementation iRateViewController
-
-
-/*
-// The designated initializer. Override to perform setup that is required before the view is loaded.
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- // Custom initialization
- }
- return self;
-}
-*/
-
-/*
-// Implement loadView to create a view hierarchy programmatically, without using a nib.
-- (void)loadView {
-}
-*/
-
-
-/*
-// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
-- (void)viewDidLoad {
- [super viewDidLoad];
-}
-*/
-
-
-/*
-// Override to allow orientations other than the default portrait orientation.
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- // Return YES for supported orientations
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-*/
-
-- (void)didReceiveMemoryWarning {
- // Releases the view if it doesn't have a superview.
- [super didReceiveMemoryWarning];
-
- // Release any cached data, images, etc that aren't in use.
-}
-
-- (void)viewDidUnload {
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
-}
-
-
-- (void)dealloc {
- [super dealloc];
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
+{
+ return YES;
}
@end
@@ -203,14 +203,16 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- CODE_SIGN_ENTITLEMENTS = iRate.entitlements;
+ CODE_SIGN_ENTITLEMENTS = "";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = iRate_Prefix.pch;
INFOPLIST_FILE = "iRate-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 3.2;
PRODUCT_NAME = iRate;
+ TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
@@ -222,7 +224,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = iRate_Prefix.pch;
INFOPLIST_FILE = "iRate-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 3.2;
PRODUCT_NAME = iRate;
+ TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
View
@@ -1,6 +1,6 @@
iRate
-Version 1.4, March 19th, 2012
+Version 1.4.1, April 3rd, 2012
Copyright (C) 2011 Charcoal Design
View
@@ -33,7 +33,7 @@ To install iRate into your app, drag the iRate.h, .m and .bundle files into your
To enable iRate in your application you need to instantiate and configure iRate *before* the app has finished launching. The easiest way to do this is to add the iRate configuration code in your AppDelegate's initialize method, like this:
-As of version 1.4, iRate typically requires no configuration at all and will simply run automatically, using the Application's bundle ID to look it up on the App Store.
+As of version 1.4, iRate typically requires no configuration at all and will simply run automatically, using the Application's bundle ID to look the app ID up on the App Store.
**Note:** If you have apps with matching bundle IDs on both the Mac and iOS app stores (even if they use different capitalisation), the lookup mechanism won't work, so you'll need to manually set the appStoreID property, which is a numeric ID that can be found in iTunes Connect after you set up an app.
@@ -218,7 +218,7 @@ This is called when the user asks to be reminded to rate the app. This is useful
Localisation
---------------
-The defaults strings for iRate are already localised for English, French, German, Italian, Spanish and Japanese.
+The defaults strings for iRate are already localised for English, French, German, Italian, Spanish, Japanese, Traditional Chinese, Russian and Polish.
It is not recommended that you modify the strings files in the iRate.bundle, as it will complicate updating to newer versions of iRate. If you do want to edit the files, or open them so you can copy the keys into your own strings file, you should note that the iRate strings files have actually been compiled as binary plists, so you'll need to open them in Xcode and use the Open As > Property List option, or they will appear as gibberish.
View
@@ -1,6 +1,9 @@
-Version 1.4.1 beta
+Version 1.4.1
-- Added Russian and Polish localisations
+- Added logic to prevent UIAlertView collapsing in landscape mode
+- Added Russian, Polish and Traditional Chinese localisations
+- Improved Japanese localisation
+- Now handles nil cancel button text correctly
Version 1.4
View
@@ -1,7 +1,7 @@
//
// iRate.h
//
-// Version 1.4.1 beta
+// Version 1.4.1
//
// Created by Nick Lockwood on 26/01/2011.
// Copyright 2011 Charcoal Design
@@ -112,9 +112,9 @@ extern NSString *const iRateAppStoreGenreGame;
@interface iRate : NSObject
//required for 32-bit Macs
-#ifdef __i386__
+#ifdef __i386
{
- @private
+@private
NSUInteger appStoreID;
NSString *appStoreGenre;
View
@@ -1,7 +1,7 @@
//
// iRate.m
//
-// Version 1.4.1 beta
+// Version 1.4.1
//
// Created by Nick Lockwood on 26/01/2011.
// Copyright 2011 Charcoal Design
@@ -161,6 +161,11 @@ - (iRate *)init
name:UIApplicationWillEnterForegroundNotification
object:nil];
}
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(didRotate)
+ name:UIDeviceOrientationDidChangeNotification
+ object:nil];
#else
//register for mac application events
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -421,10 +426,57 @@ - (NSString *)valueForKey:(NSString *)key inJSON:(NSString *)json
{
NSString *value = [json substringWithRange:NSMakeRange(start, valueEnd.location - start)];
value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ while ([value hasPrefix:@"\""] && ![value hasSuffix:@"\""])
+ {
+ if (valueEnd.location == NSNotFound)
+ {
+ break;
+ }
+ NSInteger newStart = valueEnd.location + 1;
+ valueEnd = [json rangeOfString:@"," options:0 range:NSMakeRange(newStart, [json length] - newStart)];
+ value = [json substringWithRange:NSMakeRange(start, valueEnd.location - start)];
+ value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ }
+
value = [value stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"\""]];
value = [value stringByReplacingOccurrencesOfString:@"\\\\" withString:@"\\"];
+ value = [value stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"];
value = [value stringByReplacingOccurrencesOfString:@"\\\"" withString:@"\""];
value = [value stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
+ value = [value stringByReplacingOccurrencesOfString:@"\\r" withString:@"\r"];
+ value = [value stringByReplacingOccurrencesOfString:@"\\t" withString:@"\t"];
+ value = [value stringByReplacingOccurrencesOfString:@"\\f" withString:@"\f"];
+ value = [value stringByReplacingOccurrencesOfString:@"\\b" withString:@"\f"];
+
+ while (YES)
+ {
+ NSRange unicode = [value rangeOfString:@"\\u"];
+ if (unicode.location == NSNotFound)
+ {
+ break;
+ }
+
+ uint32_t c = 0;
+ NSString *hex = [value substringWithRange:NSMakeRange(unicode.location + 2, 4)];
+ NSScanner *scanner = [NSScanner scannerWithString:hex];
+ [scanner scanHexInt:&c];
+
+ if (c <= 0xffff)
+ {
+ value = [value stringByReplacingCharactersInRange:NSMakeRange(unicode.location, 6) withString:[NSString stringWithFormat:@"%C", c]];
+ }
+ else
+ {
+ //convert character to surrogate pair
+ uint16_t x = (uint16_t)c;
+ uint16_t u = (c >> 16) & ((1 << 5) - 1);
+ uint16_t w = (uint16_t)u - 1;
+ unichar high = 0xd800 | (w << 6) | x >> 10;
+ unichar low = (uint16_t)(0xdc00 | (x & ((1 << 10) - 1)));
+
+ value = [value stringByReplacingCharactersInRange:NSMakeRange(unicode.location, 6) withString:[NSString stringWithFormat:@"%C%C", high, low]];
+ }
+ }
return value;
}
}
@@ -634,7 +686,7 @@ - (void)applicationWillEnterForeground:(NSNotification *)notification
#endif
#pragma mark -
-#pragma mark UIAlertViewDelegate methods
+#pragma mark UIAlertView methods
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
@@ -643,6 +695,48 @@ - (void)openRatingsPageInAppStore
[[UIApplication sharedApplication] openURL:self.ratingsURL];
}
+- (void)resizeAlert
+{
+ CGFloat offset = 0.0f;
+ UIAlertView *alertView = visibleAlert;
+ for (UIView *view in alertView.subviews)
+ {
+ CGRect frame = view.frame;
+ if ([view isKindOfClass:[UILabel class]])
+ {
+ UILabel *label = (UILabel *)view;
+ if ([label.text isEqualToString:self.message])
+ {
+ label.alpha = 1.0f;
+ label.lineBreakMode = UILineBreakModeWordWrap;
+ label.numberOfLines = 0;
+ [label sizeToFit];
+ offset = label.frame.size.height - frame.size.height;
+ frame.size.height = label.frame.size.height;
+ }
+ }
+ else if ([view isKindOfClass:[UIControl class]])
+ {
+ frame.origin.y += offset;
+ }
+ view.frame = frame;
+ }
+ CGRect frame = alertView.frame;
+ frame.origin.y -= roundf(offset/2.0f);
+ frame.size.height += offset;
+ alertView.frame = frame;
+}
+
+- (void)didRotate
+{
+ [self performSelectorOnMainThread:@selector(resizeAlert) withObject:nil waitUntilDone:NO];
+}
+
+- (void)willPresentAlertView:(UIAlertView *)alertView
+{
+ [self resizeAlert];
+}
+
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
//consider cancel button presence

0 comments on commit db5884f

Please sign in to comment.