forked from organicmaps/organicmaps
[search] [ios] Fixed nullability warnings.
This commit is contained in:
parent
4fb9a3f293
commit
e52ba4c677
37 changed files with 127 additions and 90 deletions
|
@ -134,8 +134,9 @@
|
|||
withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
||||
{
|
||||
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
||||
[self.tableView reloadRowsAtIndexPaths:self.tableView.indexPathsForVisibleRows withRowAnimation:UITableViewRowAnimationFade];
|
||||
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {}];
|
||||
NSArray<NSIndexPath *> * ips = self.tableView.indexPathsForVisibleRows;
|
||||
[self.tableView reloadRowsAtIndexPaths:ips withRowAnimation:UITableViewRowAnimationFade];
|
||||
} completion:nil];
|
||||
}
|
||||
|
||||
- (NSString *)truncateString:(NSString *)string toWidth:(CGFloat)width withFont:(UIFont *)font
|
||||
|
@ -164,7 +165,8 @@
|
|||
{
|
||||
NSString * txt = f.text;
|
||||
// Update edited category name
|
||||
if (txt.length && ![txt isEqualToString:cell.textLabel.text])
|
||||
NSString * cellLabel = cell.textLabel.text;
|
||||
if (txt.length && ![txt isEqualToString:cellLabel])
|
||||
{
|
||||
cell.textLabel.text = txt;
|
||||
// Rename category
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
- (UIColor *)borderUIColor
|
||||
{
|
||||
return [UIColor colorWithCGColor:self.borderColor];
|
||||
return [UIColor colorWithCGColor:static_cast<CGColorRef>(self.borderColor)];
|
||||
}
|
||||
|
||||
- (void)setBorderColorName:(NSString *)colorName
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
- (UIColor *)shadowUIColor
|
||||
{
|
||||
return [UIColor colorWithCGColor:self.shadowColor];
|
||||
return [UIColor colorWithCGColor:static_cast<CGColorRef>(self.shadowColor)];
|
||||
}
|
||||
|
||||
- (void)setShadowColorName:(NSString *)colorName
|
||||
|
|
|
@ -11,7 +11,12 @@
|
|||
[self setTitle:L(localizedText) forState:UIControlStateDisabled];
|
||||
}
|
||||
|
||||
- (NSString *)localizedText { return L([self titleForState:UIControlStateNormal]); }
|
||||
- (NSString *)localizedText
|
||||
{
|
||||
NSString * title = [self titleForState:UIControlStateNormal];
|
||||
return L(title);
|
||||
}
|
||||
|
||||
- (void)setFontName:(NSString *)fontName { self.titleLabel.font = [UIFont fontWithName:fontName]; }
|
||||
- (void)setTextColorName:(NSString *)colorName
|
||||
{
|
||||
|
|
|
@ -109,7 +109,8 @@
|
|||
@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/"
|
||||
@"viewContentsUserReviews?id=510623322&onlyLatestVersion=true&pageNumber=0&"
|
||||
@"sortOrdering=1&type=Purple+Software";
|
||||
[self openURL:[NSURL URLWithString:urlString]];
|
||||
NSURL * url = [NSURL URLWithString:urlString];
|
||||
[self openURL:url];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
self.text = L(localizedText);
|
||||
}
|
||||
|
||||
- (NSString *)localizedText {
|
||||
return L(self.text);
|
||||
- (NSString *)localizedText
|
||||
{
|
||||
NSString * text = self.text;
|
||||
return L(text);
|
||||
}
|
||||
|
||||
- (void)setFontName:(NSString *)fontName
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
- (NSString *)localizedPlaceholder
|
||||
{
|
||||
return L(self.placeholder);
|
||||
NSString * placeholder = self.placeholder;
|
||||
return L(placeholder);
|
||||
}
|
||||
|
||||
- (void)setFontName:(NSString *)fontName
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
+ (UIImage *)imageWithView:(UIView *)view
|
||||
{
|
||||
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 0.0);
|
||||
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
[view.layer renderInContext:context];
|
||||
|
||||
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
@interface MWMMobileInternetAlert : MWMAlert
|
||||
|
||||
+ (instancetype)alertWithBlock:(nonnull TMWMVoidBlock)block;
|
||||
+ (nonnull instancetype)alertWithBlock:(nonnull TMWMVoidBlock)block;
|
||||
|
||||
@end
|
||||
|
|
|
@ -18,7 +18,7 @@ NSString * const kStatisticsEvent = @"Mobile Internet Settings Alert";
|
|||
|
||||
@implementation MWMMobileInternetAlert
|
||||
|
||||
+ (instancetype)alertWithBlock:(nonnull TMWMVoidBlock)block
|
||||
+ (nonnull instancetype)alertWithBlock:(nonnull TMWMVoidBlock)block
|
||||
{
|
||||
[Statistics logEvent:kStatisticsEvent withParameters:@{kStatAction : kStatOpen}];
|
||||
MWMMobileInternetAlert * alert =
|
||||
|
|
|
@ -172,9 +172,10 @@ CGFloat angleWithProgress(CGFloat progress) { return 2.0 * M_PI * progress - M_P
|
|||
? @"dark"
|
||||
: @"light";
|
||||
for (NSUInteger i = 0; i < animationImagesCount; ++i)
|
||||
animationImages[i] =
|
||||
[UIImage imageNamed:[NSString stringWithFormat:@"Spinner_%@_%@", @(i + 1), postfix]];
|
||||
|
||||
{
|
||||
UIImage * image = [UIImage imageNamed:[NSString stringWithFormat:@"Spinner_%@_%@", @(i + 1), postfix]];
|
||||
animationImages[i] = image;
|
||||
}
|
||||
self.spinner.animationDuration = 0.8;
|
||||
self.spinner.animationImages = animationImages;
|
||||
[self.spinner startAnimating];
|
||||
|
|
|
@ -38,9 +38,10 @@
|
|||
for (NSUInteger index = 0; index < buttonsCount; index++)
|
||||
{
|
||||
NSIndexPath * indexPath = [NSIndexPath indexPathForItem:index inSection:0];
|
||||
[attrs addObject:[self layoutAttributesForItemAtIndexPath:indexPath]];
|
||||
UICollectionViewLayoutAttributes * attr = [self layoutAttributesForItemAtIndexPath:indexPath];
|
||||
[attrs addObject:attr];
|
||||
}
|
||||
return attrs;
|
||||
return attrs.copy;
|
||||
}
|
||||
|
||||
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
|
||||
|
|
|
@ -531,9 +531,11 @@ CGFloat constexpr kTimeWidthRegular = 128;
|
|||
NSInteger const stepValue = direct ? 1 : -1;
|
||||
NSMutableArray * morphImages = [NSMutableArray arrayWithCapacity:morphImagesCount];
|
||||
for (NSUInteger i = startValue, j = 0; i != endValue; i += stepValue, j++)
|
||||
morphImages[j] =
|
||||
[UIImage imageNamed:[NSString stringWithFormat:@"%@%@_%@", morphTemplate, @(i).stringValue,
|
||||
[UIColor isNightMode] ? @"dark" : @"light"]];
|
||||
{
|
||||
UIImage * image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%@_%@", morphTemplate, @(i).stringValue,
|
||||
[UIColor isNightMode] ? @"dark" : @"light"]];
|
||||
morphImages[j] = image;
|
||||
}
|
||||
btn.imageView.animationImages = morphImages;
|
||||
btn.imageView.animationRepeatCount = 1;
|
||||
btn.imageView.image = morphImages.lastObject;
|
||||
|
|
|
@ -27,7 +27,7 @@ NSArray<UIImage *> * animationImages(NSString * animationTemplate, NSUInteger im
|
|||
{
|
||||
NSString * name =
|
||||
[NSString stringWithFormat:@"%@_%@_%@", animationTemplate, mode, @(i).stringValue];
|
||||
[images addObject:[UIImage imageNamed:name]];
|
||||
[images addObject:static_cast<UIImage *>([UIImage imageNamed:name])];
|
||||
}
|
||||
return images.copy;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
|
||||
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
|
||||
{
|
||||
return [self.controllers indexOfObject:pageViewController.viewControllers.firstObject];
|
||||
MWMWelcomeController * controller = pageViewController.viewControllers.firstObject;
|
||||
return [self.controllers indexOfObject:controller];
|
||||
}
|
||||
|
||||
- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
|
||||
|
|
|
@ -157,7 +157,8 @@ using namespace uber;
|
|||
{
|
||||
// TODO(Vlad): Not the best solution, need to store url's scheme of product in the uber::Product
|
||||
// instead of just "uber://".
|
||||
return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"uber://"]];
|
||||
NSURL * url = [NSURL URLWithString:@"uber://"];
|
||||
return [[UIApplication sharedApplication] canOpenURL:url];
|
||||
}
|
||||
|
||||
- (NSURL *)taxiURL;
|
||||
|
|
|
@ -225,7 +225,8 @@ using namespace osm_auth_ios;
|
|||
NSString * openLink = userInfo[@"openURL"];
|
||||
if (!openLink)
|
||||
return NO;
|
||||
[app openURL:[NSURL URLWithString:openLink]];
|
||||
NSURL * url = [NSURL URLWithString:openLink];
|
||||
[app openURL:url];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -674,7 +675,8 @@ using namespace osm_auth_ios;
|
|||
{
|
||||
if (![userActivity.activityType isEqualToString:CSSearchableItemActionType])
|
||||
return NO;
|
||||
NSString * searchString = L(userActivity.userInfo[CSSearchableItemActivityIdentifier]);
|
||||
NSString * searchStringKey = userActivity.userInfo[CSSearchableItemActivityIdentifier];
|
||||
NSString * searchString = L(searchStringKey);
|
||||
if (!searchString)
|
||||
return NO;
|
||||
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
if (self.openInSafari && inType == UIWebViewNavigationTypeLinkClicked
|
||||
&& ![inRequest.URL.scheme isEqualToString:@"applewebdata"]) // do not try to open local links in Safari
|
||||
{
|
||||
[[UIApplication sharedApplication] openURL:[inRequest URL]];
|
||||
NSURL * url = [inRequest URL];
|
||||
[[UIApplication sharedApplication] openURL:url];
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
|
||||
NSString * categoryKeyString = @(categoryKey.c_str());
|
||||
NSString * imageName = [NSString stringWithFormat:@"ic_%@_spotlight", categoryKeyString];
|
||||
attrSet.thumbnailData = UIImagePNGRepresentation([UIImage imageNamed:imageName]);
|
||||
UIImage * image = [UIImage imageNamed:imageName];
|
||||
attrSet.thumbnailData = UIImagePNGRepresentation(image);
|
||||
|
||||
CSSearchableItem * item =
|
||||
[[CSSearchableItem alloc] initWithUniqueIdentifier:categoryKeyString
|
||||
|
@ -62,9 +63,10 @@
|
|||
completionHandler:^(NSError * _Nullable error) {
|
||||
if (error)
|
||||
{
|
||||
[[Crashlytics sharedInstance] recordError:error];
|
||||
NSError * err = error;
|
||||
[[Crashlytics sharedInstance] recordError:err];
|
||||
LOG(LERROR,
|
||||
("addCategoriesToSpotlight failed: ", error.localizedDescription.UTF8String));
|
||||
("addCategoriesToSpotlight failed: ", err.localizedDescription.UTF8String));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -256,7 +256,8 @@ enum RowInMetaInfo
|
|||
self.cachedDescription = text;
|
||||
[self.tableView beginUpdates];
|
||||
[self.tableView endUpdates];
|
||||
[self.tableView scrollToRowAtIndexPath:[self.tableView indexPathForCell:cell]
|
||||
NSIndexPath * ip = [self.tableView indexPathForCell:cell];
|
||||
[self.tableView scrollToRowAtIndexPath:ip
|
||||
atScrollPosition:UITableViewScrollPositionBottom
|
||||
animated:YES];
|
||||
}
|
||||
|
|
|
@ -263,8 +263,8 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
|
||||
if (self.invalidCells.count)
|
||||
{
|
||||
MWMEditorTextTableViewCell * cell =
|
||||
[self.tableView cellForRowAtIndexPath:self.invalidCells.firstObject];
|
||||
NSIndexPath * ip = self.invalidCells.firstObject;
|
||||
MWMEditorTextTableViewCell * cell = [self.tableView cellForRowAtIndexPath:ip];
|
||||
[cell.textField becomeFirstResponder];
|
||||
return;
|
||||
}
|
||||
|
@ -825,7 +825,8 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
self.note = text;
|
||||
[self.tableView beginUpdates];
|
||||
[self.tableView endUpdates];
|
||||
[self.tableView scrollToRowAtIndexPath:[self.tableView indexPathForCell:cell]
|
||||
NSIndexPath * ip = [self.tableView indexPathForCell:cell];
|
||||
[self.tableView scrollToRowAtIndexPath:ip
|
||||
atScrollPosition:UITableViewScrollPositionBottom
|
||||
animated:YES];
|
||||
}
|
||||
|
@ -959,7 +960,8 @@ void registerCellsForTableView(vector<MWMPlacePageCellType> const & cells, UITab
|
|||
auto const latLon = m_mapObject.GetLatLon();
|
||||
CLLocation * location = [[CLLocation alloc] initWithLatitude:latLon.lat longitude:latLon.lon];
|
||||
self.isFeatureUploaded = osm::Editor::Instance().IsFeatureUploaded(fid.m_mwmId, fid.m_index);
|
||||
[self.tableView reloadRowsAtIndexPaths:@[ [self.tableView indexPathForCell:cell] ]
|
||||
NSIndexPath * ip = [self.tableView indexPathForCell:cell];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[ip]
|
||||
withRowAnimation:UITableViewRowAnimationFade];
|
||||
|
||||
auto placeDoesntExistAction = ^{
|
||||
|
|
|
@ -141,7 +141,8 @@ extern NSDictionary * const kMWMOpeningHoursEditorTableCells = @{
|
|||
- (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
return [tableView dequeueReusableCellWithIdentifier:[self cellIdentifierForIndexPath:indexPath]];
|
||||
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:[self cellIdentifierForIndexPath:indexPath]];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView * _Nonnull)tableView
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
|
||||
@protocol MWMOpeningHoursModelProtocol <NSObject>
|
||||
|
||||
@property (nonnull, copy, nonatomic) NSString * openingHours;
|
||||
@property (weak, nonatomic, readonly) UITableView * tableView;
|
||||
@property (weak, nonatomic, readonly) UIView * advancedEditor;
|
||||
@property (weak, nonatomic, readonly) MWMTextView * editorView;
|
||||
@property (weak, nonatomic, readonly) UIButton * toggleModeButton;
|
||||
@property(nonnull, copy, nonatomic) NSString * openingHours;
|
||||
@property(nullable, weak, nonatomic, readonly) UITableView * tableView;
|
||||
@property(nullable, weak, nonatomic, readonly) UIView * advancedEditor;
|
||||
@property(nullable, weak, nonatomic, readonly) MWMTextView * editorView;
|
||||
@property(nullable, weak, nonatomic, readonly) UIButton * toggleModeButton;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMOpeningHoursModel : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSUInteger count;
|
||||
@property (nonatomic, readonly) BOOL canAddSection;
|
||||
@property(nonatomic, readonly) NSUInteger count;
|
||||
@property(nonatomic, readonly) BOOL canAddSection;
|
||||
|
||||
@property (nonatomic, readonly) BOOL isValid;
|
||||
@property (nonatomic) BOOL isSimpleMode;
|
||||
@property (nonatomic, readonly) BOOL isSimpleModeCapable;
|
||||
@property(nonatomic, readonly) BOOL isValid;
|
||||
@property(nonatomic) BOOL isSimpleMode;
|
||||
@property(nonatomic, readonly) BOOL isSimpleModeCapable;
|
||||
|
||||
- (instancetype _Nullable)initWithDelegate:(id<MWMOpeningHoursModelProtocol> _Nonnull)delegate;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
@protocol MWMOpeningHoursSectionProtocol <NSObject>
|
||||
|
||||
@property (weak, nonatomic, readonly) UITableView * tableView;
|
||||
@property(nullable, weak, nonatomic, readonly) UITableView * tableView;
|
||||
|
||||
- (void)updateActiveSection:(NSUInteger)index;
|
||||
|
||||
|
@ -17,20 +17,20 @@
|
|||
|
||||
@interface MWMOpeningHoursSection : NSObject
|
||||
|
||||
@property (nonatomic) BOOL allDay;
|
||||
@property(nonatomic) BOOL allDay;
|
||||
|
||||
@property (nonatomic, readonly) NSUInteger index;
|
||||
@property (nullable, nonatomic) NSNumber * selectedRow;
|
||||
@property (nonatomic, readonly) NSUInteger numberOfRows;
|
||||
@property(nonatomic, readonly) NSUInteger index;
|
||||
@property(nullable, nonatomic) NSNumber * selectedRow;
|
||||
@property(nonatomic, readonly) NSUInteger numberOfRows;
|
||||
|
||||
@property (nullable, nonatomic) NSDateComponents * cachedStartTime;
|
||||
@property (nullable, nonatomic) NSDateComponents * cachedEndTime;
|
||||
@property(nullable, nonatomic) NSDateComponents * cachedStartTime;
|
||||
@property(nullable, nonatomic) NSDateComponents * cachedEndTime;
|
||||
|
||||
@property (nonatomic, readonly) BOOL canAddClosedTime;
|
||||
@property(nonatomic, readonly) BOOL canAddClosedTime;
|
||||
|
||||
@property (weak, nonatomic, readonly) id<MWMOpeningHoursSectionProtocol> delegate;
|
||||
@property(nullable, weak, nonatomic, readonly) id<MWMOpeningHoursSectionProtocol> delegate;
|
||||
|
||||
- (instancetype _Nullable)initWithDelegate:(id<MWMOpeningHoursSectionProtocol> _Nonnull)delegate;
|
||||
- (instancetype _Nonnull)initWithDelegate:(id<MWMOpeningHoursSectionProtocol> _Nonnull)delegate;
|
||||
|
||||
- (void)refreshIndex:(NSUInteger)index;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace osmoh;
|
|||
|
||||
@implementation MWMOpeningHoursSection
|
||||
|
||||
- (instancetype _Nullable)initWithDelegate:(id<MWMOpeningHoursSectionProtocol> _Nonnull)delegate
|
||||
- (instancetype _Nonnull)initWithDelegate:(id<MWMOpeningHoursSectionProtocol> _Nonnull)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
|
|
|
@ -149,13 +149,12 @@ void initFieldsMap()
|
|||
}
|
||||
NSNumberFormatter * decimalFormatter = [[NSNumberFormatter alloc] init];
|
||||
decimalFormatter.numberStyle = NSNumberFormatterDecimalStyle;
|
||||
NSString * currencyString = [currencyFormatter
|
||||
stringFromNumber:
|
||||
[decimalFormatter
|
||||
numberFromString:
|
||||
[@(minPrice.c_str())
|
||||
stringByReplacingOccurrencesOfString:@"."
|
||||
withString:decimalFormatter.decimalSeparator]]];
|
||||
NSNumber * currencyNumber = [decimalFormatter
|
||||
numberFromString:
|
||||
[@(minPrice.c_str())
|
||||
stringByReplacingOccurrencesOfString:@"."
|
||||
withString:decimalFormatter.decimalSeparator]];
|
||||
NSString * currencyString = [currencyFormatter stringFromNumber:currencyNumber];
|
||||
NSString * currencyPattern =
|
||||
[L(@"place_page_starting_from") stringByReplacingOccurrencesOfString:@"%s"
|
||||
withString:@"%@"];
|
||||
|
|
|
@ -278,13 +278,12 @@ using namespace place_page;
|
|||
NSNumberFormatter * decimalFormatter = [[NSNumberFormatter alloc] init];
|
||||
decimalFormatter.numberStyle = NSNumberFormatterDecimalStyle;
|
||||
|
||||
NSString * currencyString = [currencyFormatter
|
||||
stringFromNumber:
|
||||
[decimalFormatter
|
||||
numberFromString:[@(minPrice.c_str())
|
||||
stringByReplacingOccurrencesOfString:@"."
|
||||
withString:decimalFormatter
|
||||
.decimalSeparator]]];
|
||||
NSNumber * currencyNumber = [decimalFormatter
|
||||
numberFromString:[@(minPrice.c_str())
|
||||
stringByReplacingOccurrencesOfString:@"."
|
||||
withString:decimalFormatter
|
||||
.decimalSeparator]];
|
||||
NSString * currencyString = [currencyFormatter stringFromNumber:currencyNumber];
|
||||
|
||||
NSString * pattern =
|
||||
[L(@"place_page_starting_from") stringByReplacingOccurrencesOfString:@"%s"
|
||||
|
|
|
@ -282,13 +282,15 @@
|
|||
NSAssert(self.data.phoneNumber, @"Phone number can't be nil!");
|
||||
NSString * phoneNumber = [[@"telprompt:" stringByAppendingString:self.data.phoneNumber]
|
||||
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
|
||||
NSURL * url = [NSURL URLWithString:phoneNumber];
|
||||
[[UIApplication sharedApplication] openURL:url];
|
||||
}
|
||||
|
||||
- (void)apiBack
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatPlacePage, kStatAPI)];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.data.apiURL]];
|
||||
NSURL * url = [NSURL URLWithString:self.data.apiURL];
|
||||
[[UIApplication sharedApplication] openURL:url];
|
||||
[[MapViewController controller].apiBar back];
|
||||
}
|
||||
|
||||
|
|
|
@ -162,8 +162,10 @@ NSString * titleForButton(EButton type, BOOL isSelected)
|
|||
NSUInteger const animationImagesCount = 11;
|
||||
NSMutableArray * animationImages = [NSMutableArray arrayWithCapacity:animationImagesCount];
|
||||
for (NSUInteger i = 0; i < animationImagesCount; ++i)
|
||||
animationImages[i] = [UIImage imageNamed:[NSString stringWithFormat:@"ic_bookmarks_%@", @(i+1)]];
|
||||
|
||||
{
|
||||
UIImage * image = [UIImage imageNamed:[NSString stringWithFormat:@"ic_bookmarks_%@", @(i+1)]];
|
||||
animationImages[i] = image;
|
||||
}
|
||||
UIImageView * animationIV = btn.imageView;
|
||||
animationIV.animationImages = animationImages;
|
||||
animationIV.animationRepeatCount = 1;
|
||||
|
|
|
@ -82,7 +82,8 @@ CGFloat const kLineSpacing = 5;
|
|||
- (void)downloadAssingImageWithURL:(NSURL *)URL completion:(TMWMVoidBlock)completion
|
||||
{
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
UIImage * image = [UIImage imageWithData:[NSData dataWithContentsOfURL:URL]];
|
||||
NSData * data = [NSData dataWithContentsOfURL:URL];
|
||||
UIImage * image = [UIImage imageWithData:data];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.icon.image = image;
|
||||
if (image)
|
||||
|
|
|
@ -132,8 +132,9 @@ NSString * const kTextViewContentSizeKeyPath = @"contentSize";
|
|||
NSFontAttributeName : [UIFont regular16]
|
||||
};
|
||||
NSError * error = nil;
|
||||
NSData * data = [text dataUsingEncoding:NSUnicodeStringEncoding];
|
||||
NSMutableAttributedString * str = [[NSMutableAttributedString alloc]
|
||||
initWithData:[text dataUsingEncoding:NSUnicodeStringEncoding]
|
||||
initWithData:data
|
||||
options:@{
|
||||
NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType
|
||||
}
|
||||
|
@ -178,9 +179,10 @@ NSString * const kTextViewContentSizeKeyPath = @"contentSize";
|
|||
NSMutableArray * animationImages = [NSMutableArray arrayWithCapacity:animationImagesCount];
|
||||
NSString * postfix = [UIColor isNightMode] ? @"dark" : @"light";
|
||||
for (NSUInteger i = 0; i < animationImagesCount; ++i)
|
||||
animationImages[i] =
|
||||
[UIImage imageNamed:[NSString stringWithFormat:@"Spinner_%@_%@", @(i + 1), postfix]];
|
||||
|
||||
{
|
||||
UIImage * image = [UIImage imageNamed:[NSString stringWithFormat:@"Spinner_%@_%@", @(i + 1), postfix]];
|
||||
animationImages[i] = image;
|
||||
}
|
||||
self.spinner.animationDuration = 0.8;
|
||||
self.spinner.animationImages = animationImages;
|
||||
self.spinner.hidden = NO;
|
||||
|
|
|
@ -166,8 +166,9 @@
|
|||
CGPoint const tapPoint = [sender locationInView:sender.view.superview];
|
||||
UIView * targetView =
|
||||
[self.textContainer isKindOfClass:[UITextView class]] ? sender.view : self.textContainer;
|
||||
UIView * superview = sender.view.superview;
|
||||
[menuController setTargetRect:CGRectMake(tapPoint.x, targetView.minY, 0., 0.)
|
||||
inView:sender.view.superview];
|
||||
inView:superview];
|
||||
[menuController setMenuVisible:YES animated:YES];
|
||||
[targetView becomeFirstResponder];
|
||||
[menuController update];
|
||||
|
|
|
@ -12,11 +12,11 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerState)
|
|||
|
||||
@interface MWMSearchManager : NSObject
|
||||
|
||||
@property (nullable, weak, nonatomic) IBOutlet MWMSearchTextField * searchTextField;
|
||||
@property(nullable, weak, nonatomic) IBOutlet MWMSearchTextField * searchTextField;
|
||||
|
||||
@property (nonatomic) MWMSearchManagerState state;
|
||||
@property(nonatomic) MWMSearchManagerState state;
|
||||
|
||||
@property(nonatomic) IBOutletCollection(UIView) NSArray * topViews;
|
||||
@property(nonnull, nonatomic) IBOutletCollection(UIView) NSArray * topViews;
|
||||
|
||||
- (void)mwm_refreshUI;
|
||||
|
||||
|
|
|
@ -72,7 +72,8 @@ static NSString * const kBookmarksCellIdentifier = @"MWMSearchBookmarksCell";
|
|||
- (UITableViewCell *)tableView:(UITableView *)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return [tableView dequeueReusableCellWithIdentifier:kBookmarksCellIdentifier];
|
||||
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:kBookmarksCellIdentifier];
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
|
|
@ -102,9 +102,10 @@ static NSString * const kMyPositionCellIdentifier = @"MWMSearchHistoryMyPosition
|
|||
[tCell config:[self stringAtIndex:indexPath.row]];
|
||||
return tCell;
|
||||
}
|
||||
return [tableView dequeueReusableCellWithIdentifier:self.isRouteSearchMode
|
||||
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:self.isRouteSearchMode
|
||||
? kMyPositionCellIdentifier
|
||||
: kClearCellIdentifier];
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
for (NSUInteger index = 0; index < self.tablesCount; index++)
|
||||
{
|
||||
NSIndexPath * indexPath = [NSIndexPath indexPathForItem:index inSection:0];
|
||||
[attrs addObject:[self layoutAttributesForItemAtIndexPath:indexPath]];
|
||||
UICollectionViewLayoutAttributes * attr = [self layoutAttributesForItemAtIndexPath:indexPath];
|
||||
[attrs addObject:attr];
|
||||
}
|
||||
return attrs;
|
||||
return attrs.copy;
|
||||
}
|
||||
|
||||
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { return YES; }
|
||||
|
|
|
@ -13,7 +13,7 @@ class Result;
|
|||
|
||||
@protocol MWMSearchTableViewProtocol<MWMSearchTabbedViewProtocol>
|
||||
|
||||
@property(weak, nonatomic) MWMSearchTextField * searchTextField;
|
||||
@property(nullable, weak, nonatomic) MWMSearchTextField * searchTextField;
|
||||
|
||||
@property(nonatomic) MWMSearchManagerState state;
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ static NSString * const kUnwingSegueIdentifier = @"UnwindToTTSSettings";
|
|||
if (![segue.identifier isEqualToString:kUnwingSegueIdentifier])
|
||||
return;
|
||||
MWMTTSSettingsViewController * dest = segue.destinationViewController;
|
||||
NSUInteger const row = [self.tableView indexPathForCell:sender].row;
|
||||
UITableViewCell * cell = sender;
|
||||
NSUInteger const row = [self.tableView indexPathForCell:cell].row;
|
||||
[dest setAdditionalTTSLanguage:[[MWMTextToSpeech tts] availableLanguages][row]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue