kgellci / area51 Goto Github PK
View Code? Open in Web Editor NEWOpen source Reddit client for iOS built entirely in Swift
License: GNU General Public License v3.0
Open source Reddit client for iOS built entirely in Swift
License: GNU General Public License v3.0
The main goal of this small refactor is to remove the need to unwrap SubredditSections
each time we want to use it in our UITableViewDataSource
and UITableViewDelegate
methods.
On top of that, to keep the code consistent, we will remove self.
from properties that the compiler require it to be set on - refer to issue 61
ListingService is being used as the main point of entry to receive both posts of a subreddits and subreddits. Listings are actually objects which can be multiple different types and are defined by a kind key https://www.reddit.com/dev/api
Post being t3
kind and Subreddit being t5
kind.
To accommodate and make things easier to user, I will implement two new services:
PostService: Deals with fetching and parsing subreddit posts
SubredditService: Deals with fetching and parsing subreddits
I would like to create a design mock-up for the entire app. That way we donβt have fragmented design
Please add me to testflight
FeedViewModel has logic for formatting listings. It is doing this by mutating the Listing objects in place.
https://github.com/kgellci/Area51/blob/master/Area51/Sources/ViewModels/FeedViewModel.swift#L37
We should instead instantiate ListingViewModel from a listing which will apply the needed formatting to the required fields. We can probably convert ListingsDataSource to be a ListingViewModelDataSource which would give the added benefit of only formatting listings once instead of every time more listings are loaded.
Some extensions are useful to live in a single place which can be used by multiple modules. One such extension is the String extension which was recently added:
https://github.com/kgellci/Area51/blob/4ca004468721b641ed20becb4ae9f5a899532706/Area51/Sources/Extensions/String%2BExtension.swift
I will create a Core
module where we can store such extensions.
I was thinking if we could allow testing on device without a development team?
To the SubredditService module, add a method which takes a query string for the search term and returns a list of subreddits which match the query.
You can do this by adding a new route to SubredditService/Sources/APIRoute+Subreddit.swift
The route is subreddits/search
You will then need to create a new api call in SubredditService module which uses CoreAPI.results... with the newly specified route. You will also need to pass through the query string as a parameter all the way through to CoreAPI which makes the call.
Many users browse Reddit at night. Staring a a bright white screen at 3 am is no fun.
Would be nice for someone to create a color scheme for the following attributes:
Hex values or RGB would be π
Example in the below screenshot from Settings App:
We need to use CodingKeys for mapping the names because the reddit API is not using the best key names for their properties.
This is a decent tutorial:
https://medium.com/@sarunw/codable-in-swift-4-0-1a12e38599d8
If someone wants to debug, constraints are breaking in ListingTableViewCell at runtime.
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600001d45130 ImageService.NetworkImageView:0x7fc936650a20.height == 80 (active)>",
"<NSLayoutConstraint:0x600001d45720 UIStackView:0x7fc936650820.top == UITableViewCellContentView:0x7fc93664ed10.topMargin (active)>",
"<NSLayoutConstraint:0x600001d457c0 UIStackView:0x7fc936650820.bottom == UITableViewCellContentView:0x7fc93664ed10.bottomMargin (active)>",
"<NSLayoutConstraint:0x600001d42a80 'UISV-canvas-connection' UIStackView:0x7fc936650820.top == ImageService.NetworkImageView:0x7fc936650a20.top (active)>",
"<NSLayoutConstraint:0x600001d42df0 'UISV-canvas-connection' V:[_UILayoutSpacer:0x6000001023a0'UISV-alignment-spanner']-(0)-| (active, names: '|':UIStackView:0x7fc936650820 )>",
"<NSLayoutConstraint:0x600001d42bc0 'UISV-spanning-boundary' _UILayoutSpacer:0x6000001023a0'UISV-alignment-spanner'.bottom >= ImageService.NetworkImageView:0x7fc936650a20.bottom (active)>",
"<NSLayoutConstraint:0x600001d45900 'UIView-bottomMargin-guide-constraint' V:[UILayoutGuide:0x600000746920'UIViewLayoutMarginsGuide']-(8)-| (active, names: '|':UITableViewCellContentView:0x7fc93664ed10 )>",
"<NSLayoutConstraint:0x600001d43160 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fc93664ed10.height == 96 (active)>",
"<NSLayoutConstraint:0x600001d45860 'UIView-topMargin-guide-constraint' V:|-(8)-[UILayoutGuide:0x600000746920'UIViewLayoutMarginsGuide'] (active, names: '|':UITableViewCellContentView:0x7fc93664ed10 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600001d45130 ImageService.NetworkImageView:0x7fc936650a20.height == 80 (active)>
Any possibility that we a have task list?
After running make generate
on the current commit, the previously added test file is added to a Tests
path. This is ok for the one test we have now, but looking forward this will likely cause confusion.
I propose we split test files in the Xcode Project into folders, named after their target. For example, rather than what we have now:
Area51
|
| Tests
We will have
Area51
|
| CoreTests
| CoreAPITests
And so on.
https://github.com/realm/SwiftLint/blob/master/Rules.md#sorted-imports
Enable sorted imports in our swiftlint usage.
Instructions: https://github.com/realm/SwiftLint#configuration
Describe the solution you'd like
Additional context
We should add a TabBarController with two tabs to start.
Add a SettingsViewController and have the Settings tab point to it:
https://github.com/kgellci/Area51/blob/master/Area51/Sources/NavigationRouter.swift#L8
The SettingsViewController should be a grouped UITableView. Have a single section / row to start which points to the CHANGELOG.md file in this project. It can open the file in a SFSafariViewController.
https://github.com/kgellci/Area51/blob/master/CHANGELOG.md
From discussions in this PR - adopting the Model-View-ViewModel paradigm would allow us to separate our business logic from our Views. This will also help us Unit Test better and easier.
I'll kick start this off, by introducing it in the FeedViewController
- this will involve the following:
FeedViewController
a little bit as part of this issue to use a Model instead. Ie The UITableViewDataSource
will need to communicate with the model directly instead of a collection.If successful, we should follow this paradigm with new screens we add to the app along with unit testing.
I would like to make a profile page
I think Reddit has sunset their default subreddits list, but we can still pre-populate the side navigation with a defaults list. Can probably start by using this one: https://www.reddit.com/r/defaults/comments/61mgs9/list_of_default_subreddits_26_march_2017/
We can make the changes here for now: https://github.com/kgellci/Area51/blob/master/ListingService/Sources/Subreddit.swift
I plan on refactoring to make less static fo future use but fine to use for now.
Is your feature request related to a problem? Please describe.
Try to search for a given subreddit not in the default subreddits list
Describe the solution you'd like
Use the reddit search API to find subreddits matching the keywords typed into the search bar. ( Search bar implemented in #44 )
Display the matching subreddits to the user.
Allow the user to navigate to the selected subreddit page.
We should add SwifLint to help out with enforcing some coding standards within the project.
Would be cool to have a CHANGELOG where developers can list their changes. We can eventually display it in app as a what's new feed. It will also be useful for the Apple release notes when publishing to the store.
Here is the one from SwiftLint for reference: https://github.com/realm/SwiftLint/blob/master/CHANGELOG.md
We probably only need:
Since this project is aimed at beginners and show casing latest iOS development techniques; we should also include unit testing with this project.
Thoughts?
Describe the bug
When the Search Bar is focused in landscape mode, the top part of the search bar seems to be cutoff. Issue can be avoided by disabling the animation for moving the title of the view upwards.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
There should be a space between the edge of the screen and the Search Bar. The Search Bar should be completely visible
Screenshots
Smartphone (please complete the following information):
Additional context
The issue can be avoided by disabling the UI animation which occurs when the Search Bar is focused.
Is your feature request related to a problem? Please describe.
Whilst browsing the feeds, it would be helpful to know which subreddit a particular post belongs to
Describe the solution you'd like
Perhaps a small label at the top (left or right) of each ListingTableViewCell
in the FeedViewController
showing which subreddit the post belongs to - perhaps also in a different colour?
Describe alternatives you've considered
Not sure about alternatives to this feature; the only place for it is in each ListingTableViewCell
Additional context
Since every post (Listing
) has to belong to a subreddit; there should be no logic to hide this label and therefore it should be easy enough to add above the top level UIStackView
in that cell. However I would perhaps wrap it in, it's own UIStackView
set to horizontal alignment. This way, should we add new labels to the top of the cell, we won't have to mess about with AutoLayout constraints directly.
As noted in #83 (comment) it may be useful for someone to setup Danger.
This would automate the initial QA of a Pull Request. It's easy to forget things sometimes, so this could automatically check the following:
This would probably need the project owner to setup, as it relies on a GitHub bot to run automatically. See Getting Started.
https://github.com/realm/SwiftLint/blob/master/Rules.md#explicit-self
Enable explicit self in our swiftlint usage. This will help keep the code across the project consistent and make it more clear in a function if a variable being accessed belongs to the class or is defined somewhere in the function.
Instructions: https://github.com/realm/SwiftLint#configuration
Is your feature request related to a problem? Please describe.
I would like to add a search bar to the subreddit view to search for subreddits.
Describe the solution you'd like
I would like add a search bar to filter default subreddits.
Is your feature request related to a problem? Please describe.
Currently, the reddit posts are viewed using a web view.
Describe the solution you'd like
Add a screen to view posts natively.
Additional context
The screen should display the following:
It would be great to show a preview of the post (either a link or the description) under the title of the table view cells.
This could be accomplished by using a cell preset with two labels.
Hi all,
I personally think this project will benefit greatly with a bit of direction / design and a roadmap. I feel without this, there will be lots of inconsistency throughout the app.
Areas of focus:
On top of all this and maybe other things to consider; I suggest maybe a Slack workspace for all contributors to communicate on - discuss things easier and then create issues on GitHub out of those discussions?
We could tackle the above points in a Slack channel for example?
We should separate the UITableView
's datasource
from the UIViewController
and try make it as reusable as possible.
Changes to be made:
FeedViewController
(First 'test' case and example)datasource
reusable.Pros
Anytime we need to display a list of common results (In this case, Listing
) we do not need to setup the UITableView
's datasource - we simply instantiate it and supply it a collection of Listing
objects. The rest is taken care of.
This will also separate the responsibilities a little more between the various UI layers. It as the added benefit that should we decide to change UI layout / implementation of a UITableViewCell
for the given Datasource it will be all done in one place.
Cons
Don't see any immediate cons to this approach. It's an extra file in the project per datasource
that we create - however I feel this is minor.
As part of this change, I will also clean up the code in FeedViewController
and make it ready for a review in the next day or two.
I think we should use this as an example to implement other datasources for UiTableViews if accepted through a PR. We don't always have to aim for high reusability in every case - can judge that on a case by case basis.
We need an app icon else we can't distribute beta builds!
Following Apples HIG for icon design is the best place to start!
Appreciated files would be any of the following:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.