diff --git a/HabitRPG/Habitica-Info.plist b/HabitRPG/Habitica-Info.plist index 9a21965f0..202850df2 100644 --- a/HabitRPG/Habitica-Info.plist +++ b/HabitRPG/Habitica-Info.plist @@ -39,7 +39,7 @@ CFBundleVersion - 246 + 248 CustomDomain ${CUSTOM_DOMAIN} DisableSSL diff --git a/HabitRPG/TableViewController/Inventory/Shops/HRPGShopViewController.m b/HabitRPG/TableViewController/Inventory/Shops/HRPGShopViewController.m index 49c3c4cdb..d3bd81245 100644 --- a/HabitRPG/TableViewController/Inventory/Shops/HRPGShopViewController.m +++ b/HabitRPG/TableViewController/Inventory/Shops/HRPGShopViewController.m @@ -207,10 +207,13 @@ - (void)configureEmpty { [bgView addSubview:closedShopInfoView]; [bgView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[closedView]-0-|" options:0 metrics:nil views:@{@"closedView": closedShopInfoView}]]; - [bgView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:visualFormat - options:0 - metrics:nil - views:views]]; + if (visualFormat != nil) { + [bgView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:visualFormat + options:0 + metrics:nil + views:views]]; + } + closedShopInfoView.image = [UIImage imageNamed:imageName]; closedShopInfoView.shopItemTitleLabel.text = title; closedShopInfoView.shopItemDescriptionLabel.text = notes; diff --git a/HabitRPG/TableViewController/Modals/HRPGBuyItemModalViewController.swift b/HabitRPG/TableViewController/Modals/HRPGBuyItemModalViewController.swift index ca6918f5f..e7cff91f0 100644 --- a/HabitRPG/TableViewController/Modals/HRPGBuyItemModalViewController.swift +++ b/HabitRPG/TableViewController/Modals/HRPGBuyItemModalViewController.swift @@ -318,7 +318,6 @@ class HRPGBuyItemModalViewController: UIViewController { self.dismiss(animated: true, completion: nil) let topViewController = self.presentingViewController - let storyboard = UIStoryboard(name: "BuyModal", bundle: nil) if !canAfford() { var viewControllerName: String? = nil if currency == .hourglass { @@ -330,10 +329,7 @@ class HRPGBuyItemModalViewController: UIViewController { } if let name = viewControllerName { - let viewController = storyboard.instantiateViewController(withIdentifier: name) - viewController.modalTransitionStyle = .crossDissolve - viewController.modalPresentationStyle = .currentContext - topViewController?.present(viewController, animated: true, completion: nil) + HRPGBuyItemModalViewController.displayViewController(name: name, parent: topViewController) } return @@ -342,32 +338,40 @@ class HRPGBuyItemModalViewController: UIViewController { if currency == .hourglass { if purchaseType == "gear" || purchaseType == "mystery_set" { HRPGManager.shared().purchaseMysterySet(setIdentifier, onSuccess: successBlock, onError: { - topViewController?.performSegue(withIdentifier: "insufficientHourglasses", sender: self) + HRPGBuyItemModalViewController.displayViewController(name: "InsufficientHourglassesViewController", parent: topViewController) }) } else { HRPGManager.shared().purchaseHourglassItem(key, withPurchaseType: purchaseType, withText: text, withImageName: imageName, onSuccess: successBlock, onError: { - topViewController?.performSegue(withIdentifier: "insufficientHourglasses", sender: self) + HRPGBuyItemModalViewController.displayViewController(name: "InsufficientHourglassesViewController", parent: topViewController) }) } } else if currency == .gem || purchaseType == "gems" { HRPGManager.shared().purchaseItem(key, withPurchaseType: purchaseType, withText: text, withImageName: imageName, onSuccess: successBlock, onError: { - topViewController?.performSegue(withIdentifier: "insufficientGems", sender: self) + HRPGBuyItemModalViewController.displayViewController(name: "InsufficientGemsViewController", parent: topViewController) }) } else { if currency == .gold && purchaseType == "quests" { HRPGManager.shared().purchaseQuest(key, withText: text, withImageName: imageName, onSuccess: successBlock, onError: { - topViewController?.performSegue(withIdentifier: "insufficientGold", sender: self) + HRPGBuyItemModalViewController.displayViewController(name: "InsufficientGoldViewController", parent: topViewController) }) } else { HRPGManager.shared().buyObject(key, withValue: value, withText: text, onSuccess: successBlock, onError: { - topViewController?.performSegue(withIdentifier: "insufficientGold", sender: self) + HRPGBuyItemModalViewController.displayViewController(name: "InsufficientGoldViewController", parent: topViewController) }) } } } } + private static func displayViewController(name: String, parent: UIViewController?) { + let storyboard = UIStoryboard(name: "BuyModal", bundle: nil) + let viewController = storyboard.instantiateViewController(withIdentifier: name) + viewController.modalTransitionStyle = .crossDissolve + viewController.modalPresentationStyle = .currentContext + parent?.present(viewController, animated: true, completion: nil) + } + func closePressed() { dismiss(animated: true, completion: nil) } diff --git a/HabitRPG/TableViewController/Modals/HRPGFilterViewController.m b/HabitRPG/TableViewController/Modals/HRPGFilterViewController.m index 254208799..18ef47641 100644 --- a/HabitRPG/TableViewController/Modals/HRPGFilterViewController.m +++ b/HabitRPG/TableViewController/Modals/HRPGFilterViewController.m @@ -215,9 +215,11 @@ - (void)controller:(NSFetchedResultsController *)controller break; case NSFetchedResultsChangeDelete: - [self.areTagsSelected removeObjectAtIndex:indexPath.item]; - [tableView deleteRowsAtIndexPaths:@[ indexPath ] - withRowAnimation:UITableViewRowAnimationFade]; + if (self.areTagsSelected.count > indexPath.item) { + [self.areTagsSelected removeObjectAtIndex:indexPath.item]; + [tableView deleteRowsAtIndexPaths:@[ indexPath ] + withRowAnimation:UITableViewRowAnimationFade]; + } break; case NSFetchedResultsChangeUpdate: diff --git a/HabitRPG/TableViewController/Social/HRPGInboxChatViewController.m b/HabitRPG/TableViewController/Social/HRPGInboxChatViewController.m index eb41de4ba..72a6a5da1 100644 --- a/HabitRPG/TableViewController/Social/HRPGInboxChatViewController.m +++ b/HabitRPG/TableViewController/Social/HRPGInboxChatViewController.m @@ -106,7 +106,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - HRPGChatTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChatMessageCell" forIndexPath:indexPath]; + HRPGChatTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChatMessageCell"]; cell.transform = self.tableView.transform; [self configureCell:cell atIndexPath:indexPath withAnimation:NO]; return cell; diff --git a/HabitRPG/TableViewDataSources/HRPGCoreDataDataSource.m b/HabitRPG/TableViewDataSources/HRPGCoreDataDataSource.m index dc5026e9c..7068a8732 100644 --- a/HabitRPG/TableViewDataSources/HRPGCoreDataDataSource.m +++ b/HabitRPG/TableViewDataSources/HRPGCoreDataDataSource.m @@ -121,8 +121,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - id sectionInfo = - [self.fetchedResultsController sections][(NSUInteger)section]; + id sectionInfo = [self.fetchedResultsController sections][(NSUInteger)section]; return [sectionInfo numberOfObjects]; } diff --git a/Habitica Snapshots/Info.plist b/Habitica Snapshots/Info.plist index e768d6364..a8c490242 100644 --- a/Habitica Snapshots/Info.plist +++ b/Habitica Snapshots/Info.plist @@ -17,6 +17,6 @@ CFBundleShortVersionString 1.0 CFBundleVersion - 246 + 248 diff --git a/Habitica.xcodeproj/project.pbxproj b/Habitica.xcodeproj/project.pbxproj index dc79680c2..87de027c4 100644 --- a/Habitica.xcodeproj/project.pbxproj +++ b/Habitica.xcodeproj/project.pbxproj @@ -3623,7 +3623,7 @@ CODE_SIGN_ENTITLEMENTS = Habitica.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 246; + CURRENT_PROJECT_VERSION = 248; DEVELOPMENT_TEAM = 9Q9SMRMCNN; ENABLE_BITCODE = NO; EXCLUDED_SOURCE_FILE_NAMES = ""; @@ -3715,7 +3715,7 @@ CODE_SIGN_ENTITLEMENTS = Habitica.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 246; + CURRENT_PROJECT_VERSION = 248; DEVELOPMENT_TEAM = 9Q9SMRMCNN; ENABLE_BITCODE = NO; EXCLUDED_SOURCE_FILE_NAMES = "FLEX*"; diff --git a/HabiticaTests/Info.plist b/HabiticaTests/Info.plist index 64271bb85..362dac6f9 100644 --- a/HabiticaTests/Info.plist +++ b/HabiticaTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 246 + 248