Skip to content

Commit

Permalink
Merge pull request #543 from joaomgcd/tasker_plugin_fix_for_minify
Browse files Browse the repository at this point in the history
Fixed crashes with Tasker plugin actions when using minified code
  • Loading branch information
mchowning authored Nov 4, 2022
2 parents 358c9b5 + f80be29 commit 99ff95c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-----
* New Features:
* 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)).

* Allowed customization of actions through Settings in Media Notification Control for Android 13 users.
([#499](https://github.com/Automattic/pocket-casts-android/pull/540)).
Expand All @@ -12,7 +14,7 @@

* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import kotlinx.coroutines.flow.MutableStateFlow

abstract class ViewModelBase<TInput : Any, THelper : TaskerPluginConfigHelperNoOutput<TInput, out TaskerPluginRunnerActionNoOutput<TInput>>>(application: Application) : AndroidViewModel(application), TaskerPluginConfig<TInput> {
override val context get() = getApplication<Application>()
abstract val helperClass: Class<THelper>
private val taskerHelper by lazy { helperClass.getConstructor(TaskerPluginConfig::class.java).newInstance(this) }
abstract fun getNewHelper(pluginConfig: TaskerPluginConfig<TInput>): THelper
private val taskerHelper by lazy { getNewHelper(this) }
protected var input: TInput? = null

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import au.com.shiftyjelly.pocketcasts.localization.R as LR
class ViewModelConfigControlPlayback @Inject constructor(
application: Application
) : ViewModelBase<InputControlPlayback, ActionHelperControlPlayback>(application), TaskerPluginConfig<InputControlPlayback> {
override val helperClass get() = ActionHelperControlPlayback::class.java
override fun getNewHelper(pluginConfig: TaskerPluginConfig<InputControlPlayback>) = 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import javax.inject.Inject
class ViewModelConfigPlayPlaylist @Inject constructor(
application: Application
) : ViewModelBase<InputPlayPlaylist, ActionHelperPlayPlaylist>(application), TaskerPluginConfig<InputPlayPlaylist> {
override val helperClass get() = ActionHelperPlayPlaylist::class.java
override fun getNewHelper(pluginConfig: TaskerPluginConfig<InputPlayPlaylist>) = ActionHelperPlayPlaylist(pluginConfig)

private inner class InputField constructor(@StringRes labelResId: Int, @DrawableRes iconResId: Int, valueGetter: InputPlayPlaylist.() -> String?, valueSetter: InputPlayPlaylist.(String?) -> Unit) : InputFieldBase<String>(labelResId, iconResId, valueGetter, valueSetter) {
override val askFor get() = true
Expand Down

0 comments on commit 99ff95c

Please sign in to comment.