forked from mattermost-community/focalboard
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mattermost-communityGH-314] Persist and reapply users settings in ma…
…c app (mattermost-community#331) * [mattermost-communityGH-314] Persist and reapply users settings in mac app Relates to: mattermost-community#314 * Inject settings blob at document start, push base64 conversion into TS, use proper quotes * Remove whitespace * Rename base64 to blob for consistency
- Loading branch information
Showing
7 changed files
with
132 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {importUserSettingsBlob} from './userSettings' | ||
|
||
declare interface INativeApp { | ||
settingsBlob: string | null; | ||
} | ||
|
||
declare const NativeApp: INativeApp | ||
|
||
export function importNativeAppSettings() { | ||
if (typeof NativeApp === 'undefined' || !NativeApp.settingsBlob) { | ||
return | ||
} | ||
const success = importUserSettingsBlob(NativeApp.settingsBlob) | ||
const messageType = success ? 'didImportUserSettings' : 'didNotImportUserSettings' | ||
postWebKitMessage({type: messageType, settingsBlob: NativeApp.settingsBlob}) | ||
NativeApp.settingsBlob = null | ||
} | ||
|
||
function postWebKitMessage(message: any) { | ||
const webkit = (window as any).webkit | ||
if (typeof webkit === 'undefined') { | ||
return | ||
} | ||
const handler = webkit.messageHandlers.nativeApp | ||
if (typeof handler === 'undefined') { | ||
return | ||
} | ||
handler.postMessage(message) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters