Skip to content

Commit

Permalink
Ios out of band
Browse files Browse the repository at this point in the history
few bits to sort out
- [x] make our mix of simulator/emulator consistent, settling on emulator
- [x] passing the factory in works great for just in time asset decoding, but its not amazing when you want to decode ahead of time.
- [x] couple of places left to pass this function signature through. (Question) is there a neater way to get this done, feels a bit like we are going back to parameter explosion a bit?
- [x] should do a few examples, i think the complexity grows quite a bit in this one as you add caching, or callbacks
- [x] should get the cached images/fonts to draw on init as well, either warming up cache, or jitting
- [x] examples loading assets from the bundle (also there seem to be actual asset things too? should we use those?!)
- [x] add test
- [x] re-add "preview" project & rev the preview project once this has been deployed. (do this after new ios deploy)
- [x] fix up race condition (see comment)

https://github.com/rive-app/rive/assets/1216025/2c14330f-e8a4-481b-bc27-4807cabe3b82

(simple example, both swift ui and standard)

![CleanShot 2023-11-20 at 16 54 59](https://github.com/rive-app/rive/assets/1216025/a71e207c-30ad-44dd-9e4b-ad7431b22186)

Diffs=
fabb7f97f Ios out of band (#6232)

Co-authored-by: Gordon Hayes <pggordonhayes@gmail.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
  • Loading branch information
3 people committed Dec 5, 2023
1 parent 7c93bc0 commit b3fa7de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ed4474d1ab3aa1e68d47cfcb2c178f39c376257e
fabb7f97fe7b69368c9a7369febfecbc90be49cd
5 changes: 4 additions & 1 deletion wasm/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class FileAssetLoaderWrapper : public wrapper<rive::FileAssetLoader>
public:
EMSCRIPTEN_WRAPPER(FileAssetLoaderWrapper);

bool loadContents(rive::FileAsset& asset, rive::Span<const uint8_t> inBandBytes)
bool loadContents(rive::FileAsset& asset,
rive::Span<const uint8_t> inBandBytes,
rive::Factory* factory)
{
auto bytes =
emscripten::val(emscripten::typed_memory_view(inBandBytes.size(), inBandBytes.data()));
Expand All @@ -253,6 +255,7 @@ rive::File* load(emscripten::val byteArray, rive::FileAssetLoader* fileAssetLoad
emscripten::val memoryView{emscripten::typed_memory_view(l, rv.data())};
memoryView.call<void>("set", byteArray);

// QUESTION (max) we ignore the result currently, we could use it and throw exceptions with it.
return rive::File::import(rv, jsFactory(), nullptr, fileAssetLoader).release();
}

Expand Down
2 changes: 1 addition & 1 deletion wasm/submodules/rive-cpp

0 comments on commit b3fa7de

Please sign in to comment.