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

Open
wants to merge 6 commits into
base: feature/cozy-integration
Choose a base branch
from

Conversation

tddang-linagora
Copy link
Collaborator

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

Issue

Related PRs

Demo

Screen.Recording.2025-04-24.at.09.40.01.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

JSBoolean() => flag.toDart,
JSString() => flag.toDart == 'true',
_ => false,
};
Copy link
Member

@zatteo zatteo Mar 31, 2025

Choose a reason for hiding this comment

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

⚠️ flag can also be null, a number, a string, a JS object or an JS array

part 'cozy_contact.g.dart';

@JsonSerializable(createToJson: false)
class CozyContact with EquatableMixin {
Copy link
Member

Choose a reason for hiding this comment

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

For your information, 'io.cozy.contacts' definition is here https://github.com/cozy/cozy-doctypes/blob/master/docs/io.cozy.contacts.md (but maybe you already found it?).

But looks good, no need to add other fields for the moment 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah we do the serialization on our side so it's all good.

@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
lib/main.dart Outdated
Comment on lines 72 to 81
// Get contacts example
cozyConfig.getCozyContacts().then((contacts) {
print('Contacts: $contacts');
});

// Get flag example
cozyConfig.getCozyFeatureFlag('cozy.search.enabled').then((flag) {
final isEnabled = flag == true || flag == 'true';
print('Search enabled: $isEnabled');
});
Copy link
Member

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

move all things relate to cozy to another flutter module

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines 27 to 53
Future<List<CozyContact>> getCozyContacts() async {
try {
final contacts = await promiseToFuture(getContactsJs());
return (contacts as JSArray<JSObject>)
.toDart
.map((contact) => CozyContact.fromJson(jsonDecode(stringify(contact))))
.toList();
} catch (e) {
print('Error getting cozy contacts: $e');
return [];
}
}

Future<dynamic> getCozyFeatureFlag(String flagName) async {
try {
final flag = await promiseToFuture(getFlagJs(flagName));
return switch (flag) {
JSBoolean() => flag.toDart,
JSString() => flag.toDart,
JSNumber() => flag.toDartDouble,
JSObject() => stringify(flag),
_ => null,
};
} catch (e) {
print('Error getting cozy feature flag: $e');
return null;
}
Copy link
Member

Choose a reason for hiding this comment

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

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

TF-3603 [TEMP] expose Cozy integration result to console.log
@hoangdat
Copy link
Member

  • light mode forcing available in latest of cozy-twake-mail/chat also

@zatteo
Copy link
Member

zatteo commented Apr 22, 2025

  • light mode forcing available in latest of cozy-twake-mail/chat also

Done here cozy/cozy-twakechat#10 and cozy/cozy-twakemail#11. Locally it should work by just pulling master and yarn install/yarn build

cozy/.metadata Outdated
Copy link
Member

Choose a reason for hiding this comment

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

remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -0,0 +1,24 @@
name: cozy
description: "A new Flutter project."
Copy link
Member

Choose a reason for hiding this comment

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

Cozy integration module

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

maybe we should choose another type of module to avoid a lot of things for app

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

web folder resources and code will not be included in android or ios build.

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