emorydunn / StreamDeckPlugin

A library for creating Stream Deck plugins in Swift.
https://emorydunn.github.io/StreamDeckPlugin/
MIT License
50 stars 7 forks source link

another capitalisation problem #26

Closed justme-1968 closed 6 months ago

justme-1968 commented 6 months ago

i think i found a another capitalisation bug.

i could not get the monitoring of start and stop of an application to work. there were never any didLaunch or didTerminate events generated.

after some digging i found that the automatic manifest creation will create

"ApplicationsToMonitor" : {
    "Mac" : [
      ...
    ],
    "Windows" : [
    ]
  },

but as per the api documentation "mac" and "windows" have to be all lower case. manually changing this will result in a plugin that gets the launch and terminate messages.

i have not checked jet, but maybe the reason is similar to issue #25 and i suspect there are more of these.

also maybe relying on the autogenerated codable implementations for custom types is problematic if you have to follow a api specification that seems to use more or less random capitalisation of the keys.

emorydunn commented 6 months ago

Like you noted the capitalization in the protocol is inconsistent, to say the very least. Instead of providing custom CodingKeys for each type, many of which are repeated and would be a lot to maintain, I opted for a custom key encoding strategy at the encoder level.

StreamDeckKey provides overrides for keys with specific capitalization, but it appears I missed a couple. Both Mac and Windows keys have been added. If you do notice any others feel free to open a PR with the changes.

justme-1968 commented 6 months ago

never mind... i checkt out a version manually and copied it over and that worked.