Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

🚧 Merge updated Starlight code into main branch #17

Closed
wants to merge 47 commits into from

Conversation

alicerunsonfedora
Copy link
Member

@alicerunsonfedora alicerunsonfedora commented Oct 10, 2021

Changes Overview
This PR makes the following changes:

  • Updates root code with new views and components that utilize async/await.

Does this PR fix, close, or implement any issues?

  • This PR closes, fixes, or implements the following issues.

Pending for review
@hyperspacedev/swift-ui

iAlex11 and others added 30 commits July 7, 2021 16:28
Added [mergepbx](https://github.com/simonwagner/mergepbx) as merge tool for avoiding xcode project conflicts and making it easier to merge, stash changes, and move between branches.
After a long discussion in our discord server, we have decided that we will be focusing mainly on developing Starlight for the latest versions of iOS and macOS.
Chica will be the new backend for Starlight for all connections handled. No changes
to the codebase have been made yet to accommodate for this, but future commits
should hold up with Chica. 🌟🎸
A new LoginView has been added which contains the view for getting a user's
domain, which should open the OAuth page respectively. The starlight URI
scheme has also been registered.

Further commits will need to register the application and properly deep link
the OAuth to store the token correctly as per the documentation.
This commit also adds a startAuthFlow func to LoginView to get the information
necessary. The StarlightApp struct also now handles URLs with Chica.handleURL.
It has yet to be determined how we can tell if a user is logged in or not.
In ContentView, the login page is only displayed if Chica's OAuth state is signed
out.

The login page now more closely resembles the mockups from the SwiftUI
channel.
Chica already handles this when calling OAuth.startOAuthFlow.
This commit adds Localizable.strings so that we can start programming
for localization in mind, rather than after the fact. The login view and
compact layout have been updated with this in mind.
This should hopefully remove bugs.

Signed-off-by: Marquis Kurt <[email protected]>
This is still a work in progress, but this component is to emulate what is
seen in the iOS Settings App.
The ProfileImage struct will be the basis for fetching the current user's profile image
from Mastodon.

Additionally, a new extension method has been introduced to convert a String with
emoji shortcodes into Markdown with embedded images from a Mastodon server.
Some minor tweaks to the mockup Settings page and ProfileImage.
It also appears that Section is not properly translating content. This
may be a bug in SwiftUI, or it's not the correct way of handling such
 a case.
The Explore page is now in its own view with the searchable modifier enabled.
I am unsure of how we can use the search bar to populate a search request,
but this is still a work in progress. Search suggestions for users and hashtags
appear as normal.

Additionally, before trends load in, a placeholder with five tags is inserted to
prevent massive UI jittering. The trending tags localization has also been fixed
by writing an explicit header with localizable text.
Some touch ups have been made to the standard navigation layout for the macOS and
iPadOS clients to match the current iOS counterparts. Trending tags appear in the side
bar along with the new Home, Network, and Messages tabs. Older sidebar actions have
been removed to better follow the new design.

Some pieces of text have been given new localizations in English.

The settings view from the Settings tab on iOS has been ported to macOS as the
Preferences window.

The login window will appear if the user is not logged in, though the OAuth flow
seems to disregard whether or not the OAuth status has changed, and it opens a
new instance on macOS.

The profile card now has three different configurable sizes for the profile image.

Entitlements for macOS have been added with network configurations.
To facilitate converting the sanitized HTML to Markdown, new String
extension methods exist. Currently, linking doesn't work as intended.
The TimelineView now displays an empty placeholder when no posts are
found, or a placeholder when the resulting list is nil.

The Home view has also been introduced with a custom header bar on
iOS. This is typically only present on the Compact layout.
This includes the Home page, the Network page, and the trending tags list.
This also refactors ProfileImage to accept any given account type.
alicerunsonfedora and others added 15 commits August 5, 2021 20:09
Implement StylableScrollView on Home page and Profile pages (Profile should be overwriten by @iAlex11)
This seems to resolve the problem where navigation links are disabled on the Network view.
Both of these now use an underlying TimelineViewable, which is responsible for fetching the data
and handling async state representation with views. TimelineViewable merely requires the
developer to pass in a ViewBuilder which specifies what the loaded result will look like, instead of
rewriting the code for representing all of the states.

This was necessary to get ProfileView to display posts from a user's profile, since the scope in
TimelineViewable has been adjusted for this. The ProfileView's TimelineScrollViewCompatible
seems to be suffering from a ForEach, issue, however:

ForEach<Range<Int>, Int, AnyView> count (157) != its initial count (1). `ForEach(_:content:)`
should only be used for *constant* data. Instead conform data to `Identifiable` or use
`ForEach(_:id:content:)` and provide an explicit `id`!

Which shouldn't be an issue because we're using the status's ID, but it's not being registered.
I suspect the nesting of this inside of the View may be causing some of the issues here, since
it's not being affected on the Home and Network pages.
Some of the template text has been replaced with data that can be pulled from the
Account data.
The blurb section of the ProfileView uses reusable methods and variables that will construct
the blurbs themselves, trimming down the size of the code and making it more readable.

It also appears that the action for the blurb button is broken; i.e., it doesn't do anything. This
should be investigated.
For future usages of ISO strings, please use String.toMastodonDate to convert the String
to a proper Date object that formatters can use.
.animation(_:) was deprecated in iOS 15 and recommended .animation(_:, value: V) instead.
This has been changed to account for this deprecation.
Some more complicated views have been moved to corresponding properties of the struct,
and some parts of the code have been documented accordingly.
The notifications page doesn't yet fetch or have representations for notifications, but the base parts
of the page are present.
@alicerunsonfedora alicerunsonfedora changed the title Merge changes into root 🚧 Merge changes into root Oct 10, 2021
@alicerunsonfedora alicerunsonfedora changed the title 🚧 Merge changes into root 🚧 Merge updated Starlight code into main branch Oct 10, 2021
The directory listings show five people whose posts are active and new arrivals. They are
NavigationLinks that correspond to their profile views.

Additionally, a bug where the profile image in the ProfileView has been fixed by changing
the profile context.
@alicerunsonfedora alicerunsonfedora deleted the refactor/GH-16 branch October 23, 2021 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants