Skip to content

Commit

Permalink
add: init plugins system
Browse files Browse the repository at this point in the history
  • Loading branch information
rhenwinch committed Mar 6, 2024
1 parent 59652f7 commit 3aa8bee
Show file tree
Hide file tree
Showing 50 changed files with 1,467 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ dependencies {
implementation(projects.feature.mobile.home)
implementation(projects.feature.mobile.player)
implementation(projects.feature.mobile.preferences)
implementation(projects.feature.mobile.provider)
implementation(projects.feature.mobile.plugin)
implementation(projects.feature.mobile.recentlyWatched)
implementation(projects.feature.mobile.search)
implementation(projects.feature.mobile.searchExpanded)
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/kotlin/com/flixclusive/FlixclusiveApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,23 @@ import com.flixclusive.core.datastore.AppSettingsManager
import com.flixclusive.crash.GlobalCrashHandler
import com.flixclusive.data.configuration.AppBuild
import com.flixclusive.data.configuration.AppConfigurationManager
import com.flixclusive.data.provider.ProviderRepository
import com.flixclusive.data.provider.PluginManager
import dagger.hilt.android.HiltAndroidApp
import okhttp3.OkHttpClient
import javax.inject.Inject

@HiltAndroidApp
class FlixclusiveApplication : Application(), ImageLoaderFactory {
@Inject
lateinit var providersRepository: ProviderRepository
lateinit var pluginManager: PluginManager
@Inject
lateinit var appConfigurationManager: AppConfigurationManager
@Inject
lateinit var appSettingsManager: AppSettingsManager
@Inject
lateinit var client: OkHttpClient
@Inject
lateinit var scope: OkHttpClient

override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(this)
Expand All @@ -43,7 +45,8 @@ class FlixclusiveApplication : Application(), ImageLoaderFactory {
build = getString(R.string.build).toLong(),
)
)

pluginManager.initialize()
appSettingsManager.initialize()
providersRepository.initialize()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.flixclusive.feature.mobile.home.HomeNavigator
import com.flixclusive.feature.mobile.player.PlayerScreenNavigator
import com.flixclusive.feature.mobile.player.destinations.PlayerScreenDestination
import com.flixclusive.feature.mobile.preferences.PreferencesScreenNavigator
import com.flixclusive.feature.mobile.provider.destinations.ProvidersScreenDestination
import com.flixclusive.feature.mobile.plugin.destinations.PluginsScreenDestination
import com.flixclusive.feature.mobile.recentlyWatched.destinations.RecentlyWatchedScreenDestination
import com.flixclusive.feature.mobile.search.SearchScreenNavigator
import com.flixclusive.feature.mobile.searchExpanded.destinations.SearchExpandedScreenDestination
Expand Down Expand Up @@ -75,7 +75,7 @@ internal class MobileAppNavigator(
}

override fun openProvidersScreen() {
navController.navigateIfResumed(ProvidersScreenDestination within destination.navGraph())
navController.navigateIfResumed(PluginsScreenDestination within destination.navGraph())
}

override fun openAboutScreen() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/flixclusive/mobile/MobileNavGraphs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.flixclusive.feature.mobile.genre.destinations.GenreScreenDestination
import com.flixclusive.feature.mobile.home.destinations.HomeScreenDestination
import com.flixclusive.feature.mobile.player.destinations.PlayerScreenDestination
import com.flixclusive.feature.mobile.preferences.destinations.PreferencesScreenDestination
import com.flixclusive.feature.mobile.provider.destinations.ProvidersScreenDestination
import com.flixclusive.feature.mobile.plugin.destinations.PluginsScreenDestination
import com.flixclusive.feature.mobile.recentlyWatched.destinations.RecentlyWatchedScreenDestination
import com.flixclusive.feature.mobile.search.destinations.SearchScreenDestination
import com.flixclusive.feature.mobile.searchExpanded.destinations.SearchExpandedScreenDestination
Expand Down Expand Up @@ -62,7 +62,7 @@ internal object MobileNavGraphs {
AboutScreenDestination,
FilmScreenDestination,
GenreScreenDestination,
ProvidersScreenDestination,
PluginsScreenDestination,
RecentlyWatchedScreenDestination,
SettingsScreenDestination,
UpdateDialogDestination,
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/flixclusive/tv/AppTvNavigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal class AppTvNavigator(
// }
//
// override fun openProvidersScreen() {
// navController.navigateIfResumed(ProvidersScreenDestination within destination.navGraph())
// navController.navigateIfResumed(PluginsScreenDestination within destination.navGraph())
// }
//
// override fun openAboutScreen() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ val md_theme_mobile_dark_background = Color(0xFF121212)
val md_theme_mobile_dark_onBackground = Color(0xFFEAE0E4)
val md_theme_mobile_dark_surface = Color(0xFF121212)
val md_theme_mobile_dark_onSurface = Color(0xFFEAE0E4)
val md_theme_mobile_dark_surfaceVariant = Color(0xFF2B2B2B)
val md_theme_mobile_dark_surfaceVariant = Color(0xFF282828)
val md_theme_mobile_dark_onSurfaceVariant = Color(0xFFE7E4EE)

val subtitleColors = mapOf(
Expand Down
9 changes: 9 additions & 0 deletions core/ui/common/src/main/res/drawable/plugin_logo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="M352,840L200,840q-33,0 -56.5,-23.5T120,760v-152q48,0 84,-30.5t36,-77.5q0,-47 -36,-77.5T120,392v-152q0,-33 23.5,-56.5T200,160h160q0,-42 29,-71t71,-29q42,0 71,29t29,71h160q33,0 56.5,23.5T800,240v160q42,0 71,29t29,71q0,42 -29,71t-71,29v160q0,33 -23.5,56.5T720,840L568,840q0,-50 -31.5,-85T460,720q-45,0 -76.5,35T352,840ZM200,760h85q24,-66 77,-93t98,-27q45,0 98,27t77,93h85v-240h80q8,0 14,-6t6,-14q0,-8 -6,-14t-14,-6h-80v-240L480,240v-80q0,-8 -6,-14t-14,-6q-8,0 -14,6t-6,14v80L200,240v88q54,20 87,67t33,105q0,57 -33,104t-87,68v88ZM460,500Z"/>
</vector>
9 changes: 9 additions & 0 deletions core/ui/common/src/main/res/drawable/provider_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="M480,840q-17,0 -28.5,-11.5T440,800v-160q0,-17 11.5,-28.5T480,600q17,0 28.5,11.5T520,640v40h280q17,0 28.5,11.5T840,720q0,17 -11.5,28.5T800,760L520,760v40q0,17 -11.5,28.5T480,840ZM160,760q-17,0 -28.5,-11.5T120,720q0,-17 11.5,-28.5T160,680h160q17,0 28.5,11.5T360,720q0,17 -11.5,28.5T320,760L160,760ZM320,600q-17,0 -28.5,-11.5T280,560v-40L160,520q-17,0 -28.5,-11.5T120,480q0,-17 11.5,-28.5T160,440h120v-40q0,-17 11.5,-28.5T320,360q17,0 28.5,11.5T360,400v160q0,17 -11.5,28.5T320,600ZM480,520q-17,0 -28.5,-11.5T440,480q0,-17 11.5,-28.5T480,440h320q17,0 28.5,11.5T840,480q0,17 -11.5,28.5T800,520L480,520ZM640,360q-17,0 -28.5,-11.5T600,320v-160q0,-17 11.5,-28.5T640,120q17,0 28.5,11.5T680,160v40h120q17,0 28.5,11.5T840,240q0,17 -11.5,28.5T800,280L680,280v40q0,17 -11.5,28.5T640,360ZM160,280q-17,0 -28.5,-11.5T120,240q0,-17 11.5,-28.5T160,200h320q17,0 28.5,11.5T520,240q0,17 -11.5,28.5T480,280L160,280Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.flixclusive.core.util.common.provider

import android.os.Environment.getExternalStorageDirectory

val PLUGINS_PATH = getExternalStorageDirectory().absolutePath + "/Flixclusive/repositories/"
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.reflect.TypeToken
import java.io.Reader

/**
* Parses the specified JSON string into an object of type [T] using Gson library.
Expand All @@ -18,6 +19,11 @@ inline fun <reified T> fromJson(json: String): T {
.fromJson(json, object : TypeToken<T>() {}.type)
}

inline fun <reified T> fromJson(
reader: Reader
): T = Gson()
.fromJson(reader, object : TypeToken<T>() {}.type)

/**
* Parses the specified [JsonElement] into an object of type [T] using Gson library.
*
Expand Down
9 changes: 8 additions & 1 deletion core/util/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<string name="sync">Sync</string>
<string name="sync_subtitles">Sync Subtitles</string>
<string name="understood">Understood</string>
<string name="uninstall">Uninstall</string>
<string name="unknown_language">Unknown language</string>
<string name="unlock_label">Unlock</string>
<string name="update_info">Update information</string>
Expand All @@ -159,18 +160,20 @@

<!-- Extra labels with formatting -->
<string name="continue_watching_tv_show">Continue Watching S%1$d E%2$d</string>
<string name="current_playback_speed_format">Current playback speed: %1$sx</string>
<string name="episode_runtime_formatter">%1$d Episode</string>
<string name="made_by_author_label_format">Made by %1$s</string>
<string name="season_number_formatter">Season %1$d</string>
<string name="season_runtime_formatter">%1$d Season</string>
<string name="seek_seconds_format">%1$s seconds</string>
<string name="current_playback_speed_format">Current playback speed: %1$sx</string>

<!-- State messages -->
<string name="checking_for_updates">Checking for updates…</string>
<string name="copy_stack_trace_message">You could open a github issue and paste this stack trace.</string>
<string name="default_update_info_message">No additional update information provided.</string>
<string name="download_completed">Download completed</string>
<string name="download_in_progress">Downloading</string>
<string name="failed_to_load_plugins_msg">Some plugins failed to load. Check the plugins page for more info.</string>
<string name="fetching_episode_message">Fetching show episode…</string>
<string name="film_data_fetching">Fetching film details…</string>
<string name="load_link_job_active_error_message">Still processing the last request…</string>
Expand All @@ -192,6 +195,8 @@
<string name="episode_non_existent_error_message_format">Episode %1$s doesn\'t exist on Season %2$s</string>
<string name="extracting_from_provider_format">Extracting from %1$s…</string>
<string name="fetching_from_provider_format">Fetching from %1$s…</string>
<string name="invalid_plugin_file_dex_json_msg_format">Found extracted plugin file %s in your plugins folder. DO NOT EXTRACT PLUGIN ZIPS!</string>
<string name="invalid_plugin_file_directory_msg_format">Found directory %s in your plugins folder. DO NOT EXTRACT PLUGIN ZIPS!</string>
<string name="next_episode_on_format">Next episode on %1$d…</string>
<string name="update_out_now_format">%1$s is out now</string>

Expand Down Expand Up @@ -228,7 +233,9 @@
<string name="pause_button">Pause button</string>
<string name="play_button">Play button</string>
<string name="play_pause_button_content_description">Play or pause button</string>
<string name="plugin_icon_content_desc">Default icon of a provider</string>
<string name="poster_content_description">A poster of %1$s</string>
<string name="provider_settings_icon_content_desc">Provider settings</string>
<string name="rating_icon">Rating Icon</string>
<string name="release_player_desc">For seamless playback, turn this off. Though, this is required to free device memory.</string>
<string name="replay_button">Replay button</string>
Expand Down
1 change: 1 addition & 0 deletions data/provider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ android {
dependencies {
api(libs.compose.runtime)
api(projects.core.datastore)
api(projects.core.ui.common)
api(projects.core.util)
api(projects.model.datastore)
api(projects.model.provider)
Expand Down
Loading

0 comments on commit 3aa8bee

Please sign in to comment.