Skip to content

TF-3603: Integrate Cozy features #3604

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

Merged
merged 3 commits into from
Jun 18, 2025
Merged

Conversation

tddang-linagora
Copy link
Collaborator

@tddang-linagora tddang-linagora commented Mar 31, 2025

Issue

Related PRs

Demo

Screen.Recording.2025-06-17.at.11.22.23.mov

@tddang-linagora tddang-linagora self-assigned this Mar 31, 2025
@tddang-linagora tddang-linagora changed the title TF-3603: Integrate Cozy features [WIP] TF-3603: Integrate Cozy features Mar 31, 2025
@tddang-linagora tddang-linagora marked this pull request as draft March 31, 2025 07:01
Copy link

This PR has been deployed to https://linagora.github.io/tmail-flutter/3604.

@dab246
Copy link
Member

dab246 commented Mar 31, 2025

  • Should create new module to integrate for Cozy

@zatteo
Copy link
Member

zatteo commented Mar 31, 2025

Looks great! 🎉 🎉

@tddang-linagora tddang-linagora force-pushed the feature/TF-3603-cozy-js-interop branch from 4d4c578 to 112f446 Compare April 18, 2025 03:06
Copy link
Member

@dab246 dab246 left a comment

Choose a reason for hiding this comment

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

  • Remove web folder in Cozy module

@dab246
Copy link
Member

dab246 commented Jun 16, 2025

  • Should reorganize the cozy config file to make it clearer
// cozy_config_manager_stub.dart
class CozyConfigManager {
  Future<void> injectCozyScript() async {
    throw UnimplementedError('Cannot use injectCozyScript in non-web environment');
  }

  Future<void> initialize() async {
    throw UnimplementedError('Cannot initialize in non-web environment');
  }

  Future<bool> get isInsideCozy async {
    throw UnimplementedError('Cannot check Cozy environment in non-web environment');
  }
}

// cozy_config_manager_web.dart (implementation for web)
import 'dart:async';

import 'package:linagora_design_flutter/cozy_config_manager/cozy_config_manager.dart' as cozy;

class CozyConfigManager {
  bool? _isInsideCozy;

  Future<void> injectCozyScript() async {
    // Web-specific implementation
  }

  Future<void> initialize() async {
    // Web-specific implementation
  }

  Future<bool> get isInsideCozy async {
    return _isInsideCozy ??= await _checkCozyEnvironment();
  }

  Future<bool> _checkCozyEnvironment() async {
    return await cozy.CozyConfigManager().isInsideCozy;
  }
}

// cozy_config_manager.dart
export 'cozy_config_manager_stub.dart' if (dart.library.html) 'cozy_config_manager_web.dart';

// cozy_config.dart
import 'package:cozy/cozy_config/cozy_config_manager.dart';

class CozyConfig {
  static final CozyConfig _instance = CozyConfig._internal();
  final dynamic manager;

  factory CozyConfig() => _instance;

  CozyConfig._internal() : manager = CozyConfigManager();

  Future<bool> get isInsideCozy async => await manager.isInsideCozy;
}

hoangdat
hoangdat previously approved these changes Jun 18, 2025
Copy link
Member

@dab246 dab246 left a comment

Choose a reason for hiding this comment

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

LGTM

@hoangdat hoangdat merged commit 787b9fa into master Jun 18, 2025
23 checks passed
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.

4 participants