feat: naive scrobbling integration
This commit is contained in:
@@ -33,7 +33,17 @@ const persistConfig: PersistConfig<Omit<AppState, '_persist'>> = {
|
||||
queued: []
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
// @ts-expect-error migrations are poorly typed
|
||||
3: (state: AppState) => {
|
||||
return {
|
||||
...state,
|
||||
settings: {
|
||||
...state.settings,
|
||||
enablePlaybackReporting: true,
|
||||
}
|
||||
};
|
||||
},
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ import { createAction } from '@reduxjs/toolkit';
|
||||
export const setJellyfinCredentials = createAction<{ access_token: string, user_id: string, uri: string, device_id: string; }>('SET_JELLYFIN_CREDENTIALS');
|
||||
export const setBitrate = createAction<number>('SET_BITRATE');
|
||||
export const setOnboardingStatus = createAction<boolean>('SET_ONBOARDING_STATUS');
|
||||
export const setReceivedErrorReportingAlert = createAction<void>('SET_RECEIVED_ERROR_REPORTING_ALERT');
|
||||
export const setReceivedErrorReportingAlert = createAction<void>('SET_RECEIVED_ERROR_REPORTING_ALERT');
|
||||
export const setEnablePlaybackReporting = createAction<boolean>('SET_ENABLE_PLAYBACK_REPORTING');
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createReducer } from '@reduxjs/toolkit';
|
||||
import { setReceivedErrorReportingAlert, setBitrate, setJellyfinCredentials, setOnboardingStatus } from './actions';
|
||||
import { setReceivedErrorReportingAlert, setBitrate, setJellyfinCredentials, setOnboardingStatus, setEnablePlaybackReporting } from './actions';
|
||||
|
||||
interface State {
|
||||
jellyfin?: {
|
||||
@@ -11,12 +11,14 @@ interface State {
|
||||
bitrate: number;
|
||||
isOnboardingComplete: boolean;
|
||||
hasReceivedErrorReportingAlert: boolean;
|
||||
enablePlaybackReporting: boolean;
|
||||
}
|
||||
|
||||
const initialState: State = {
|
||||
bitrate: 140000000,
|
||||
isOnboardingComplete: false,
|
||||
hasReceivedErrorReportingAlert: false,
|
||||
enablePlaybackReporting: true,
|
||||
};
|
||||
|
||||
const settings = createReducer(initialState, builder => {
|
||||
@@ -36,6 +38,10 @@ const settings = createReducer(initialState, builder => {
|
||||
...state,
|
||||
hasReceivedErrorReportingAlert: true,
|
||||
}));
|
||||
builder.addCase(setEnablePlaybackReporting, (state, action) => ({
|
||||
...state,
|
||||
enablePlaybackReporting: action.payload,
|
||||
}));
|
||||
});
|
||||
|
||||
export default settings;
|
||||
Reference in New Issue
Block a user