Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MWMWhatsNewProfileBookingController.mm « Welcome « MapViewControls « CustomViews « Classes « Maps « iphone - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f24c1cb611cbaa818e4ef155c3eabe6d790e617d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#import "MWMWhatsNewProfileBookingController.h"
#import "MWMPageController.h"

@interface MWMWhatsNewProfileBookingController ()

@property(weak, nonatomic) IBOutlet UIView * containerView;
@property(weak, nonatomic) IBOutlet UIImageView * image;
@property(weak, nonatomic) IBOutlet UILabel * alertTitle;
@property(weak, nonatomic) IBOutlet UILabel * alertText;
@property(weak, nonatomic) IBOutlet UIButton * nextPageButton;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerWidth;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerHeight;

@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageMinHeight;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageHeight;

@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleTopOffset;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleImageOffset;

@end

namespace
{
NSArray<TMWMWelcomeConfigBlock> * pagesConfigBlocks = @[
  [^(MWMWhatsNewProfileBookingController * controller) {
    controller.image.image = [UIImage imageNamed:@"img_whatsnew_route_profile"];
    controller.alertTitle.text = L(@"whats_new_route_profile_title");
    controller.alertText.text = L(@"whats_new_route_profile_message");
    [controller.nextPageButton setTitle:L(@"whats_new_next_button") forState:UIControlStateNormal];
    [controller.nextPageButton addTarget:controller.pageController
                                  action:@selector(nextPage)
                        forControlEvents:UIControlEventTouchUpInside];
  } copy],
  [^(MWMWhatsNewProfileBookingController * controller) {
    controller.image.image = [UIImage imageNamed:@"img_whatsnew_booking_improved"];
    controller.alertTitle.text = L(@"whats_new_booking_improve_title");
    controller.alertText.text = L(@"whats_new_booking_improve_message");
    [controller.nextPageButton setTitle:L(@"done") forState:UIControlStateNormal];
    [controller.nextPageButton addTarget:controller.pageController
                                  action:@selector(close)
                        forControlEvents:UIControlEventTouchUpInside];
  } copy]
];

}  // namespace

@implementation MWMWhatsNewProfileBookingController

+ (NSString *)udWelcomeWasShownKey { return @"WhatsNewProfileBookingWasShown"; }
+ (NSArray<TMWMWelcomeConfigBlock> *)pagesConfig { return pagesConfigBlocks; }
- (IBAction)close { [self.pageController close]; }
#pragma mark - Properties

- (void)setSize:(CGSize)size
{
  super.size = size;
  CGSize const newSize = super.size;
  CGFloat const width = newSize.width;
  CGFloat const height = newSize.height;
  BOOL const hideImage = (self.imageHeight.multiplier * height <= self.imageMinHeight.constant);
  self.titleImageOffset.priority =
      hideImage ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
  self.image.hidden = hideImage;
  self.containerWidth.constant = width;
  self.containerHeight.constant = height;
}

@end