Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularization #54

Closed
ChristopheCVB opened this issue Nov 30, 2022 — with Volta.net · 1 comment · Fixed by #51
Closed

Modularization #54

ChristopheCVB opened this issue Nov 30, 2022 — with Volta.net · 1 comment · Fixed by #51
Assignees
Labels
core SDK Core enhancement New feature or request
Milestone

Comments

Copy link
Owner

ChristopheCVB commented Nov 30, 2022

The current way of handling actions works great for small plugins, however, for larger ones, it gets a bit messy.

Add the possibility for Actions and Connectors to be classes that extend something from the SDK.

Basically an abstract class such as:

abstract class TPInvokable<T extends TouchPortalPlugin> {
  protected final T touchPortalPlugin;

  public TPInvokable(T touchPortalPlugin) {
    this.touchPortalPlugin = touchPortalPlugin;
  }

  public abstract void onInvoke();

  public abstract void onListChanged(TPListChangeMessage tpListChangeMessage);
}
  • TPAction would extend it as is
  • TPConnector would extend it and also add the necessary implementation to handle the ConnectorValue

Developers would then have to register those to the TouchPortalPlugin before connecting

// Plugin class
public class MyTPPlugin extends TouchPortalPlugin {}
// TPAction class
@Action(name = "Action One", categoryId = "BaseCategory")
public class ActionOne extends TPAction<MyTPPlugin> {
  @Data
  private String param1;

  public ActionOne(MyTPPlugin myTPPlugin) {
    super(myTPPlugin);
  }

  @Override
  public void onListChanged(TPListChangeMessage tpListChangeMessage) {
    // Update Specific Choices
  }

  @Override
  public void onInvoke() {
    // Do stuff
  }
}
// Later when the plugin starts
MyTPPlugin myTPPlugin = new MyTPPlugin();
myTPPlugin.register(ActionOne.class);
myTPPlugin.connectThenPairAndListen(myTPPlugin);
@ChristopheCVB ChristopheCVB self-assigned this Nov 30, 2022
@Pjiesco
Copy link
Collaborator

Pjiesco commented Nov 30, 2022

I think this would be a really nice addition to the SDK!

@ChristopheCVB ChristopheCVB added enhancement New feature or request and removed to specify labels Nov 30, 2022 — with Volta.net
ChristopheCVB added a commit that referenced this issue Dec 4, 2022
@ChristopheCVB ChristopheCVB linked a pull request Oct 5, 2023 that will close this issue
@ChristopheCVB ChristopheCVB added this to the 9.0.0 milestone Oct 5, 2023
ChristopheCVB added a commit that referenced this issue Nov 18, 2024
* [Feature] Dynamic state parent group (#48)

* feat: add parentGroup field in createState message

* bump SDK and TP Api version

* Change parameter order

* feat: use the name from the category of the categoryId if parentGroup isn't specified

* fix: typo's in stateId
fix: use correct categoryId

* fix: add check for category id from constants

* fix: break outer loop

* feat: add CategoryHelper.getCategoryShortId method

* core: Upgrade dependencies

* core: Upgrade Gradle version to 7.5.1

* core: Upgrade Gradle version to 7.5.1

* core: Upgrade Gradle version to 7.5.1

* core: Upgrade Gradle version to 7.5.1

* core: Upgrade Gradle version to 7.5.1

* core: Dependencies management

* core: ActionTranslation annotation

* fix: Github Workflow

* fix: Github Workflows

* fix: Github Workflows

* fix: Github Workflows

* fix: Tests wait time

* fix: Packager SNAPSHOT publication

* fix: Packager SNAPSHOT publication

* fix: Packager SNAPSHOT publication

* fix: Packager SNAPSHOT publication

* fix: Packager SNAPSHOT publication

* feat: Plugin ParentCategory

* feat: TouchPortalPlugin.getBase64ImageFromUrl closes #38

* fix: Set encoding to UTF-8

* feat: TP Plugin API 7 Platform start command

* core: Refactor Annotations Processor
core: TP_JAVA_FILE

* fix: JavaDoc

* fix: JavaDoc

* fix: JavaDoc

* core: Refactor Annotations Processor

* core: Add logs in tests

* core: (WIP) Modularization closes #54

* doc: Update Samples and README.md

* core: Call TPInvokable.onInvoke from callbacksExecutor

* core: TPInvokable.onListChanged
core: Use callbacksExecutor

* core: Revert to System Java instalation

* core: Revert to System Java instalation

* core: 9.0.0

* Feat: TriggerEvent (#63)

* Feat: forceUpdate (#64)

Co-authored-by: Christophe Carvalho Vilas-Boas <[email protected]>

* Change `sdk` to `api` (#66)

* Add CodeQL workflow for GitHub code scanning (#53)

Co-authored-by: LGTM Migrator <[email protected]>

* [API 7] Setting Tooltip (#65)

* Feat: Setting Tooltip

* fix: use java 8

* Remove empty lines

* Check if empty

* use UpperCamelCase instead of Full uppercase

* Check if empty

---------

Co-authored-by: Pjiesco <[email protected]>
Co-authored-by: lgtm-com[bot] <43144390+lgtm-com[bot]@users.noreply.github.com>
Co-authored-by: LGTM Migrator <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core SDK Core enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants