Skip to content

Commit

Permalink
MessageViewController's collection view is working once again
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-Tyler committed Aug 21, 2018
1 parent 037d298 commit 08f5d3b
Show file tree
Hide file tree
Showing 8 changed files with 532 additions and 82 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ fastlane/screenshots/**/*.png
fastlane/test_output

GroupMe/token.txt
Project.playground

510 changes: 510 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

16 changes: 6 additions & 10 deletions GroupMac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
4CDC814220DB23CB004D8DD0 /* ConvosViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDC814120DB23CB004D8DD0 /* ConvosViewController.swift */; };
5D786FECBEFA441532910443 /* Pods_GroupMac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 415CC64559BA1B574C68A601 /* Pods_GroupMac.framework */; };
9732A1827C76D1E7B72ADF77 /* NotificationSocketDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9732AC292DD2BE4DFA789A74 /* NotificationSocketDelegate.swift */; };
9732A2C9BA6651AEF167EB76 /* AttachmentContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9732A1EC1A8162F327B833DE /* AttachmentContent.swift */; };
9732A897C2C8F699E66989C0 /* APIResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9732ABDEEE4AA9F6324C7EFB /* APIResponse.swift */; };
9732A948C22C52614A047EE4 /* ConvoHeaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9732A0C79F8EF2CDDA9D290D /* ConvoHeaderViewController.swift */; };
9732AEF24DF4A5729B1BFA48 /* MessageComposerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9732A681295E00D3B85DBDC3 /* MessageComposerViewController.swift */; };
Expand Down Expand Up @@ -117,7 +116,6 @@
4CDC814120DB23CB004D8DD0 /* ConvosViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvosViewController.swift; sourceTree = "<group>"; };
831C8A87BAFE21A2FF9877CB /* Pods-GroupMac.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GroupMac.release.xcconfig"; path = "Pods/Target Support Files/Pods-GroupMac/Pods-GroupMac.release.xcconfig"; sourceTree = "<group>"; };
9732A0C79F8EF2CDDA9D290D /* ConvoHeaderViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConvoHeaderViewController.swift; sourceTree = "<group>"; };
9732A1EC1A8162F327B833DE /* AttachmentContent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentContent.swift; sourceTree = "<group>"; };
9732A6673DB0DEC96B8F9E72 /* MessagesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
9732A681295E00D3B85DBDC3 /* MessageComposerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageComposerViewController.swift; sourceTree = "<group>"; };
9732ABDEEE4AA9F6324C7EFB /* APIResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIResponse.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -209,16 +207,16 @@
4C78FD8A20D8280D006385B2 /* AppDelegate.swift */,
4C334D3020F8DDC900DC48E9 /* Buttons */,
4C019D7D20F58297001282E3 /* ConversationCell.swift */,
9732A0C79F8EF2CDDA9D290D /* ConvoHeaderViewController.swift */,
4CDC814120DB23CB004D8DD0 /* ConvosViewController.swift */,
4CC32AC320ED70A30046ED1D /* MessageCells */,
4CDC813D20DAF9EC004D8DD0 /* ConvoViewController.swift */,
4CC32AC320ED70A30046ED1D /* MessageCells */,
9732A681295E00D3B85DBDC3 /* MessageComposerViewController.swift */,
9732A6673DB0DEC96B8F9E72 /* MessagesViewController.swift */,
4C78FD8C20D8280D006385B2 /* ViewController.swift */,
4C78FD8E20D8280F006385B2 /* Assets.xcassets */,
4C78FD9320D8280F006385B2 /* Info.plist */,
4C78FD9420D8280F006385B2 /* GroupMac.entitlements */,
9732A6673DB0DEC96B8F9E72 /* MessagesViewController.swift */,
9732A681295E00D3B85DBDC3 /* MessageComposerViewController.swift */,
9732A0C79F8EF2CDDA9D290D /* ConvoHeaderViewController.swift */,
);
path = GroupMac;
sourceTree = "<group>";
Expand All @@ -245,15 +243,14 @@
4C78FDBB20D82E34006385B2 /* GroupMe */ = {
isa = PBXGroup;
children = (
9732ABDEEE4AA9F6324C7EFB /* APIResponse.swift */,
4C78FDB620D82C8D006385B2 /* GroupMe.swift */,
4C3035FD20FA6B5500EDFBAB /* Attachment.swift */,
4C74BE7420DE95E100F765C8 /* Chat.swift */,
4CDC813520DAD169004D8DD0 /* Group.swift */,
4C019D7B20F57CB6001282E3 /* Me.swift */,
4C78FDB920D82E21006385B2 /* token.txt */,
9732ABDEEE4AA9F6324C7EFB /* APIResponse.swift */,
9732A1EC1A8162F327B833DE /* AttachmentContent.swift */,
9732AC292DD2BE4DFA789A74 /* NotificationSocketDelegate.swift */,
4C78FDB920D82E21006385B2 /* token.txt */,
);
path = GroupMe;
sourceTree = "<group>";
Expand Down Expand Up @@ -490,7 +487,6 @@
4CC32AC020ED18D30046ED1D /* CollectionLayout.swift in Sources */,
4C78FDB720D82C8D006385B2 /* GroupMe.swift in Sources */,
9732A897C2C8F699E66989C0 /* APIResponse.swift in Sources */,
9732A2C9BA6651AEF167EB76 /* AttachmentContent.swift in Sources */,
9732A1827C76D1E7B72ADF77 /* NotificationSocketDelegate.swift in Sources */,
9732AFFDB30E91EA9A5CB26F /* MessagesViewController.swift in Sources */,
9732AEF24DF4A5729B1BFA48 /* MessageComposerViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>GroupMac.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
Expand Down
14 changes: 7 additions & 7 deletions GroupMac/ConvoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ final class ConvoViewController: NSViewController {
welcomeLabel.removeFromSuperview()

let headerView = convoHeaderViewController.view
// let messagesView = messagesViewController.view
let messagesView = messagesViewController.view
let composerView = messageComposerController.view

view.addSubview(headerView)
// view.addSubview(messagesView)
view.addSubview(messagesView)
view.addSubview(composerView)

headerView.translatesAutoresizingMaskIntoConstraints = false
Expand All @@ -57,11 +57,11 @@ final class ConvoViewController: NSViewController {
headerView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
headerView.heightAnchor.constraint(equalToConstant: 38).isActive = true

// messagesView.translatesAutoresizingMaskIntoConstraints = false
// messagesView.topAnchor.constraint(equalTo: view.topAnchor, constant: 4).isActive = true // overlap borders
// messagesView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
// messagesView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
// messagesView.bottomAnchor.constraint(equalTo: view.topAnchor, constant: 1).isActive = true // overlap borders
messagesView.translatesAutoresizingMaskIntoConstraints = false
messagesView.topAnchor.constraint(equalTo: headerView.bottomAnchor, constant: -1).isActive = true // overlap borders
messagesView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
messagesView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
messagesView.bottomAnchor.constraint(equalTo: composerView.topAnchor, constant: 1).isActive = true // overlap borders

composerView.translatesAutoresizingMaskIntoConstraints = false
composerView.heightAnchor.constraint(equalToConstant: 38).isActive = true
Expand Down
9 changes: 1 addition & 8 deletions GroupMac/MessagesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@ final class MessagesViewController: NSViewController, NSCollectionViewDelegateFl
private let scrollView = NSScrollView()

override func loadView() {
// view = scrollView
view = {
let view = NSView()

view.backColor = .white

return view
}()
view = scrollView
}
override func viewDidLoad() {
super.viewDidLoad()
Expand Down
52 changes: 5 additions & 47 deletions GroupMe/Attachment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import Foundation


protocol AttachmentContent {}

extension GroupMe {

class Attachment: Decodable {
Expand All @@ -20,7 +22,7 @@ extension GroupMe {
let values = try! decoder.container(keyedBy: CodingKeys.self)
let contentString = try! values.decode(String.self, forKey: .contentType)

self.contentType = ContentType(rawValue: contentString) ?? .notSupported
self.contentType = ContentType(rawValue: contentString) ?? .unknown

switch contentType {
case .image:
Expand All @@ -45,7 +47,7 @@ extension GroupMe {
case .mentions:
content = Mentions(loci: try! values.decode([[Int]].self, forKey: .loci))

case .notSupported:
case .unknown:
content = nil
}
}
Expand All @@ -57,7 +59,7 @@ extension GroupMe {
case emoji
case poll
case mentions
case notSupported
case unknown
}

private enum CodingKeys: String, CodingKey {
Expand Down Expand Up @@ -103,47 +105,3 @@ extension GroupMe {
}

}












































9 changes: 0 additions & 9 deletions GroupMe/AttachmentContent.swift

This file was deleted.

0 comments on commit 08f5d3b

Please sign in to comment.