mirror of
https://github.com/Jellify-Music/App.git
synced 2026-04-24 11:59:02 -05:00
ae7aef5df3
Adds an Instant Mix Button and Screen - users can view an instant mix from the album page by tapping on the Compass icon (which is styled for Dark and Light mode, respectfully) Fixes Android playback controls not showing up - this is a regression introduced by React Native's New Architecture and is being rolled back. A future update will fix this and get Android builds back on the New Architecture Adds Tamagui styling to toasts so that they are more homogenous with the rest of the UI
36 lines
996 B
TypeScript
36 lines
996 B
TypeScript
import { Api } from '@jellyfin/sdk'
|
|
import { JellyfinInfo } from '../info'
|
|
import _ from 'lodash'
|
|
|
|
export function createApi(
|
|
serverUrl?: string,
|
|
username?: string,
|
|
password?: string,
|
|
accessToken?: string,
|
|
): Promise<Api> {
|
|
return new Promise((resolve, reject) => {
|
|
if (_.isUndefined(serverUrl)) {
|
|
console.info("Server Url doesn't exist yet")
|
|
return reject("Server Url doesn't exist")
|
|
}
|
|
|
|
if (!_.isUndefined(accessToken)) {
|
|
console.info('Creating API with accessToken')
|
|
return resolve(JellyfinInfo.createApi(serverUrl, accessToken))
|
|
}
|
|
|
|
if (_.isUndefined(username) && _.isUndefined(password)) {
|
|
console.info('Creating public API for server url')
|
|
return resolve(JellyfinInfo.createApi(serverUrl))
|
|
}
|
|
|
|
JellyfinInfo.createApi(serverUrl)
|
|
.authenticateUserByName(username!, password)
|
|
.then(({ data }) => {
|
|
if (data.AccessToken)
|
|
return resolve(JellyfinInfo.createApi(serverUrl, data.AccessToken))
|
|
else return reject('Unable to sign in')
|
|
})
|
|
})
|
|
}
|