google / automotive-design-compose

Automotive Design for Compose is an extension to Jetpack Compose that allows every screen, component, and overlay of your Android App to be defined in Figma, and lets you see the latest changes to your Figma design in your app, immediately!
https://google.github.io/automotive-design-compose/
Apache License 2.0
106 stars 14 forks source link

Figma Live Update fails if the access token doesn't have read access for variables #1296

Open timothyfroehlich opened 1 week ago

timothyfroehlich commented 1 week ago

@johnoneil just found this out. I don't think we'd realized this before and we'll need to update documentation to note that users will need their token to have both file read and variable read.

rylin8 commented 3 days ago

I don't think we should restrict access to enterprise users. If the request for variables returns because the Figma API key doesn't have access, we can log the error (logcat, Design Switcher, or maybe something even more visible?), but don't fail live update completely.

A second improvement can be that before making the variables API request, we can check to see if the document uses any variables, and if not, don't perform the request.

Lastly, if the file does in fact use variables but the Figma API key does not have access, there might be an issue where we try to use the variable values but can't find them, so we use the default, and incorrect, values (black/white colors, 0 corner radius, etc). I'm not sure what will happen here, but if this is the case we may need to make a change to use the node's direct values instead of the variable value since we don't have access to it. If this is complex we can make a separate ticket for it.