mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-03 22:59:56 +00:00
Minor leak fix, login warning support, refs
This commit is contained in:
parent
0f60d4737e
commit
cf86ce1ab3
7 changed files with 35 additions and 19 deletions
|
@ -10,6 +10,7 @@ import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import com.futo.platformplayer.R
|
import com.futo.platformplayer.R
|
||||||
|
import com.futo.platformplayer.UIDialogs
|
||||||
import com.futo.platformplayer.api.media.platforms.js.SourceAuth
|
import com.futo.platformplayer.api.media.platforms.js.SourceAuth
|
||||||
import com.futo.platformplayer.api.media.platforms.js.SourcePluginAuthConfig
|
import com.futo.platformplayer.api.media.platforms.js.SourcePluginAuthConfig
|
||||||
import com.futo.platformplayer.api.media.platforms.js.SourcePluginConfig
|
import com.futo.platformplayer.api.media.platforms.js.SourcePluginConfig
|
||||||
|
@ -39,6 +40,7 @@ class LoginActivity : AppCompatActivity() {
|
||||||
_textUrl = findViewById(R.id.text_url);
|
_textUrl = findViewById(R.id.text_url);
|
||||||
_buttonClose = findViewById(R.id.button_close);
|
_buttonClose = findViewById(R.id.button_close);
|
||||||
_buttonClose.setOnClickListener {
|
_buttonClose.setOnClickListener {
|
||||||
|
UIDialogs.toast("Login cancelled", false);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,5 @@ class SourcePluginAuthConfig(
|
||||||
val userAgent: String? = null,
|
val userAgent: String? = null,
|
||||||
val loginButton: String? = null,
|
val loginButton: String? = null,
|
||||||
val domainHeadersToFind: Map<String, List<String>>? = null,
|
val domainHeadersToFind: Map<String, List<String>>? = null,
|
||||||
|
val loginWarning: String? = null
|
||||||
) { }
|
) { }
|
|
@ -354,11 +354,22 @@ class SourceDetailFragment : MainFragment() {
|
||||||
if(config.authentication == null)
|
if(config.authentication == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LoginActivity.showLogin(StateApp.instance.context, config) {
|
if(config.authentication.loginWarning != null) {
|
||||||
StatePlugins.instance.setPluginAuth(config.id, it);
|
UIDialogs.showDialog(context, R.drawable.ic_warning_yellow, "Login Warning",
|
||||||
|
config.authentication.loginWarning, null, 0,
|
||||||
reloadSource(config.id);
|
UIDialogs.Action("Cancel", {}, UIDialogs.ActionStyle.NONE),
|
||||||
};
|
UIDialogs.Action("Login", {
|
||||||
|
LoginActivity.showLogin(StateApp.instance.context, config) {
|
||||||
|
StatePlugins.instance.setPluginAuth(config.id, it);
|
||||||
|
reloadSource(config.id);
|
||||||
|
};
|
||||||
|
}, UIDialogs.ActionStyle.PRIMARY))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LoginActivity.showLogin(StateApp.instance.context, config) {
|
||||||
|
StatePlugins.instance.setPluginAuth(config.id, it);
|
||||||
|
reloadSource(config.id);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
private fun logoutSource(clear: Boolean = true) {
|
private fun logoutSource(clear: Boolean = true) {
|
||||||
val config = _config ?: return;
|
val config = _config ?: return;
|
||||||
|
|
|
@ -109,16 +109,6 @@ class SubscriptionsFeedFragment : MainFragment() {
|
||||||
|
|
||||||
constructor(fragment: SubscriptionsFeedFragment, inflater: LayoutInflater, cachedRecyclerData: RecyclerData<InsertedViewAdapterWithLoader<ContentPreviewViewHolder>, LinearLayoutManager, IPager<IPlatformContent>, IPlatformContent, IPlatformContent, InsertedViewHolder<ContentPreviewViewHolder>>? = null) : super(fragment, inflater, cachedRecyclerData) {
|
constructor(fragment: SubscriptionsFeedFragment, inflater: LayoutInflater, cachedRecyclerData: RecyclerData<InsertedViewAdapterWithLoader<ContentPreviewViewHolder>, LinearLayoutManager, IPager<IPlatformContent>, IPlatformContent, IPlatformContent, InsertedViewHolder<ContentPreviewViewHolder>>? = null) : super(fragment, inflater, cachedRecyclerData) {
|
||||||
Logger.i(TAG, "SubscriptionsFeedFragment constructor()");
|
Logger.i(TAG, "SubscriptionsFeedFragment constructor()");
|
||||||
StateSubscriptions.instance.onFeedProgress.subscribe(this) { id, progress, total ->
|
|
||||||
if(subGroup?.id == id)
|
|
||||||
fragment.lifecycleScope.launch(Dispatchers.Main) {
|
|
||||||
try {
|
|
||||||
setProgress(progress, total);
|
|
||||||
} catch (e: Throwable) {
|
|
||||||
Logger.e(TAG, "Failed to set progress", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StateSubscriptions.instance.global.onUpdateProgress.subscribe(this) { progress, total ->
|
StateSubscriptions.instance.global.onUpdateProgress.subscribe(this) { progress, total ->
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,12 +164,24 @@ class SubscriptionsFeedFragment : MainFragment() {
|
||||||
if (!StateSubscriptions.instance.global.isGlobalUpdating) {
|
if (!StateSubscriptions.instance.global.isGlobalUpdating) {
|
||||||
finishRefreshLayoutLoader();
|
finishRefreshLayoutLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StateSubscriptions.instance.onFeedProgress.subscribe(this) { id, progress, total ->
|
||||||
|
if(subGroup?.id == id)
|
||||||
|
fragment.lifecycleScope.launch(Dispatchers.Main) {
|
||||||
|
try {
|
||||||
|
setProgress(progress, total);
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
Logger.e(TAG, "Failed to set progress", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cleanup() {
|
override fun cleanup() {
|
||||||
super.cleanup()
|
super.cleanup()
|
||||||
StateSubscriptions.instance.global.onUpdateProgress.remove(this);
|
StateSubscriptions.instance.global.onUpdateProgress.remove(this);
|
||||||
StateSubscriptions.instance.onSubscriptionsChanged.remove(this);
|
StateSubscriptions.instance.onSubscriptionsChanged.remove(this);
|
||||||
|
StateSubscriptions.instance.onFeedProgress.remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
override val feedStyle: FeedStyle get() = Settings.instance.subscriptions.getSubscriptionsFeedStyle();
|
override val feedStyle: FeedStyle get() = Settings.instance.subscriptions.getSubscriptionsFeedStyle();
|
||||||
|
|
|
@ -38,12 +38,12 @@
|
||||||
android:id="@+id/dialog_text_details"
|
android:id="@+id/dialog_text_details"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:textColor="#AAAAAA"
|
android:textColor="#AAAAAA"
|
||||||
android:fontFamily="@font/inter_regular"
|
android:fontFamily="@font/inter_light"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:layout_marginStart="30dp"
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:textSize="11dp"
|
android:textSize="13dp"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/dialog_text_code"
|
android:id="@+id/dialog_text_code"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c3e21983564fce43d8c0b9aa96ee97b47fd7353f
|
Subproject commit b7864b910172659d29602f05d968427bffcc95f0
|
|
@ -1 +1 @@
|
||||||
Subproject commit c3e21983564fce43d8c0b9aa96ee97b47fd7353f
|
Subproject commit b7864b910172659d29602f05d968427bffcc95f0
|
Loading…
Add table
Add a link
Reference in a new issue