From 215afc1f5e11e24637c8e03454dbc9df2262a04b Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Wed, 1 Dec 2021 16:28:53 +0300
Subject: Fixes for Mac
---
Juick.xcodeproj/project.pbxproj | 30 ++++----
Juick/AppDelegate.m | 6 ++
Juick/Main.storyboard | 23 +-----
Juick/ViewControllers/ChatViewController.m | 4 +-
Juick/ViewControllers/DialogsViewController.m | 7 ++
Juick/ViewControllers/MessagesViewController.m | 2 +
Juick/Views/ConversationCell.m | 2 +-
Juick/Views/ConversationCell.xib | 98 ++++++++++++--------------
8 files changed, 80 insertions(+), 92 deletions(-)
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index 2230b06..614dee8 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -861,17 +861,18 @@
CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 159;
- DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
+ CURRENT_PROJECT_VERSION = 160;
DEVELOPMENT_TEAM = KH4MX79ZK7;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch";
INFOPLIST_FILE = "Juick/Supporting Files/Juick-Info.plist";
+ "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.juick.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SUPPORTS_MACCATALYST = YES;
- TARGETED_DEVICE_FAMILY = "1,2";
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+ TARGETED_DEVICE_FAMILY = "1,2,6";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -882,16 +883,17 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 159;
- DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
+ CURRENT_PROJECT_VERSION = 160;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch";
INFOPLIST_FILE = "Juick/Supporting Files/Juick-Info.plist";
+ "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.juick.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SUPPORTS_MACCATALYST = YES;
- TARGETED_DEVICE_FAMILY = "1,2";
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+ TARGETED_DEVICE_FAMILY = "1,2,6";
WRAPPER_EXTENSION = app;
};
name = Release;
@@ -909,9 +911,8 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 159;
+ CURRENT_PROJECT_VERSION = 160;
DEBUG_INFORMATION_FORMAT = dwarf;
- DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = KH4MX79ZK7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
@@ -940,9 +941,8 @@
CODE_SIGN_ENTITLEMENTS = JuickPush/JuickPush.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 159;
+ CURRENT_PROJECT_VERSION = 160;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = JuickPush/Info.plist;
@@ -1022,17 +1022,18 @@
CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CURRENT_PROJECT_VERSION = 159;
- DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
+ CURRENT_PROJECT_VERSION = 160;
DEVELOPMENT_TEAM = KH4MX79ZK7;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch";
INFOPLIST_FILE = "Juick/Supporting Files/Juick-Info.plist";
+ "IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
PRODUCT_BUNDLE_IDENTIFIER = "com.juick.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SUPPORTS_MACCATALYST = YES;
- TARGETED_DEVICE_FAMILY = "1,2";
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+ TARGETED_DEVICE_FAMILY = "1,2,6";
WRAPPER_EXTENSION = app;
};
name = "Debug (local)";
@@ -1050,9 +1051,8 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 159;
+ CURRENT_PROJECT_VERSION = 160;
DEBUG_INFORMATION_FORMAT = dwarf;
- DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
DEVELOPMENT_TEAM = KH4MX79ZK7;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index da72111..51e5df1 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -66,6 +66,12 @@
if (userInfo) {
[self parseNotificationPayload:userInfo];
}
+ UISplitViewController *splitViewController = (UISplitViewController *)[self window].rootViewController;
+#if TARGET_OS_MACCATALYST
+ splitViewController.primaryBackgroundStyle = UISplitViewControllerBackgroundStyleSidebar;
+#else
+ splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAllVisible;
+#endif
return YES;
}
diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard
index 6a7f2d2..41051bf 100644
--- a/Juick/Main.storyboard
+++ b/Juick/Main.storyboard
@@ -121,16 +121,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -292,20 +282,11 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m
index cfecc48..9ca024c 100644
--- a/Juick/ViewControllers/ChatViewController.m
+++ b/Juick/ViewControllers/ChatViewController.m
@@ -34,12 +34,12 @@
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
[self reloadChat];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
- self.tableView.refreshControl = [UIRefreshControl new];
- [self.tableView.refreshControl addTarget:self action:@selector(reloadChat) forControlEvents:UIControlEventValueChanged];
[self addObserver:self forKeyPath:@"uname" options:0 context:nil];
#if TARGET_OS_MACCATALYST
[self.stack addArrangedSubview:[self inputAccessoryView]];
#else
+ self.tableView.refreshControl = [UIRefreshControl new];
+ [self.tableView.refreshControl addTarget:self action:@selector(reloadChat) forControlEvents:UIControlEventValueChanged];
self.stackBottomConstraint.constant = kMessageInputInitialHeight;
#endif
}
diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m
index 5f2dca9..dff8529 100644
--- a/Juick/ViewControllers/DialogsViewController.m
+++ b/Juick/ViewControllers/DialogsViewController.m
@@ -25,8 +25,11 @@
[super viewDidLoad];
[self.view setBackgroundColor:[UIColor colorNamed:@"Background"]];
[self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"];
+ self.tableView.rowHeight = UITableViewAutomaticDimension;
+#if !TARGET_OS_MACCATALYST
self.refreshControl = [UIRefreshControl new];
[self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
+#endif
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationActivated) name:UIApplicationDidBecomeActiveNotification object:nil];
[self refreshData];
}
@@ -83,6 +86,10 @@
return cell;
}
+- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
+ return 84.0f;
+}
+
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"chatSegue" sender:self];
}
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 7814d1e..cd4d740 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -118,8 +118,10 @@ NSString* const messageCellIdentifier = @"messageCell";
if (!self.messages) {
self.messages = [NSMutableArray array];
}
+#if !TARGET_OS_MACCATALYST
self.refreshControl = [UIRefreshControl new];
[self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
+#endif
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(newMessage:) name:NewMessageNotificationName object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationActivated) name:UIApplicationDidBecomeActiveNotification object:nil];
[self refreshData];
diff --git a/Juick/Views/ConversationCell.m b/Juick/Views/ConversationCell.m
index 21a3af2..360ed2b 100644
--- a/Juick/Views/ConversationCell.m
+++ b/Juick/Views/ConversationCell.m
@@ -15,7 +15,7 @@
self.chatName.textColor = [UIColor colorNamed:@"Title"];
self.chatName.text = chat.uname;
self.lastMessage.text = chat.lastMessageText;
- self.unreadMarker.hidden = true;
+ self.unreadMarker.hidden = false;
__weak UIImageView *weakAvatar = self.avatar;
[[AppDelegate shared].api fetchImageWithURL:[NSURL URLWithString:chat.avatar] callback:^(NSData *data) {
[UIView transitionWithView:weakAvatar
diff --git a/Juick/Views/ConversationCell.xib b/Juick/Views/ConversationCell.xib
index 4cd7a30..b524816 100644
--- a/Juick/Views/ConversationCell.xib
+++ b/Juick/Views/ConversationCell.xib
@@ -10,64 +10,56 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -76,7 +68,7 @@
-
+
--
cgit v1.2.3