Skip to content

Commit

Permalink
fix a crash and improve thread-safety settings in various classes
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Sep 13, 2023
1 parent b01683f commit 85c9c10
Show file tree
Hide file tree
Showing 30 changed files with 82 additions and 87 deletions.
22 changes: 11 additions & 11 deletions IRCCloud/Classes/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
NSMutableSet *_activeScenes;
}

@property (strong, nonatomic) UIWindow *window;
@property (strong) UIWindow *window;

@property (strong, nonatomic) LoginSplashViewController *loginSplashViewController;
@property (strong, nonatomic) MainViewController *mainViewController;
@property (strong, nonatomic) ECSlidingViewController *slideViewController;
@property (strong, nonatomic) SplashViewController *splashViewController;
@property (strong) LoginSplashViewController *loginSplashViewController;
@property (strong) MainViewController *mainViewController;
@property (strong) ECSlidingViewController *slideViewController;
@property (strong) SplashViewController *splashViewController;

@property BOOL movedToBackground;

Expand All @@ -93,11 +93,11 @@ API_AVAILABLE(ios(13.0))
AppDelegate *_appDelegate;
UIScene *_scene;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIScene *scene;
@property (strong) UIWindow *window;
@property (strong) UIScene *scene;

@property (strong, nonatomic) LoginSplashViewController *loginSplashViewController;
@property (strong, nonatomic) MainViewController *mainViewController;
@property (strong, nonatomic) ECSlidingViewController *slideViewController;
@property (strong, nonatomic) SplashViewController *splashViewController;
@property (strong) LoginSplashViewController *loginSplashViewController;
@property (strong) MainViewController *mainViewController;
@property (strong) ECSlidingViewController *slideViewController;
@property (strong) SplashViewController *splashViewController;
@end
4 changes: 2 additions & 2 deletions IRCCloud/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ + (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host {
//From: http://stackoverflow.com/a/19313559
@interface NavBarHax : UINavigationBar

@property (nonatomic, assign) BOOL changingUserInteraction;
@property (nonatomic, assign) BOOL userInteractionChangedBySystem;
@property (assign) BOOL changingUserInteraction;
@property (assign) BOOL userInteractionChangedBySystem;

@end

Expand Down
6 changes: 3 additions & 3 deletions IRCCloud/Classes/AvatarsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
NSMutableDictionary *_selfImages;
NSTimeInterval _lastAccessTime;
}
@property (nonatomic, assign) int bid;
@property (nonatomic, copy) NSString *nick, *displayName;
@property (nonatomic, readonly) NSTimeInterval lastAccessTime;
@property (assign) int bid;
@property (copy) NSString *nick, *displayName;
@property (readonly) NSTimeInterval lastAccessTime;
-(UIImage *)getImage:(int)size isSelf:(BOOL)isSelf;
-(UIImage *)getImage:(int)size isSelf:(BOOL)isSelf isChannel:(BOOL)isChannel;
@end
Expand Down
16 changes: 8 additions & 8 deletions IRCCloud/Classes/BuffersDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@
NSString *_displayName;
NSMutableDictionary *_typingIndicators;
}
@property (nonatomic, assign) int bid, cid, archived, deferred, timeout, extraHighlights;
@property (nonatomic, assign) NSTimeInterval min_eid, last_seen_eid, scrolledUpFrom, created;
@property (nonatomic, assign) CGFloat savedScrollOffset;
@property (nonatomic, copy) NSString *name, *type, *away_msg, *chantypes;
@property (nonatomic, assign) BOOL valid, scrolledUp, serverIsSlack;
@property (nonatomic, copy) NSString *draft;
@property (nonatomic, strong) Buffer *lastBuffer, *nextBuffer;
@property (nonatomic, strong) NSMutableDictionary *typingIndicators;
@property (assign) int bid, cid, archived, deferred, timeout, extraHighlights;
@property (assign) NSTimeInterval min_eid, last_seen_eid, scrolledUpFrom, created;
@property (assign) CGFloat savedScrollOffset;
@property (copy) NSString *name, *type, *away_msg, *chantypes;
@property (assign) BOOL valid, scrolledUp, serverIsSlack;
@property (copy) NSString *draft;
@property (strong) Buffer *lastBuffer, *nextBuffer;
@property (strong) NSMutableDictionary *typingIndicators;
@property (readonly) NSString *accessibilityValue, *normalizedName, *displayName;
@property (readonly) BOOL isMPDM;
-(NSComparisonResult)compare:(Buffer *)aBuffer;
Expand Down
4 changes: 2 additions & 2 deletions IRCCloud/Classes/CallerIDTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
UIBarButtonItem *_addButton;
UILabel *_placeholder;
}
@property (strong, nonatomic) NSArray *nicks;
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) NSArray *nicks;
@property (strong) IRCCloudJSONObject *event;
@end
4 changes: 2 additions & 2 deletions IRCCloud/Classes/ChannelListTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
UILabel *_placeholder;
UIActivityIndicatorView *_activity;
}
@property (strong, nonatomic) NSArray *channels;
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) NSArray *channels;
@property (strong) IRCCloudJSONObject *event;
-(void)refresh;
@end
4 changes: 2 additions & 2 deletions IRCCloud/Classes/ChannelModeListTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
NSString *_mask;
BOOL _canChangeMode;
}
@property (strong, nonatomic) NSArray *data;
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) NSArray *data;
@property (strong) IRCCloudJSONObject *event;
@property NSString *mask;

-(id)initWithList:(int)list mode:(NSString *)mode param:(NSString *)param placeholder:(NSString *)placeholder cid:(int)cid bid:(int)bid;
Expand Down
10 changes: 5 additions & 5 deletions IRCCloud/Classes/ChannelsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
BOOL _valid;
BOOL _key;
}
@property (nonatomic, assign) int cid, bid;
@property (nonatomic, assign) BOOL valid, key;
@property (nonatomic, copy) NSString *name, *topic_text, *topic_author, *type, *mode, *url;
@property (nonatomic, assign) NSTimeInterval topic_time, timestamp;
@property (nonatomic, strong) NSArray *modes;
@property (assign) int cid, bid;
@property (assign) BOOL valid, key;
@property (copy) NSString *name, *topic_text, *topic_author, *type, *mode, *url;
@property (assign) NSTimeInterval topic_time, timestamp;
@property (strong) NSArray *modes;
-(void)addMode:(NSString *)mode param:(NSString *)param;
-(void)removeMode:(NSString *)mode;
-(BOOL)hasMode:(NSString *)mode;
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/DisplayOptionsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
UISwitch *_nocolors;
UISwitch *_typingStatus;
}
@property (strong, nonatomic) Buffer *buffer;
@property (strong) Buffer *buffer;
@end
2 changes: 1 addition & 1 deletion IRCCloud/Classes/EditConnectionViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ @interface NetworkListViewController : UITableViewController {

UIActivityIndicatorView *_activityIndicator;
}
@property (nonatomic) NSString *selection;
@property (copy) NSString *selection;
-(id)initWithDelegate:(id)delegate;
- (void)fetchServerList;
@end
Expand Down
24 changes: 12 additions & 12 deletions IRCCloud/Classes/EventsDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@
BOOL _collapsed;
NSTimeInterval _lastEditEID;
}
@property (nonatomic, assign) int cid, bid, rowType, reqId, childEventCount, replyCount;
@property (nonatomic, assign) NSTimeInterval eid, groupEid, serverTime, parent, lastEditEID;
@property (nonatomic, copy) NSString *timestamp, *type, *msg, *hostmask, *from, *fromMode, *nick, *oldNick, *server, *diff, *groupMsg, *targetMode, *formattedMsg, *to, *command, *day, *chan, *realname, *accessibilityLabel, *accessibilityValue, *avatar, *avatarURL, *fromNick, *msgid, *formattedPrefix;
@property (nonatomic, assign) BOOL isHighlight, isSelf, toChan, toBuffer, linkify, pending, monospace, isHeader, isEmojiOnly, isQuoted, isCodeBlock, hasReply, isReply, edited, collapsed, hasReplyRow;
@property (nonatomic, copy) NSDictionary *ops,*entities;
@property (nonatomic, strong) UIColor *color, *bgColor;
@property (nonatomic, copy) NSAttributedString *formatted, *formattedNick, *formattedRealname, *formattedPadded;
@property (nonatomic, assign) float height, timestampPosition, avatarHeight, estimatedWidth;
@property (nonatomic, strong) NSArray *links, *realnameLinks;
@property (nonatomic, strong) NSMutableSet *replyNicks;
@property (nonatomic, strong) NSTimer *expirationTimer;
@property (nonatomic, assign) NSInteger row, mentionOffset;
@property (assign) int cid, bid, rowType, reqId, childEventCount, replyCount;
@property (assign) NSTimeInterval eid, groupEid, serverTime, parent, lastEditEID;
@property (copy) NSString *timestamp, *type, *msg, *hostmask, *from, *fromMode, *nick, *oldNick, *server, *diff, *groupMsg, *targetMode, *formattedMsg, *to, *command, *day, *chan, *realname, *accessibilityLabel, *accessibilityValue, *avatar, *avatarURL, *fromNick, *msgid, *formattedPrefix;
@property (assign) BOOL isHighlight, isSelf, toChan, toBuffer, linkify, pending, monospace, isHeader, isEmojiOnly, isQuoted, isCodeBlock, hasReply, isReply, edited, collapsed, hasReplyRow;
@property (copy) NSDictionary *ops,*entities;
@property (strong) UIColor *color, *bgColor;
@property (copy) NSAttributedString *formatted, *formattedNick, *formattedRealname, *formattedPadded;
@property (assign) float height, timestampPosition, avatarHeight, estimatedWidth;
@property (strong) NSArray *links, *realnameLinks;
@property (strong) NSMutableSet *replyNicks;
@property (strong) NSTimer *expirationTimer;
@property (assign) NSInteger row, mentionOffset;
-(NSComparisonResult)compare:(Event *)aEvent;
-(BOOL)isImportant:(NSString *)bufferType;
-(BOOL)isMessage;
Expand Down
5 changes: 0 additions & 5 deletions IRCCloud/Classes/EventsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ @implementation Event
+ (BOOL)supportsSecureCoding {
return YES;
}
-(instancetype)init {
self = [super init];
self->_type = (NSString *)[[NSNull alloc] init];
return self;
}
-(NSComparisonResult)compare:(Event *)aEvent {
if(aEvent.pending && !_pending)
return NSOrderedAscending;
Expand Down
4 changes: 2 additions & 2 deletions IRCCloud/Classes/EventsTableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@
@property (readonly) UILabel *topUnreadLabel;
@property (readonly) UILabel *bottomUnreadLabel;
@property (readonly) UILabel *bottomUnreadArrow;
@property (nonatomic) NSTimeInterval eidToOpen;
@property (assign) NSTimeInterval eidToOpen;
@property (readonly) UIImageView *stickyAvatar;
@property Buffer *buffer;
@property NSString *msgid;
@property (nonatomic) BOOL shouldAutoFetch;
@property (assign) BOOL shouldAutoFetch;
-(void)insertEvent:(Event *)event backlog:(BOOL)backlog nextIsGrouped:(BOOL)nextIsGrouped;
-(IBAction)topUnreadBarClicked:(id)sender;
-(IBAction)bottomUnreadBarClicked:(id)sender;
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/EventsTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ @interface EventsTableCell : UITableViewCell {
@property (readonly) UIView *quoteBorder, *codeBlockBackground, *topBorder, *bottomBorder, *lastSeenEIDBackground, *socketClosedBar;
@property (readonly) NSLayoutConstraint *messageOffsetLeft, *messageOffsetRight, *messageOffsetTop, *messageOffsetBottom, *timestampWidth, *avatarOffset, *nicknameOffset, *lastSeenEIDOffset, *avatarWidth, *avatarHeight, *replyCenter, *replyXOffset, *avatarTop;
@property (readonly) UIControl *replyButton;
@property (nonatomic) NSURL *largeAvatarURL;
@property (strong) NSURL *largeAvatarURL;

-(IBAction)avatarTapped:(UITapGestureRecognizer *)sender;
@end
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/IRCColorPickerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
UIButton *_fg[16];
UIButton *_bg[16];
}
@property (nonatomic, assign) id<IRCColorPickerViewDelegate> delegate;
@property (assign) id<IRCColorPickerViewDelegate> delegate;
-(void)updateButtonColors:(BOOL)background;
@end

2 changes: 1 addition & 1 deletion IRCCloud/Classes/IgnoresTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
int _cid;
UILabel *_placeholder;
}
@property (strong, nonatomic) NSArray *ignores;
@property (strong) NSArray *ignores;
@property int cid;
@end
4 changes: 2 additions & 2 deletions IRCCloud/Classes/LinkLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
UITapGestureRecognizer *_tapGesture;
NSMutableArray *_links;
}
@property (nonatomic, unsafe_unretained) id <LinkLabelDelegate> linkDelegate;
@property (nonatomic, strong) NSDictionary *linkAttributes;
@property (unsafe_unretained) id <LinkLabelDelegate> linkDelegate;
@property (strong) NSDictionary *linkAttributes;

- (void)addLinkToURL:(NSURL *)url withRange:(NSRange)range;
- (void)addLinkWithTextCheckingResult:(NSTextCheckingResult *)result;
Expand Down
4 changes: 2 additions & 2 deletions IRCCloud/Classes/LinkTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
UITapGestureRecognizer *_tapGesture;
NSMutableArray *_links;
}
@property (nonatomic, unsafe_unretained) id <LinkTextViewDelegate> linkDelegate;
@property (nonatomic, strong) NSDictionary *linkAttributes;
@property (unsafe_unretained) id <LinkTextViewDelegate> linkDelegate;
@property (strong) NSDictionary *linkAttributes;

- (void)addLinkToURL:(NSURL *)url withRange:(NSRange)range;
- (void)addLinkWithTextCheckingResult:(NSTextCheckingResult *)result;
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/LinksListTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
IRCCloudJSONObject *_event;
NSArray *_data;
}
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) IRCCloudJSONObject *event;
-(void)refresh;
@end
2 changes: 1 addition & 1 deletion IRCCloud/Classes/LogExportsTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@property Buffer *buffer;
@property Server *server;
@property (nonatomic, copy) void (^completionHandler)(void);
@property (copy) void (^completionHandler)(void);

-(void)download:(NSURL *)url;

Expand Down
10 changes: 5 additions & 5 deletions IRCCloud/Classes/MainViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@
UILabel *_typingIndicator;
NSTimer *_typingTimer;
}
@property (nonatomic) int cidToOpen;
@property (nonatomic) int bidToOpen;
@property (nonatomic) NSTimeInterval eidToOpen;
@property (nonatomic) NSString *incomingDraft;
@property (nonatomic) NSString *bufferToOpen;
@property (assign) int cidToOpen;
@property (assign) int bidToOpen;
@property (assign) NSTimeInterval eidToOpen;
@property (copy) NSString *incomingDraft;
@property (copy) NSString *bufferToOpen;
@property (readonly) EventsTableView *eventsView;
@property (readonly) Buffer *buffer;
@property BOOL isShowingPreview;
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/NamesListTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
IRCCloudJSONObject *_event;
NSArray *_data;
}
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) IRCCloudJSONObject *event;
-(void)refresh;
@end
2 changes: 1 addition & 1 deletion IRCCloud/Classes/NetworkConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ @interface OOBFetcher : NSObject<NSURLSessionDataDelegate> {
}
@property (readonly) NSString *url;
@property int bid;
@property (nonatomic, copy) void (^completionHandler)(BOOL);
@property (copy) void (^completionHandler)(BOOL);
-(id)initWithURL:(NSString *)URL;
-(void)cancel;
-(void)start;
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/NickCompletionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
NSInteger _selection;
}
@property (readonly) UIFont *font;
@property (nonatomic, assign) id<NickCompletionViewDelegate> completionDelegate;
@property (assign) id<NickCompletionViewDelegate> completionDelegate;
@property NSInteger selection;
-(void)setSuggestions:(NSArray *)suggestions;
-(NSUInteger)count;
Expand Down
14 changes: 7 additions & 7 deletions IRCCloud/Classes/ServersDataSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
BOOL _blocksDeletes;
BOOL _blocksTyping;
}
@property (nonatomic, assign) int cid, port, ssl, order, deferred_archives, orgId, avatars_supported, slack;
@property (nonatomic, copy) NSString *name, *hostname, *nick, *status, *realname, *server_pass, *nickserv_pass, *join_commands, *away, *usermask, *mode, *CHANTYPES, *MODE_OPER, *MODE_OWNER, *MODE_ADMIN, *MODE_OP, *MODE_HALFOP, *MODE_VOICED, *server_realname, *ircserver, *avatar, *avatarURL, *from;
@property (nonatomic, copy) NSDictionary *fail_info, *PREFIX;
@property (nonatomic, copy) NSDictionary *isupport;
@property (nonatomic, copy) NSArray *caps;
@property (nonatomic) NSMutableDictionary *collapsed;
@property (assign) int cid, port, ssl, order, deferred_archives, orgId, avatars_supported, slack;
@property (copy) NSString *name, *hostname, *nick, *status, *realname, *server_pass, *nickserv_pass, *join_commands, *away, *usermask, *mode, *CHANTYPES, *MODE_OPER, *MODE_OWNER, *MODE_ADMIN, *MODE_OP, *MODE_HALFOP, *MODE_VOICED, *server_realname, *ircserver, *avatar, *avatarURL, *from;
@property (copy) NSDictionary *fail_info, *PREFIX;
@property (copy) NSDictionary *isupport;
@property (copy) NSArray *caps;
@property (strong) NSMutableDictionary *collapsed;
@property (readonly) Ignore *ignore;
@property (nonatomic) BOOL blocksEdits, blocksReplies, blocksReactions, blocksDeletes, blocksTyping;
@property (assign) BOOL blocksEdits, blocksReplies, blocksReactions, blocksDeletes, blocksTyping;
-(NSComparisonResult)compare:(Server *)aServer;
-(NSArray *)ignores;
-(void)setIgnores:(NSArray *)ignores;
Expand Down
4 changes: 2 additions & 2 deletions IRCCloud/Classes/UIColor+IRCCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#define IRC_COLOR_COUNT 99

@interface UITableViewCell (IRCCloudAppearanceHax) <UIAppearance>
@property (strong, nonatomic) UIColor *textLabelColor UI_APPEARANCE_SELECTOR;
@property (strong, nonatomic) UIColor *detailTextLabelColor UI_APPEARANCE_SELECTOR;
@property (strong) UIColor *textLabelColor UI_APPEARANCE_SELECTOR;
@property (strong) UIColor *detailTextLabelColor UI_APPEARANCE_SELECTOR;
@end

@interface UIColor (IRCCloud)
Expand Down
4 changes: 2 additions & 2 deletions IRCCloud/Classes/URLHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ typedef void (^mediaURLResult)(BOOL, NSString *);
NSMutableDictionary *_fileIDs;
}

@property (nonatomic, copy) NSURL *appCallbackURL;
@property (strong, nonatomic) UIWindow *window;
@property (copy) NSURL *appCallbackURL;
@property (strong) UIWindow *window;

+ (BOOL)isImageURL:(NSURL *)url;
+ (BOOL)isYouTubeURL:(NSURL *)url;
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/WhoListTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
NSArray *_data;
NSDictionary *_selectedRow;
}
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) IRCCloudJSONObject *event;
-(void)refresh;
@end
2 changes: 1 addition & 1 deletion IRCCloud/Classes/WhoWasTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
IRCCloudJSONObject *_event;
UILabel *_placeholder;
}
@property (strong, nonatomic) IRCCloudJSONObject *event;
@property (strong) IRCCloudJSONObject *event;
-(void)refresh;
@end
2 changes: 1 addition & 1 deletion build-scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
337
339

0 comments on commit 85c9c10

Please sign in to comment.