Filter notification lists and status icons by source preferences

This commit is contained in:
Blendman974 committed 2026-11-07 21:12:40 +01:00
1 parent 1959e57d02
commit 0f62573b1c
7 files changed
+86 -16

No files matched your search

+9 -1
View File
@@ -9,7 +9,7 @@ const generator = require('../scripts/generate-pebble-icons.cjs');
function setup(notifications) {
const load = loader({}, {
'../g2/ancs-client': { AncsClient: class {}, ANCS_CONNECT_MESSAGE: '' },
'./notification-sources': { rememberNotificationSources() {} },
'./notification-sources': { rememberNotificationSources() {}, shouldShowNotificationOnGlasses: packageName => packageName !== "muted" },
});
const icons = load('app/native/notification-icons.ios.ts');
icons.bindIosNotifications({ read: () => notifications });
@@ -106,3 +106,11 @@ test('the icon generator inverts Pebble art: black ink lights up, white fills hi
const decoded = loader({}, { './pebble-icons-data': loader({}, {})(dataFile) })('app/graphics/pebble-icons.ts').pebbleIcon('probe');
assert.deepEqual([...decoded.pixels], [...pixels]);
});
test('muted sources are hidden before list and icon limits without removing phone notifications', () => {
const notifications = [notification('hidden', 'muted', '0'), notification('shown', 'allowed', '0')];
const { icons } = setup(notifications);
assert.deepEqual([...icons.readVisibleNotifications(1)].map(n => n.key), ['shown']);
assert.deepEqual([...icons.readActiveNotificationIcons(1, false).keys], ['shown']);
assert.equal(icons.readActiveNotifications(10).length, 2);
});