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

TW-504: config notifications for default push rules #568

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sherlockvn
Copy link
Collaborator

Demo:

RPReplay_Final1694021601.MP4

@sherlockvn sherlockvn changed the title TW-504: config notifications for default push rules [WIP] TW-504: config notifications for default push rules Sep 6, 2023
'.m.rule.member_event',
(c) => L10n.of(c)!.memberChanges,
'm.rule.change_group_name',
(c) => "Group chat name change",
Copy link
Member

Choose a reason for hiding this comment

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

l10n

'.m.rule.suppress_notices',
(c) => L10n.of(c)!.botMessages,
'm.rule.change_avatar_group',
(c) => "Group chat avatar change",
Copy link
Member

Choose a reason for hiding this comment

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

l10n

@@ -448,6 +449,77 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
createVoipPlugin();
}

Future<void> _setUpUserDefinedPushRules(Client client) async {
await client.setPushRuleEnabled(
Copy link
Member

Choose a reason for hiding this comment

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

use Future.wait for some parallel rules

final homeServerUrlInterceptor = getIt.get<DynamicUrlInterceptors>(
instanceName: NetworkDI.homeServerUrlInterceptorName,
);
Logs().d(
'MatrixState::_setUpHomeServer: ${homeServerUrlInterceptor.baseUrl}',
);
homeServerUrlInterceptor.changeBaseUrl(homeServerUri.toString());
_setUpUserDefinedPushRules(client);
Copy link
Member

Choose a reason for hiding this comment

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

Please make sure to call it one time in login?

Copy link
Member

Choose a reason for hiding this comment

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

please make sure this will not make conflict with other setup in other device?

@hoangdat
Copy link
Member

IMO, it is good. Can you write ADRs to describe about:

    1. What is push rule? What is system? User? What is global? ....
    1. What the push rule detail we set for Twake?

@sherlockvn sherlockvn changed the title [WIP] TW-504: config notifications for default push rules TW-504: config notifications for default push rules Sep 11, 2023
}

bool containsRule(String ruleId) {
final rule = devicePushRules?.override?.firstWhere((PushRule rule) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
final rule = devicePushRules?.override?.firstWhere((PushRule rule) {
final rule = devicePushRules?.override?.any((rule) => rule.ruleId == ruleId);

@@ -522,7 +613,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
}
}

void _setUpHomeServer(Uri homeServerUri) {
void _setUpHomeServer(Uri homeServerUri) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need

Copy link
Member

Choose a reason for hiding this comment

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

please show demo for new settings

}
}

bool containsRule(String ruleId) {
Copy link
Member

Choose a reason for hiding this comment

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

Where you can put this check? Before or after sync?

],
),
client.setupUserDefinedPushRule(
ruleId: 'm.rule.set_me_as_admin',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ruleId: 'm.rule.set_me_as_admin',
ruleId: 'm.rule.change_power_level',

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.

3 participants