[MM-45780] Update to macos-notification-state 3.0, update entitlements and provisioning profile to allow Communication Notification access (#2972)

* [MM-45780] Update to macos-notification-state 3.0, update entitlements and provisioning profile to allow Communication Notification access

* Remove extra entitlements

* Add proper inherit
This commit is contained in:
Devin Binnie
2024-03-11 09:37:38 -04:00
committed by GitHub
parent 4eec77d299
commit c55e37da2f
12 changed files with 55 additions and 23 deletions

View File

@@ -163,7 +163,9 @@ jobs:
CSC_FOR_PULL_REQUEST: true CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }} CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }} CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
MAC_PROFILE: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_DMG_PROFILE }}
run: | run: |
echo $MAC_PROFILE | base64 -D > ./mac.provisionprofile
mkdir -p ./build/macos mkdir -p ./build/macos
npm run package:mac npm run package:mac
bash -x ./scripts/patch_updater_yml.sh bash -x ./scripts/patch_updater_yml.sh

View File

@@ -172,7 +172,9 @@ jobs:
CSC_FOR_PULL_REQUEST: true CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }} CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }} CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
MAC_PROFILE: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_DMG_PROFILE }}
run: | run: |
echo $MAC_PROFILE | base64 -D > ./mac.provisionprofile
mkdir -p ./build/macos-release mkdir -p ./build/macos-release
npm run package:mac-with-universal npm run package:mac-with-universal
bash -x ./scripts/patch_updater_yml.sh bash -x ./scripts/patch_updater_yml.sh

View File

@@ -102,7 +102,9 @@ jobs:
CSC_FOR_PULL_REQUEST: true CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }} CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }} CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
MAC_PROFILE: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_DMG_PROFILE }}
run: | run: |
echo $MAC_PROFILE | base64 -D > ./mac.provisionprofile
mkdir -p ./build/macos mkdir -p ./build/macos
npm run package:mac-with-universal npm run package:mac-with-universal
bash -x ./scripts/patch_updater_yml.sh bash -x ./scripts/patch_updater_yml.sh

View File

@@ -144,7 +144,9 @@ jobs:
CSC_FOR_PULL_REQUEST: true CSC_FOR_PULL_REQUEST: true
CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }} CSC_KEY_PASSWORD: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }} CSC_LINK: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_CSC_LINK }}
MAC_PROFILE: ${{ secrets.MM_DESKTOP_MAC_INSTALLER_DMG_PROFILE }}
run: | run: |
echo $MAC_PROFILE | base64 -D > ./mac.provisionprofile
mkdir -p ./build/macos-release mkdir -p ./build/macos-release
npm run package:mac-with-universal npm run package:mac-with-universal
bash -x ./scripts/patch_updater_yml.sh bash -x ./scripts/patch_updater_yml.sh

View File

@@ -100,12 +100,14 @@
"hardenedRuntime": true, "hardenedRuntime": true,
"gatekeeperAssess": true, "gatekeeperAssess": true,
"entitlements": "./entitlements.mac.plist", "entitlements": "./entitlements.mac.plist",
"entitlementsInherit": "./entitlements.mac.plist", "entitlementsInherit": "./entitlements.mac.inherit.plist",
"extendInfo": { "extendInfo": {
"NSMicrophoneUsageDescription": "Microphone access may be used by Mattermost plugins, such as Jitsi video conferencing.", "NSMicrophoneUsageDescription": "Microphone access may be used by Mattermost plugins, such as Jitsi video conferencing.",
"NSCameraUsageDescription": "Camera access may be used by Mattermost plugins, such as Jitsi video conferencing.", "NSCameraUsageDescription": "Camera access may be used by Mattermost plugins, such as Jitsi video conferencing.",
"NSFocusStatusUsageDescription": "Focus status is used by Mattermost to determine whether to send notifications or not.",
"LSFileQuarantineEnabled": true "LSFileQuarantineEnabled": true
} },
"provisioningProfile": "./mac.provisionprofile"
}, },
"mas": { "mas": {
"hardenedRuntime": false, "hardenedRuntime": false,
@@ -119,7 +121,7 @@
"singleArchFiles": "*" "singleArchFiles": "*"
}, },
"masDev": { "masDev": {
"provisioningProfile": "./mas-dev.provisionprofile" "provisioningProfile": "./dev.provisionprofile"
}, },
"dmg": { "dmg": {
"background": "src/assets/osx/DMG_BG.png", "background": "src/assets/osx/DMG_BG.png",

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>

View File

@@ -14,5 +14,7 @@
<true/> <true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key> <key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/> <true/>
<key>com.apple.developer.usernotifications.communication</key>
<true/>
</dict> </dict>
</plist> </plist>

View File

@@ -36,5 +36,7 @@
<true/> <true/>
<key>com.apple.security.files.bookmarks.document-scope</key> <key>com.apple.security.files.bookmarks.document-scope</key>
<true/> <true/>
<key>com.apple.developer.usernotifications.communication</key>
<true/>
</dict> </dict>
</plist> </plist>

16
package-lock.json generated
View File

@@ -10,7 +10,7 @@
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"macos-notification-state": "2.0.2", "macos-notification-state": "3.0.0",
"windows-focus-assist": "1.3.0" "windows-focus-assist": "1.3.0"
}, },
"devDependencies": { "devDependencies": {
@@ -17523,14 +17523,20 @@
} }
}, },
"node_modules/macos-notification-state": { "node_modules/macos-notification-state": {
"version": "2.0.2", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/macos-notification-state/-/macos-notification-state-2.0.2.tgz", "resolved": "https://registry.npmjs.org/macos-notification-state/-/macos-notification-state-3.0.0.tgz",
"integrity": "sha512-rTKda+694hvxXm4s00I5LEwlQxGwwCZKaCXogxEXyGagmsP7mGfLiyoI6MX360GQ0V6lmHOCqivg4LLQPFYb6A==", "integrity": "sha512-tvFDZajIcwIsYg1WQAXGtrJFljlL1PEOK2cCoPDrN//XxIwTiVNvaXznxLjV4mYkyXctIDVs0ujGdrbGzeOY/w==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"bindings": "^1.5.0" "bindings": "^1.5.0",
"node-addon-api": "3.0.0"
} }
}, },
"node_modules/macos-notification-state/node_modules/node-addon-api": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.0.0.tgz",
"integrity": "sha512-sSHCgWfJ+Lui/u+0msF3oyCgvdkhxDbkCS6Q8uiJquzOimkJBvX6hl5aSSA7DR1XbMpdM8r7phjcF63sF4rkKg=="
},
"node_modules/magic-string": { "node_modules/magic-string": {
"version": "0.30.8", "version": "0.30.8",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz",

View File

@@ -220,7 +220,7 @@
"yargs": "17.4.0" "yargs": "17.4.0"
}, },
"dependencies": { "dependencies": {
"macos-notification-state": "2.0.2", "macos-notification-state": "3.0.0",
"windows-focus-assist": "1.3.0" "windows-focus-assist": "1.3.0"
} }
} }

View File

@@ -121,7 +121,7 @@ describe('main/notifications', () => {
PermissionsManager.doPermissionRequest.mockReturnValue(Promise.resolve(true)); PermissionsManager.doPermissionRequest.mockReturnValue(Promise.resolve(true));
Notification.isSupported.mockImplementation(() => true); Notification.isSupported.mockImplementation(() => true);
getFocusAssist.mockReturnValue({value: 0, name: ''}); getFocusAssist.mockReturnValue({value: 0, name: ''});
getDarwinDoNotDisturb.mockReturnValue(false); getDarwinDoNotDisturb.mockReturnValue(Promise.resolve(false));
Config.notifications = { Config.notifications = {
flashWindow: 0, flashWindow: 0,
bounceIcon: false, bounceIcon: false,
@@ -184,7 +184,7 @@ describe('main/notifications', () => {
value: 'darwin', value: 'darwin',
}); });
getDarwinDoNotDisturb.mockReturnValue(true); getDarwinDoNotDisturb.mockReturnValue(Promise.resolve(true));
await NotificationManager.displayMention( await NotificationManager.displayMention(
'test', 'test',
'test body', 'test body',
@@ -389,13 +389,13 @@ describe('main/notifications', () => {
beforeEach(() => { beforeEach(() => {
Notification.isSupported.mockImplementation(() => true); Notification.isSupported.mockImplementation(() => true);
getFocusAssist.mockReturnValue({value: 0, name: ''}); getFocusAssist.mockReturnValue({value: 0, name: ''});
getDarwinDoNotDisturb.mockReturnValue(false); getDarwinDoNotDisturb.mockReturnValue(Promise.resolve(false));
}); });
it('should open file when clicked', () => { it('should open file when clicked', async () => {
getDarwinDoNotDisturb.mockReturnValue(false); getDarwinDoNotDisturb.mockReturnValue(Promise.resolve(false));
localizeMessage.mockReturnValue('test_filename'); localizeMessage.mockReturnValue('test_filename');
NotificationManager.displayDownloadCompleted( await NotificationManager.displayDownloadCompleted(
'test_filename', 'test_filename',
'/path/to/file', '/path/to/file',
'server_name', 'server_name',

View File

@@ -34,7 +34,7 @@ class NotificationManager {
return; return;
} }
if (getDoNotDisturb()) { if (await getDoNotDisturb()) {
return; return;
} }
@@ -102,7 +102,7 @@ class NotificationManager {
mention.show(); mention.show();
} }
public displayDownloadCompleted(fileName: string, path: string, serverName: string) { public async displayDownloadCompleted(fileName: string, path: string, serverName: string) {
log.debug('displayDownloadCompleted', {fileName, path, serverName}); log.debug('displayDownloadCompleted', {fileName, path, serverName});
if (!Notification.isSupported()) { if (!Notification.isSupported()) {
@@ -110,7 +110,7 @@ class NotificationManager {
return; return;
} }
if (getDoNotDisturb()) { if (await getDoNotDisturb()) {
return; return;
} }
@@ -136,12 +136,12 @@ class NotificationManager {
download.show(); download.show();
} }
public displayUpgrade(version: string, handleUpgrade: () => void): void { public async displayUpgrade(version: string, handleUpgrade: () => void) {
if (!Notification.isSupported()) { if (!Notification.isSupported()) {
log.error('notification not supported'); log.error('notification not supported');
return; return;
} }
if (getDoNotDisturb()) { if (await getDoNotDisturb()) {
return; return;
} }
@@ -156,12 +156,12 @@ class NotificationManager {
this.upgradeNotification.show(); this.upgradeNotification.show();
} }
public displayRestartToUpgrade(version: string, handleUpgrade: () => void): void { public async displayRestartToUpgrade(version: string, handleUpgrade: () => void) {
if (!Notification.isSupported()) { if (!Notification.isSupported()) {
log.error('notification not supported'); log.error('notification not supported');
return; return;
} }
if (getDoNotDisturb()) { if (await getDoNotDisturb()) {
return; return;
} }
@@ -174,7 +174,7 @@ class NotificationManager {
} }
} }
function getDoNotDisturb() { async function getDoNotDisturb() {
if (process.platform === 'win32') { if (process.platform === 'win32') {
return getWindowsDoNotDisturb(); return getWindowsDoNotDisturb();
} }