-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM-54553 - Calls: Enable microphone input in background (Android) (#7585
) * Add foreground service for Android; add voip UIBackgroundMode for iOS * remove iOS change for this PR * create foreground notification channel once at startup
- Loading branch information
Showing
6 changed files
with
79 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
import VIForegroundService from '@voximplant/react-native-foreground-service'; | ||
|
||
import {logError} from '@utils/log'; | ||
|
||
const channelConfig = { | ||
id: 'calls_channel', | ||
name: 'Mattermost', | ||
description: 'Mattermost Calls microphone while app is in the background', | ||
enableVibration: false, | ||
}; | ||
|
||
// Note: multiple calls with same arguments are a noop. | ||
export const foregroundServiceSetup = () => { | ||
VIForegroundService.getInstance().createNotificationChannel(channelConfig); | ||
}; | ||
|
||
export const foregroundServiceStart = async () => { | ||
const notificationConfig = { | ||
channelId: 'calls_channel', | ||
id: 345678, | ||
title: 'Mattermost', | ||
text: 'Mattermost Calls Microphone', | ||
icon: '', | ||
button: 'Stop', | ||
}; | ||
try { | ||
await VIForegroundService.getInstance().startService(notificationConfig); | ||
} catch (e) { | ||
logError('Calls: Cannot start ForegroundService, error:', e); | ||
} | ||
}; | ||
|
||
export const foregroundServiceStop = async () => { | ||
await VIForegroundService.getInstance().stopService(); | ||
}; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
"@sentry/react-native": "5.9.0", | ||
"@stream-io/flat-list-mvcp": "0.10.3", | ||
"@tsconfig/react-native": "3.0.2", | ||
"@voximplant/react-native-foreground-service": "3.0.2", | ||
"base-64": "1.0.0", | ||
"commonmark": "npm:@mattermost/[email protected]", | ||
"commonmark-react-renderer": "github:mattermost/commonmark-react-renderer#235bc817bcade503fb81fa51bbbe3c84f958ed12", | ||
|