Stories projects: interoperability discussion #477
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: keeping this PR as draft (WIP), we may probably not merge in the end, but serves as a placeholder for the discussion about formatting to happen freely but yet on with a more structured discussion flow.
The file being added in this PR is a sample of the serialized state we're using on Android as is (see refs #414 and #435); we'll use this as a starting point to discuss which parts need to be platform agnostic in order to come up with a serialized format that works for everyone.
This base PR only adds a sample file with an actual output of the current format being used on Android, and as such there are things super local to the variables being used there.
I'll describe each of the parts of the structure here, and pose the following questions:
Follow up PRs can suggest modifications to this structure in order to bring in the normalized information we'd need to be able to share this structure among platforms.
Description
frames
, and may have atitle
or not.frame
is a story slide (we could rename it toslides
)Frames
Then for each frame:
source
is the background media descriptor, and it also indicates the type which is relevant for Android (is it a Uri or an actual File)frameItemType
tells us whether this is a video or an image. For video, we also have a property"muteAudio": false
that describes the audio setting for this video.addedViews
is the collection of views the user put on top of each slide (text, emoji)saveResultReason
is how things went when we tried to save this slide to disk the last time - this is a save state that is passed around for internal communication in Android between the Activity and the Service, notifying the user about what went wrong if unsuccessful, etc. This is a candidate to be removed for an actual interoperable / exchange format.AddedViews (within a frame)
Then,
addedViews
is a collection of objects that belong to aframe
, that have this information:viewType
could beTEXT
orEMOJI
for now (we also could be adding animated gif stickers, for example, which the Android stories lib is capable of but not using atm)uri
in the case thisaddedView
has some background (we’re not using it for now, but we would have to use it in the case of animated gif or just plain images being added)viewInfo
has information to understand how to position the view with regards to the screenrotation
,translation
, andscale
are the exact values eachView
had at the moment of serialization, and are indicators of their positioning on the screen. As we can see, the information about the screen it taken for obvious and is not explicitly defined.viewType == TEXT
:text
(contains the text),fontSizePx
contains the font size in device pixels (this is dependent on the device where things were created, we could do conversions ofc it’s just that we don’t care for now),textColor
has the textColor code in signed Integer format (we can change that), andtextAlignment
has a value of 0, 1, or 2 for text aligned to theleft
,center
orright
respectively (currently matches the values for View.setTextAlignment` on Android but give we defined our own values here we can make it interoperable as well).The Story represented in the Story composer
The Story being represented in this example is shown like this on the Composer: