From 58162954caf32fd9ee0680b69d78c5b18c5f4996 Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 15:12:37 +0530 Subject: [PATCH 1/7] App lounge: (issue_4427) add jackson and yaml dependency for retrofit --- app/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 8e626ab45..4821feb5f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -116,10 +116,14 @@ dependencies { def retrofit_version = "2.9.0" implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version" + implementation "com.squareup.retrofit2:converter-jackson:$retrofit_version" implementation "com.squareup.moshi:moshi-kotlin:1.13.0" // implementation "com.squareup.moshi:moshi-adapters:1.5.0" implementation "com.squareup.okhttp3:okhttp:4.9.2" + // YAML factory + implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.2" + // Navigation Components def navigation_version = "2.3.5" implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" -- GitLab From 43dcc5c8383524cf27ad23358c6541784c278daa Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 19:05:13 +0530 Subject: [PATCH 2/7] App lounge: (issue_4427) Create models for F-Droid, API and Dao --- .../e/apps/api/fdroid/FdroidApiInterface.kt | 18 ++++++++++++ .../foundation/e/apps/api/fdroid/FdroidDao.kt | 21 ++++++++++++++ .../e/apps/api/fdroid/FdroidRepository.kt | 28 +++++++++++++++++++ .../apps/api/fdroid/models/FdroidApiModel.kt | 27 ++++++++++++++++++ .../e/apps/api/fdroid/models/FdroidEntity.kt | 21 ++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt create mode 100644 app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt create mode 100644 app/src/main/java/foundation/e/apps/api/fdroid/FdroidRepository.kt create mode 100644 app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidApiModel.kt create mode 100644 app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt new file mode 100644 index 000000000..f5fadf253 --- /dev/null +++ b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt @@ -0,0 +1,18 @@ +package foundation.e.apps.api.fdroid + +import foundation.e.apps.api.fdroid.models.FdroidApiModel +import retrofit2.http.GET +import retrofit2.http.Path + +/** + * Interface for retrofit calls. + */ +interface FdroidApiInterface { + + companion object { + const val BASE_URL = "https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/" + } + + @GET("{packageName}.yml") + suspend fun getFdroidInfoForPackage(@Path("packageName") packageName: String): FdroidApiModel? +} \ No newline at end of file diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt new file mode 100644 index 000000000..7f0763b77 --- /dev/null +++ b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt @@ -0,0 +1,21 @@ +package foundation.e.apps.api.fdroid + +import androidx.room.Dao +import androidx.room.Insert +import androidx.room.OnConflictStrategy +import androidx.room.Query +import foundation.e.apps.api.fdroid.models.FdroidEntity + +/** + * Dao interface for storing Fdroid info in DB. + */ +@Dao +interface FdroidDao { + + @Insert(onConflict = OnConflictStrategy.REPLACE) + suspend fun saveFdroidEntity(fdroidEntity: FdroidEntity) + + @Query("SELECT * FROM FdroidEntity where packageName is :packageName") + suspend fun getFdroidEntityFromPackageName(packageName: String): FdroidEntity? + +} \ No newline at end of file diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidRepository.kt b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidRepository.kt new file mode 100644 index 000000000..b04e3366b --- /dev/null +++ b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidRepository.kt @@ -0,0 +1,28 @@ +package foundation.e.apps.api.fdroid + +import foundation.e.apps.api.fdroid.models.FdroidEntity +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class FdroidRepository @Inject constructor( + private val fdroidApi: FdroidApiInterface, + private val fdroidDao: FdroidDao, +) { + + /** + * Get Fdroid entity from DB is present. + * If not present then make an API call, store the fetched result and return the result. + * + * Result may be null. + */ + suspend fun getFdroidInfo(packageName: String): FdroidEntity? { + return fdroidDao.getFdroidEntityFromPackageName(packageName) + ?: fdroidApi.getFdroidInfoForPackage(packageName)?.let { + FdroidEntity(packageName, it.authorName).also { + fdroidDao.saveFdroidEntity(it) + } + } + } + +} \ No newline at end of file diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidApiModel.kt b/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidApiModel.kt new file mode 100644 index 000000000..26d33ee77 --- /dev/null +++ b/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidApiModel.kt @@ -0,0 +1,27 @@ +package foundation.e.apps.api.fdroid.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * Data class for requests to F-droid API. + * https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/.yml + * + * An empty constructor is required to allow parsing by Jackson. + * https://facingissuesonit.com/2019/07/17/com-fasterxml-jackson-databind-exc-invaliddefinitionexception-cannot-construct-instance-of-xyz-no-creators-like-default-construct-exist-cannot-deserialize-from-object-value-no-delega/ + * + * Jackson annotations can be found here: + * https://github.com/FasterXML/jackson-annotations + * + * Currently only being used to fetch author name. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +class FdroidApiModel() { + var authorName: String = "" + + @JsonCreator + constructor(@JsonProperty("AuthorName") AuthorName: String?): this(){ + this.authorName = AuthorName ?: "" + } +} \ No newline at end of file diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt b/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt new file mode 100644 index 000000000..4375f6d46 --- /dev/null +++ b/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt @@ -0,0 +1,21 @@ +package foundation.e.apps.api.fdroid.models + +import androidx.room.Entity +import androidx.room.PrimaryKey + +/** + * Store the contents from api in DB to prevent further network calls. + * This is also the model used for views. + */ +@Entity +class FdroidEntity(@PrimaryKey val packageName: String, authorName: String) { + + companion object { + val DEFAULT_FDROID_AUTHOR_NAME = "F-Droid" + } + + var authorName: String = DEFAULT_FDROID_AUTHOR_NAME + init { + if (authorName.isNotBlank()) this.authorName = authorName + } +} \ No newline at end of file -- GitLab From d40f8cdebae580525f8d799d19bf6f8bb029adf2 Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 19:08:00 +0530 Subject: [PATCH 3/7] App lounge: (issue_4427) add fdroid related interfaces in DIs, Retrofit, Room. --- .../e/apps/api/cleanapk/RetrofitModule.kt | 35 +++++++++++++++++++ .../e/apps/api/database/AppDatabase.kt | 5 ++- .../e/apps/api/fdroid/FdroidApiInterface.kt | 1 + .../foundation/e/apps/api/fdroid/FdroidDao.kt | 1 + .../java/foundation/e/apps/di/DaoModule.kt | 6 ++++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt b/app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt index 73cb2a3b8..dc95ec3bf 100644 --- a/app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt +++ b/app/src/main/java/foundation/e/apps/api/cleanapk/RetrofitModule.kt @@ -20,6 +20,8 @@ package foundation.e.apps.api.cleanapk import android.os.Build import android.util.Log +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory import com.squareup.moshi.Moshi import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import dagger.Module @@ -27,6 +29,7 @@ import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import foundation.e.apps.api.exodus.ExodusTrackerApi +import foundation.e.apps.api.fdroid.FdroidApiInterface import okhttp3.Cache import okhttp3.Interceptor import okhttp3.MediaType.Companion.toMediaTypeOrNull @@ -35,8 +38,10 @@ import okhttp3.Protocol import okhttp3.Response import okhttp3.ResponseBody.Companion.toResponseBody import retrofit2.Retrofit +import retrofit2.converter.jackson.JacksonConverterFactory import retrofit2.converter.moshi.MoshiConverterFactory import java.net.ConnectException +import javax.inject.Named import javax.inject.Singleton @Module @@ -69,6 +74,25 @@ object RetrofitModule { .create(ExodusTrackerApi::class.java) } + /** + * The fdroid api returns results in .yaml format. + * Hence we need a yaml convertor. + * Convertor is being provided by [getYamlFactory]. + */ + @Singleton + @Provides + fun provideFdroidApi( + okHttpClient: OkHttpClient, + @Named("yamlFactory") yamlFactory: JacksonConverterFactory + ): FdroidApiInterface { + return Retrofit.Builder() + .baseUrl(FdroidApiInterface.BASE_URL) + .client(okHttpClient) + .addConverterFactory(yamlFactory) + .build() + .create(FdroidApiInterface::class.java) + } + @Singleton @Provides fun getMoshi(): Moshi { @@ -77,6 +101,17 @@ object RetrofitModule { .build() } + /** + * Used in above [provideFdroidApi]. + * Reference: https://stackoverflow.com/a/69859687 + */ + @Singleton + @Provides + @Named("yamlFactory") + fun getYamlFactory(): JacksonConverterFactory { + return JacksonConverterFactory.create(ObjectMapper(YAMLFactory())) + } + @Singleton @Provides fun provideInterceptor(): Interceptor { diff --git a/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt b/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt index 9fbfd4249..a9158b1ef 100644 --- a/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt +++ b/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt @@ -6,14 +6,17 @@ import androidx.room.Room import androidx.room.RoomDatabase import foundation.e.apps.api.exodus.Tracker import foundation.e.apps.api.exodus.TrackerDao +import foundation.e.apps.api.fdroid.FdroidDao +import foundation.e.apps.api.fdroid.models.FdroidEntity @Database( - entities = [Tracker::class], + entities = [Tracker::class, FdroidEntity::class], version = 1, exportSchema = false ) abstract class AppDatabase : RoomDatabase() { abstract fun trackerDao(): TrackerDao + abstract fun fdroidDao(): FdroidDao companion object { private lateinit var INSTANCE: AppDatabase diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt index f5fadf253..612ecf7a6 100644 --- a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt +++ b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidApiInterface.kt @@ -6,6 +6,7 @@ import retrofit2.http.Path /** * Interface for retrofit calls. + * Created from [foundation.e.apps.api.cleanapk.RetrofitModule.provideFdroidApi]. */ interface FdroidApiInterface { diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt index 7f0763b77..345c8f002 100644 --- a/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt +++ b/app/src/main/java/foundation/e/apps/api/fdroid/FdroidDao.kt @@ -8,6 +8,7 @@ import foundation.e.apps.api.fdroid.models.FdroidEntity /** * Dao interface for storing Fdroid info in DB. + * Created from [foundation.e.apps.di.DaoModule.getFdroidDao] */ @Dao interface FdroidDao { diff --git a/app/src/main/java/foundation/e/apps/di/DaoModule.kt b/app/src/main/java/foundation/e/apps/di/DaoModule.kt index eda0f83b3..6b2f8692a 100644 --- a/app/src/main/java/foundation/e/apps/di/DaoModule.kt +++ b/app/src/main/java/foundation/e/apps/di/DaoModule.kt @@ -8,6 +8,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.components.SingletonComponent import foundation.e.apps.api.database.AppDatabase import foundation.e.apps.api.exodus.TrackerDao +import foundation.e.apps.api.fdroid.FdroidDao @InstallIn(SingletonComponent::class) @Module @@ -16,4 +17,9 @@ object DaoModule { fun getTrackerDao(@ApplicationContext context: Context): TrackerDao { return AppDatabase.getInstance(context).trackerDao() } + + @Provides + fun getFdroidDao(@ApplicationContext context: Context): FdroidDao { + return AppDatabase.getInstance(context).fdroidDao() + } } -- GitLab From 48002cc323603be5553139690f66351b17086f95 Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 19:08:30 +0530 Subject: [PATCH 4/7] App lounge: (issue_4427) increase database version to 2 --- app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt b/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt index a9158b1ef..174e825e2 100644 --- a/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt +++ b/app/src/main/java/foundation/e/apps/api/database/AppDatabase.kt @@ -11,7 +11,7 @@ import foundation.e.apps.api.fdroid.models.FdroidEntity @Database( entities = [Tracker::class, FdroidEntity::class], - version = 1, + version = 2, exportSchema = false ) abstract class AppDatabase : RoomDatabase() { -- GitLab From bde1eec74cce718e891746dc1a7477f663c65a77 Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 19:09:26 +0530 Subject: [PATCH 5/7] App lounge: (issue_4427) Create FdroidFetchViewModel.kt to store and display fdroid info fetched from API --- .../foundation/e/apps/FdroidFetchViewModel.kt | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 app/src/main/java/foundation/e/apps/FdroidFetchViewModel.kt diff --git a/app/src/main/java/foundation/e/apps/FdroidFetchViewModel.kt b/app/src/main/java/foundation/e/apps/FdroidFetchViewModel.kt new file mode 100644 index 000000000..8b6d78346 --- /dev/null +++ b/app/src/main/java/foundation/e/apps/FdroidFetchViewModel.kt @@ -0,0 +1,60 @@ +package foundation.e.apps + +import android.widget.TextView +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import dagger.hilt.android.lifecycle.HiltViewModel +import foundation.e.apps.api.fdroid.FdroidRepository +import foundation.e.apps.api.fdroid.models.FdroidEntity +import foundation.e.apps.api.fused.data.FusedApp +import foundation.e.apps.utils.enums.Origin +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import javax.inject.Inject + +/** + * + */ +@HiltViewModel +class FdroidFetchViewModel @Inject constructor( + private val fdroidRepository: FdroidRepository +): ViewModel() { + + private val fdroidEntries = mutableMapOf() + + fun setAuthorNameIfNeeded(textView: TextView, fusedApp: FusedApp) { + viewModelScope.launch { + var authorNameToDisplay = textView.text + withContext(Dispatchers.Default) { + fusedApp.run { + try { + if (author == "unknown" && origin == Origin.CLEANAPK) { + + withContext(Dispatchers.Main) { + textView.text = FdroidEntity.DEFAULT_FDROID_AUTHOR_NAME + } + + var result = fdroidEntries[package_name] + if (result == null) { + result = fdroidRepository.getFdroidInfo(package_name)?.also { + fdroidEntries[package_name] = it + } + } + result?.authorName?.let { + authorNameToDisplay = it + } + } + } + catch (e: Exception) { + e.printStackTrace() + } + } + } + withContext(Dispatchers.Main) { + textView.text = authorNameToDisplay + } + } + } + +} \ No newline at end of file -- GitLab From ed6e716cf44697237444fb5f9f7fe760b9e53a05 Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 19:12:53 +0530 Subject: [PATCH 6/7] App lounge: (issue_4427) implement FdroidFetchViewModel in app lists and fragments. --- .../java/foundation/e/apps/application/ApplicationFragment.kt | 3 +++ .../e/apps/applicationlist/ApplicationListFragment.kt | 3 +++ .../e/apps/applicationlist/model/ApplicationListRVAdapter.kt | 3 +++ app/src/main/java/foundation/e/apps/search/SearchFragment.kt | 3 +++ app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt | 3 +++ 5 files changed, 15 insertions(+) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index a08402cc6..d8b283498 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -44,6 +44,7 @@ import com.google.android.material.button.MaterialButton import com.google.android.material.snackbar.Snackbar import com.google.android.material.textview.MaterialTextView import dagger.hilt.android.AndroidEntryPoint +import foundation.e.apps.FdroidFetchViewModel import foundation.e.apps.MainActivityViewModel import foundation.e.apps.PrivacyInfoViewModel import foundation.e.apps.R @@ -75,6 +76,7 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { private val applicationViewModel: ApplicationViewModel by viewModels() private val privacyInfoViewModel: PrivacyInfoViewModel by viewModels() + private val fdroidFetchViewModel: FdroidFetchViewModel by viewModels() private val mainActivityViewModel: MainActivityViewModel by activityViewModels() private var applicationIcon: ImageView? = null @@ -144,6 +146,7 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) { applicationIcon = appIcon appName.text = it.name appAuthor.text = it.author + fdroidFetchViewModel.setAuthorNameIfNeeded(appAuthor, it) categoryTitle.text = it.category if (args.origin == Origin.CLEANAPK) { appIcon.load(CleanAPKInterface.ASSET_URL + it.icon_image_path) diff --git a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt index f3d8ed137..46e9b82d8 100644 --- a/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt +++ b/app/src/main/java/foundation/e/apps/applicationlist/ApplicationListFragment.kt @@ -34,6 +34,7 @@ import dagger.hilt.android.AndroidEntryPoint import foundation.e.apps.AppProgressViewModel import foundation.e.apps.MainActivityViewModel import foundation.e.apps.PrivacyInfoViewModel +import foundation.e.apps.FdroidFetchViewModel import foundation.e.apps.R import foundation.e.apps.api.fused.FusedAPIInterface import foundation.e.apps.api.fused.data.FusedApp @@ -57,6 +58,7 @@ class ApplicationListFragment : Fragment(R.layout.fragment_application_list), Fu private val viewModel: ApplicationListViewModel by viewModels() private val privacyInfoViewModel: PrivacyInfoViewModel by viewModels() + private val fdroidFetchViewModel: FdroidFetchViewModel by viewModels() private val mainActivityViewModel: MainActivityViewModel by activityViewModels() private val appProgressViewModel: AppProgressViewModel by viewModels() @@ -110,6 +112,7 @@ class ApplicationListFragment : Fragment(R.layout.fragment_application_list), Fu ApplicationListRVAdapter( this, privacyInfoViewModel, + fdroidFetchViewModel, it, pkgManagerModule, User.valueOf(mainActivityViewModel.userType.value ?: User.UNAVAILABLE.name), diff --git a/app/src/main/java/foundation/e/apps/applicationlist/model/ApplicationListRVAdapter.kt b/app/src/main/java/foundation/e/apps/applicationlist/model/ApplicationListRVAdapter.kt index 048d23f7f..b7cdbfe51 100644 --- a/app/src/main/java/foundation/e/apps/applicationlist/model/ApplicationListRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/applicationlist/model/ApplicationListRVAdapter.kt @@ -34,6 +34,7 @@ import com.facebook.shimmer.Shimmer import com.facebook.shimmer.Shimmer.Direction.LEFT_TO_RIGHT import com.facebook.shimmer.ShimmerDrawable import com.google.android.material.snackbar.Snackbar +import foundation.e.apps.FdroidFetchViewModel import foundation.e.apps.PrivacyInfoViewModel import foundation.e.apps.R import foundation.e.apps.api.cleanapk.CleanAPKInterface @@ -53,6 +54,7 @@ import javax.inject.Singleton class ApplicationListRVAdapter( private val fusedAPIInterface: FusedAPIInterface, private val privacyInfoViewModel: PrivacyInfoViewModel, + private val fdroidFetchViewModel: FdroidFetchViewModel, private val currentDestinationId: Int, private val pkgManagerModule: PkgManagerModule, private val user: User, @@ -121,6 +123,7 @@ class ApplicationListRVAdapter( } appTitle.text = searchApp.name appAuthor.text = searchApp.author + fdroidFetchViewModel.setAuthorNameIfNeeded(appAuthor, searchApp) if (searchApp.ratings.usageQualityScore != -1.0) { appRating.text = searchApp.ratings.usageQualityScore.toString() appRatingBar.rating = searchApp.ratings.usageQualityScore.toFloat() diff --git a/app/src/main/java/foundation/e/apps/search/SearchFragment.kt b/app/src/main/java/foundation/e/apps/search/SearchFragment.kt index 589cd6c37..64a9e78d8 100644 --- a/app/src/main/java/foundation/e/apps/search/SearchFragment.kt +++ b/app/src/main/java/foundation/e/apps/search/SearchFragment.kt @@ -42,6 +42,7 @@ import dagger.hilt.android.AndroidEntryPoint import foundation.e.apps.AppProgressViewModel import foundation.e.apps.MainActivityViewModel import foundation.e.apps.PrivacyInfoViewModel +import foundation.e.apps.FdroidFetchViewModel import foundation.e.apps.R import foundation.e.apps.api.fused.FusedAPIInterface import foundation.e.apps.api.fused.data.FusedApp @@ -69,6 +70,7 @@ class SearchFragment : private val searchViewModel: SearchViewModel by viewModels() private val privacyInfoViewModel: PrivacyInfoViewModel by viewModels() + private val fdroidFetchViewModel: FdroidFetchViewModel by viewModels() private val mainActivityViewModel: MainActivityViewModel by activityViewModels() private val appProgressViewModel: AppProgressViewModel by viewModels() @@ -114,6 +116,7 @@ class SearchFragment : ApplicationListRVAdapter( this, privacyInfoViewModel, + fdroidFetchViewModel, it, pkgManagerModule, User.valueOf(mainActivityViewModel.userType.value ?: User.UNAVAILABLE.name), diff --git a/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt b/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt index f9b2962e9..537197f19 100644 --- a/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt +++ b/app/src/main/java/foundation/e/apps/updates/UpdatesFragment.kt @@ -32,6 +32,7 @@ import dagger.hilt.android.AndroidEntryPoint import foundation.e.apps.AppProgressViewModel import foundation.e.apps.MainActivityViewModel import foundation.e.apps.PrivacyInfoViewModel +import foundation.e.apps.FdroidFetchViewModel import foundation.e.apps.R import foundation.e.apps.api.fused.FusedAPIInterface import foundation.e.apps.api.fused.data.FusedApp @@ -56,6 +57,7 @@ class UpdatesFragment : Fragment(R.layout.fragment_updates), FusedAPIInterface { private val updatesViewModel: UpdatesViewModel by viewModels() private val privacyInfoViewModel: PrivacyInfoViewModel by viewModels() + private val fdroidFetchViewModel: FdroidFetchViewModel by viewModels() private val mainActivityViewModel: MainActivityViewModel by activityViewModels() private val appProgressViewModel: AppProgressViewModel by viewModels() @@ -83,6 +85,7 @@ class UpdatesFragment : Fragment(R.layout.fragment_updates), FusedAPIInterface { ApplicationListRVAdapter( this, privacyInfoViewModel, + fdroidFetchViewModel, it, pkgManagerModule, User.valueOf(mainActivityViewModel.userType.value ?: User.UNAVAILABLE.name), -- GitLab From a731a74a1f59e18c384ef5eb1f43f6f37fd48443 Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Tue, 5 Apr 2022 20:00:18 +0530 Subject: [PATCH 7/7] App lounge: (issue_4427) make DEFAULT_FDROID_AUTHOR_NAME as const --- .../java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt b/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt index 4375f6d46..ddd5ad221 100644 --- a/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt +++ b/app/src/main/java/foundation/e/apps/api/fdroid/models/FdroidEntity.kt @@ -11,7 +11,7 @@ import androidx.room.PrimaryKey class FdroidEntity(@PrimaryKey val packageName: String, authorName: String) { companion object { - val DEFAULT_FDROID_AUTHOR_NAME = "F-Droid" + const val DEFAULT_FDROID_AUTHOR_NAME = "F-Droid" } var authorName: String = DEFAULT_FDROID_AUTHOR_NAME -- GitLab