Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncing with upstream #429

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,19 @@ shared_lib/dependencies
shared_lib/bin
*.make
Makefile

# https://dart.dev/guides/libraries/private-files

.dart_tool/
build/

doc/api/

# IntelliJ
*.iml
*.ipr
*.iws
.idea/

# Mac
.DS_Store
6 changes: 4 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
analyzer:
errors:
unused_import: error
prefer_is_empty: ignore
exclude:
- ios
- macos
Expand Down Expand Up @@ -51,7 +52,8 @@ linter:
- join_return_with_assignment
- library_names
- library_prefixes
- lines_longer_than_80_chars
# STOKANAL-FORK-EDIT
# - lines_longer_than_80_chars
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
- no_adjacent_strings_in_list
- no_duplicate_case_values
Expand All @@ -76,7 +78,7 @@ linter:
- prefer_contains
- prefer_final_fields
- prefer_final_in_for_each
- prefer_foreach
# - prefer_foreach
- prefer_function_declarations_over_variables
- prefer_initializing_formals
- prefer_is_empty
Expand Down
32 changes: 32 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation

import audio_session
import device_info_plus
import flutter_udid
import in_app_purchase_storekit
import just_audio
import package_info_plus
import path_provider_foundation
import rive_common
import shared_preferences_foundation
import url_launcher_macos
import wakelock_plus

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlutterUdidPlugin.register(with: registry.registrar(forPlugin: "FlutterUdidPlugin"))
InAppPurchasePlugin.register(with: registry.registrar(forPlugin: "InAppPurchasePlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
}
20 changes: 20 additions & 0 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Generated file. Do not edit.
//

// clang-format off

#include "generated_plugin_registrant.h"

#include <flutter_udid/flutter_udid_plugin_c_api.h>
#include <rive_common/rive_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FlutterUdidPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterUdidPluginCApi"));
RivePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("RivePlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
15 changes: 15 additions & 0 deletions example/windows/flutter/generated_plugin_registrant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//

// clang-format off

#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

#include <flutter/plugin_registry.h>

// Registers Flutter plugins.
void RegisterPlugins(flutter::PluginRegistry* registry);

#endif // GENERATED_PLUGIN_REGISTRANT_
26 changes: 26 additions & 0 deletions example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Generated file, do not edit.
#

list(APPEND FLUTTER_PLUGIN_LIST
flutter_udid
rive_common
url_launcher_windows
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
13 changes: 9 additions & 4 deletions lib/src/controllers/linear_animation_controller.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:collection';

import 'package:rive/src/core/core.dart';
import 'package:rive/src/rive_core/animation/keyed_object.dart';
import 'package:rive/src/rive_core/animation/linear_animation_instance.dart'
Expand All @@ -10,7 +12,7 @@ export 'package:rive/src/runtime_mounted_artboard.dart';
/// the inputs of the StateMachine.
class LinearAnimationInstance extends core.LinearAnimationInstance
with RuntimeEventReporter, KeyedCallbackReporter {
final _runtimeEventListeners = <OnRuntimeEvent>{};
final _runtimeEventListeners = HashSet<OnRuntimeEvent>(); // {};
late CoreContext? context;

LinearAnimationInstance(animation,
Expand All @@ -27,9 +29,12 @@ class LinearAnimationInstance extends core.LinearAnimationInstance

@override
void reportEvent(Event event) {
_runtimeEventListeners.toList().forEach((callback) {
callback(event);
});
for (final t in _runtimeEventListeners) {
t(event);
}
// _runtimeEventListeners.toList().forEach((callback) {
// callback(event);
// });
}

@override
Expand Down
13 changes: 10 additions & 3 deletions lib/src/controllers/state_machine_controller.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:collection';

import 'package:rive/src/core/core.dart';
import 'package:rive/src/rive_core/animation/state_machine.dart';
import 'package:rive/src/rive_core/animation/state_machine_bool.dart';
Expand Down Expand Up @@ -119,7 +121,7 @@ class StateMachineController extends core.StateMachineController
/// A list of inputs available in the StateMachine.
Iterable<SMIInput> get inputs => _inputs;

final _runtimeEventListeners = <OnRuntimeEvent>{};
final _runtimeEventListeners = HashSet<OnRuntimeEvent>();//{};

StateMachineController(
StateMachine stateMachine, {
Expand Down Expand Up @@ -224,8 +226,13 @@ class StateMachineController extends core.StateMachineController

@override
void applyEvents() {
var events = reportedEvents.toList(growable: false);
// var events = reportedEvents.toList(growable: false);
super.applyEvents();
_runtimeEventListeners.toList().forEach(events.forEach);

// _runtimeEventListeners.toList().forEach(events.forEach);
for (final t in _runtimeEventListeners) {
reportedEvents.forEach(t);
}
// _runtimeEventListeners.toList().forEach(reportedEvents.forEach);
}
}
2 changes: 1 addition & 1 deletion lib/src/core/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ abstract class CoreContext {

// ignore: one_member_abstracts
abstract class ImportStackObject {
final _resolveBefore = <ImportStackObject>{};
final _resolveBefore = HashSet<ImportStackObject>();//{};
bool _resolved = false;

bool initStack(ImportStack stack) {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/core/field_types/core_field_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import 'package:rive_common/utilities.dart';
abstract class CoreFieldType<T extends Object> {
T deserialize(BinaryReader reader);
void skip(BinaryReader reader) => deserialize(reader);

// const CoreFieldType();
}
2 changes: 1 addition & 1 deletion lib/src/core/importers/artboard_importer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ArtboardImporter extends ImportStackObject {
}
assert(!artboard.children.contains(artboard),
'artboard should never contain itself as a child');
for (final object in artboard.objects.toList(growable: false)) {
for (final object in artboard.objects) {//.toList(growable: false)) {
if (object == null) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/core/importers/backboard_importer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class BackboardImporter extends ImportStackObject {
final Backboard backboard;

final HashMap<int, Artboard> artboardLookup;
final Set<NestedArtboard> nestedArtboards = {};
final Set<NestedArtboard> nestedArtboards = HashSet<NestedArtboard>();//{};
final List<FileAsset> fileAssets = [];
final Set<FileAssetReferencer> fileAssetReferencers = {};
final Set<FileAssetReferencer> fileAssetReferencers = HashSet<FileAssetReferencer>();//{};
BackboardImporter(this.artboardLookup, this.backboard);

void addArtboard(Artboard object) {}
Expand Down
1 change: 1 addition & 0 deletions lib/src/generated/animation/keyed_object_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:rive/src/core/core.dart';

abstract class KeyedObjectBase<T extends CoreContext> extends Core<T> {
static const int typeKey = 25;

@override
int get coreType => KeyedObjectBase.typeKey;
@override
Expand Down
16 changes: 9 additions & 7 deletions lib/src/generated/animation/keyed_property_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ abstract class KeyedPropertyBase<T extends CoreContext> extends Core<T> {
/// PropertyKey field with key 53.
static const int propertyKeyPropertyKey = 53;
static const int propertyKeyInitialValue = CoreContext.invalidPropertyKey;
int _propertyKey = propertyKeyInitialValue;

/// STOKANAL-FORK-EDIT: exposing
int propertyKey_ = propertyKeyInitialValue;

/// The property type that is keyed.
int get propertyKey => _propertyKey;
int get propertyKey => propertyKey_;

/// Change the [_propertyKey] field value.
/// Change the [propertyKey_] field value.
/// [propertyKeyChanged] will be invoked only if the field's value has
/// changed.
set propertyKey(int value) {
if (_propertyKey == value) {
if (propertyKey_ == value) {
return;
}
int from = _propertyKey;
_propertyKey = value;
int from = propertyKey_;
propertyKey_ = value;
if (hasValidated) {
propertyKeyChanged(from, value);
}
Expand All @@ -40,7 +42,7 @@ abstract class KeyedPropertyBase<T extends CoreContext> extends Core<T> {
void copy(Core source) {
super.copy(source);
if (source is KeyedPropertyBase) {
_propertyKey = source._propertyKey;
propertyKey_ = source.propertyKey_;
}
}
}
17 changes: 10 additions & 7 deletions lib/src/generated/animation/keyframe_double_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ abstract class KeyFrameDoubleBase extends InterpolatingKeyFrame {
/// Value field with key 70.
static const int valuePropertyKey = 70;
static const double valueInitialValue = 0;
double _value = valueInitialValue;
double get value => _value;

/// Change the [_value] field value.
/// STOKANAL-FORK-EDIT: exposing
double value_ = valueInitialValue;

double get value => value_;

/// Change the [value_] field value.
/// [valueChanged] will be invoked only if the field's value has changed.
set value(double value) {
if (_value == value) {
if (value_ == value) {
return;
}
double from = _value;
_value = value;
double from = value_;
value_ = value;
if (hasValidated) {
valueChanged(from, value);
}
Expand All @@ -43,7 +46,7 @@ abstract class KeyFrameDoubleBase extends InterpolatingKeyFrame {
void copy(Core source) {
super.copy(source);
if (source is KeyFrameDoubleBase) {
_value = source._value;
value_ = source.value_;
}
}
}
Loading