summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-05-15 15:34:00 +0300
committerGravatar Vitaly Takmazov2020-05-15 15:34:00 +0300
commitaaa0bc8c2284b95187a51b10e44df26758e96718 (patch)
treed8c6c96da446605d6c88a09f0c420684cdbf687b /Juick
parentfa86aab338a9b866c240425c15dafdbaf4e0491f (diff)
Selection style
Diffstat (limited to 'Juick')
-rw-r--r--Juick/ViewControllers/MessagesViewController.h1
-rw-r--r--Juick/ViewControllers/MessagesViewController.m3
-rw-r--r--Juick/ViewControllers/ThreadViewController.m4
-rw-r--r--Juick/Views/MessageCell.h2
-rw-r--r--Juick/Views/MessageCell.m4
-rw-r--r--Juick/Views/MessageCell.xib10
6 files changed, 16 insertions, 8 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h
index 7025e8b..d2fc935 100644
--- a/Juick/ViewControllers/MessagesViewController.h
+++ b/Juick/ViewControllers/MessagesViewController.h
@@ -19,6 +19,7 @@ extern NSString* const messageCellIdentifier;
@property(nonatomic, strong) NSString *path;
@property(nonatomic, strong) NSDictionary *params;
@property(nonatomic, assign) BOOL shouldScrollToUnreadOnRefresh;
+@property(nonatomic, assign) BOOL shouldAllowToSelectText;
@property(nonatomic) NSNumber * firstUnread;
-(void) refreshData;
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index f61d8b4..8fc6408 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -129,7 +129,7 @@ NSString* const messageCellIdentifier = @"messageCell";
} else {
Message *msg = [self.messages objectAtIndex:indexPath.row];
MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:messageCellIdentifier forIndexPath:indexPath];
- [cell configureWithMessage:msg];
+ [cell configureWithMessage:msg selectable:self.shouldAllowToSelectText];
return cell;
}
}
@@ -141,6 +141,7 @@ NSString* const messageCellIdentifier = @"messageCell";
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Message *msg = [self.messages objectAtIndex:indexPath.row];
[self viewThreadForMessage:msg mid:msg.mid scrollTo:0];
+ [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
diff --git a/Juick/ViewControllers/ThreadViewController.m b/Juick/ViewControllers/ThreadViewController.m
index 8ee7623..fd754cf 100644
--- a/Juick/ViewControllers/ThreadViewController.m
+++ b/Juick/ViewControllers/ThreadViewController.m
@@ -49,4 +49,8 @@
[self refreshData];
}
+- (BOOL)shouldAllowToSelectText {
+ return YES;
+}
+
@end
diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h
index 684a620..d50751b 100644
--- a/Juick/Views/MessageCell.h
+++ b/Juick/Views/MessageCell.h
@@ -26,5 +26,5 @@
@property (nonatomic, strong) id<MessageCellDelegate> delegate;
-- (void) configureWithMessage:(Message *)msg;
+- (void) configureWithMessage:(Message *)msg selectable:(BOOL)selectable;
@end
diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m
index ad1a3a3..f02aa48 100644
--- a/Juick/Views/MessageCell.m
+++ b/Juick/Views/MessageCell.m
@@ -46,7 +46,7 @@ const NSString *unreadMarker = @"●";
_italicFont = [UIFont fontWithDescriptor:italicFontDescriptor size: 0.0];
}
-- (void) configureWithMessage:(Message *)msg {
+- (void) configureWithMessage:(Message *)msg selectable:(BOOL)selectable {
self.avatar.image = nil;
__weak UIImageView *weakAvatar = self.avatar;
[[AppDelegate shared].api fetchImageWithURL:[NSURL URLWithString:msg.user.avatar] callback:^(NSData *data) {
@@ -101,6 +101,8 @@ const NSString *unreadMarker = @"●";
self.text.attributedText = nil;
if (msg.text) {
[self.text setHidden:NO];
+ [self.text setSelectable:selectable];
+ [self.text setUserInteractionEnabled:selectable];
NSMutableAttributedString *txt = [[NSMutableAttributedString alloc]
initWithString:msg.text
attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody],
diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib
index 5b5ebd3..e690318 100644
--- a/Juick/Views/MessageCell.xib
+++ b/Juick/Views/MessageCell.xib
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
- <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="604" id="KGk-i7-Jjw" customClass="MessageCell">
+ <tableViewCell contentMode="scaleToFill" selectionStyle="gray" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="604" id="KGk-i7-Jjw" customClass="MessageCell">
<rect key="frame" x="0.0" y="0.0" width="572" height="604"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
@@ -49,9 +49,9 @@
</stackView>
</subviews>
</stackView>
- <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="749" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt">
+ <textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="749" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt">
<rect key="frame" x="0.0" y="104" width="560" height="192"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>