From f59196f2fd9acb6c42f6a2def2f831aa070051a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dias?= Date: Fri, 4 Nov 2022 08:57:13 +0000 Subject: [PATCH 1/2] Fixed crashes with Tasker plugin actions when using minified code --- .../pocketcasts/taskerplugin/base/ViewModelBase.kt | 4 ++-- .../controlplayback/config/ViewModelConfigControlPlayback.kt | 2 +- .../playplaylist/config/ViewModelConfigPlayPlaylist.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/base/ViewModelBase.kt b/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/base/ViewModelBase.kt index a980a6793e1..d0a77067f79 100644 --- a/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/base/ViewModelBase.kt +++ b/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/base/ViewModelBase.kt @@ -14,8 +14,8 @@ import kotlinx.coroutines.flow.MutableStateFlow abstract class ViewModelBase>>(application: Application) : AndroidViewModel(application), TaskerPluginConfig { override val context get() = getApplication() - abstract val helperClass: Class - private val taskerHelper by lazy { helperClass.getConstructor(TaskerPluginConfig::class.java).newInstance(this) } + abstract fun getNewHelper(pluginConfig: TaskerPluginConfig): THelper + private val taskerHelper by lazy { getNewHelper(this) } protected var input: TInput? = null /** diff --git a/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/controlplayback/config/ViewModelConfigControlPlayback.kt b/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/controlplayback/config/ViewModelConfigControlPlayback.kt index 960ff58d3a0..7308ec0f196 100644 --- a/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/controlplayback/config/ViewModelConfigControlPlayback.kt +++ b/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/controlplayback/config/ViewModelConfigControlPlayback.kt @@ -19,7 +19,7 @@ import au.com.shiftyjelly.pocketcasts.localization.R as LR class ViewModelConfigControlPlayback @Inject constructor( application: Application ) : ViewModelBase(application), TaskerPluginConfig { - override val helperClass get() = ActionHelperControlPlayback::class.java + override fun getNewHelper(pluginConfig: TaskerPluginConfig) = ActionHelperControlPlayback(pluginConfig) /** * A field that only appears depending on the type of the playback command. For example, the field "Time to Skip To" will only appear if the command is "Skip To Time". A field can also always appear if it doesn't depend on a command type diff --git a/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/playplaylist/config/ViewModelConfigPlayPlaylist.kt b/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/playplaylist/config/ViewModelConfigPlayPlaylist.kt index c7ca82110eb..5a68bffa8e6 100644 --- a/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/playplaylist/config/ViewModelConfigPlayPlaylist.kt +++ b/modules/features/taskerplugin/src/main/java/au/com/shiftyjelly/pocketcasts/taskerplugin/playplaylist/config/ViewModelConfigPlayPlaylist.kt @@ -18,7 +18,7 @@ import javax.inject.Inject class ViewModelConfigPlayPlaylist @Inject constructor( application: Application ) : ViewModelBase(application), TaskerPluginConfig { - override val helperClass get() = ActionHelperPlayPlaylist::class.java + override fun getNewHelper(pluginConfig: TaskerPluginConfig) = ActionHelperPlayPlaylist(pluginConfig) private inner class InputField constructor(@StringRes labelResId: Int, @DrawableRes iconResId: Int, valueGetter: InputPlayPlaylist.() -> String?, valueSetter: InputPlayPlaylist.(String?) -> Unit) : InputFieldBase(labelResId, iconResId, valueGetter, valueSetter) { override val askFor get() = true From f80be290a165794fe6f2d88a5c468c6672a78787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Dias?= Date: Fri, 4 Nov 2022 13:06:02 +0000 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91f93900634..ce6f684bc1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,16 @@ 7.27 ----- * Added ability to set playback effects in Tasker "Control Playback" action. - ([#415](https://github.com/Automattic/pocket-casts-android/pull/509)). + ([#509](https://github.com/Automattic/pocket-casts-android/pull/509)). + * Fixed crashes with Tasker plugin actions when using minified code. + ([#543](https://github.com/Automattic/pocket-casts-android/pull/543)). 7.26 ----- * New Features: * Added Tasker integration with "Play Filter" and "Control Playback" actions. - ([#415](https://github.com/Automattic/pocket-casts-android/pull/431)). + ([#431](https://github.com/Automattic/pocket-casts-android/pull/431)). * Import OPML from a URL ([#482](https://github.com/Automattic/pocket-casts-android/pull/482)). * Redesign of the fullscreen player share option