diff --git a/deko.xcodeproj/project.pbxproj b/deko.xcodeproj/project.pbxproj index d19fbbe..265cc8a 100644 --- a/deko.xcodeproj/project.pbxproj +++ b/deko.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 9070355E166E252E001FE82B /* DekoSceneManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9070355D166E252E001FE82B /* DekoSceneManager.m */; }; 90703561166E26D0001FE82B /* DekoScene.m in Sources */ = {isa = PBXBuildFile; fileRef = 90703560166E26CF001FE82B /* DekoScene.m */; }; 907C3B851675069500149188 /* DekoTutorialHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 907C3B841675069500149188 /* DekoTutorialHelper.m */; }; + 907C3C001F74F73E00D49B6D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 907C3BFF1F74F73E00D49B6D /* LaunchScreen.storyboard */; }; 907E727A16675DC70070829F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 907E727916675DC70070829F /* SystemConfiguration.framework */; }; 907E728016675E210070829F /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 907E727F16675E210070829F /* libsqlite3.dylib */; }; 907E728216675E2F0070829F /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 907E728116675E2F0070829F /* AudioToolbox.framework */; }; @@ -125,6 +126,7 @@ 90703560166E26CF001FE82B /* DekoScene.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DekoScene.m; sourceTree = ""; }; 907C3B831675069500149188 /* DekoTutorialHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DekoTutorialHelper.h; sourceTree = ""; }; 907C3B841675069500149188 /* DekoTutorialHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DekoTutorialHelper.m; sourceTree = ""; }; + 907C3BFF1F74F73E00D49B6D /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 907E727916675DC70070829F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 907E727F16675E210070829F /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; 907E728116675E2F0070829F /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; @@ -255,6 +257,7 @@ 9053F9F916AEA86A00B3192B /* Localizable.strings */, 905F09A11663567E0001AD10 /* deko-Info.plist */, 905F09A21663567E0001AD10 /* InfoPlist.strings */, + 907C3BFF1F74F73E00D49B6D /* LaunchScreen.storyboard */, ); name = "Supporting Files"; sourceTree = ""; @@ -385,7 +388,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = Deko; - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Aero Deko"; TargetAttributes = { 905F09941663567E0001AD10 = { @@ -423,6 +426,7 @@ 905F09A41663567E0001AD10 /* InfoPlist.strings in Resources */, 90002E7619ED136F00F559DD /* Images.xcassets in Resources */, 9053F9F716AEA86A00B3192B /* Localizable.strings in Resources */, + 907C3C001F74F73E00D49B6D /* LaunchScreen.storyboard in Resources */, 90BDCA1B16C4F9F200B7B964 /* Lantinghei_1.ttf in Resources */, 90BDCA2116C4FC1700B7B964 /* AppleSDGothicNeo-UltraLight.otf in Resources */, ); @@ -480,7 +484,6 @@ 90B4AB141700D7E500EA63B7 /* fi */, ); name = Localizable.strings; - path = ..; sourceTree = ""; }; 905F09A21663567E0001AD10 /* InfoPlist.strings */ = { @@ -503,25 +506,45 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -532,18 +555,37 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -555,7 +597,6 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; FRAMEWORK_SEARCH_PATHS = ( @@ -565,11 +606,12 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "deko/deko-Prefix.pch"; INFOPLIST_FILE = "deko/deko-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/deko\"", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.aerodeko.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; @@ -580,7 +622,6 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; FRAMEWORK_SEARCH_PATHS = ( @@ -590,11 +631,12 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "deko/deko-Prefix.pch"; INFOPLIST_FILE = "deko/deko-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/deko\"", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.aerodeko.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; WRAPPER_EXTENSION = app; diff --git a/deko/ALAssetsLibrary+CustomPhotoAlbum.m b/deko/ALAssetsLibrary+CustomPhotoAlbum.m index 9f30574..7bdf329 100644 --- a/deko/ALAssetsLibrary+CustomPhotoAlbum.m +++ b/deko/ALAssetsLibrary+CustomPhotoAlbum.m @@ -11,8 +11,7 @@ @implementation ALAssetsLibrary(CustomPhotoAlbum) - (void)saveImageData:(NSData *)imageData toAlbum:(NSString *)albumName withCompletionBlock:(SaveImageCompletion)completionBlock { - [self writeImageDataToSavedPhotosAlbum:imageData metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) - { + [self writeImageDataToSavedPhotosAlbum:imageData metadata:nil completionBlock:^(NSURL *assetURL, NSError *error) { if (error != nil) { completionBlock(error); @@ -27,18 +26,15 @@ - (void)addAssetURL:(NSURL *)assetURL toAlbum:(NSString *)albumName withCompleti { __block BOOL albumWasFound = NO; - [self enumerateGroupsWithTypes:ALAssetsGroupAlbum usingBlock:^(ALAssetsGroup *group, BOOL *stop) - { - if ([albumName compare:[group valueForProperty:ALAssetsGroupPropertyName]]==NSOrderedSame) + [self enumerateGroupsWithTypes:ALAssetsGroupAlbum usingBlock:^(ALAssetsGroup *group, BOOL *stop) { + if ([albumName compare:[group valueForProperty:ALAssetsGroupPropertyName]] == NSOrderedSame) { albumWasFound = YES; - [self assetForURL:assetURL resultBlock:^(ALAsset *asset) - { + [self assetForURL:assetURL resultBlock:^(ALAsset *asset) { [group addAsset: asset]; completionBlock(nil); - } - failureBlock:completionBlock]; + } failureBlock:completionBlock]; return; } @@ -47,21 +43,16 @@ - (void)addAssetURL:(NSURL *)assetURL toAlbum:(NSString *)albumName withCompleti { __weak ALAssetsLibrary *weakSelf = self; - [self addAssetsGroupAlbumWithName:albumName resultBlock:^(ALAssetsGroup *group) - { - [weakSelf assetForURL:assetURL resultBlock:^(ALAsset *asset) - { + [self addAssetsGroupAlbumWithName:albumName resultBlock:^(ALAssetsGroup *group) { + [weakSelf assetForURL:assetURL resultBlock:^(ALAsset *asset) { [group addAsset:asset]; completionBlock(nil); - } - failureBlock:completionBlock]; - } - failureBlock:completionBlock]; + } failureBlock:completionBlock]; + } failureBlock:completionBlock]; return; } - } - failureBlock:completionBlock]; + } failureBlock:completionBlock]; } @end diff --git a/deko/DekoConstants.h b/deko/DekoConstants.h index 8c9ab29..f4c7a93 100644 --- a/deko/DekoConstants.h +++ b/deko/DekoConstants.h @@ -11,9 +11,19 @@ static const CGFloat DekoBackgroundColor = 0.93; static const CGFloat DekoThumbnailSize = 100.0; static const CGFloat DekoLaunchBackgroundColor = 0.1568627451; +static const CGFloat DekoiPadOffset = 238.0; +static const CGFloat DekoiPhone6PlusOffset = ((2662.0 - 2208.0) / 3.0); // whee +static const CGFloat DekoiPhone6WidthOffset = 51.0; +static const CGFloat DekoiPhone6HeightOffset = 137.0; +static const CGFloat DekoiPhoneWidthOffset = 52.0; +static const CGFloat DekoiPhoneHeightOffset = 128.0; +static const CGFloat DekoiPhone4WidthOffset = 50.0; +static const CGFloat DekoiPhone4HeightOffset = 118.0; +static const NSTimeInterval DekoLogoAnimationDuration = 2.0; typedef NS_ENUM(NSInteger, DekoDeviceType) { + DekoDeviceTypeInvalid, DekoDeviceTypeiPad, DekoDeviceTypeiPhone6Plus, DekoDeviceTypeiPhone6, diff --git a/deko/DekoCreditsViewController.m b/deko/DekoCreditsViewController.m index 8693359..4a3e322 100644 --- a/deko/DekoCreditsViewController.m +++ b/deko/DekoCreditsViewController.m @@ -25,28 +25,21 @@ @implementation DekoCreditsViewController - (void)_dismiss { - [self dismissViewControllerAnimated:YES completion:^ - { + [self dismissViewControllerAnimated:YES completion:^{ AELOG_DEBUG(@"Credits dismissed"); }]; } - (void)_animateLayers { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:5.0 options:0 animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:5.0 options:0 animations:^{ self.layer1.alpha = 0; self.layer2.alpha = 1; - } - completion:^(BOOL finished1) - { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:5.0 options:0 animations:^ - { + } completion:^(BOOL finished1) { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:5.0 options:0 animations:^{ self.layer1.alpha = 1; self.layer2.alpha = 0; - } - completion:^(BOOL finished2) - { + } completion:^(BOOL finished2) { [self _animateLayers]; }]; }]; @@ -117,8 +110,8 @@ - (void)viewDidLoad versionLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin; [versionLabel sizeToFit]; versionLabel.frame = AECGRectPlace(versionLabel.frame, - CGRectGetMaxX(self.view.bounds) - CGRectGetWidth(versionLabel.bounds) - 10.0, - CGRectGetMaxY(self.view.bounds) - CGRectGetHeight(versionLabel.bounds) - 10.0); + CGRectGetMaxX(self.view.bounds) - CGRectGetWidth(versionLabel.bounds) - 20.0, + CGRectGetMaxY(self.view.bounds) - CGRectGetHeight(versionLabel.bounds) - 20.0); [self.view addSubview:versionLabel]; } diff --git a/deko/DekoFunctions.h b/deko/DekoFunctions.h index c3ccf0d..e153cfa 100644 --- a/deko/DekoFunctions.h +++ b/deko/DekoFunctions.h @@ -10,6 +10,7 @@ #import "DekoConstants.h" -DekoDeviceType DekoGetCurrentDeviceType(); -BOOL DekoShouldAutorotate(); -BOOL DekoFloatsAreEqual(float float1, float float2); +extern DekoDeviceType DekoGetCurrentDeviceType(void); +extern BOOL DekoShouldAutorotate(void); +extern BOOL DekoFloatsAreEqual(float float1, float float2); +extern CGFloat DekoGetSquareOffset(void); diff --git a/deko/DekoFunctions.m b/deko/DekoFunctions.m index 956634f..62b7533 100644 --- a/deko/DekoFunctions.m +++ b/deko/DekoFunctions.m @@ -47,3 +47,25 @@ BOOL DekoFloatsAreEqual(float float1, float float2) return (float1 < (float2 + epsilon) && float1 > (float2 - epsilon)); } + +CGFloat DekoGetSquareOffset() +{ + DekoDeviceType deviceType = DekoGetCurrentDeviceType(); + + switch (deviceType) + { + case DekoDeviceTypeiPad: + return DekoiPadOffset; + case DekoDeviceTypeiPhone6Plus: + return DekoiPhone6PlusOffset; + case DekoDeviceTypeiPhone6: + return DekoiPhone6HeightOffset; + case DekoDeviceTypeiPhone5: + return DekoiPhoneHeightOffset; + case DekoDeviceTypeiPhone: + return DekoiPhone4HeightOffset; + default: + AELOG_ERROR(@"Unknown device type: %ld", (long)deviceType); + return DekoDeviceTypeInvalid; + } +} \ No newline at end of file diff --git a/deko/DekoGalleryItemView.m b/deko/DekoGalleryItemView.m index f41de63..7e7128f 100644 --- a/deko/DekoGalleryItemView.m +++ b/deko/DekoGalleryItemView.m @@ -17,7 +17,7 @@ @implementation DekoGalleryItemView #pragma mark - UIView -- (id)initWithFrame:(CGRect)frame +- (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { diff --git a/deko/DekoGalleryViewController.m b/deko/DekoGalleryViewController.m index d1b3744..976e349 100644 --- a/deko/DekoGalleryViewController.m +++ b/deko/DekoGalleryViewController.m @@ -66,10 +66,9 @@ - (DekoGalleryItemView *)_itemViewForIndexPath:(NSIndexPath *)indexPath - (CGFloat)_paddingForCollectionView { - CGFloat spacing = 1.0; CGFloat width = MIN(self.view.bounds.size.width, self.view.bounds.size.height); CGFloat amountOfItemsPerLine = floor(width / 100.0); - CGFloat padding = (((NSInteger)width % (NSInteger)DekoThumbnailSize) / 2.0) - (((amountOfItemsPerLine - 1) * spacing) / 2.0); + CGFloat padding = (((NSInteger)width % (NSInteger)DekoThumbnailSize) / 2.0) - (((amountOfItemsPerLine - 1) * DekoCollectionViewSpacing) / 2.0); return padding; } @@ -173,8 +172,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell } DekoScene *scene = self.scenes[indexPath.item]; - [self.sceneManager loadThumbnailForSceneID:scene.id completion:^(UIImage *thumbnail) - { + [self.sceneManager loadThumbnailForSceneID:scene.id completion:^(UIImage *thumbnail) { itemView.thumbnail = thumbnail; }]; [cell.contentView addSubview:itemView]; diff --git a/deko/DekoIAPManager.h b/deko/DekoIAPManager.h index bdc7c08..7f22fa9 100644 --- a/deko/DekoIAPManager.h +++ b/deko/DekoIAPManager.h @@ -14,10 +14,10 @@ extern NSString * const DekoIAPManagerProVersionPurchasedNotification; @interface DekoIAPManager : NSObject @property (nonatomic, assign, readonly) BOOL proPurchased; +@property (nonatomic, readonly, copy) NSString *priceForProVersion; - (void)startManager; - (void)purchaseProVersion:(void (^)(NSError *error))completionBlock; -- (NSString *)priceForProVersion; - (void)restorePurchases; @end diff --git a/deko/DekoIAPViewController.m b/deko/DekoIAPViewController.m index d987c0b..60a6a4d 100644 --- a/deko/DekoIAPViewController.m +++ b/deko/DekoIAPViewController.m @@ -31,8 +31,7 @@ @implementation DekoIAPViewController - (void)_dismiss { - [self dismissViewControllerAnimated:YES completion:^ - { + [self dismissViewControllerAnimated:YES completion:^{ AELOG_DEBUG(@"IAP view dismissed."); }]; } @@ -43,8 +42,7 @@ - (void)_purchaseProVersion self.busyView.hidden = NO; - [self.purchaseManager purchaseProVersion:^(NSError *error) - { + [self.purchaseManager purchaseProVersion:^(NSError *error) { self.busyView.hidden = YES; // I know this is wrong but the headers explicitly say that the error is only set if the transaction has failed... @@ -83,8 +81,7 @@ - (void)_configurePurchaseButtonSizeAnimated:(BOOL)animated size.width = minimumSize; } - void (^animationBlock)() = ^ - { + void (^animationBlock)(void) = ^{ CGFloat offset = DekoGetCurrentDeviceType() == DekoDeviceTypeiPad ? 10.0 : 0; self.purchaseButton.frame = CGRectMake(self.titleLabel.frame.origin.x - 5.0, self.iapCopyLabel.frame.origin.y + self.iapCopyLabel.bounds.size.height + 15.0 + offset, diff --git a/deko/DekoLocalizationManager.m b/deko/DekoLocalizationManager.m index 230c553..f014991 100644 --- a/deko/DekoLocalizationManager.m +++ b/deko/DekoLocalizationManager.m @@ -29,11 +29,11 @@ @implementation DekoLocalizationManager #pragma mark - Public -- (id)init +- (instancetype)init { if ((self = [super init])) { - NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0]; + NSString *language = [NSLocale preferredLanguages][0]; if ([language isEqualToString:@"zh-Hans"]) { _currentLanguage = DekoLanguageTypeChina; diff --git a/deko/DekoLogoView.m b/deko/DekoLogoView.m index d0bbe30..2b4ea7b 100644 --- a/deko/DekoLogoView.m +++ b/deko/DekoLogoView.m @@ -25,12 +25,9 @@ - (void)_animateView:(UIView *)view { AEAssert([view isKindOfClass:[UIImageView class]]); - [UIView animateWithDuration:self.duration delay:0 options:UIViewAnimationOptionCurveLinear animations:^ - { + [UIView animateWithDuration:self.duration delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ view.alpha = 1; - } - completion:^(BOOL finished) - { + } completion:^(BOOL finished) { [self.logoPieces removeObject:view]; if ([self.logoPieces count] == 0) @@ -45,7 +42,7 @@ - (void)_animateView:(UIView *)view #pragma mark - UIView -- (id)initWithFrame:(CGRect)frame +- (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { @@ -122,8 +119,7 @@ - (void)animateLogoWithDuration:(NSTimeInterval)duration completion:(void (^)(vo UIView *view = self.logoPieces[i]; NSTimeInterval delay = i * interval; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void) - { + dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { [self _animateView:view]; }); } diff --git a/deko/DekoMenuView.h b/deko/DekoMenuView.h index 31dbb55..b396f67 100644 --- a/deko/DekoMenuView.h +++ b/deko/DekoMenuView.h @@ -37,7 +37,9 @@ typedef NS_ENUM(NSInteger, DekoShareType) @property (nonatomic, weak) NSObject *delegate; @property (nonatomic) DekoLocalizationManager *localizationManager; -- (id)initWithFrame:(CGRect)frame containerWidth:(CGFloat)containerWidth; +- (instancetype)initWithFrame:(CGRect)frame containerWidth:(CGFloat)containerWidth NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; - (void)setupWithDelegate:(id)delegate purchased:(BOOL)purchased tutorial:(BOOL)tutorial; - (void)updateMenuWithSaveStatus:(BOOL)saved tutorial:(BOOL)tutorial animated:(BOOL)animated; - (void)refreshShareMenuWithPurchaseStatus:(BOOL)purchased tutorial:(BOOL)tutorial; diff --git a/deko/DekoMenuView.m b/deko/DekoMenuView.m index a2a3498..7c26c8e 100644 --- a/deko/DekoMenuView.m +++ b/deko/DekoMenuView.m @@ -104,7 +104,7 @@ - (void)_removeAllSubviewsFromView:(UIView *)view #pragma mark - UIView -- (id)initWithFrame:(CGRect)frame containerWidth:(CGFloat)containerWidth +- (instancetype)initWithFrame:(CGRect)frame containerWidth:(CGFloat)containerWidth { if ((self = [super initWithFrame:frame])) { @@ -435,8 +435,7 @@ - (void)updateMenuWithSaveStatus:(BOOL)saved tutorial:(BOOL)tutorial animated:(B self.tutorialSaveLabel.hidden = !tutorial; self.tutorialShareLabel.hidden = !tutorial; - void (^animationBlock)(void) = ^ - { + void (^animationBlock)(void) = ^{ if (saved) { self.plusButton.transform = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI_4); @@ -447,8 +446,7 @@ - (void)updateMenuWithSaveStatus:(BOOL)saved tutorial:(BOOL)tutorial animated:(B } }; - void (^animationCompletionBlock)(BOOL) = ^(BOOL finished) - { + void (^animationCompletionBlock)(BOOL) = ^(BOOL finished) { if (saved) { [self.galleryButton setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@%@", DekoButtonGallerySaved, self.deviceType]] forState:UIControlStateNormal]; @@ -485,8 +483,7 @@ - (void)flipMenu { self.baseContainer.frame = self.shareContainer.frame; - [UIView transitionFromView:self.shareContainer toView:self.baseContainer duration:UINavigationControllerHideShowBarDuration * 2.0 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) - { + [UIView transitionFromView:self.shareContainer toView:self.baseContainer duration:UINavigationControllerHideShowBarDuration * 2.0 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) { self.shareMenuVisible = NO; }]; } @@ -494,8 +491,7 @@ - (void)flipMenu { self.shareContainer.frame = self.baseContainer.frame; - [UIView transitionFromView:self.baseContainer toView:self.shareContainer duration:UINavigationControllerHideShowBarDuration * 2.0 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) - { + [UIView transitionFromView:self.baseContainer toView:self.shareContainer duration:UINavigationControllerHideShowBarDuration * 2.0 options:UIViewAnimationOptionTransitionFlipFromRight completion:^(BOOL finished) { self.shareMenuVisible = YES; }]; } diff --git a/deko/DekoSceneManager.h b/deko/DekoSceneManager.h index 15e4faa..aaa1bd4 100644 --- a/deko/DekoSceneManager.h +++ b/deko/DekoSceneManager.h @@ -13,10 +13,11 @@ @interface DekoSceneManager : NSObject +@property (nonatomic, readonly, copy) NSArray *allScenes; + - (NSString *)sceneIDBySavingSceneWithCanvasSettings:(HarmonyCanvasSettings *)settings thumbnail:(UIImage *)image; - (void)deleteSceneWithID:(NSString *)sceneID; - (DekoScene *)sceneWithID:(NSString *)sceneID; -- (NSArray *)allScenes; - (void)loadThumbnailForSceneID:(NSString *)sceneID completion:(void (^)(UIImage *thumbnail))completion; @end diff --git a/deko/DekoSceneManager.m b/deko/DekoSceneManager.m index 81f9cc9..4821128 100644 --- a/deko/DekoSceneManager.m +++ b/deko/DekoSceneManager.m @@ -82,7 +82,7 @@ - (NSString *)_pathForThumbnailWithSceneID:(NSString *)sceneID #pragma mark - NSObject -- (id)init +- (instancetype)init { if ((self = [super init])) { @@ -102,25 +102,25 @@ - (NSString *)sceneIDBySavingSceneWithCanvasSettings:(HarmonyCanvasSettings *)se NSData *thumbnailData = UIImagePNGRepresentation(image); NSString *sceneID = [[NSProcessInfo processInfo] globallyUniqueString]; NSDictionary *settingDictionary = @{ - DekoSettingMixingTypeKey : [NSNumber numberWithInteger:settings.mixingType], - DekoSettingPositionTypeKey : [NSNumber numberWithInteger:settings.positionType], - DekoSettingTransformTypeKey : [NSNumber numberWithInteger:settings.transformType], - DekoSettingSizeTypeKey : [NSNumber numberWithInteger:settings.sizeType], - DekoSettingRotationTypeKey : [NSNumber numberWithInteger:settings.rotationType], - DekoSettingShapeTypeKey : [NSNumber numberWithInteger:settings.shapeType], - DekoSettingColorTypeKey : [NSNumber numberWithInteger:settings.colorType], - DekoSettingColorBrightnessTypeKey : [NSNumber numberWithInteger:settings.brightnessType], - DekoSettingColorSaturationTypeKey : [NSNumber numberWithInteger:settings.saturationType], - DekoSettingHueKey : [NSNumber numberWithDouble:settings.hue], - DekoSettingBaseSizeKey : [NSNumber numberWithDouble:settings.baseSize], - DekoSettingBaseDistanceKey : [NSNumber numberWithDouble:settings.baseDistance], - DekoSettingAngleKey : [NSNumber numberWithDouble:settings.angle], - DekoSettingBackground1HueKey : [NSNumber numberWithDouble:settings.background1Hue], - DekoSettingBackground1SaturationKey : [NSNumber numberWithDouble:settings.background1Saturation], - DekoSettingBackground1BrightnessKey : [NSNumber numberWithDouble:settings.background1Brightness], - DekoSettingBackground2HueKey : [NSNumber numberWithDouble:settings.background2Hue], - DekoSettingBackground2SaturationKey : [NSNumber numberWithDouble:settings.background2Saturation], - DekoSettingBackground2BrightnessKey : [NSNumber numberWithDouble:settings.background2Brightness], + DekoSettingMixingTypeKey : @(settings.mixingType), + DekoSettingPositionTypeKey : @(settings.positionType), + DekoSettingTransformTypeKey : @(settings.transformType), + DekoSettingSizeTypeKey : @(settings.sizeType), + DekoSettingRotationTypeKey : @(settings.rotationType), + DekoSettingShapeTypeKey : @(settings.shapeType), + DekoSettingColorTypeKey : @(settings.colorType), + DekoSettingColorBrightnessTypeKey : @(settings.brightnessType), + DekoSettingColorSaturationTypeKey : @(settings.saturationType), + DekoSettingHueKey : @(settings.hue), + DekoSettingBaseSizeKey : @(settings.baseSize), + DekoSettingBaseDistanceKey : @(settings.baseDistance), + DekoSettingAngleKey : @(settings.angle), + DekoSettingBackground1HueKey : @(settings.background1Hue), + DekoSettingBackground1SaturationKey : @(settings.background1Saturation), + DekoSettingBackground1BrightnessKey : @(settings.background1Brightness), + DekoSettingBackground2HueKey : @(settings.background2Hue), + DekoSettingBackground2SaturationKey : @(settings.background2Saturation), + DekoSettingBackground2BrightnessKey : @(settings.background2Brightness), }; NSDictionary *sceneDictionary = @{ @@ -265,8 +265,7 @@ - (void)loadThumbnailForSceneID:(NSString *)sceneID completion:(void (^)(UIImage { AEAssert(sceneID != nil); - dispatch_async(self.fileQueue, ^ - { + dispatch_async(self.fileQueue, ^{ NSString *path = [self _pathForThumbnailWithSceneID:sceneID]; NSError *error = nil; NSData *imageData = [NSData dataWithContentsOfFile:path options:0 error:&error]; @@ -275,8 +274,7 @@ - (void)loadThumbnailForSceneID:(NSString *)sceneID completion:(void (^)(UIImage { UIImage *image = [UIImage imageWithData:imageData scale:[[UIScreen mainScreen] scale]]; - dispatch_async(dispatch_get_main_queue(), ^ - { + dispatch_async(dispatch_get_main_queue(), ^{ completion(image); }); } @@ -284,8 +282,7 @@ - (void)loadThumbnailForSceneID:(NSString *)sceneID completion:(void (^)(UIImage { AELOG_ERROR(@"Unable to read file at '%@' with error: %@", path, [error localizedDescription]); - dispatch_async(dispatch_get_main_queue(), ^ - { + dispatch_async(dispatch_get_main_queue(), ^{ completion(nil); }); } diff --git a/deko/DekoShareHelper.m b/deko/DekoShareHelper.m index 86046c5..0809cc1 100644 --- a/deko/DekoShareHelper.m +++ b/deko/DekoShareHelper.m @@ -71,8 +71,7 @@ - (void)_emailImage:(UIImage *)image - (void)_saveImageToPhotos:(UIImage *)image { ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; - [library saveImageData:[self _imageDataFromImage:image] toAlbum:NSLocalizedString(@"Deko", @"Photo album title, do not localize") withCompletionBlock:^(NSError *error) - { + [library saveImageData:[self _imageDataFromImage:image] toAlbum:NSLocalizedString(@"Deko", @"Photo album title, do not localize") withCompletionBlock:^(NSError *error) { [self.delegate shareHelper:self savedImageWithError:error]; }]; } diff --git a/deko/DekoTutorialHelper.m b/deko/DekoTutorialHelper.m index 6d9e4d3..1238803 100644 --- a/deko/DekoTutorialHelper.m +++ b/deko/DekoTutorialHelper.m @@ -35,27 +35,18 @@ - (void)_performLeftArrowAnimation self.tutorialLeftArrow.image.size.height); self.tutorialLeftArrow.frame = arrowRect; - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration options:0 animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration options:0 animations:^{ self.tutorialLeftArrow.alpha = 1.0; - } - completion:^(BOOL finished) - { - [UIView animateWithDuration:1.0 animations:^ - { + } completion:^(BOOL finished) { + [UIView animateWithDuration:1.0 animations:^{ self.tutorialLeftArrow.frame = CGRectMake(arrowRect.origin.x - DekoArrowLength, self.tutorialLeftArrow.frame.origin.y, self.tutorialLeftArrow.image.size.width + DekoArrowLength, self.tutorialLeftArrow.bounds.size.height); - } - completion:^(BOOL finished1) - { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^ - { + } completion:^(BOOL finished1) { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^{ self.tutorialLeftArrow.alpha = 0; - } - completion:^(BOOL finished2) - { + } completion:^(BOOL finished2) { [self _performLeftArrowAnimation]; }]; }]; @@ -70,27 +61,18 @@ - (void)_performRightArrowAnimation self.tutorialRightArrow.image.size.height); self.tutorialRightArrow.frame = arrowRect; - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration options:0 animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration options:0 animations:^{ self.tutorialRightArrow.alpha = 1.0; - } - completion:^(BOOL finished) - { - [UIView animateWithDuration:1.0 animations:^ - { + } completion:^(BOOL finished) { + [UIView animateWithDuration:1.0 animations:^{ self.tutorialRightArrow.frame = CGRectMake(self.tutorialRightArrow.frame.origin.x, self.tutorialRightArrow.frame.origin.y, self.tutorialRightArrow.image.size.width + DekoArrowLength, self.tutorialRightArrow.bounds.size.height); - } - completion:^(BOOL finished1) - { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^ - { + } completion:^(BOOL finished1) { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^{ self.tutorialRightArrow.alpha = 0; - } - completion:^(BOOL finished2) - { + } completion:^(BOOL finished2) { [self _performRightArrowAnimation]; }]; }]; @@ -99,44 +81,28 @@ - (void)_performRightArrowAnimation - (void)_performTapCircleAnimation { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:0 options:0 animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:0 options:0 animations:^{ self.tutorialCircle1.alpha = 1.0; - } - completion:^(BOOL finished) - { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration * 4.0 delay:0 options:0 animations:^ - { + } completion:^(BOOL finished) { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration * 4.0 delay:0 options:0 animations:^{ self.tutorialCircle1.alpha = 0; - } - completion:nil]; + } completion:nil]; }]; - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration * 2.0 options:0 animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration * 2.0 options:0 animations:^{ self.tutorialCircle2.alpha = 1.0; - } - completion:^(BOOL finished) - { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration * 4.0 delay:0 options:0 animations:^ - { + } completion:^(BOOL finished) { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration * 4.0 delay:0 options:0 animations:^{ self.tutorialCircle2.alpha = 0; - } - completion:nil]; + } completion:nil]; }]; - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration * 4.0 options:0 animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:UINavigationControllerHideShowBarDuration * 4.0 options:0 animations:^{ self.tutorialCircle3.alpha = 1.0; - } - completion:^(BOOL finished1) - { - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration * 4.0 delay:0 options:0 animations:^ - { + } completion:^(BOOL finished1) { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration * 4.0 delay:0 options:0 animations:^{ self.tutorialCircle3.alpha = 0; - } - completion:^(BOOL finished2) - { + } completion:^(BOOL finished2) { [self _performTapCircleAnimation]; }]; }]; @@ -171,12 +137,9 @@ - (void)dismissLeftArrow return; } - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^{ self.tutorialLeftArrow.alpha = 0; - } - completion:^(BOOL finished) - { + } completion:^(BOOL finished) { [self.tutorialLeftArrow removeFromSuperview]; self.tutorialLeftArrow = nil; self.view = nil; @@ -210,12 +173,9 @@ - (void)dismissRightArrow return; } - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^{ self.tutorialRightArrow.alpha = 0; - } - completion:^(BOOL finished) - { + } completion:^(BOOL finished) { [self.tutorialRightArrow removeFromSuperview]; self.tutorialRightArrow = nil; self.view = nil; @@ -265,12 +225,9 @@ - (void)dismissTapCircles return; } - [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^ - { + [UIView animateWithDuration:UINavigationControllerHideShowBarDuration animations:^{ self.tutorialCircleView.alpha = 0; - } - completion:^(BOOL finished) - { + } completion:^(BOOL finished) { [self.tutorialCircleView removeFromSuperview]; self.tutorialCircleView = nil; self.view = nil; diff --git a/deko/DekoViewController.m b/deko/DekoViewController.m index 55d3351..4bea5b1 100644 --- a/deko/DekoViewController.m +++ b/deko/DekoViewController.m @@ -70,47 +70,13 @@ @interface DekoViewController () + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deko/deko-Info.plist b/deko/deko-Info.plist index ae1034c..7bf7eb8 100644 --- a/deko/deko-Info.plist +++ b/deko/deko-Info.plist @@ -13,7 +13,7 @@ CFBundleIcons~ipad CFBundleIdentifier - com.aerodeko.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -21,18 +21,24 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.6 + 1.1.7 CFBundleSignature ???? CFBundleVersion - 8 + 9 LSRequiresIPhoneOS + NSPhotoLibraryAddUsageDescription + We need permission to save images to your device. + NSPhotoLibraryUsageDescription + We need permission to save images to your device. UIAppFonts AppleSDGothicNeo-UltraLight.otf Lantinghei_1.ttf + UILaunchStoryboardName + LaunchScreen UIPrerenderedIcon UIRequiredDeviceCapabilities diff --git a/en.lproj/Localizable.strings b/deko/en.lproj/Localizable.strings similarity index 100% rename from en.lproj/Localizable.strings rename to deko/en.lproj/Localizable.strings diff --git a/fi.lproj/Localizable.strings b/deko/fi.lproj/Localizable.strings similarity index 100% rename from fi.lproj/Localizable.strings rename to deko/fi.lproj/Localizable.strings diff --git a/it.lproj/Localizable.strings b/deko/it.lproj/Localizable.strings similarity index 100% rename from it.lproj/Localizable.strings rename to deko/it.lproj/Localizable.strings diff --git a/ja.lproj/Localizable.strings b/deko/ja.lproj/Localizable.strings similarity index 100% rename from ja.lproj/Localizable.strings rename to deko/ja.lproj/Localizable.strings diff --git a/ko.lproj/Localizable.strings b/deko/ko.lproj/Localizable.strings similarity index 100% rename from ko.lproj/Localizable.strings rename to deko/ko.lproj/Localizable.strings diff --git a/zh-Hans.lproj/Localizable.strings b/deko/zh-Hans.lproj/Localizable.strings similarity index 100% rename from zh-Hans.lproj/Localizable.strings rename to deko/zh-Hans.lproj/Localizable.strings