Skip to content

Commit

Permalink
feat: Allow clisk konnectors to have incognito mode in webview
Browse files Browse the repository at this point in the history
This can avoid the need to force logout each time the konnector is run
  • Loading branch information
doubleface committed Nov 15, 2024
1 parent 9674402 commit 8e41369
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libs/ReactNativeLauncher.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class ReactNativeLauncher extends Launcher {
'saveIdentity',
'queryAll',
'setUserAgent',
'setIncognito',
'getCredentials',
'saveCredentials',
'getCookiesByDomain',
Expand Down Expand Up @@ -583,6 +584,15 @@ class ReactNativeLauncher extends Launcher {
this.emit('SET_USER_AGENT', userAgent)
}

/**
* Set incognito mode for worker webview
*
* @param {Boolean} incognito
*/
async setIncognito(incognito) {
this.emit('SET_INCOGNITO', incognito)
}

/**
* Run the specified method in the worker and make it fail with WORKER_WILL_RELOAD message
* if the worker page is reloaded
Expand Down
5 changes: 5 additions & 0 deletions src/screens/konnectors/LauncherView.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class LauncherView extends Component {
this.workerWebview = null
this.state = {
userAgent: undefined,
incognito: false,
konnector: null,
workerInnerUrl: null,
worker: {},
Expand Down Expand Up @@ -220,6 +221,9 @@ export class LauncherView extends Component {
this.launcher.on('SET_USER_AGENT', userAgent => {
this.setState({ userAgent })
})
this.launcher.on('SET_INCOGNITO', incognito => {
this.setState({ incognito })
})
this.launcher.on('CREATED_ACCOUNT', this.onCreatedAccount)
this.launcher.on('CREATED_JOB', this.onCreatedJob)
this.launcher.on('STOPPED_JOB', this.onStoppedJob)
Expand Down Expand Up @@ -304,6 +308,7 @@ export class LauncherView extends Component {
javaScriptEnabled={true}
onContentProcessDidTerminate={this.onWorkerWebviewKilled}
onRenderProcessGone={this.onWorkerWebviewKilled}
incognito={this.state.incognito}
userAgent={this.state.userAgent}
source={{
uri: this.state.worker.url
Expand Down

0 comments on commit 8e41369

Please sign in to comment.