Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy Posts #39

Draft
wants to merge 41 commits into
base: main
Choose a base branch
from
Draft

Fancy Posts #39

wants to merge 41 commits into from

Conversation

lishaduck
Copy link
Member

@lishaduck lishaduck commented Oct 17, 2024

Thanks for contributing!
Provide a description of your changes below and a general summary in the title.
Please look at the following checklist to ensure that your PR can be accepted quickly:

Once you've read over these comments, you should delete them.

Description

Describe your changes in a sentence or two.

This PR...

Which issue does this close?
If none, quickly write up a more detailed issue so any non-development-related discussion can go there.

Closes: #issue

CC: @MattsAttack


Type of Change

Delete all non-applicable categories.

  • ✨ New feature
  • 🐛 Bug fix
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Code refactor
  • 🎨 Style
  • ⚡️ Performance improvements
  • 🧹 Reduce tech debt
  • 🔥 Remove obsolete, unused things
  • 🧪 Test
  • 💚 CI
  • 🛠️ Build configuration change
  • ⏪️ Revert
  • 🗑️ Chore

Checklist

Before submitting the PR, please make sure you do the following:

  • Read the Contributing Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Fill out this template.
  • Log your hours.
  • Check that commits follow the Angular commit convention, more or less.
  • Ideally, include relevant tests that fail without this PR but pass with it (if applicable).

Tested on

What device(s) have you tested this on?
Delete all non-applicable examples.

  • CI
  • macOS 14
  • Ubuntu 24.04
  • Windows 10
  • etc.

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 32.60870% with 186 lines in your changes missing coverage. Please review.

Project coverage is 37.36%. Comparing base (45544f5) to head (7152729).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../lib/src/features/home/presentation/home/post.dart 55.17% 39 Missing ⚠️
...rc/features/auth/presentation/auth/login_page.dart 0.00% 31 Missing ⚠️
...ttings/presentation/preferences/settings_page.dart 17.64% 28 Missing ⚠️
packages/app/lib/src/utils/hooks.dart 0.00% 25 Missing ⚠️
packages/app/lib/src/app/wrapper_page.dart 0.00% 24 Missing ⚠️
...ib/src/features/home/application/feed_service.dart 15.38% 11 Missing ⚠️
.../src/features/map/presentation/items/map_page.dart 0.00% 10 Missing ⚠️
...pp/lib/src/features/home/data/post_repository.dart 0.00% 9 Missing ⚠️
...ib/src/features/auth/application/auth_service.dart 33.33% 4 Missing ⚠️
...c/features/auth/presentation/auth/signup_page.dart 0.00% 3 Missing ⚠️
... and 2 more
Files with missing lines Coverage Δ
packages/app/lib/src/app/app.dart 4.54% <ø> (ø)
packages/app/lib/src/app/router.dart 70.45% <100.00%> (+1.40%) ⬆️
.../src/features/home/application/avatar_service.dart 100.00% <100.00%> (ø)
.../lib/src/features/home/data/avatar_repository.dart 100.00% <100.00%> (ø)
.../app/lib/src/features/home/domain/post_entity.dart 0.00% <ø> (ø)
.../lib/src/features/home/presentation/home/feed.dart 100.00% <100.00%> (ø)
...ures/home/presentation/home/feed_routing_page.dart 100.00% <100.00%> (ø)
...rc/features/home/application/location_service.dart 75.00% <50.00%> (-25.00%) ⬇️
packages/app/lib/src/utils/design.dart 50.00% <50.00%> (ø)
...c/features/auth/presentation/auth/signup_page.dart 0.00% <0.00%> (ø)
... and 9 more

... and 1 file with indirect coverage changes

@lishaduck
Copy link
Member Author

@MattsAttack, you pushed a rebase instead of force pushing, so I had to clean it up.
Run git reset origin/fancy-posts.

@MattsAttack
Copy link
Contributor

My bad

@lishaduck
Copy link
Member Author

My bad

Oh, and I did it wrong myself. Give me a few minutes.

@lishaduck
Copy link
Member Author

Ok, you can run git reset --hard origin/fancy-posts now. Keep in mind that it'll wipe everything, so make sure there's nothing unstaged. If there is, memorize it 😉

@MattsAttack
Copy link
Contributor

@lishaduck I believe there's an issue with the app not requesting the users location and then not loading in the local feed. The pop up to request location only pops up sometimes on web and if doesn't theres no way to load in the local feed

@lishaduck
Copy link
Member Author

Might be fixed with #44?


@override
Widget build(BuildContext context, WidgetRef ref) {
return AutoTabsScaffold(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use AutoTabsRouter.tabBar (and no scaffold?)

post.timestamp.timeZoneOffset; // Duration values are negative
int timeValue;
String timePostValue;
if (timeSincePost.inDays < -364) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is it less than a negative? This is a bit confusing. Also, you ought to be able to use a switch here, which is nice. You can't usually do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed how this worked. Its a positive difference now

@MattsAttack
Copy link
Contributor

@lishaduck how should I go about getting a username from a user id?

@lishaduck
Copy link
Member Author

@lishaduck how should I go about getting a username from a user id?

For security reasons you, erm, can't. I spent a lot of time looking into it, and it looks like you'd need to a) write a server function, or b) store a user-id => preferred name mapping in a new db collection, which would be annoying.
I pitched it as being anonymous for that reason in the script.

@MattsAttack
Copy link
Contributor

MattsAttack commented Oct 20, 2024

For security reasons you, erm, can't.

What if I just added an attribute to posts that stores the person who created its user name? That should be pretty simple.

@lishaduck
Copy link
Member Author

For security reasons you, erm, can't.

What if I just added an attribute to posts that stores the person who created its user name? That should be pretty simple.

Hm. That'd be fine assuming that we don't allow changing your display name.

@MattsAttack
Copy link
Contributor

MattsAttack commented Oct 20, 2024

Hm. That'd be fine assuming that we don't allow changing your display name.

That's true. But if they were to change it we could update the value of the posts the users made in the data base with their new user name. It's not the best but its probably better than sending an api call every time you load a post

@lishaduck
Copy link
Member Author

That's true. But if they were to change it we could update the value of the posts the users made in the data base with their new user name. It's not the best but its probably better than sending an api call every time you load a post

It would take a while and we could cache it, but yeah, I think it'd be fine. Just write it :)

@MattsAttack
Copy link
Contributor

It would take a while and we could cache it, but yeah, I think it'd be fine. Just write it :)

Ai ai captain

Comment on lines 164 to 153
Future<MemoryImage> getAvatar(Avatars avatarService) async {
return MemoryImage(await avatarService.getInitials(name: post.authorName));
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fetches them every frame. (well, flutter and images are weird, it might just be per every time it gets a new render, but still, should be globally memoized)

I forgot to share this with you: https://github.com/PSDTools/app/blob/2b793de1d796cb215a91a2b1767d95fbb80481cc/lib/features/auth/data/avatar_repository.dart
https://github.com/PSDTools/app/blob/2b793de1d796cb215a91a2b1767d95fbb80481cc/lib/features/auth/data/auth_repository.dart

I've been wanting to add a drawer, I might just copy all this code over.

@lishaduck lishaduck linked an issue Oct 23, 2024 that may be closed by this pull request
@MattsAttack
Copy link
Contributor

Oh nice! Did you fix the local world tab background?

@lishaduck
Copy link
Member Author

lishaduck commented Oct 23, 2024

Oh nice! Did you fix the local world tab background?

Yup! It was easy-peasy once I'd figured out the issue.

@MattsAttack
Copy link
Contributor

awesome sauce

@MattsAttack
Copy link
Contributor

@lishaduck could you help me debug the windows build sometime? The rebrand broke it due to naming issues. It's currently crashing and returning:
CMake Error at runner/CMakeLists.txt:9 (add_executable):
The target name "Town Talk" is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.

CMake Error at CMakeLists.txt:41 (target_compile_features):
Cannot specify compile features for target "Town Talk" which is not built
by this project.
Call Stack (most recent call first):
runner/CMakeLists.txt:21 (apply_standard_settings)

CMake Error at runner/CMakeLists.txt:24 (target_compile_definitions):
Cannot specify compile definitions for target "Town Talk" which is not
built by this project.

CMake Error at runner/CMakeLists.txt:25 (target_compile_definitions):
Cannot specify compile definitions for target "Town Talk" which is not
built by this project.

CMake Error at runner/CMakeLists.txt:26 (target_compile_definitions):
Cannot specify compile definitions for target "Town Talk" which is not
built by this project.

CMake Error at runner/CMakeLists.txt:27 (target_compile_definitions):
Cannot specify compile definitions for target "Town Talk" which is not
built by this project.

CMake Error at runner/CMakeLists.txt:28 (target_compile_definitions):
Cannot specify compile definitions for target "Town Talk" which is not
built by this project.

CMake Error at runner/CMakeLists.txt:31 (target_compile_definitions):
Cannot specify compile definitions for target "Town Talk" which is not
built by this project.

CMake Error at runner/CMakeLists.txt:35 (target_link_libraries):
Cannot specify link libraries for target "Town Talk" which is not built by
this project.

Error: Unable to generate build files

Exited (1).

I figured out that one of the issues is your binary name has spaced but not it's giving this error 20 times:
CMake Error:
Error evaluating generator expression:

$<TARGET_FILE_DIR:nexus>

No target "nexus"

I'm assuming it's because the name of the app in pubspec is different. We may want to decide on a name for the TSA version and just rename everything. I've committed what I've done so far.

"github-actions.workflows.pinned.workflows": [
".github/workflows/ci.yaml"
],
"C_Cpp.errorSquiggles": "enabled"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accidentally disabled errorSquiggles so i turned them back on. I thought it was a local setting

melos.yaml Outdated Show resolved Hide resolved
packages/app/linux/CMakeLists.txt Outdated Show resolved Hide resolved
packages/app/windows/CMakeLists.txt Outdated Show resolved Hide resolved
@@ -6,7 +6,7 @@ project(runner LANGUAGES CXX)
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME} WIN32
add_executable(TownTalk WIN32
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentional?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loosely. I wanted to see if it would change anything. I'll probably revert it

MattsAttack and others added 3 commits November 20, 2024 08:28
Co-authored-by: Eli <[email protected]>
Signed-off-by: Matthew Wasser <[email protected]>
Co-authored-by: Eli <[email protected]>
Signed-off-by: Matthew Wasser <[email protected]>
Co-authored-by: Eli <[email protected]>
Signed-off-by: Matthew Wasser <[email protected]>
@MattsAttack
Copy link
Contributor

@lishaduck yeah it's still returning
CMake Error:
Error evaluating generator expression:

$<TARGET_FILE_DIR:nexus>

No target "nexus"

20 times

@lishaduck
Copy link
Member Author

@lishaduck yeah it's still returning CMake Error: Error evaluating generator expression:

Try flutter clean.

Comment on lines 221 to 227
onPressed: () {
if (thumbsIcon.value.icon == Icons.thumb_up_outlined) {
thumbsIcon.value = const Icon(Icons.thumb_up_sharp);
} else {
thumbsIcon.value = const Icon(Icons.thumb_up_outlined);
}
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant as an animation? 🤣

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe eventually. right now it just updates the icon of the thumb when you click it

if (cachedPost != null) return cachedPost;

if (cachedPost != null) {
// Updates
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing comment. -1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. I was to busy watching Freebird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI design
2 participants