Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Implement the public section in the Share tab#77

Merged
hamorillo merged 4 commits intotrunkfrom
adam/GRA-577
Jul 28, 2025
Merged

Implement the public section in the Share tab#77
hamorillo merged 4 commits intotrunkfrom
adam/GRA-577

Conversation

@AdamGrzybkowski
Copy link
Contributor

Description

This PR implements the public section in the Share tab.

I've put the UserSharePreferences in the :userComponent module, as we will have to get that info from there anyway.

No local persistence layer, so the state will be lost when the app is killed.

share_tab_public_section

Testing Steps

  1. Launch the app
  2. Go to share tab
  3. Confirm you see non-empty values from your profile (name, title, organization, description, profileUrl, location)
  4. Toggle the switches
  5. Change screens
  6. Confirm switches are in the same state

@AdamGrzybkowski AdamGrzybkowski added the enhancement New feature or request label Jul 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the public section functionality in the Share tab, allowing users to control which profile information from their Gravatar is shared publicly. The implementation adds toggle switches for various profile fields like name, location, job title, organization, description, and profile URL, with state management handled through a new UserSharePreferences data class.

Key changes:

  • Added UserSharePreferences model to manage public sharing preferences for different profile fields
  • Created UI components for displaying and controlling public profile information sharing
  • Integrated the public section into the existing Share screen with proper state management

Reviewed Changes

Copilot reviewed 13 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
UserSharePreferences.kt New data class defining boolean preferences for sharing profile fields
SharePublicRow.kt UI component for individual profile field sharing controls with label, value, and toggle
SharePublicContactInfo.kt Main component organizing all public profile fields with their sharing controls
ShareUiState.kt Enhanced state management with user preferences and field type definitions
ShareViewModel.kt Added event handling for user preference changes
ShareScreen.kt Integrated public contact info section into the main share screen
ItemDivider.kt Utility component for visual separation between sections
Test files Comprehensive unit and UI tests for the new components and functionality

Comment on lines +23 to +30
userSharePreferences = userSharePreferences.copy(
name = if (shareFieldType is ShareFieldType.Name) shareFieldType.checked else userSharePreferences.name,
location = if (shareFieldType is ShareFieldType.Location) shareFieldType.checked else userSharePreferences.location,
title = if (shareFieldType is ShareFieldType.Title) shareFieldType.checked else userSharePreferences.title,
organization = if (shareFieldType is ShareFieldType.Organization) shareFieldType.checked else userSharePreferences.organization,
description = if (shareFieldType is ShareFieldType.Description) shareFieldType.checked else userSharePreferences.description,
profileUrl = if (shareFieldType is ShareFieldType.ProfileUrl) shareFieldType.checked else userSharePreferences.profileUrl,
)
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

The copyWithUserSharePreferences function uses repetitive if-else chains that could be simplified. Consider using a when expression or extracting the logic into the ShareFieldType sealed class to reduce code duplication and improve maintainability.

Suggested change
userSharePreferences = userSharePreferences.copy(
name = if (shareFieldType is ShareFieldType.Name) shareFieldType.checked else userSharePreferences.name,
location = if (shareFieldType is ShareFieldType.Location) shareFieldType.checked else userSharePreferences.location,
title = if (shareFieldType is ShareFieldType.Title) shareFieldType.checked else userSharePreferences.title,
organization = if (shareFieldType is ShareFieldType.Organization) shareFieldType.checked else userSharePreferences.organization,
description = if (shareFieldType is ShareFieldType.Description) shareFieldType.checked else userSharePreferences.description,
profileUrl = if (shareFieldType is ShareFieldType.ProfileUrl) shareFieldType.checked else userSharePreferences.profileUrl,
)
userSharePreferences = shareFieldType.updatePreferences(userSharePreferences)

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those two were being generated for a while, I've decided to push them and hope this will stop.

Copy link

@hamorillo hamorillo left a comment

Choose a reason for hiding this comment

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

🚀

@hamorillo hamorillo merged commit 63b410f into trunk Jul 28, 2025
10 of 11 checks passed
@hamorillo hamorillo deleted the adam/GRA-577 branch July 28, 2025 21:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants