Commit Graph

14 Commits

Author SHA1 Message Date
philter
9dc67e3515 Remove files to unblock downstream iOS push
Diffs=
cf89553e9 Remove files to unblock downstream iOS push (#7500)
1adf3dbf4 disable fallback font during artboard rendering (#7480)
6f29a9c0c Miscellaneous Layout UX Fixes (#7491)
09ccc9ebb Add yoga to thumbnail generator build (#7494)
aa390d5dc change how viewmodel instances target their viewmodel (#7468)
e66e242c6 Xxxx databinding add boolean (#7456)
9cd8759a0 Xxxx data binding data context (#7454)
31f5ee5c4 Animation for Layouts (#7426)
a4439ee42 Renames for Yoga and libjpeg (#7446)
97578005c Update LayoutComponentStyle bitfields to be compatible with older C++ versions (#7436)
75823467d databinding (#7341)
ef9ef9fd1 Ios golden test (#7413)

Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
2024-06-28 21:33:34 +00:00
mjtalbot
fbe16bb3dd only start/stop the audio engine if its been initialized
simple things first.

after some debugging on audio "ducking"

it looks like we only start to kill audio after we initialize the audio engine. this first "fix" simply prevents us from initializing the audio engine if its not already been initialized. when going into the background/foreground.

other than this, we initialize the audio engine when you first play an audio clip in `void AudioEvent::play()`

this still leaves an issue lying around where after we have initialized the audio engine we will now "forever" duck audio when we go into the background/foreground. but at least you should be able to avoid this entirely if you never load a file with audio.

Diffs=
d4b3118e1 only start/stop the audio engine if its been initialized (#7335)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2024-06-03 10:29:41 +00:00
mjtalbot
38f4ba0de5 name:NSApplicationDidFinishLaunchingNotification -> name:NSApplicatio…
…nDidResignActiveNotification

good spot on the bad notification, will push another build with this when in

Diffs=
14ea38786 name:NSApplicationDidFinishLaunchingNotification -> name:NSApplicatio… (#7102)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2024-04-22 17:08:06 +00:00
mjtalbot
06111d028f patch backgrounding to use macos notifications when appropriate
we seem to use  `#if __has_include(<UIKit/UIKit.h>)` & `#if TARGET_OS_IPHONE` to determine if we are buidling for ios or not.

i'm not sure if it really matters which we use here, but i guess we should just use one of them, i kinda like the look of TARGET_OS_IPHONE more.

Diffs=
f20d5944a patch backgrounding to use macos notifications when appropriate (#7101)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2024-04-22 14:51:16 +00:00
luigi-rosso
ff8648e4cb Stop audio in iOS when backgrounded.
- Fixes a crash when a sound is still playing and Artboard is de-allocated. Easy to cause with long sounds as sound resources would get nuked and the engine would keep trying to decode from a dead buffer.
- Stops audio when going in background, resumes when coming to foreground.

The way I did the backgrounding is on the RiveRendererView as I couldn't find a better general spot to do this but maybe @mjtalbot has an idea.

This does not stop long sounds (like songs) when exiting a view, we can address that separately...

Diffs=
4a9947630 Stop audio in iOS when backgrounded. (#7055)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-04-16 21:29:23 +00:00
luigi-rosso
27de5abf4b Ios out of band
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>
2023-12-05 21:23:08 +00:00
csmartdalton
afbd9e2085 Add a "Stress Test" to the example iOS app
Diffs=
a7e5cc22f Add a "Stress Test" to the example iOS app (#5986)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Co-authored-by: Zach Plata <plata.zach@gmail.com>
2023-10-05 17:13:18 +00:00
csmartdalton
a795c2fe60 Add a CG render context to the iOS runtime
Diffs=
42f393436 Add a CG render context to the iOS runtime (#5998)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
2023-09-15 23:41:26 +00:00
csmartdalton
b1f11bf828 Integrate the Rive renderer into iOS
Diffs=
afc961233 Integrate the Rive renderer into iOS (#5952)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
2023-09-08 18:30:17 +00:00
mjtalbot
ea061e0190 fixup touch location for ios when the riveview is a subview
i've manually tested this changing our simple animation view controller to this:

(had to also install snapkit for this example to work btw)

i should probably check the commit history to see if there's some rationale behind adding origin into the mix, or if that was just "the first guess" as we need origin in our own sizing...

```
//
//  SimpleAnimation.swift
//  RiveExample
//
//  Created by Maxwell Talbot on 06/05/2021.
//  Copyright © 2021 Rive. All rights reserved.
//

import UIKit
import RiveRuntime
import SwiftUI
import SnapKit

class SimpleAnimationViewController: UIViewController {
    var viewModel = RiveViewModel(fileName: "play_button_event_example")
    var viewModel2 = RiveViewModel(fileName: "play_button_event_example")

    override func viewWillAppear(_ animated: Bool) {
        let riveContainerView = UIView()
        let riveView = viewModel.createRiveView()

        if (false){
//            bad

            let topSpacer = UILayoutGuide()
            let midSpacer = UILayoutGuide()
            let bottomSpacer = UILayoutGuide()

            [riveView].forEach(view.addSubview)
            [topSpacer, midSpacer, bottomSpacer].forEach(view.addLayoutGuide)

            topSpacer.snp.makeConstraints { make in
                make.top.left.right.equalToSuperview()
                make.height.equalTo(bottomSpacer)
            }

            midSpacer.snp.makeConstraints { make in
                make.top.equalTo(topSpacer.snp.bottom)
                make.left.right.equalToSuperview()
                make.height.equalTo(bottomSpacer)
            }

            riveView.snp.makeConstraints { make in
                make.top.equalTo(midSpacer.snp.bottom)
                make.width.equalToSuperview()
                make.height.equalTo(riveView.snp.width)
            }

            bottomSpacer.snp.makeConstraints { make in
                make.bottom.left.right.equalToSuperview()
                make.top.equalTo(riveView.snp.bottom)
                make.height.greaterThanOrEqualTo(1)
            }

        }else {

    //            good

                let topSpacer = UILayoutGuide()
                let midSpacer = UILayoutGuide()
                let bottomSpacer = UILayoutGuide()

                riveContainerView.addSubview(riveView)

                [riveContainerView].forEach(view.addSubview)
                [topSpacer, midSpacer, bottomSpacer].forEach(view.addLayoutGuide)

                topSpacer.snp.makeConstraints { make in
                    make.top.left.right.equalToSuperview()
                    make.height.equalTo(bottomSpacer)
                }

                midSpacer.snp.makeConstraints { make in
                    make.top.equalTo(topSpacer.snp.bottom)

                    make.left.right.equalToSuperview()
                    make.height.equalTo(bottomSpacer)
                }

            riveContainerView.snp.makeConstraints { make in
                    make.top.equalTo(midSpacer.snp.bottom)
                    make.width.equalToSuperview()
                    make.height.equalTo(riveView.snp.width)
                }

                riveView.snp.makeConstraints { make in
                    make.edges.equalToSuperview()
                }

                bottomSpacer.snp.makeConstraints { make in
                    make.bottom.left.right.equalToSuperview()
                    make.top.equalTo(riveView.snp.bottom)
                    make.height.greaterThanOrEqualTo(1)
                }
        }

    }
}

```

Diffs=
f3176e045 fixup touch location for ios when the riveview is a subview (#5592)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-17 13:33:10 +00:00
mjtalbot
b6d48a1f7b Macos take2
draft because i need to get a todo list together.

Adds macos as a target for our ios runtime! Also adds a macos target for our example (which is a different app completely, very minimalistic right now).

<img width="331" alt="CleanShot 2023-05-17 at 20 32 45@2x" src="https://github.com/rive-app/rive/assets/1216025/7a6cadce-9763-41a3-b1a0-6d067dfc3eca">

macos, macos rosetta, macos (designed for ipad), and ios  all co existing in peace, from the same runtime project

![CleanShot 2023-05-17 at 18 32 04@2x](https://github.com/rive-app/rive/assets/1216025/eead319d-a16b-4098-a7db-d5f033b1ef8f)

todo:
- [x] update build scripts to build supporting macos (gotta do this)
- [x] run formatter
- [x] test out builds in forked version of ios? (gotta do this)
- [ ] one more stab at catalyst? (i think we can try that later...)
- [ ] do we need a more comprehensive example setup for macos (I think we can do this later & try to pull zach's examples in)
- [ ] I think we should restructure the ios project, but i think we can do that after this as well (i just think the folder structure/project structure can do with some work, now that we add macos (and should make room for tvos as well)
- [x] probably got tests to fix
- [ ] there's probably a bunch of looking at errors in the debugger and figuring those out, but i would hope that we can deploy with some warnings here too.

catalyst problem:

we get this error:
and the problem is basically that we can target a specific library for macos, but we need one for macos and one for macos catalyst. they share the same architecture, so i dont think we can lipo them into one file...

we could change the compiled binaries before creating the frameworks I guess though? .. maybe something to try..

`/Users/maxwelltalbot/development/rive/rive/packages/runtime_ios/dependencies/debug/librive_skia_renderer_macos.a(cg_factory.o), building for Mac Catalyst, but linking in object file built for macOS, file '/Users/maxwelltalbot/development/rive/rive/packages/runtime_ios/dependencies/debug/librive_skia_renderer_macos.a' for architecture arm64` basically

Diffs=
a9f8a1c5d Macos take2 (#5258)
2023-05-24 11:15:51 +00:00
mjtalbot
c4238e9b36 Ios memory shared context
Set of ios changes:
- Fixes a couple of memory leaks
- Implements ref counting for our graphics context, so we can ditch it if noone's using it
- few leftover notes about things i've not quite "solved" we still keep a hold of too much url data, but i think i want to get this change in. its been too long

Diffs=
1ddbb679a Ios memory shared context (#5169)
2023-04-26 13:27:28 +00:00
csmartdalton
627ecee71c Update ObjC formatting to look more similar to the C++
Also update the auto formatter to run on *.m and *.mm files, and effectively ban breaking on return types entirely, as I think this is ugly.

Diffs=
c7d125c7d Update ObjC formatting to look more similar to the C++
2023-02-15 17:24:57 +00:00
duncandoit
4b03b7a0ae iOS project reorg
Reorganized the project to put it inline with the cleaner organization of the mac runtime

Diffs=
3468941d0 Reorganized the project to put it inline with the cleaner organization of the mac runtime
2022-12-15 00:07:37 +00:00