mirror of
https://github.com/jellyfin/jellyfin-expo.git
synced 2024-11-24 06:29:57 +00:00
27 lines
739 B
JavaScript
27 lines
739 B
JavaScript
/**
|
||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||
*/
|
||
import Constants from 'expo-constants';
|
||
import * as Device from 'expo-device';
|
||
|
||
export function getAppName() {
|
||
return `Jellyfin Mobile (${Device.osName})`;
|
||
}
|
||
|
||
export function getSafeDeviceName() {
|
||
let safeName = Constants.deviceName
|
||
// Replace non-ascii apostrophe with single quote (default on iOS)
|
||
.replace(/’/g, '\'')
|
||
// Remove all other non-ascii characters
|
||
.replace(/[^\x20-\x7E]/g, '')
|
||
// Trim whitespace
|
||
.trim();
|
||
if (safeName) {
|
||
return safeName;
|
||
}
|
||
|
||
return Device.modelName || 'Jellyfin Mobile Device';
|
||
}
|