git.iko.soy/cinny-click-packaging
on main help sign in
Add missing import in notification hook patch
4086f92Marcel Alexandru Nitan
patches/0008-Set-push-notifications-to-UTs-push-hook.patch+25−23
@@ -1,41 +1,43 @@
1−From a47256cf63eaefc54a0a2ec5fec876e90c138d51 Mon Sep 17 00:00:00 2001
1+From 4305381292b98fff780bef159014076897569e74 Mon Sep 17 00:00:00 2001
2From: Marcel Alexandru Nitan <nitan.marcel@protonmail.com>
2From: Marcel Alexandru Nitan <nitan.marcel@protonmail.com>
3−Date: Tue, 14 Jun 2022 13:44:39 +0300
3+Date: Thu, 16 Jun 2022 16:05:12 +0300
4Subject: [PATCH] Set push notifications to UTs push hook
4Subject: [PATCH] Set push notifications to UTs push hook
5
5
6---
6---
7− src/client/initMatrix.js | 36 ++++++++++++++++++++++++++++++++++++
7+ src/client/initMatrix.js | 31 +++++++++++++++++++++++++++++++
8− 1 file changed, 36 insertions(+)
8+ 1 file changed, 31 insertions(+)
9
9
10diff --git a/src/client/initMatrix.js b/src/client/initMatrix.js
10diff --git a/src/client/initMatrix.js b/src/client/initMatrix.js
11−index aec2f3d..7dfa8a6 100644
11+index aec2f3d..23c7598 100644
12--- a/src/client/initMatrix.js
12--- a/src/client/initMatrix.js
13+++ b/src/client/initMatrix.js
13+++ b/src/client/initMatrix.js
14+@@ -2,6 +2,7 @@ import EventEmitter from 'events';
15+ import * as sdk from 'matrix-js-sdk';
16+ // import { logger } from 'matrix-js-sdk/lib/logger';
17+
18++import { cons } from './state/cons';
19+ import { secret } from './state/auth';
20+ import RoomList from './state/RoomList';
21+ import AccountData from './state/AccountData';
14−@@ -18,6 +18,18 @@ class InitMatrix extends EventEmitter {
22+@@ -18,6 +19,12 @@ class InitMatrix extends EventEmitter {
15 await this.startClient();
23 await this.startClient();
16 this.setupSync();
24 this.setupSync();
17 this.listenEvents();
25 this.listenEvents();
18+
26+
19−+ try {
20−+ this.setPush(QML.settings.pushToken, QML.settings.pushAppId)
27++ this.setPush(QML.settings.pushToken, QML.settings.pushAppId)
21−+
22−+ QML.matrixPushTokenChanged.connect(async function (token) {
28++ QML.matrixPushTokenChanged.connect(async function (token) {
23−+ this.setPush(token, QML.settings.pushAppId)
29++ this.setPush(token, QML.settings.pushAppId)
24+
30+
25−+ });
31++ });
26−+ }
27−+ catch {
28−+ console.log("Failed to update push rules!")
29−+ }
30 }
32 }
31
33
32 async startClient() {
34 async startClient() {
33−@@ -51,6 +63,30 @@ class InitMatrix extends EventEmitter {
35+@@ -51,6 +58,30 @@ class InitMatrix extends EventEmitter {
34 this.matrixClient.setGlobalErrorOnUnknownDevices(false);
36 this.matrixClient.setGlobalErrorOnUnknownDevices(false);
35 }
37 }
36
38
37+ setPush(token, appId) {
39+ setPush(token, appId) {
38−+ var promises = []
40++ const promises = []
39+
41+
40+ promises.push(
42+ promises.push(
41+ this.matrixClient.setPusher(
43+ this.matrixClient.setPusher(
@@ -51,11 +53,11 @@ index aec2f3d..7dfa8a6 100644
51+ "kind": "http",
53+ "kind": "http",
52+ "profile_tag": "xxyyzz",
54+ "profile_tag": "xxyyzz",
53+ "pushkey": token
55+ "pushkey": token
54−+ },
56++ }
55−+ function () {}
56−+ ))
57++ ));
57−+ promises.push(this.matrixClient.setPushRuleEnabled('global', 'content', '.m.rule.contains_user_name', true, function () {}))
58++ promises.push(this.matrixClient.setPushRuleEnabled('global', 'content', '.m.rule.contains_user_name', true));
59++ console.error("Set appID " + appId + "with token " + token)
58−+ Promise.all(promises)
60++ return Promise.all(promises);
59+ }
61+ }
60+
62+
61 setupSync() {
63 setupSync() {