diff --git a/src/models/portals.js b/src/models/portals.js index 77fadfb6..c054e97d 100644 --- a/src/models/portals.js +++ b/src/models/portals.js @@ -65,11 +65,13 @@ var FlatpakPortalsModel = GObject.registerClass({ this._notificationsSupported = null; this._devicesSupported = null; this._locationSupported = null; + this._wallpaperSupported = null; this._backgroundReason = ''; this._notificationReason = ''; this._devicesReason = ''; this._locationReason = ''; + this._wallpaperReason = ''; this._info = info.getDefault(); this._appId = ''; @@ -152,6 +154,16 @@ var FlatpakPortalsModel = GObject.registerClass({ allowed: ['EXACT', '0'], disallowed: ['NONE', '0'], }, + 'portals-wallpaper': { + supported: this.isSupported('wallpaper'), + description: _('Wallpaper'), + value: this.constructor.getDefault(), + example: _('Can change your background and lockscreen wallpapers'), + table: 'wallpaper', + id: 'wallpaper', + allowed: ['yes'], + disallowed: ['no'], + }, }; } diff --git a/tests/service.js b/tests/service.js index a2581da0..a839bdc4 100644 --- a/tests/service.js +++ b/tests/service.js @@ -65,6 +65,9 @@ class MockPermissionsStore { location: { location: {}, }, + wallpaper: { + wallpaper: {}, + }, }; this._version = new GLib.Variant('u', 2); diff --git a/tests/src/testModels.js b/tests/src/testModels.js index d14a8f00..958ec420 100644 --- a/tests/src/testModels.js +++ b/tests/src/testModels.js @@ -31,7 +31,7 @@ const { setup(); -const _totalPermissions = 36; +const _totalPermissions = 37; const _basicAppId = 'com.test.Basic'; const _oldAppId = 'com.test.Old'; @@ -774,6 +774,9 @@ describe('Model', function() { expect(permissions.portals_location).toBe(false); permissions.set_property('portals_location', true); + expect(permissions.portals_wallpaper).toBe(false); + permissions.set_property('portals_wallpaper', true); + GLib.timeout_add(GLib.PRIORITY_HIGH, delay + 1, () => { expect(getValueFromService('background', 'background', 'yes', _basicAppId)).toBe(true); expect(getValueFromService('notifications', 'notification', 'yes', _basicAppId)).toBe(true); @@ -781,6 +784,7 @@ describe('Model', function() { expect(getValueFromService('devices', 'speakers', 'yes', _basicAppId)).toBe(true); expect(getValueFromService('devices', 'camera', 'yes', _basicAppId)).toBe(true); expect(getValueFromService('location', 'location', 'EXACT', _basicAppId)).toBe(true); + expect(getValueFromService('wallpaper', 'wallpaper', 'yes', _basicAppId)).toBe(true); done(); return GLib.SOURCE_REMOVE; @@ -800,6 +804,7 @@ describe('Model', function() { expect(getValueFromService('devices', 'speakers', 'no', _basicAppId)).toBe(true); expect(getValueFromService('devices', 'camera', 'no', _basicAppId)).toBe(true); expect(getValueFromService('location', 'location', 'NONE', _basicAppId)).toBe(true); + expect(getValueFromService('wallpaper', 'wallpaper', 'no', _basicAppId)).toBe(true); }); @@ -813,6 +818,7 @@ describe('Model', function() { expect(permissions.portals_speakers).toBe(false); expect(permissions.portals_camera).toBe(false); expect(permissions.portals_location).toBe(false); + expect(permissions.portals_wallpaper).toBe(false); permissions.set_property('portals_notification', true); permissions.set_property('portals_background', true); @@ -820,6 +826,7 @@ describe('Model', function() { permissions.set_property('portals_speakers', true); permissions.set_property('portals_camera', true); permissions.set_property('portals_location', true); + permissions.set_property('portals_wallpaper', true); GLib.timeout_add(GLib.PRIORITY_HIGH, delay + 1, () => { expect(getValueFromService('background', 'background', 'yes', _overridenAppId)).toBe(true); @@ -828,6 +835,7 @@ describe('Model', function() { expect(getValueFromService('devices', 'speakers', 'yes', _overridenAppId)).toBe(true); expect(getValueFromService('devices', 'camera', 'yes', _overridenAppId)).toBe(true); expect(getValueFromService('location', 'location', 'EXACT', _overridenAppId)).toBe(true); + expect(getValueFromService('wallpaper', 'wallpaper', 'yes', _overridenAppId)).toBe(true); permissions.reset(); @@ -837,6 +845,7 @@ describe('Model', function() { expect(getValueFromService('devices', 'speakers', 'no', _overridenAppId)).toBe(true); expect(getValueFromService('devices', 'camera', 'no', _overridenAppId)).toBe(true); expect(getValueFromService('location', 'location', 'NONE', _overridenAppId)).toBe(true); + expect(getValueFromService('wallpaper', 'wallpaper', 'no', _overridenAppId)).toBe(true); permissions.undo(); @@ -846,6 +855,7 @@ describe('Model', function() { expect(getValueFromService('devices', 'speakers', 'yes', _overridenAppId)).toBe(true); expect(getValueFromService('devices', 'camera', 'yes', _overridenAppId)).toBe(true); expect(getValueFromService('location', 'location', 'EXACT', _overridenAppId)).toBe(true); + expect(getValueFromService('wallpaper', 'wallpaper', 'yes', _overridenAppId)).toBe(true); done(); return GLib.SOURCE_REMOVE;