diff options
author | Vitaly Takmazov | 2017-12-10 11:52:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-12-10 11:52:54 +0300 |
commit | 38d16e9d26b4f8653063ef2c572ccfc803ab165b (patch) | |
tree | c0e3bc1bb760f38150850f5e451bea77fa5a8373 /Juick | |
parent | 8a9a7fb25405c3662ae9b3b58263e9088baa7082 (diff) |
fix layout
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/Supporting Files/Juick-Info.plist | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 26 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.m | 20 | ||||
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 3 | ||||
-rw-r--r-- | Juick/Views/MessageCell.xib | 19 |
5 files changed, 35 insertions, 35 deletions
diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index 53c5301..dcaee08 100644 --- a/Juick/Supporting Files/Juick-Info.plist +++ b/Juick/Supporting Files/Juick-Info.plist @@ -21,7 +21,7 @@ <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>1.0.34</string> + <string>1.0.35</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSApplicationCategoryType</key> diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m index 2a109d4..26ec710 100644 --- a/Juick/ViewControllers/DiscoverViewController.m +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -23,10 +23,25 @@ AppDelegate *appDelegate; -(void) viewDidLoad { [super viewDidLoad]; [self.navigationController.navigationBar setPrefersLargeTitles:YES]; - if ([self.path isEqualToString:[APIClient feedUrl]]) { - [self setTitle:@"My feed"]; + if ([User isAuthenticated]) { + [User checkIsValid:^(BOOL success) { + if (success) { + if ([self.path length] == 0) { + self.path = [APIClient feedUrl]; + [self setTitle:@"My feed"]; + } + [self refreshData:NO]; + } else { + [User throwUnableToLogin:self]; + } + }]; + } else { - [self setTitle:@"Discover"]; + if ([self.path length] == 0) { + self.path = [APIClient messagesUrl]; + [self setTitle:@"Discover"]; + } + [self refreshData:NO]; } appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate; if (appDelegate.pushedThread != nil) { @@ -43,9 +58,11 @@ AppDelegate *appDelegate; -(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqual: @"threadViewSegue"]) { NSNumber *mid; + BOOL scrollToEnd = NO; if (appDelegate.pushedThread != nil) { mid = appDelegate.pushedThread; appDelegate.pushedThread = nil; + scrollToEnd = YES; } else { Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; mid = msg.mid; @@ -53,12 +70,14 @@ AppDelegate *appDelegate; ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; [threadVC setPath:[APIClient threadUrl]]; [threadVC setParams:[@{@"mid": mid } mutableCopy]]; + [threadVC refreshData:scrollToEnd]; } } - (IBAction)filterAction:(id)sender { UIAlertController *filterAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"My feed" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self setTitle:@"My feed"]; self.path = [APIClient feedUrl]; self.params = nil; [self.messages removeAllObjects]; @@ -66,6 +85,7 @@ AppDelegate *appDelegate; [self refreshData:NO]; }]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Discover" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + [self setTitle:@"Discover"]; self.path = [APIClient messagesUrl]; self.params = nil; [self.messages removeAllObjects]; diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 823d838..8e4835b 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -76,25 +76,7 @@ self.tableView.estimatedRowHeight = 500.0f; self.messages = [NSMutableArray array]; self.refreshControl = [UIRefreshControl new]; - [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; - if ([User isAuthenticated]) { - [User checkIsValid:^(BOOL success) { - if (success) { - if ([self.path length] == 0) { - self.path = [APIClient feedUrl]; - } - [self refreshData:NO]; - } else { - [User throwUnableToLogin:self]; - } - }]; - - } else { - if ([self.path length] == 0) { - self.path = [APIClient messagesUrl]; - } - [self refreshData:NO]; - } + [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; } - (void) composePressed { diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 8a9bc0e..143dd96 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -35,8 +35,7 @@ } self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelCompose)]; - self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd - target:self action:@selector(doneCompose)]; + self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send" style:UIBarButtonItemStyleDone target:self action:@selector(doneCompose)]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; [self.textView becomeFirstResponder]; diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index e54c8f9..d32defe 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -23,26 +23,25 @@ <rect key="frame" x="6" y="6" width="574" height="425.5"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d"> - <rect key="frame" x="0.0" y="0.0" width="574" height="48"/> + <rect key="frame" x="0.0" y="0.0" width="574" height="52.5"/> <subviews> - <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="CZk-Q8-JqS"> - <rect key="frame" x="0.0" y="0.0" width="48" height="48"/> + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="999" verticalHuggingPriority="251" horizontalCompressionResistancePriority="999" translatesAutoresizingMaskIntoConstraints="NO" id="CZk-Q8-JqS"> + <rect key="frame" x="0.0" y="0.0" width="48" height="52.5"/> <constraints> - <constraint firstAttribute="width" constant="48" id="Pw1-ZE-53h"/> - <constraint firstAttribute="height" constant="48" id="RAa-ds-3oT"/> + <constraint firstAttribute="width" constant="48" id="khZ-DB-qfq"/> </constraints> </imageView> - <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="o3h-ci-LWF"> - <rect key="frame" x="60" y="0.0" width="574" height="48"/> + <stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="252" axis="vertical" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="o3h-ci-LWF"> + <rect key="frame" x="60" y="0.0" width="574" height="52.5"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CHd-h0-hPk"> - <rect key="frame" x="0.0" y="0.0" width="574" height="20"/> + <rect key="frame" x="0.0" y="0.0" width="574" height="20.5"/> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AVu-qV-q84"> - <rect key="frame" x="0.0" y="32" width="574" height="16"/> + <rect key="frame" x="0.0" y="36.5" width="574" height="16"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -52,7 +51,7 @@ </subviews> </stackView> <view contentMode="scaleToFill" verticalCompressionResistancePriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="N08-my-2Lr" customClass="TagListView"> - <rect key="frame" x="0.0" y="60" width="574" height="37"/> + <rect key="frame" x="0.0" y="64.5" width="574" height="32.5"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="borderWidth"> |