Skip to content

Backend & Mobile – OAuth Handling, Compatibility Rules, and UX Improvements#207

Merged
Arkteus merged 35 commits into
mainfrom
hotfix--google-oauth2
Nov 2, 2025
Merged

Backend & Mobile – OAuth Handling, Compatibility Rules, and UX Improvements#207
Arkteus merged 35 commits into
mainfrom
hotfix--google-oauth2

Conversation

@maelemiel

@maelemiel maelemiel commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator

PR Title

Backend & Mobile – OAuth Handling, Compatibility Rules, and UX Improvements

Description

This pull request introduces several backend and mobile app changes to improve OAuth service handling, action-reaction compatibility, and user experience.

The main updates include:

  • Exposing OAuth requirements for services via the API
  • Supporting compatibility rules between actions and reactions
  • Updating mobile models and UI to use backend-provided OAuth info
  • Enhancing deep link handling for OAuth callbacks

Changes Made

Backend Enhancements

  • Added requires_oauth and logo fields to the AboutServiceSerializer, exposing whether a service requires OAuth and its logo via the API.
    The logic checks both direct OAuth providers and mapped services (e.g., gmail → google).
    (Files: backend/services/serializers.py, backend/services/views.py)
  • Introduced a public endpoint /api/compatibility-rules/ and corresponding CompatibilityRulesView to return action-reaction compatibility rules, making it easier for clients to fetch valid combinations.
    (Files: backend/compatibility/views.py, backend/compatibility/urls.py)

Mobile App Improvements

  • Updated the Service model to include requiresOAuth and logo fields, using backend data instead of local mappings.
    Refactored UI logic to sort and display services based on these fields.
    (Files: mobile/lib/models/service.dart, mobile/lib/pages/service_list.dart, etc.)
  • Improved OAuth callback handling in the Android manifest to support deep links for emulator testing.
    Added duplicate deep link filtering to prevent repeated processing.
    (Files: mobile/android/app/src/main/AndroidManifest.xml, mobile/lib/services/oauth_handler.dart)
  • Added a CompatibilityProvider to the mobile app, automatically loading compatibility rules at startup for use in applet creation and validation.
    (Files: mobile/lib/providers/compatibility_provider.dart, mobile/lib/main.dart)
  • Minor UI and logic fixes in applet creation and service connection pages for better state reset and configuration management.
    (Files: mobile/lib/pages/applet_creation_page.dart, mobile/lib/pages/service_connection_page.dart)

How to Test

  1. Start backend and mobile environments
  2. Call /api/services/ and verify requires_oauth and logo are correctly exposed
  3. Test /api/compatibility-rules/ endpoint returns valid data
  4. Launch the mobile app and verify:
    • Services display proper OAuth info and logos
    • OAuth callback works correctly on emulator
    • Compatibility rules are fetched and applied during applet creation
  5. Confirm applet creation and service connection flows work as expected
image image image

- Updated Service model to include `requiresOAuth` field.
- Modified Service serialization and deserialization to handle `requiresOAuth`.
- Adjusted ServiceConnectionsPage to sort and filter services based on OAuth requirement.
- Enhanced CreateAppletPage to reset action and reaction configurations.
- Introduced CompatibilityProvider for managing action-reaction compatibility rules.
- Updated ConnectedServicesProvider to map service names to their OAuth tokens.
- Refactored OAuthService to improve error handling and connection logic.
- Implemented ServiceTokenMapper for resolving service names to OAuth tokens.
- Enhanced ActionConfigCard and ServiceActionSelectorCard to filter reactions based on compatibility.
- Updated tests to cover new `requiresOAuth` functionality in Service and related components.
@maelemiel maelemiel requested a review from Copilot October 29, 2025 06:33
@maelemiel maelemiel self-assigned this Oct 29, 2025
@maelemiel maelemiel added flutter Flutter mobile app auth Authentication labels Oct 29, 2025
@maelemiel maelemiel changed the title Hotfix google oauth2 Backend & Mobile – OAuth Handling, Compatibility Rules, and UX Improvements Oct 29, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enhances the mobile app with OAuth management improvements, compatibility filtering, and service metadata enhancements. The changes include adding a requiresOAuth field to services, implementing action-reaction compatibility filtering, adding SVG logo support, and improving OAuth callback handling.

  • Added requiresOAuth boolean field to Service model to eliminate reliance on hardcoded OAuth service checks
  • Implemented compatibility provider for dynamic action-reaction filtering based on backend rules
  • Enhanced OAuth deep link handler with duplicate detection and better error handling for redirects

Reviewed Changes

Copilot reviewed 22 out of 23 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
mobile/lib/models/service.dart Added requiresOAuth and logo fields to Service model
mobile/lib/services/service_catalog_service.dart Updated service parsing to include requiresOAuth and logo from backend
mobile/lib/providers/compatibility_provider.dart New provider for managing action-reaction compatibility rules
mobile/lib/widgets/create_applet/service_action_selector_card.dart Added compatibility filtering for reactions based on selected trigger action
mobile/lib/utils/service_token_mapper.dart New utility for mapping service names to OAuth token providers
mobile/lib/services/oauth_service.dart Enhanced OAuth callback handling with redirect support and service token mapping
mobile/lib/utils/oauth_deep_link_handler.dart Refactored to support both custom and HTTP schemes with duplicate prevention
mobile/lib/main.dart Added compatibility provider initialization and duplicate deep link detection
mobile/lib/pages/service_connections_page.dart Updated to use SVG logos and requiresOAuth field from service model
mobile/lib/widgets/service_card.dart Added SVG logo support with fallback to icon
mobile/pubspec.yaml Added flutter_svg dependency
backend/automations/serializers.py Added requires_oauth field to AboutServiceSerializer
backend/automations/views.py Added CompatibilityRulesView endpoint
mobile/android/app/src/main/AndroidManifest.xml Added HTTP deep link handling for OAuth callbacks in emulator
mobile/test/*.dart Updated all test files to include required requiresOAuth field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mobile/lib/widgets/service_card.dart
Comment thread mobile/lib/pages/service_connections_page.dart
Comment thread mobile/lib/providers/compatibility_provider.dart
Comment thread backend/automations/serializers.py
Comment thread mobile/lib/pages/create_applet_page.dart Outdated
Comment thread backend/automations/serializers.py
@maelemiel maelemiel marked this pull request as ready for review November 1, 2025 15:33
@Arkteus Arkteus force-pushed the hotfix--google-oauth2 branch from 200a527 to 2486e49 Compare November 2, 2025 01:01
@Arkteus Arkteus merged commit 6d09498 into main Nov 2, 2025
7 checks passed
@Arkteus Arkteus deleted the hotfix--google-oauth2 branch November 2, 2025 01:18
Arkteus added a commit that referenced this pull request Nov 2, 2025
…auth2

Backend & Mobile – OAuth Handling, Compatibility Rules, and UX Improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Authentication flutter Flutter mobile app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants