Skip to content

Migrate “History and Cache” to Jetpack Compose#11494

Open
braiso-22 wants to merge 8 commits intoTeamNewPipe:refactorfrom
braiso-22:history_cache_compose
Open

Migrate “History and Cache” to Jetpack Compose#11494
braiso-22 wants to merge 8 commits intoTeamNewPipe:refactorfrom
braiso-22:history_cache_compose

Conversation

@braiso-22
Copy link
Copy Markdown

@braiso-22 braiso-22 commented Sep 1, 2024

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Added daggerHilt DI
  • Changed the History and cache setting screen to use compose

Before/After Screenshots/Screen Record

  • Before:
    Captura de pantalla 2024-09-01 a las 18 44 50
    image

  • After:
    Captura de pantalla 2024-09-01 a las 18 39 49
    image

Fixes the following issue(s)

  • Fixes #

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions Bot added the size/giant PRs with more than 750 changed lines label Sep 1, 2024
@braiso-22
Copy link
Copy Markdown
Author

@snaik20 can you review this PR?

@TobiGr TobiGr added the GUI Issue is related to the graphical user interface label Sep 2, 2024
Copy link
Copy Markdown
Member

@Isira-Seneviratne Isira-Seneviratne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty decent, thank you! In particular, the addition of Hilt will be useful.

That being said, I've suggested some improvements.

@braiso-22 braiso-22 mentioned this pull request Sep 20, 2024
5 tasks
@ShareASmile ShareASmile added the rewrite Issues and PRs related to rewrite label Oct 5, 2024
@Profpatsch Profpatsch changed the title History cache compose Migrate “History and Cache” to Jetbrains Compose Nov 19, 2024
@AudricV AudricV changed the title Migrate “History and Cache” to Jetbrains Compose Migrate “History and Cache” to Jetpack Compose Nov 20, 2024
@Profpatsch Profpatsch force-pushed the history_cache_compose branch from 89576ad to c3aa4e7 Compare November 20, 2024 15:41
@Profpatsch
Copy link
Copy Markdown
Contributor

I rebased on current refactor & squashed, but I can’t get it to work. The hilt library is throwing weird injection errors:

/home/philip/kot/android/NewPipe/app/build/generated/hilt/component_sources/debug/org/schabi/newpipe/App_HiltComponents.java:144: error: [Dagger/DuplicateBindings] android.content.SharedPreferences is bound multiple times:
  public abstract static class SingletonC implements FragmentGetContextFix.FragmentGetContextFixEntryPoint,
                         ^
          @Provides @Singleton android.content.SharedPreferences org.schabi.newpipe.AppModule.providesSharedPreference(@dagger.hilt.android.qualifiers.ApplicationContext android.content.Context)
          @Provides @Singleton android.content.SharedPreferences org.schabi.newpipe.dependency_injection.AppModule.provideSharedPreferences(@dagger.hilt.android.qualifiers.ApplicationContext android.content.Context)
      android.content.SharedPreferences is injected at
          org.schabi.newpipe.settings.viewmodel.SettingsViewModel(…, preferenceManager)
      org.schabi.newpipe.settings.viewmodel.SettingsViewModel is injected at
          org.schabi.newpipe.settings.viewmodel.SettingsViewModel_HiltModules.BindsModule.binds(vm)
      @dagger.hilt.android.internal.lifecycle.HiltViewModelMap java.util.Map<java.lang.Class<?>,javax.inject.Provider<androidx.lifecycle.ViewModel>> is requested at
          dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.ViewModelFactoriesEntryPoint.getHiltViewModelMap() [org.schabi.newpipe.App_HiltComponents.SingletonC → org.schabi.newpipe.App_HiltComponents.ActivityRetainedC → org.schabi.newpipe.App_HiltComponents.ViewModelC]
  It is also requested at:
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideGetBooleanPreference(sharedPreferences, …)
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideGetStringPreference(sharedPreferences, …)
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideUpdateBooleanPreference(sharedPreferences, …)
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideUpdateStringPreference(sharedPreferences, …)

@Profpatsch
Copy link
Copy Markdown
Contributor

Something I noticed: the old implementation seems to be still around, don’t we want to remove it?

@ShareASmile ShareASmile added the history Anything to do with previously watched stuff label Jan 23, 2025
@Stypox Stypox added the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Oct 1, 2025
@Stypox
Copy link
Copy Markdown
Member

Stypox commented Oct 1, 2025

Hey @braiso-22, do you have time to address the reviews and complete this PR? Thanks in advance :-)

@braiso-22
Copy link
Copy Markdown
Author

braiso-22 commented Oct 3, 2025

Hey @braiso-22, do you have time to address the reviews and complete this PR? Thanks in advance :-)

Sorry for leaving this PR unattended for so long! Life has been a bit crazy lately and I completely forgot about it. I'll get back to it soon

@github-actions github-actions Bot removed the waiting for author If the author doesn't respond, the issue will be auto-closed. Otherwise the label will be removed. label Oct 3, 2025
@Stypox
Copy link
Copy Markdown
Member

Stypox commented Oct 3, 2025

Totally understandable, thanks!

@braiso-22
Copy link
Copy Markdown
Author

I rebased on current refactor & squashed, but I can’t get it to work. The hilt library is throwing weird injection errors:

/home/philip/kot/android/NewPipe/app/build/generated/hilt/component_sources/debug/org/schabi/newpipe/App_HiltComponents.java:144: error: [Dagger/DuplicateBindings] android.content.SharedPreferences is bound multiple times:
  public abstract static class SingletonC implements FragmentGetContextFix.FragmentGetContextFixEntryPoint,
                         ^
          @Provides @Singleton android.content.SharedPreferences org.schabi.newpipe.AppModule.providesSharedPreference(@dagger.hilt.android.qualifiers.ApplicationContext android.content.Context)
          @Provides @Singleton android.content.SharedPreferences org.schabi.newpipe.dependency_injection.AppModule.provideSharedPreferences(@dagger.hilt.android.qualifiers.ApplicationContext android.content.Context)
      android.content.SharedPreferences is injected at
          org.schabi.newpipe.settings.viewmodel.SettingsViewModel(…, preferenceManager)
      org.schabi.newpipe.settings.viewmodel.SettingsViewModel is injected at
          org.schabi.newpipe.settings.viewmodel.SettingsViewModel_HiltModules.BindsModule.binds(vm)
      @dagger.hilt.android.internal.lifecycle.HiltViewModelMap java.util.Map<java.lang.Class<?>,javax.inject.Provider<androidx.lifecycle.ViewModel>> is requested at
          dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.ViewModelFactoriesEntryPoint.getHiltViewModelMap() [org.schabi.newpipe.App_HiltComponents.SingletonC → org.schabi.newpipe.App_HiltComponents.ActivityRetainedC → org.schabi.newpipe.App_HiltComponents.ViewModelC]
  It is also requested at:
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideGetBooleanPreference(sharedPreferences, …)
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideGetStringPreference(sharedPreferences, …)
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideUpdateBooleanPreference(sharedPreferences, …)
      org.schabi.newpipe.settings.dependency_injection.SettingsModule.provideUpdateStringPreference(sharedPreferences, …)

fixed in the latest commit

@braiso-22
Copy link
Copy Markdown
Author

Something I noticed: the old implementation seems to be still around, don’t we want to remove it?

Do you mean the xml view? I don't know how do we proceed in this case @Isira-Seneviratne what do i do?

@braiso-22
Copy link
Copy Markdown
Author

Hi @Stypox and @Isira-Seneviratne, I think this PR is ready for another review. I’ve addressed some of the comments, and for the ones that seemed out of scope, I’ve added explanations in my replies. Could you please take another look?

@braiso-22
Copy link
Copy Markdown
Author

The pipeline started failing on the ktLint Gradle task in a class I didn’t modify. I’ve merged my branch with the refactor branch again and fixed the two errors reported by the pipeline. You can approve it again.

@Stypox Stypox self-assigned this Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI Issue is related to the graphical user interface history Anything to do with previously watched stuff rewrite Issues and PRs related to rewrite size/giant PRs with more than 750 changed lines

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

7 participants