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

Restructuring for Multi-Platform Extensions (Phase 2) #11483

Merged
merged 8 commits into from
Mar 20, 2025

Conversation

flvndvd
Copy link
Contributor

@flvndvd flvndvd commented Mar 19, 2025

Description

Follow up of #11460.

This PR implements the platform service architecture designed in Phase 1, moving our business logic into the new structure. It enables sharing core functionality between Chrome and Front extensions while keeping platform-specific code cleanly separated.

Implementation Details

The core of this change is the PlatformService interface and its implementations. Shared business logic lives in BasePlatformLogic, while platform-specific code (storage, auth flows) is implemented separately for each platform. React components access these services through a shared context.

Key Changes

  • Migrated storage operations to platform-specific implementations
  • Moved auth flows to platform services while sharing token management
  • Updated background script to use Chrome platform service
  • Added React context for component access to platform services

Some behavior changes:

  • Remove the timer to refresh access tokens, instead embedded in getAccessToken which will refresh if token is expired.
  • We could not change theme properly, fixed in this PR as well.

Motivation

As we prepare to integrate with Front's mail client, this architecture lets us reuse our core extension logic without duplicating code. Each platform only needs to implement its specific storage and auth mechanisms.

Tests

Risk

Deploy Plan

// Chrome specific helpers.

// Store version for force update.
async savePendingUpdate(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very much chrome's specific for now.

@flvndvd flvndvd marked this pull request as ready for review March 19, 2025 16:38
Copy link
Contributor

@tdraier tdraier left a comment

Choose a reason for hiding this comment

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

🔥

@flvndvd flvndvd merged commit 2cda9e4 into main Mar 20, 2025
5 checks passed
@flvndvd flvndvd deleted the flav/restructure-extension branch March 20, 2025 08:06
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.

2 participants