mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-20 21:29:00 +00:00
excluded questionable photos from 500px data source endpoint call. removed unneeded files for ASDK example.
This commit is contained in:
parent
b5e502fbc9
commit
d96582913a
@ -19,21 +19,16 @@
|
||||
768843831CAA37EF00D8629E /* CommentsNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688436B1CAA37EF00D8629E /* CommentsNode.m */; };
|
||||
768843841CAA37EF00D8629E /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688436C1CAA37EF00D8629E /* CommentView.m */; };
|
||||
768843851CAA37EF00D8629E /* ImageURLModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688436D1CAA37EF00D8629E /* ImageURLModel.m */; };
|
||||
768843861CAA37EF00D8629E /* LikersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688436E1CAA37EF00D8629E /* LikersViewController.m */; };
|
||||
768843871CAA37EF00D8629E /* LocationCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688436F1CAA37EF00D8629E /* LocationCollectionViewController.m */; };
|
||||
768843881CAA37EF00D8629E /* LocationModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843701CAA37EF00D8629E /* LocationModel.m */; };
|
||||
768843891CAA37EF00D8629E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843711CAA37EF00D8629E /* main.m */; };
|
||||
7688438A1CAA37EF00D8629E /* MoreInfoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843721CAA37EF00D8629E /* MoreInfoViewController.m */; };
|
||||
7688438B1CAA37EF00D8629E /* PhotoCellNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843731CAA37EF00D8629E /* PhotoCellNode.m */; };
|
||||
7688438C1CAA37EF00D8629E /* PhotoCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843741CAA37EF00D8629E /* PhotoCollectionViewCell.m */; };
|
||||
7688438D1CAA37EF00D8629E /* PhotoFeedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843751CAA37EF00D8629E /* PhotoFeedModel.m */; };
|
||||
7688438E1CAA37EF00D8629E /* PhotoFeedNodeController.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */; };
|
||||
7688438F1CAA37EF00D8629E /* PhotoMapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843771CAA37EF00D8629E /* PhotoMapViewController.m */; };
|
||||
768843901CAA37EF00D8629E /* PhotoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843781CAA37EF00D8629E /* PhotoModel.m */; };
|
||||
768843911CAA37EF00D8629E /* PhotoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 768843791CAA37EF00D8629E /* PhotoTableViewCell.m */; };
|
||||
768843921CAA37EF00D8629E /* PhotoTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */; };
|
||||
768843931CAA37EF00D8629E /* UserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437B1CAA37EF00D8629E /* UserModel.m */; };
|
||||
768843941CAA37EF00D8629E /* UserProfileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437C1CAA37EF00D8629E /* UserProfileViewController.m */; };
|
||||
768843951CAA37EF00D8629E /* UserRowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437D1CAA37EF00D8629E /* UserRowView.m */; };
|
||||
768843961CAA37EF00D8629E /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 7688437E1CAA37EF00D8629E /* Utilities.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
@ -53,20 +48,15 @@
|
||||
768843541CAA37EF00D8629E /* CommentsNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentsNode.h; sourceTree = "<group>"; };
|
||||
768843551CAA37EF00D8629E /* CommentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentView.h; sourceTree = "<group>"; };
|
||||
768843561CAA37EF00D8629E /* ImageURLModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageURLModel.h; sourceTree = "<group>"; };
|
||||
768843571CAA37EF00D8629E /* LikersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LikersViewController.h; sourceTree = "<group>"; };
|
||||
768843581CAA37EF00D8629E /* LocationCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationCollectionViewController.h; sourceTree = "<group>"; };
|
||||
768843591CAA37EF00D8629E /* LocationModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationModel.h; sourceTree = "<group>"; };
|
||||
7688435A1CAA37EF00D8629E /* MoreInfoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoreInfoViewController.h; sourceTree = "<group>"; };
|
||||
7688435B1CAA37EF00D8629E /* PhotoCellNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoCellNode.h; sourceTree = "<group>"; };
|
||||
7688435C1CAA37EF00D8629E /* PhotoCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoCollectionViewCell.h; sourceTree = "<group>"; };
|
||||
7688435D1CAA37EF00D8629E /* PhotoFeedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoFeedModel.h; sourceTree = "<group>"; };
|
||||
7688435E1CAA37EF00D8629E /* PhotoFeedNodeController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoFeedNodeController.h; sourceTree = "<group>"; };
|
||||
7688435F1CAA37EF00D8629E /* PhotoMapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoMapViewController.h; sourceTree = "<group>"; };
|
||||
768843601CAA37EF00D8629E /* PhotoModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoModel.h; sourceTree = "<group>"; };
|
||||
768843611CAA37EF00D8629E /* PhotoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoTableViewCell.h; sourceTree = "<group>"; };
|
||||
768843621CAA37EF00D8629E /* PhotoTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhotoTableViewController.h; sourceTree = "<group>"; };
|
||||
768843631CAA37EF00D8629E /* UserModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserModel.h; sourceTree = "<group>"; };
|
||||
768843641CAA37EF00D8629E /* UserProfileViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserProfileViewController.h; sourceTree = "<group>"; };
|
||||
768843651CAA37EF00D8629E /* UserRowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserRowView.h; sourceTree = "<group>"; };
|
||||
768843661CAA37EF00D8629E /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utilities.h; sourceTree = "<group>"; };
|
||||
768843671CAA37EF00D8629E /* Flickrgram.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flickrgram.pch; sourceTree = "<group>"; };
|
||||
@ -76,21 +66,16 @@
|
||||
7688436B1CAA37EF00D8629E /* CommentsNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentsNode.m; sourceTree = "<group>"; };
|
||||
7688436C1CAA37EF00D8629E /* CommentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentView.m; sourceTree = "<group>"; };
|
||||
7688436D1CAA37EF00D8629E /* ImageURLModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageURLModel.m; sourceTree = "<group>"; };
|
||||
7688436E1CAA37EF00D8629E /* LikersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LikersViewController.m; sourceTree = "<group>"; };
|
||||
7688436F1CAA37EF00D8629E /* LocationCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationCollectionViewController.m; sourceTree = "<group>"; };
|
||||
768843701CAA37EF00D8629E /* LocationModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationModel.m; sourceTree = "<group>"; };
|
||||
768843711CAA37EF00D8629E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
768843721CAA37EF00D8629E /* MoreInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MoreInfoViewController.m; sourceTree = "<group>"; };
|
||||
768843731CAA37EF00D8629E /* PhotoCellNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoCellNode.m; sourceTree = "<group>"; };
|
||||
768843741CAA37EF00D8629E /* PhotoCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoCollectionViewCell.m; sourceTree = "<group>"; };
|
||||
768843751CAA37EF00D8629E /* PhotoFeedModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoFeedModel.m; sourceTree = "<group>"; };
|
||||
768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoFeedNodeController.m; sourceTree = "<group>"; };
|
||||
768843771CAA37EF00D8629E /* PhotoMapViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoMapViewController.m; sourceTree = "<group>"; };
|
||||
768843781CAA37EF00D8629E /* PhotoModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoModel.m; sourceTree = "<group>"; };
|
||||
768843791CAA37EF00D8629E /* PhotoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoTableViewCell.m; sourceTree = "<group>"; };
|
||||
7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhotoTableViewController.m; sourceTree = "<group>"; };
|
||||
7688437B1CAA37EF00D8629E /* UserModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserModel.m; sourceTree = "<group>"; };
|
||||
7688437C1CAA37EF00D8629E /* UserProfileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserProfileViewController.m; sourceTree = "<group>"; };
|
||||
7688437D1CAA37EF00D8629E /* UserRowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UserRowView.m; sourceTree = "<group>"; };
|
||||
7688437E1CAA37EF00D8629E /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utilities.m; sourceTree = "<group>"; };
|
||||
7688437F1CAA37EF00D8629E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
@ -133,54 +118,11 @@
|
||||
05E2128319D4DB510098F589 /* Sample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
767A5F121CAA3C66004CDA8D /* Assets.xcassets */,
|
||||
768843511CAA37EF00D8629E /* AppDelegate.h */,
|
||||
768843521CAA37EF00D8629E /* CommentFeedModel.h */,
|
||||
768843531CAA37EF00D8629E /* CommentModel.h */,
|
||||
768843541CAA37EF00D8629E /* CommentsNode.h */,
|
||||
768843551CAA37EF00D8629E /* CommentView.h */,
|
||||
768843561CAA37EF00D8629E /* ImageURLModel.h */,
|
||||
768843571CAA37EF00D8629E /* LikersViewController.h */,
|
||||
768843581CAA37EF00D8629E /* LocationCollectionViewController.h */,
|
||||
768843591CAA37EF00D8629E /* LocationModel.h */,
|
||||
7688435A1CAA37EF00D8629E /* MoreInfoViewController.h */,
|
||||
7688435B1CAA37EF00D8629E /* PhotoCellNode.h */,
|
||||
7688435C1CAA37EF00D8629E /* PhotoCollectionViewCell.h */,
|
||||
7688435D1CAA37EF00D8629E /* PhotoFeedModel.h */,
|
||||
7688435E1CAA37EF00D8629E /* PhotoFeedNodeController.h */,
|
||||
7688435F1CAA37EF00D8629E /* PhotoMapViewController.h */,
|
||||
768843601CAA37EF00D8629E /* PhotoModel.h */,
|
||||
768843611CAA37EF00D8629E /* PhotoTableViewCell.h */,
|
||||
768843621CAA37EF00D8629E /* PhotoTableViewController.h */,
|
||||
768843631CAA37EF00D8629E /* UserModel.h */,
|
||||
768843641CAA37EF00D8629E /* UserProfileViewController.h */,
|
||||
768843651CAA37EF00D8629E /* UserRowView.h */,
|
||||
768843661CAA37EF00D8629E /* Utilities.h */,
|
||||
768843671CAA37EF00D8629E /* Flickrgram.pch */,
|
||||
768843681CAA37EF00D8629E /* AppDelegate.m */,
|
||||
768843691CAA37EF00D8629E /* CommentFeedModel.m */,
|
||||
7688436A1CAA37EF00D8629E /* CommentModel.m */,
|
||||
7688436B1CAA37EF00D8629E /* CommentsNode.m */,
|
||||
7688436C1CAA37EF00D8629E /* CommentView.m */,
|
||||
7688436D1CAA37EF00D8629E /* ImageURLModel.m */,
|
||||
7688436E1CAA37EF00D8629E /* LikersViewController.m */,
|
||||
7688436F1CAA37EF00D8629E /* LocationCollectionViewController.m */,
|
||||
768843701CAA37EF00D8629E /* LocationModel.m */,
|
||||
768843711CAA37EF00D8629E /* main.m */,
|
||||
768843721CAA37EF00D8629E /* MoreInfoViewController.m */,
|
||||
768843731CAA37EF00D8629E /* PhotoCellNode.m */,
|
||||
768843741CAA37EF00D8629E /* PhotoCollectionViewCell.m */,
|
||||
768843751CAA37EF00D8629E /* PhotoFeedModel.m */,
|
||||
768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */,
|
||||
768843771CAA37EF00D8629E /* PhotoMapViewController.m */,
|
||||
768843781CAA37EF00D8629E /* PhotoModel.m */,
|
||||
768843791CAA37EF00D8629E /* PhotoTableViewCell.m */,
|
||||
7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */,
|
||||
7688437B1CAA37EF00D8629E /* UserModel.m */,
|
||||
7688437C1CAA37EF00D8629E /* UserProfileViewController.m */,
|
||||
7688437D1CAA37EF00D8629E /* UserRowView.m */,
|
||||
7688437E1CAA37EF00D8629E /* Utilities.m */,
|
||||
7688437F1CAA37EF00D8629E /* Info.plist */,
|
||||
767A5F141CAA3D8A004CDA8D /* Controller */,
|
||||
767A5F181CAA3DB0004CDA8D /* View */,
|
||||
767A5F171CAA3DA1004CDA8D /* Model */,
|
||||
05E2128419D4DB510098F589 /* Supporting Files */,
|
||||
);
|
||||
path = Sample;
|
||||
@ -189,6 +131,10 @@
|
||||
05E2128419D4DB510098F589 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
768843671CAA37EF00D8629E /* Flickrgram.pch */,
|
||||
7688437F1CAA37EF00D8629E /* Info.plist */,
|
||||
768843711CAA37EF00D8629E /* main.m */,
|
||||
767A5F121CAA3C66004CDA8D /* Assets.xcassets */,
|
||||
767A5F101CAA3BFE004CDA8D /* tabBarIcons */,
|
||||
0585427F19D4DBE100606EA6 /* Default-568h@2x.png */,
|
||||
6C2C82AA19EE274300767484 /* Default-667h@2x.png */,
|
||||
@ -214,6 +160,91 @@
|
||||
name = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F141CAA3D8A004CDA8D /* Controller */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
767A5F161CAA3D96004CDA8D /* UIKit */,
|
||||
767A5F151CAA3D90004CDA8D /* ASDK */,
|
||||
);
|
||||
name = Controller;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F151CAA3D90004CDA8D /* ASDK */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7688435E1CAA37EF00D8629E /* PhotoFeedNodeController.h */,
|
||||
768843761CAA37EF00D8629E /* PhotoFeedNodeController.m */,
|
||||
);
|
||||
name = ASDK;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F161CAA3D96004CDA8D /* UIKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
768843621CAA37EF00D8629E /* PhotoTableViewController.h */,
|
||||
7688437A1CAA37EF00D8629E /* PhotoTableViewController.m */,
|
||||
);
|
||||
name = UIKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F171CAA3DA1004CDA8D /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7688435D1CAA37EF00D8629E /* PhotoFeedModel.h */,
|
||||
768843751CAA37EF00D8629E /* PhotoFeedModel.m */,
|
||||
768843601CAA37EF00D8629E /* PhotoModel.h */,
|
||||
768843781CAA37EF00D8629E /* PhotoModel.m */,
|
||||
768843561CAA37EF00D8629E /* ImageURLModel.h */,
|
||||
7688436D1CAA37EF00D8629E /* ImageURLModel.m */,
|
||||
768843521CAA37EF00D8629E /* CommentFeedModel.h */,
|
||||
768843691CAA37EF00D8629E /* CommentFeedModel.m */,
|
||||
768843531CAA37EF00D8629E /* CommentModel.h */,
|
||||
7688436A1CAA37EF00D8629E /* CommentModel.m */,
|
||||
768843631CAA37EF00D8629E /* UserModel.h */,
|
||||
7688437B1CAA37EF00D8629E /* UserModel.m */,
|
||||
768843591CAA37EF00D8629E /* LocationModel.h */,
|
||||
768843701CAA37EF00D8629E /* LocationModel.m */,
|
||||
768843661CAA37EF00D8629E /* Utilities.h */,
|
||||
7688437E1CAA37EF00D8629E /* Utilities.m */,
|
||||
);
|
||||
name = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F181CAA3DB0004CDA8D /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
767A5F191CAA3DB9004CDA8D /* UIKit */,
|
||||
767A5F1A1CAA3DBF004CDA8D /* ASDK */,
|
||||
);
|
||||
name = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F191CAA3DB9004CDA8D /* UIKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
768843611CAA37EF00D8629E /* PhotoTableViewCell.h */,
|
||||
768843791CAA37EF00D8629E /* PhotoTableViewCell.m */,
|
||||
7688435C1CAA37EF00D8629E /* PhotoCollectionViewCell.h */,
|
||||
768843741CAA37EF00D8629E /* PhotoCollectionViewCell.m */,
|
||||
768843551CAA37EF00D8629E /* CommentView.h */,
|
||||
7688436C1CAA37EF00D8629E /* CommentView.m */,
|
||||
768843651CAA37EF00D8629E /* UserRowView.h */,
|
||||
7688437D1CAA37EF00D8629E /* UserRowView.m */,
|
||||
);
|
||||
name = UIKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
767A5F1A1CAA3DBF004CDA8D /* ASDK */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7688435B1CAA37EF00D8629E /* PhotoCellNode.h */,
|
||||
768843731CAA37EF00D8629E /* PhotoCellNode.m */,
|
||||
768843541CAA37EF00D8629E /* CommentsNode.h */,
|
||||
7688436B1CAA37EF00D8629E /* CommentsNode.m */,
|
||||
);
|
||||
name = ASDK;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -341,11 +372,9 @@
|
||||
768843891CAA37EF00D8629E /* main.m in Sources */,
|
||||
7688438C1CAA37EF00D8629E /* PhotoCollectionViewCell.m in Sources */,
|
||||
768843921CAA37EF00D8629E /* PhotoTableViewController.m in Sources */,
|
||||
7688438A1CAA37EF00D8629E /* MoreInfoViewController.m in Sources */,
|
||||
768843821CAA37EF00D8629E /* CommentModel.m in Sources */,
|
||||
768843831CAA37EF00D8629E /* CommentsNode.m in Sources */,
|
||||
768843961CAA37EF00D8629E /* Utilities.m in Sources */,
|
||||
768843941CAA37EF00D8629E /* UserProfileViewController.m in Sources */,
|
||||
768843931CAA37EF00D8629E /* UserModel.m in Sources */,
|
||||
768843801CAA37EF00D8629E /* AppDelegate.m in Sources */,
|
||||
768843811CAA37EF00D8629E /* CommentFeedModel.m in Sources */,
|
||||
@ -353,10 +382,7 @@
|
||||
768843841CAA37EF00D8629E /* CommentView.m in Sources */,
|
||||
768843951CAA37EF00D8629E /* UserRowView.m in Sources */,
|
||||
768843881CAA37EF00D8629E /* LocationModel.m in Sources */,
|
||||
7688438F1CAA37EF00D8629E /* PhotoMapViewController.m in Sources */,
|
||||
768843871CAA37EF00D8629E /* LocationCollectionViewController.m in Sources */,
|
||||
768843901CAA37EF00D8629E /* PhotoModel.m in Sources */,
|
||||
768843861CAA37EF00D8629E /* LikersViewController.m in Sources */,
|
||||
768843911CAA37EF00D8629E /* PhotoTableViewCell.m in Sources */,
|
||||
7688438B1CAA37EF00D8629E /* PhotoCellNode.m in Sources */,
|
||||
7688438D1CAA37EF00D8629E /* PhotoFeedModel.m in Sources */,
|
||||
@ -452,7 +478,7 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
INFOPLIST_FILE = Sample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.AsyncDisplayKit.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@ -469,7 +495,7 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
INFOPLIST_FILE = Sample/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.facebook.AsyncDisplayKit.Sample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@ -9,9 +9,7 @@
|
||||
#import "AppDelegate.h"
|
||||
#import "PhotoTableViewController.h"
|
||||
#import "PhotoFeedNodeController.h"
|
||||
#import "MoreInfoViewController.h"
|
||||
#import "Utilities.h"
|
||||
//#import "KMCGeigerCounter.h"
|
||||
#import "AsyncDisplayKit+Debug.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
@ -45,13 +43,6 @@
|
||||
//http://stackoverflow.com/questions/19022210/preferredstatusbarstyle-isnt-called/19513714#19513714
|
||||
uikitHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
||||
asdkHomeFeedNavCtrl.navigationBar.barStyle = UIBarStyleBlack;
|
||||
|
||||
|
||||
// create Stats viewController & navController
|
||||
// MoreInfoViewController *VC = [[MoreInfoViewController alloc] init];
|
||||
// VC.view.backgroundColor = [UIColor whiteColor];
|
||||
// UINavigationController *statsNavController = [[UINavigationController alloc] initWithRootViewController:VC];
|
||||
// statsNavController.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMore tag:0];
|
||||
|
||||
// configure UITabBarController and add viewControllers
|
||||
tabBarController.viewControllers = @[uikitHomeFeedNavCtrl, asdkHomeFeedNavCtrl];
|
||||
|
||||
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
@ -1,18 +0,0 @@
|
||||
//
|
||||
// LikersViewController.h
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 3/14/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "PhotoModel.h"
|
||||
|
||||
@interface LikersViewController : UIViewController
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
|
||||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
|
||||
- (instancetype)initWithPhoto:(PhotoModel *)photo NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
@ -1,110 +0,0 @@
|
||||
//
|
||||
// LikersViewController.m
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 3/14/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "LikersViewController.h"
|
||||
#import "UserRowView.h"
|
||||
#import "CommentFeedModel.h"
|
||||
|
||||
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 1.0
|
||||
|
||||
@interface LikersViewController () <UITableViewDataSource, UITableViewDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@implementation LikersViewController
|
||||
{
|
||||
PhotoModel *_photo;
|
||||
UITableView *_tableView;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)initWithPhoto:(PhotoModel *)photo
|
||||
{
|
||||
self = [super initWithNibName:nil bundle:nil];
|
||||
|
||||
if (self) {
|
||||
|
||||
self.navigationItem.title = @"LIKERS";
|
||||
|
||||
_photo = photo;
|
||||
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.allowsSelection = NO;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
|
||||
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"userRowCell"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self.view addSubview:_tableView];
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
[super viewWillLayoutSubviews];
|
||||
|
||||
self.navigationController.hidesBarsOnSwipe = NO; // FIXME: why won't this work?
|
||||
|
||||
_tableView.frame = self.view.bounds;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||
{
|
||||
CGFloat currentOffSetY = scrollView.contentOffset.y;
|
||||
CGFloat contentHeight = scrollView.contentSize.height;
|
||||
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
|
||||
|
||||
// automatic tail loading
|
||||
CGFloat screenfullsBeforeBottom = (contentHeight - currentOffSetY) / screenHeight;
|
||||
if (screenfullsBeforeBottom < AUTO_TAIL_LOADING_NUM_SCREENFULS) {
|
||||
// NSLog(@"AUTOMATIC TAIL LOADING BEGIN");
|
||||
[_photo.commentFeed requestPageWithCompletionBlock:^(NSArray *newComments) { // FIXME: add number of items to load
|
||||
[_tableView reloadData]; //FIXME: insert
|
||||
[self.view setNeedsLayout];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UITableViewDataSource methods
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return [_photo.commentFeed numberOfItemsInFeed];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:@"userRowCell"];
|
||||
|
||||
if ([[cell.contentView subviews] count] == 0) {
|
||||
UserRowView *userRowView = [[UserRowView alloc] initWithFrame:cell.frame withPhotoFeedModelType:UserRowViewTypeComments];
|
||||
[cell.contentView addSubview:userRowView];
|
||||
}
|
||||
|
||||
CommentModel *comment = [_photo.commentFeed objectAtIndex:indexPath.row];
|
||||
[[[cell.contentView subviews] objectAtIndex:0] updateWithCommentModel:comment];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,21 +0,0 @@
|
||||
//
|
||||
// LocationCollectionViewController.h
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 2/24/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <CoreLocation/CLLocation.h>
|
||||
|
||||
@interface LocationCollectionViewController : UICollectionViewController
|
||||
|
||||
|
||||
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
|
||||
coordinates:(CLLocationCoordinate2D)coordiantes NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout NS_UNAVAILABLE;
|
||||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
@ -1,130 +0,0 @@
|
||||
//
|
||||
// LocationCollectionViewController.m
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 2/24/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "LocationCollectionViewController.h"
|
||||
#import "PhotoCollectionViewCell.h"
|
||||
#import "PhotoFeedModel.h"
|
||||
#import <MapKit/MKMapView.h>
|
||||
#import <MapKit/MKPointAnnotation.h>
|
||||
|
||||
|
||||
#define MAP_HEIGHT_VERTICAL_SCREEN_RATIO 0.3
|
||||
|
||||
@implementation LocationCollectionViewController
|
||||
{
|
||||
CLLocationCoordinate2D _coordinates;
|
||||
MKMapView *_mapView;
|
||||
PhotoFeedModel *_photoFeed;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
|
||||
coordinates:(CLLocationCoordinate2D)coordiantes
|
||||
|
||||
{
|
||||
self = [super initWithCollectionViewLayout:layout];
|
||||
|
||||
if (self) {
|
||||
|
||||
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
||||
CGFloat screenScale = [[UIScreen mainScreen] scale];
|
||||
CGSize imageSize = CGSizeMake(screenRect.size.width * screenScale / 3.0, screenRect.size.width * screenScale / 3.0);
|
||||
|
||||
_photoFeed = [[PhotoFeedModel alloc] initWithPhotoFeedModelType:PhotoFeedModelTypeLocation imageSize:imageSize];
|
||||
[_photoFeed updatePhotoFeedModelTypeLocationCoordinates:coordiantes radiusInMiles:10];
|
||||
[_photoFeed refreshFeedWithCompletionBlock:^(NSArray *newPhotos) {
|
||||
[self.collectionView reloadData];
|
||||
} numResultsToReturn:21];
|
||||
|
||||
// set collection view dataSource and delegate
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.allowsSelection = NO;
|
||||
self.collectionView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
// register cell class
|
||||
[self.collectionView registerClass:[PhotoCollectionViewCell class] forCellWithReuseIdentifier:@"photo"];
|
||||
[self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"headerView"];
|
||||
|
||||
// configure MKMapView & add as subview
|
||||
_mapView = [[MKMapView alloc] init];
|
||||
_mapView.showsUserLocation = YES;
|
||||
|
||||
// set coordinates
|
||||
_coordinates = coordiantes;
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// add annotation for coordinates
|
||||
MKPointAnnotation *photoLocationAnnotation = [[MKPointAnnotation alloc] init];
|
||||
photoLocationAnnotation.coordinate = _coordinates;
|
||||
[_mapView addAnnotation:photoLocationAnnotation];
|
||||
|
||||
// center map on photo pin
|
||||
[_mapView setCenterCoordinate:_coordinates];
|
||||
|
||||
// set map span and region
|
||||
MKCoordinateSpan span = MKCoordinateSpanMake(5, 5);
|
||||
MKCoordinateRegion region = MKCoordinateRegionMake(_coordinates, span);
|
||||
[_mapView setRegion:region animated:NO];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
[super viewWillLayoutSubviews];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDataSource
|
||||
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
|
||||
{
|
||||
return [_photoFeed numberOfItemsInFeed];
|
||||
}
|
||||
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
// dequeue a reusable cell
|
||||
PhotoCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"photo" forIndexPath:indexPath];
|
||||
|
||||
// configure the cell for the appropriate photo
|
||||
[cell updateCellWithPhotoObject:[_photoFeed objectAtIndex:indexPath.row]];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UICollectionReusableView *reusableview = nil;
|
||||
|
||||
if (kind == UICollectionElementKindSectionHeader) {
|
||||
UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"headerView" forIndexPath:indexPath];
|
||||
|
||||
if (!headerView) {
|
||||
headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"headerView" forIndexPath:indexPath];
|
||||
}
|
||||
|
||||
_mapView.frame = headerView.frame;
|
||||
[headerView addSubview:_mapView];
|
||||
|
||||
reusableview = headerView;
|
||||
}
|
||||
|
||||
return reusableview;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@ -1,13 +0,0 @@
|
||||
//
|
||||
// MoreInfoViewController.h
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 3/21/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
|
||||
@interface MoreInfoViewController : ASViewController
|
||||
|
||||
@end
|
||||
@ -1,35 +0,0 @@
|
||||
//
|
||||
// MoreInfoViewController.m
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 3/21/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MoreInfoViewController.h"
|
||||
|
||||
@implementation MoreInfoViewController
|
||||
{
|
||||
ASTextNode *_textNode;
|
||||
}
|
||||
|
||||
//- (instancetype)initWithNode:(DisplayNodeType)node NS_DESIGNATED_INITIALIZER;
|
||||
//
|
||||
//{
|
||||
// self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
//
|
||||
// if (self) {
|
||||
//
|
||||
// self.navigationItem.title = @"500pixgram";
|
||||
// [self.navigationController setNavigationBarHidden:YES];
|
||||
//
|
||||
// _textNode = [[ASTextNode alloc] init];
|
||||
//
|
||||
// }
|
||||
//
|
||||
// return self;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@ -73,8 +73,7 @@
|
||||
// make sure to use _photoModel instance variable as photo may change when cell is reused,
|
||||
// where as local variable will never change
|
||||
if (locationModel == _photoModel.location) {
|
||||
_photoLocationLabel.attributedString = [[NSAttributedString alloc] initWithString:@"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"];
|
||||
// _photoLocationLabel.attributedString = [photo locationAttributedStringWithFontSize:FONT_SIZE];
|
||||
_photoLocationLabel.attributedString = [photo locationAttributedStringWithFontSize:FONT_SIZE];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
}];
|
||||
@ -98,20 +97,6 @@
|
||||
// instead of adding everything addSubnode:
|
||||
self.usesImplicitHierarchyManagement = YES;
|
||||
|
||||
// UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(cellWasLongPressed:)];
|
||||
// [self.view addGestureRecognizer:lpgr];
|
||||
//
|
||||
// // tap gesture recognizer
|
||||
// UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cellWasTapped:)];
|
||||
// [self.view addGestureRecognizer:tgr];
|
||||
|
||||
[_userAvatarImageView addTarget:self action:@selector(doNothing) forControlEvents:ASControlNodeEventTouchUpInside];
|
||||
[_photoLikesLabel addTarget:self action:@selector(doNothing) forControlEvents:ASControlNodeEventTouchUpInside];
|
||||
[_userNameLabel addTarget:self action:@selector(doNothing) forControlEvents:ASControlNodeEventTouchUpInside];
|
||||
_userAvatarImageView.hitTestSlop = UIEdgeInsetsMake(-10, -10, -10, -20);
|
||||
_photoLikesLabel.hitTestSlop = UIEdgeInsetsMake(5, 5, 5, 5);
|
||||
|
||||
|
||||
#if DEBUG_PHOTOCELL_LAYOUT
|
||||
_userAvatarImageView.backgroundColor = [UIColor greenColor];
|
||||
_userNameLabel.backgroundColor = [UIColor greenColor];
|
||||
|
||||
@ -10,11 +10,12 @@
|
||||
#import "ImageURLModel.h"
|
||||
|
||||
#define fiveHundredPX_ENDPOINT_HOST @"https://api.500px.com/v1/"
|
||||
#define fiveHundredPX_ENDPOINT_POPULAR @"photos?feature=popular&sort=rating&image_size=3&include_store=store_download&include_states=voted"
|
||||
#define fiveHundredPX_ENDPOINT_POPULAR @"photos?feature=popular&exclude=Nude,People,Fashion&sort=rating&image_size=3&include_store=store_download&include_states=voted"
|
||||
#define fiveHundredPX_ENDPOINT_SEARCH @"photos/search?geo=" //latitude,longitude,radius<units>
|
||||
#define fiveHundredPX_ENDPOINT_USER @"photos?user_id="
|
||||
#define fiveHundredPX_CONSUMER_KEY_PARAM @"&consumer_key=Fi13GVb8g53sGvHICzlram7QkKOlSDmAmp9s9aqC"
|
||||
|
||||
// &exclude='Nude,People'
|
||||
|
||||
@implementation PhotoFeedModel
|
||||
{
|
||||
|
||||
@ -10,15 +10,13 @@
|
||||
#import "PhotoModel.h"
|
||||
#import "PhotoCellNode.h"
|
||||
#import "PhotoTableViewCell.h"
|
||||
#import "UserProfileViewController.h"
|
||||
#import "LocationCollectionViewController.h"
|
||||
#import "PhotoFeedModel.h"
|
||||
#import <AsyncDisplayKit/AsyncDisplayKit.h>
|
||||
#import "Utilities.h"
|
||||
|
||||
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
||||
|
||||
@interface PhotoFeedNodeController () <ASTableDelegate, ASTableDataSource, PhotoTableViewCellProtocol>
|
||||
@interface PhotoFeedNodeController () <ASTableDelegate, ASTableDataSource>
|
||||
@end
|
||||
|
||||
@implementation PhotoFeedNodeController
|
||||
@ -37,7 +35,7 @@
|
||||
|
||||
if (self) {
|
||||
|
||||
self.navigationItem.title = @"500pixgram";
|
||||
self.navigationItem.title = @"ASDK";
|
||||
[self.navigationController setNavigationBarHidden:YES];
|
||||
|
||||
// _tableView.refreshControl = [[UIRefreshControl alloc] init];
|
||||
@ -215,59 +213,4 @@
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - PhotoTableViewCellProtocol
|
||||
|
||||
- (void)photoLikesWasTouchedWithPhoto:(PhotoModel *)photo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (void)userProfileWasTouchedWithUser:(UserModel *)user
|
||||
{
|
||||
UserProfileViewController *userProfileView = [[UserProfileViewController alloc] initWithUser:user];
|
||||
|
||||
[self.navigationController pushViewController:userProfileView animated:YES];
|
||||
}
|
||||
|
||||
- (void)photoLocationWasTouchedWithCoordinate:(CLLocationCoordinate2D)coordiantes name:(NSString *)name
|
||||
{
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumInteritemSpacing = 1;
|
||||
layout.minimumLineSpacing = 1;
|
||||
layout.headerReferenceSize = CGSizeMake(self.view.bounds.size.width, 200);
|
||||
|
||||
CGFloat numItemsLine = 3;
|
||||
layout.itemSize = CGSizeMake((self.view.bounds.size.width - (numItemsLine - 1)) / numItemsLine,
|
||||
(self.view.bounds.size.width - (numItemsLine - 1)) / numItemsLine);
|
||||
|
||||
LocationCollectionViewController *locationCVC = [[LocationCollectionViewController alloc] initWithCollectionViewLayout:layout coordinates:coordiantes];
|
||||
locationCVC.navigationItem.title = name;
|
||||
|
||||
[self.navigationController pushViewController:locationCVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)cellWasLongPressedWithPhoto:(PhotoModel *)photo
|
||||
{
|
||||
UIAlertAction *savePhotoAction = [UIAlertAction actionWithTitle:@"Save Photo"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
NSLog(@"hi");
|
||||
}];
|
||||
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
}];
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
[alert addAction:savePhotoAction];
|
||||
[alert addAction:cancelAction];
|
||||
|
||||
[self presentViewController:alert animated:YES completion:^{}];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
//
|
||||
// PhotoMapViewController.h
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 3/2/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface PhotoMapViewController : UIViewController
|
||||
|
||||
@end
|
||||
@ -1,195 +0,0 @@
|
||||
//
|
||||
// PhotoMapViewController.m
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 3/2/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PhotoMapViewController.h"
|
||||
#import <MapKit/MKMapView.h>
|
||||
#import <MapKit/MKPointAnnotation.h>
|
||||
#import <MapKit/MKUserLocation.h>
|
||||
|
||||
@interface PhotoMapViewController () <MKMapViewDelegate, CLLocationManagerDelegate>
|
||||
@end
|
||||
|
||||
@implementation PhotoMapViewController
|
||||
{
|
||||
MKMapView *_mapView;
|
||||
UIButton *_mapCrosshairsBtn;
|
||||
CLLocationManager *_locationManager;
|
||||
BOOL _userLocationEnabled;
|
||||
BOOL _CLLocationAuthorizationStatusDeniedAlertPresentedOnce;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
|
||||
if (self) {
|
||||
|
||||
self.navigationItem.title = @"Discover Nearby Photos";
|
||||
|
||||
// location manager
|
||||
_locationManager = [[CLLocationManager alloc] init];
|
||||
_locationManager.delegate = self;
|
||||
|
||||
// map view
|
||||
_mapView = [[MKMapView alloc] init];
|
||||
_mapView.delegate = self;
|
||||
|
||||
[self.view addSubview:_mapView];
|
||||
|
||||
// map view - crosshairs button
|
||||
_mapCrosshairsBtn = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
[_mapCrosshairsBtn setImage:[UIImage imageNamed:@"crosshairs"] forState:UIControlStateNormal];
|
||||
[_mapCrosshairsBtn addTarget:self action:@selector(centerMapOnUsersLocationIfLocationEnabled) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
[self.view addSubview:_mapCrosshairsBtn];
|
||||
|
||||
// check App's CLLocation authorization status
|
||||
[self checkCLAuthorizationStatusWithAlertForStatusDenied:NO];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// check App's CLLocation authorization status & prompt user to enable if not authorized
|
||||
[self checkCLAuthorizationStatusWithAlertForStatusDenied:YES];
|
||||
|
||||
if (_userLocationEnabled) {
|
||||
|
||||
// if the user's location is enabled show it on the map
|
||||
_mapView.showsUserLocation = YES;
|
||||
|
||||
[_locationManager startUpdatingLocation];
|
||||
|
||||
// check if user's Location is in mapView visible area, if not center the map on the user
|
||||
MKMapPoint userPoint = MKMapPointForCoordinate(_mapView.userLocation.location.coordinate);
|
||||
MKMapRect mapRect = _mapView.visibleMapRect;
|
||||
BOOL inside = MKMapRectContainsPoint(mapRect, userPoint);
|
||||
if (!inside) {
|
||||
[self centerMapOnUsersLocation];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MAP_CROSSHAIRS_BTN_WIDTH 30
|
||||
#define MAP_CROSSHAIRS_BTN_INSET 20
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
// FIXME: tune into NSNotification
|
||||
|
||||
[super viewWillLayoutSubviews];
|
||||
|
||||
CGSize boundsSize = self.view.bounds.size;
|
||||
|
||||
// layout map crosshairs button
|
||||
CGSize btnSize = CGSizeMake(MAP_CROSSHAIRS_BTN_WIDTH, MAP_CROSSHAIRS_BTN_WIDTH);
|
||||
CGFloat x = boundsSize.width - btnSize.width - MAP_CROSSHAIRS_BTN_INSET;
|
||||
CGFloat y = CGRectGetMinY(self.tabBarController.tabBar.frame) - btnSize.width - MAP_CROSSHAIRS_BTN_INSET;
|
||||
_mapCrosshairsBtn.frame = (CGRect) {CGPointMake(x, y), btnSize};
|
||||
|
||||
// layout mapView
|
||||
_mapView.frame = self.view.bounds;
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated
|
||||
{
|
||||
if (_userLocationEnabled) {
|
||||
[_locationManager stopUpdatingLocation];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Helper Functions
|
||||
|
||||
- (void)centerMapOnUsersLocationIfLocationEnabled
|
||||
{
|
||||
if (_userLocationEnabled) {
|
||||
[self centerMapOnUsersLocation];
|
||||
} else {
|
||||
[self checkCLAuthorizationStatusWithAlertForStatusDenied:YES];
|
||||
}
|
||||
}
|
||||
|
||||
#define ZOOM_SPAN_DELTA 0.03
|
||||
- (void)centerMapOnUsersLocation
|
||||
{
|
||||
// set mapView region
|
||||
CLLocationCoordinate2D location;
|
||||
CLLocation *usersLocation = [_locationManager location];
|
||||
location.latitude = usersLocation.coordinate.latitude;
|
||||
location.longitude = usersLocation.coordinate.longitude;
|
||||
MKCoordinateSpan span = MKCoordinateSpanMake(ZOOM_SPAN_DELTA, ZOOM_SPAN_DELTA);
|
||||
MKCoordinateRegion region = MKCoordinateRegionMake(location, span);
|
||||
|
||||
[_mapView setRegion:region animated:YES];
|
||||
}
|
||||
|
||||
- (void)checkCLAuthorizationStatusWithAlertForStatusDenied:(BOOL)showDeniedAlert
|
||||
{
|
||||
// check app's permission to use location services
|
||||
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
||||
|
||||
if (status == kCLAuthorizationStatusNotDetermined) {
|
||||
|
||||
NSLog(@"App's permission to use location NOT DETERMINED");
|
||||
_userLocationEnabled = NO;
|
||||
[_locationManager requestWhenInUseAuthorization];
|
||||
|
||||
} else if (status == kCLAuthorizationStatusDenied) {
|
||||
|
||||
NSLog(@"App's permission to use location DENIED");
|
||||
|
||||
_userLocationEnabled = NO;
|
||||
|
||||
if (showDeniedAlert) {
|
||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
|
||||
message:@"Location services disabled. See Settings > Flickergram > Location to change."
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction *acknowledgeAction = [UIAlertAction actionWithTitle:@"Ok"
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * _Nonnull action) {}];
|
||||
|
||||
[alertController addAction:acknowledgeAction];
|
||||
|
||||
[self presentViewController:alertController animated:YES completion:^{}];
|
||||
}
|
||||
|
||||
} else if (status == kCLAuthorizationStatusRestricted) {
|
||||
|
||||
NSLog(@"App's permission to use location RESTRICTED");
|
||||
_userLocationEnabled = NO;
|
||||
|
||||
} else {
|
||||
|
||||
NSLog(@"App has permission to use location");
|
||||
_userLocationEnabled = YES;
|
||||
_mapView.showsUserLocation = YES;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MKMapKitDelegate
|
||||
|
||||
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
|
||||
{
|
||||
// FIXME:
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - CLLocationManagerDelegate
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
|
||||
{
|
||||
[self checkCLAuthorizationStatusWithAlertForStatusDenied:NO];
|
||||
[self centerMapOnUsersLocationIfLocationEnabled];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -88,12 +88,6 @@
|
||||
[self addSubview:_photoLikesLabel];
|
||||
[self addSubview:_photoDescriptionLabel];
|
||||
|
||||
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(cellWasLongPressed:)];
|
||||
[self addGestureRecognizer:lpgr];
|
||||
|
||||
UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cellWasTapped:)];
|
||||
[self addGestureRecognizer:tgr];
|
||||
|
||||
#if DEBUG_PHOTOCELL_LAYOUT
|
||||
_userAvatarImageView.backgroundColor = [UIColor greenColor];
|
||||
_userNameLabel.backgroundColor = [UIColor greenColor];
|
||||
@ -266,84 +260,4 @@
|
||||
// }];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Gesture Handling
|
||||
|
||||
- (void)cellWasLongPressed:(UIGestureRecognizer *)sender
|
||||
{
|
||||
if (sender.state == UIGestureRecognizerStateBegan) {
|
||||
|
||||
// determine which area of cell was tapped
|
||||
CGPoint tapPoint = [sender locationInView:_photoImageView];
|
||||
|
||||
if (tapPoint.y > 0) {
|
||||
|
||||
// photo long pressed
|
||||
NSLog(@"LONG PRESS");
|
||||
|
||||
// need a 2nd method to be able to pass photo model
|
||||
[self longPressRecognized];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)longPressRecognized
|
||||
{
|
||||
[self.delegate cellWasLongPressedWithPhoto:_photoModel];
|
||||
}
|
||||
|
||||
- (void)cellWasTapped:(UIGestureRecognizer *)sender
|
||||
{
|
||||
// determine which area of cell was tapped
|
||||
CGPoint tapPoint = [sender locationInView:self];
|
||||
|
||||
if (tapPoint.y > HEADER_HEIGHT && tapPoint.y < (HEADER_HEIGHT + self.bounds.size.width)) {
|
||||
|
||||
// photo tapped
|
||||
NSLog(@"TAP: photo");
|
||||
|
||||
} else if (tapPoint.y > (HEADER_HEIGHT + self.bounds.size.width)) {
|
||||
|
||||
[self.delegate photoLikesWasTouchedWithPhoto:_photoModel];
|
||||
[_photoModel.commentFeed requestPageWithCompletionBlock:^(NSArray *newcomments) {}]; //FIXME: make comments likes :)
|
||||
|
||||
// photo tapped
|
||||
NSLog(@"TAP: photo likes");
|
||||
|
||||
} else if (tapPoint.x <= CGRectGetMaxX(_userAvatarImageView.frame)) {
|
||||
|
||||
// user avatar tapped
|
||||
NSLog(@"TAP: Buddy Icon");
|
||||
|
||||
[self.delegate userProfileWasTouchedWithUser:_photoModel.ownerUserProfile];
|
||||
|
||||
// start downloading likes
|
||||
[self startDownloadingLikesForPhoto:_photoModel];
|
||||
|
||||
} else if (tapPoint.x < CGRectGetMinX(_photoTimeIntervalSincePostLabel.frame)) {
|
||||
|
||||
// check if location exists
|
||||
if (_photoLocationLabel.attributedText) {
|
||||
|
||||
if (tapPoint.y > CGRectGetMinY(_photoLocationLabel.frame)) {
|
||||
NSLog(@"TAP: Location Label");
|
||||
[self.delegate photoLocationWasTouchedWithCoordinate:_photoModel.location.coordinates name:_photoLocationLabel.attributedText];
|
||||
|
||||
} else {
|
||||
|
||||
NSLog(@"Tap: Username Label");
|
||||
|
||||
[self.delegate userProfileWasTouchedWithUser:_photoModel.ownerUserProfile];
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// username tapped
|
||||
NSLog(@"Tap: Username Label");
|
||||
|
||||
[self.delegate userProfileWasTouchedWithUser:_photoModel.ownerUserProfile];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -8,17 +8,12 @@
|
||||
|
||||
#import "PhotoTableViewController.h"
|
||||
#import "PhotoTableViewCell.h"
|
||||
#import "UserProfileViewController.h"
|
||||
#import "LikersViewController.h"
|
||||
#import "LocationCollectionViewController.h"
|
||||
#import "PhotoFeedModel.h"
|
||||
#import "Utilities.h"
|
||||
|
||||
|
||||
#define AUTO_TAIL_LOADING_NUM_SCREENFULS 2.5
|
||||
|
||||
@interface PhotoTableViewController () <PhotoTableViewCellProtocol>
|
||||
@end
|
||||
|
||||
@implementation PhotoTableViewController
|
||||
{
|
||||
@ -35,7 +30,7 @@
|
||||
|
||||
if (self) {
|
||||
|
||||
self.navigationItem.title = @"500pixgram";
|
||||
self.navigationItem.title = @"UIKit";
|
||||
[self.navigationController setNavigationBarHidden:YES];
|
||||
|
||||
self.refreshControl = [[UIRefreshControl alloc] init];
|
||||
@ -196,7 +191,6 @@
|
||||
{
|
||||
PhotoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"photoCell" forIndexPath:indexPath];
|
||||
|
||||
cell.delegate = self;
|
||||
[cell updateCellWithPhotoObject:[_photoFeed objectAtIndex:indexPath.row]];
|
||||
|
||||
return cell;
|
||||
@ -208,66 +202,4 @@
|
||||
return [PhotoTableViewCell heightForPhotoModel:photo withWidth:self.view.bounds.size.width];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - PhotoTableViewCellProtocol
|
||||
|
||||
- (void)userProfileWasTouchedWithUser:(UserModel *)user;
|
||||
{
|
||||
UserProfileViewController *userProfileView = [[UserProfileViewController alloc] initWithUser:user];
|
||||
[self.navigationController pushViewController:userProfileView animated:YES];
|
||||
|
||||
// force navigationController visible
|
||||
[self.navigationController setNavigationBarHidden:NO];
|
||||
}
|
||||
|
||||
- (void)photoLocationWasTouchedWithCoordinate:(CLLocationCoordinate2D)coordiantes name:(NSAttributedString *)name
|
||||
{
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.minimumInteritemSpacing = 1;
|
||||
layout.minimumLineSpacing = 1;
|
||||
|
||||
CGFloat boundsWidth = self.view.bounds.size.width;
|
||||
layout.headerReferenceSize = CGSizeMake(boundsWidth, 200);
|
||||
|
||||
CGFloat photoColumnCount = 3;
|
||||
CGFloat photoSize = (boundsWidth - (photoColumnCount - 1)) / photoColumnCount;
|
||||
layout.itemSize = CGSizeMake(photoSize, photoSize);
|
||||
|
||||
LocationCollectionViewController *locationCVC = [[LocationCollectionViewController alloc] initWithCollectionViewLayout:layout coordinates:coordiantes];
|
||||
locationCVC.navigationItem.title = name.string;
|
||||
|
||||
[self.navigationController pushViewController:locationCVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)cellWasLongPressedWithPhoto:(PhotoModel *)photo
|
||||
{
|
||||
UIAlertAction *savePhotoAction = [UIAlertAction actionWithTitle:@"Save Photo"
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
NSLog(@"hi");
|
||||
}];
|
||||
|
||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel"
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
}];
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
|
||||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleActionSheet];
|
||||
|
||||
[alert addAction:savePhotoAction];
|
||||
[alert addAction:cancelAction];
|
||||
|
||||
[self presentViewController:alert animated:YES completion:^{}];
|
||||
}
|
||||
|
||||
- (void)photoLikesWasTouchedWithPhoto:(PhotoModel *)photo
|
||||
{
|
||||
LikersViewController *vc = [[LikersViewController alloc] initWithPhoto:photo];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
|
||||
// force navigationController visible
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
//
|
||||
// UserProfileViewController.h
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 2/24/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "UserModel.h"
|
||||
|
||||
@interface UserProfileViewController : UIViewController
|
||||
|
||||
//- (instancetype)initWithMe NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithUser:(UserModel *)user NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
|
||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
|
||||
|
||||
|
||||
@end
|
||||
@ -1,401 +0,0 @@
|
||||
//
|
||||
// UserProfileViewController.m
|
||||
// Flickrgram
|
||||
//
|
||||
// Created by Hannah Troisi on 2/24/16.
|
||||
// Copyright © 2016 Hannah Troisi. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UserProfileViewController.h"
|
||||
#import "Utilities.h"
|
||||
|
||||
#define HEADER_HEIGHT 300
|
||||
#define USER_AVATAR_HEIGHT 70
|
||||
#define HEADER_HORIZONTAL_INSET 15
|
||||
|
||||
#define DEBUG_LAYOUT 0
|
||||
|
||||
@implementation UserProfileViewController
|
||||
{
|
||||
UserModel *_user;
|
||||
|
||||
UIImageView *_avatarImageView;
|
||||
UIButton *_followingStatusBtn;
|
||||
UILabel *_fullNameLabel;
|
||||
UILabel *_aboutLabel;
|
||||
UILabel *_domainLabel;
|
||||
UILabel *_followersCountLabel;
|
||||
UILabel *_followingCountLabel;
|
||||
UILabel *_photoCountLabel;
|
||||
|
||||
BOOL _animating;
|
||||
}
|
||||
|
||||
//- (instancetype)initWithMe
|
||||
//{
|
||||
// UserModel *me = [[UserModel alloc] initWithMe];
|
||||
//
|
||||
// [self initWithUser:me];
|
||||
//}
|
||||
|
||||
- (instancetype)initWithUser:(UserModel *)user
|
||||
{
|
||||
self = [super initWithNibName:nil bundle:nil];
|
||||
|
||||
if (self) {
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
_followingStatusBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_followingStatusBtn.adjustsImageWhenHighlighted = NO;
|
||||
[_followingStatusBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_followingStatusBtn setTitleColor:[UIColor lightBlueColor] forState:UIControlStateSelected];
|
||||
[_followingStatusBtn setTitle:@"Follow" forState:UIControlStateNormal];
|
||||
[_followingStatusBtn setTitle:@"Following" forState:UIControlStateSelected];
|
||||
[_followingStatusBtn addTarget:self action:@selector(toggleFollowing) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view addSubview:_followingStatusBtn];
|
||||
|
||||
_fullNameLabel = [[UILabel alloc] init];
|
||||
_fullNameLabel.font = [_fullNameLabel.font fontWithSize:14];
|
||||
[self.view addSubview:_fullNameLabel];
|
||||
|
||||
_aboutLabel = [[UILabel alloc] init];
|
||||
_aboutLabel.font = [_aboutLabel.font fontWithSize:14];
|
||||
_aboutLabel.numberOfLines = 3;
|
||||
[self.view addSubview:_aboutLabel];
|
||||
|
||||
_domainLabel = [[UILabel alloc] init];
|
||||
_domainLabel.font = [_domainLabel.font fontWithSize:14];
|
||||
_domainLabel.textColor = [UIColor darkBlueColor];
|
||||
[self.view addSubview:_domainLabel];
|
||||
|
||||
_followersCountLabel = [[UILabel alloc] init];
|
||||
_followersCountLabel.font = [_followersCountLabel.font fontWithSize:14];
|
||||
_followersCountLabel.textColor = [UIColor lightGrayColor];
|
||||
_followersCountLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_followersCountLabel.numberOfLines = 2;
|
||||
[self.view addSubview:_followersCountLabel];
|
||||
|
||||
_followingCountLabel = [[UILabel alloc] init];
|
||||
_followingCountLabel.font = [_followingCountLabel.font fontWithSize:14];
|
||||
_followingCountLabel.textColor = [UIColor lightGrayColor];
|
||||
_followingCountLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_followingCountLabel.numberOfLines = 2;
|
||||
[self.view addSubview:_followingCountLabel];
|
||||
|
||||
_photoCountLabel = [[UILabel alloc] init];
|
||||
_photoCountLabel.font = [_photoCountLabel.font fontWithSize:14];
|
||||
_photoCountLabel.textColor = [UIColor lightGrayColor];
|
||||
_photoCountLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_photoCountLabel.numberOfLines = 2;
|
||||
[self.view addSubview:_photoCountLabel];
|
||||
|
||||
// add to view last so that animation is on top
|
||||
_avatarImageView = [[UIImageView alloc] init];
|
||||
[self.view addSubview:_avatarImageView];
|
||||
|
||||
// This is what we have available as soon as we're created, without fetching new metadata from the network.
|
||||
_fullNameLabel.text = _user.fullName;
|
||||
_user = user;
|
||||
self.navigationItem.title = [user.username uppercaseString];
|
||||
|
||||
// get full set of user data
|
||||
[self loadAdditionalProfileFields];
|
||||
|
||||
// get avatar image
|
||||
[self loadAvatarImage];
|
||||
|
||||
|
||||
|
||||
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(viewWasLongPressed:)];
|
||||
// [self.view addGestureRecognizer:lpgr];
|
||||
lpgr.minimumPressDuration = 0.01;
|
||||
|
||||
if (DEBUG_LAYOUT) {
|
||||
_avatarImageView.backgroundColor = [UIColor greenColor];
|
||||
_fullNameLabel.backgroundColor = [UIColor greenColor];
|
||||
_aboutLabel.backgroundColor = [UIColor greenColor];
|
||||
_domainLabel.backgroundColor = [UIColor greenColor];
|
||||
_followersCountLabel.backgroundColor = [UIColor greenColor];
|
||||
_followingCountLabel.backgroundColor = [UIColor greenColor];
|
||||
_photoCountLabel.backgroundColor = [UIColor greenColor];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLayoutSubviews
|
||||
{
|
||||
[super viewDidLayoutSubviews];
|
||||
|
||||
CGSize boundsSize = self.view.bounds.size;
|
||||
|
||||
if (_animating) {
|
||||
return;
|
||||
}
|
||||
|
||||
// user avatar
|
||||
CGFloat x = HEADER_HORIZONTAL_INSET;
|
||||
CGFloat originalY = CGRectGetMaxY(self.navigationController.navigationBar.frame) + HEADER_HORIZONTAL_INSET;
|
||||
CGFloat y = originalY;
|
||||
_avatarImageView.frame = CGRectMake(x,
|
||||
y,
|
||||
USER_AVATAR_HEIGHT,
|
||||
USER_AVATAR_HEIGHT);
|
||||
y += _avatarImageView.frame.size.height;
|
||||
|
||||
if (!_avatarImageView.image) {
|
||||
// We generate the rounded image at layout time (unusually late) so that we can know exactly how large
|
||||
// it needs to be. This is the only way to ensure the rounded curve is perfectly smoothed / antialiased.
|
||||
// _avatarImageView.image = [avatar makeCircularImageWithSize:CGSizeMake(USER_AVATAR_HEIGHT, USER_AVATAR_HEIGHT)];
|
||||
}
|
||||
|
||||
if (_fullNameLabel.text) {
|
||||
[_fullNameLabel sizeToFit];
|
||||
y += HEADER_HORIZONTAL_INSET / 2.0;
|
||||
_fullNameLabel.frame = CGRectMake(x,
|
||||
y,
|
||||
boundsSize.width - 2 * HEADER_HORIZONTAL_INSET,
|
||||
_fullNameLabel.frame.size.height);
|
||||
|
||||
y += _fullNameLabel.frame.size.height;
|
||||
}
|
||||
|
||||
if (_aboutLabel.text) {
|
||||
[_aboutLabel sizeToFit];
|
||||
y += HEADER_HORIZONTAL_INSET / 2.0;
|
||||
_aboutLabel.frame = CGRectMake(x,
|
||||
y,
|
||||
boundsSize.width - 2 * HEADER_HORIZONTAL_INSET,
|
||||
_aboutLabel.frame.size.height);
|
||||
|
||||
y += _aboutLabel.frame.size.height;
|
||||
}
|
||||
|
||||
if (_domainLabel.text) {
|
||||
[_domainLabel sizeToFit];
|
||||
y += HEADER_HORIZONTAL_INSET / 2.0;
|
||||
_domainLabel.frame = CGRectMake(x,
|
||||
y,
|
||||
boundsSize.width - 2 * HEADER_HORIZONTAL_INSET,
|
||||
_domainLabel.frame.size.height);
|
||||
}
|
||||
|
||||
CGFloat availableWidth = boundsSize.width - 3 * HEADER_HORIZONTAL_INSET - USER_AVATAR_HEIGHT;
|
||||
CGFloat actualWidth = floorf((availableWidth - 2 * HEADER_HORIZONTAL_INSET / 2.0) / 3.0);
|
||||
|
||||
y = originalY;
|
||||
x += USER_AVATAR_HEIGHT + HEADER_HORIZONTAL_INSET;
|
||||
|
||||
[_photoCountLabel sizeToFit];
|
||||
_photoCountLabel.frame = CGRectMake(x,
|
||||
y,
|
||||
actualWidth,
|
||||
_photoCountLabel.frame.size.height);
|
||||
x += actualWidth;
|
||||
|
||||
[_followersCountLabel sizeToFit];
|
||||
x += HEADER_HORIZONTAL_INSET / 2.0;
|
||||
_followersCountLabel.frame = CGRectMake(x,
|
||||
y,
|
||||
actualWidth,
|
||||
_followersCountLabel.frame.size.height);
|
||||
x += actualWidth;
|
||||
|
||||
[_followingCountLabel sizeToFit];
|
||||
x += HEADER_HORIZONTAL_INSET / 2.0;
|
||||
_followingCountLabel.frame = CGRectMake(x,
|
||||
y,
|
||||
actualWidth,
|
||||
_followingCountLabel.frame.size.height);
|
||||
|
||||
x = USER_AVATAR_HEIGHT + 2 * HEADER_HORIZONTAL_INSET;
|
||||
y = originalY + USER_AVATAR_HEIGHT / 2.0;
|
||||
_followingStatusBtn.frame = CGRectMake(x,
|
||||
y,
|
||||
availableWidth,
|
||||
USER_AVATAR_HEIGHT / 2.0);
|
||||
|
||||
[self setFollowingButtonBackgroundsForRect:_followingStatusBtn.frame.size];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Touch Events
|
||||
|
||||
- (void)viewWasLongPressed:(UIGestureRecognizer *)sender
|
||||
{
|
||||
|
||||
if (sender.state == UIGestureRecognizerStateBegan) {
|
||||
|
||||
// determine which area of cell was tapped
|
||||
CGPoint tapPoint = [sender locationInView:_avatarImageView];
|
||||
|
||||
if (tapPoint.y > 0) {
|
||||
|
||||
NSLog(@"LONG PRESS STARTED");
|
||||
|
||||
_animating = YES;
|
||||
|
||||
// FIXME: use pinremote image to download higher res photo
|
||||
|
||||
[UIView animateWithDuration:0.2
|
||||
delay:0
|
||||
usingSpringWithDamping:0.5
|
||||
initialSpringVelocity:1.0f
|
||||
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
|
||||
animations:^{
|
||||
|
||||
// FIXME: grey the background
|
||||
|
||||
_avatarImageView.frame = CGRectMake(100, 100, 100, 100);
|
||||
|
||||
} completion:^(BOOL finished) {
|
||||
_animating = NO;
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
if (sender.state == UIGestureRecognizerStateEnded) {
|
||||
|
||||
// determine which area of cell was tapped
|
||||
CGPoint tapPoint = [sender locationInView:_avatarImageView];
|
||||
|
||||
if (tapPoint.y > 0) { // FIXME: all long presses work here
|
||||
|
||||
NSLog(@"LONG PRESS ENDED");
|
||||
|
||||
_animating = YES;
|
||||
|
||||
[UIView animateWithDuration:0.2
|
||||
delay:0
|
||||
usingSpringWithDamping:0.5
|
||||
initialSpringVelocity:1.0f
|
||||
options: UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
|
||||
animations:^{
|
||||
|
||||
CGFloat x = HEADER_HORIZONTAL_INSET;
|
||||
CGFloat originalY = CGRectGetMaxY(self.navigationController.navigationBar.frame) + HEADER_HORIZONTAL_INSET;
|
||||
CGFloat y = originalY;
|
||||
_avatarImageView.frame = CGRectMake(x,
|
||||
y,
|
||||
USER_AVATAR_HEIGHT,
|
||||
USER_AVATAR_HEIGHT);
|
||||
|
||||
} completion:^(BOOL finished) {
|
||||
_animating = NO;
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleFollowing
|
||||
{
|
||||
// toggle button state
|
||||
if (_followingStatusBtn.selected) {
|
||||
|
||||
// stop following
|
||||
NSString *urlString = [NSString stringWithFormat:@"https://api.500px.com/v1/users/%lu/friends?consumer_key=Fi13GVb8g53sGvHICzlram7QkKOlSDmAmp9s9aqC", (long)_user.userID];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
[request setHTTPMethod:@"DELETE"];
|
||||
|
||||
// FIXME: update user model
|
||||
// FIXME: check for success
|
||||
|
||||
} else {
|
||||
|
||||
// start following
|
||||
NSString *urlString = [NSString stringWithFormat:@"https://api.500px.com/v1/users/%lu/friends?consumer_key=Fi13GVb8g53sGvHICzlram7QkKOlSDmAmp9s9aqC", (long)_user.userID];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
[request setHTTPMethod:@"POST"];
|
||||
}
|
||||
|
||||
_followingStatusBtn.selected = !_followingStatusBtn.selected;
|
||||
}
|
||||
|
||||
- (void)getFollowers
|
||||
{
|
||||
NSString *urlString = [NSString stringWithFormat:@"https://api.500px.com/v1/users/%lu/friends?consumer_key=Fi13GVb8g53sGvHICzlram7QkKOlSDmAmp9s9aqC", (long)_user.userID];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
[request setHTTPMethod:@"GET"];
|
||||
}
|
||||
|
||||
#pragma mark - Helper Methods
|
||||
|
||||
- (void)loadAdditionalProfileFields
|
||||
{
|
||||
// fetch full user profile info
|
||||
[_user downloadCompleteUserDataWithCompletionBlock:^(UserModel *userModel) {
|
||||
|
||||
// check that info returning from async download is still applicable to this view
|
||||
if (userModel == _user) {
|
||||
|
||||
_followingStatusBtn.selected = userModel.following;
|
||||
_followersCountLabel.text = [NSString stringWithFormat:@"%lu\nfollowers", (long)userModel.followersCount];
|
||||
_followingCountLabel.text = [NSString stringWithFormat:@"%lu\nfollowing", (long)userModel.friendsCount];
|
||||
_photoCountLabel.text = [NSString stringWithFormat:@"%lu\nphotos", (long)userModel.photoCount];
|
||||
_aboutLabel.text = userModel.about;
|
||||
_domainLabel.text = userModel.domain;
|
||||
|
||||
[self.view setNeedsLayout];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)loadAvatarImage
|
||||
{
|
||||
[_user fetchAvatarImageWithCompletionBlock:^(UserModel *userModel, UIImage *avatar) {
|
||||
|
||||
// check that info returning from async download is still applicable to this view
|
||||
if (userModel == _user) {
|
||||
[self.view setNeedsLayout];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#define FOLLOW_BUTTON_CORNER_RADIUS 8
|
||||
- (void)setFollowingButtonBackgroundsForRect:(CGSize)size
|
||||
{
|
||||
CGSize unstretchedSize = CGSizeMake(2 * FOLLOW_BUTTON_CORNER_RADIUS + 1, 2 * FOLLOW_BUTTON_CORNER_RADIUS + 1);
|
||||
CGRect rect = (CGRect) {CGPointZero, unstretchedSize};
|
||||
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:FOLLOW_BUTTON_CORNER_RADIUS];
|
||||
|
||||
UIColor *lightBlue = [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0];
|
||||
|
||||
// create a graphics context for the following status button
|
||||
UIGraphicsBeginImageContextWithOptions(unstretchedSize, NO, 0);
|
||||
|
||||
[path addClip];
|
||||
[lightBlue setFill];
|
||||
[path fill];
|
||||
|
||||
UIImage *notFollowingBtnImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
UIImage *notFollowingBtnImageStretchable = [notFollowingBtnImage stretchableImageWithLeftCapWidth:FOLLOW_BUTTON_CORNER_RADIUS topCapHeight:FOLLOW_BUTTON_CORNER_RADIUS];
|
||||
[_followingStatusBtn setBackgroundImage:notFollowingBtnImageStretchable forState:UIControlStateNormal];
|
||||
|
||||
// create a graphics context for the not yet following status button
|
||||
UIGraphicsBeginImageContextWithOptions(unstretchedSize, NO, 0);
|
||||
|
||||
[path addClip];
|
||||
|
||||
[[UIColor whiteColor] setFill];
|
||||
[path fill];
|
||||
|
||||
path.lineWidth = 3;
|
||||
[lightBlue setStroke];
|
||||
[path stroke];
|
||||
|
||||
UIImage *followingBtnImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
UIImage *followingBtnImageStretchable = [followingBtnImage stretchableImageWithLeftCapWidth:FOLLOW_BUTTON_CORNER_RADIUS topCapHeight:FOLLOW_BUTTON_CORNER_RADIUS];
|
||||
[_followingStatusBtn setBackgroundImage:followingBtnImageStretchable forState:UIControlStateSelected];
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
x
Reference in New Issue
Block a user