Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor PlaybackHelper to use dependency injection #3584

Merged
merged 2 commits into from
May 18, 2024

Conversation

nielsvanvelzen
Copy link
Member

@nielsvanvelzen nielsvanvelzen commented May 17, 2024

Changes

  • Change all static functions in PlaybackHelper to not be static. Inject it via DI.
  • Add interface for PlaybackHelper
  • Fix a UUID comparison issue in LiveTvGuideFragment

Issues

@nielsvanvelzen nielsvanvelzen added the refactor Improvements to code realiability, readability and quality label May 17, 2024
@nielsvanvelzen nielsvanvelzen added this to the v0.17.0 milestone May 17, 2024
private Lazy<PlaybackControllerContainer> playbackControllerContainer = KoinJavaComponent.<PlaybackControllerContainer>inject(PlaybackControllerContainer.class);

@Override
public void getItemsToPlay(final org.jellyfin.sdk.model.api.BaseItemDto mainItem, boolean allowIntros, final boolean shuffle, final Response<List<org.jellyfin.sdk.model.api.BaseItemDto>> outerResponse) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
private Lazy<PlaybackControllerContainer> playbackControllerContainer = KoinJavaComponent.<PlaybackControllerContainer>inject(PlaybackControllerContainer.class);

@Override
public void getItemsToPlay(final org.jellyfin.sdk.model.api.BaseItemDto mainItem, boolean allowIntros, final boolean shuffle, final Response<List<org.jellyfin.sdk.model.api.BaseItemDto>> outerResponse) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@@ -305,22 +314,24 @@
});
}

public static void retrieveAndPlay(UUID id, boolean shuffle, Context activity) {
@Override
public void retrieveAndPlay(UUID id, boolean shuffle, Context activity) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@@ -305,22 +314,24 @@
});
}

public static void retrieveAndPlay(UUID id, boolean shuffle, Context activity) {
@Override
public void retrieveAndPlay(UUID id, boolean shuffle, Context activity) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
UUID userId = KoinJavaComponent.<SessionRepository>get(SessionRepository.class).getCurrentSession().getValue().getUserId();
KoinJavaComponent.<ApiClient>get(ApiClient.class).GetItemAsync(id.toString(), userId.toString(), new Response<BaseItemDto>() {
@Override
public void retrieveAndPlay(UUID id, final boolean shuffle, final Long position, final Context activity) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
UUID userId = KoinJavaComponent.<SessionRepository>get(SessionRepository.class).getCurrentSession().getValue().getUserId();
KoinJavaComponent.<ApiClient>get(ApiClient.class).GetItemAsync(id.toString(), userId.toString(), new Response<BaseItemDto>() {
@Override
public void retrieveAndPlay(UUID id, final boolean shuffle, final Long position, final Context activity) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
UUID userId = KoinJavaComponent.<SessionRepository>get(SessionRepository.class).getCurrentSession().getValue().getUserId();
KoinJavaComponent.<ApiClient>get(ApiClient.class).GetItemAsync(id.toString(), userId.toString(), new Response<BaseItemDto>() {
@Override
public void retrieveAndPlay(UUID id, final boolean shuffle, final Long position, final Context activity) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@@ -335,21 +346,22 @@
});
}

public static void playInstantMix(Context context, org.jellyfin.sdk.model.api.BaseItemDto item) {
@Override
public void playInstantMix(Context context, org.jellyfin.sdk.model.api.BaseItemDto item) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@@ -335,21 +346,22 @@
});
}

public static void playInstantMix(Context context, org.jellyfin.sdk.model.api.BaseItemDto item) {
@Override
public void playInstantMix(Context context, org.jellyfin.sdk.model.api.BaseItemDto item) {

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
@nielsvanvelzen nielsvanvelzen merged commit 419c01b into jellyfin:master May 18, 2024
6 checks passed
@nielsvanvelzen nielsvanvelzen deleted the static-playback-helper branch May 18, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Improvements to code realiability, readability and quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants