diff --git a/example/pubspec.lock b/example/pubspec.lock index 7c1563e..800958a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -21,26 +21,26 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.1" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.19.1" crypto: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.3" ffi: dependency: transitive description: @@ -128,14 +128,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" json_annotation: dependency: transitive description: @@ -144,6 +136,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.1" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" lints: dependency: transitive description: @@ -164,34 +180,34 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.19" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.17.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.1" path_provider: dependency: transitive description: @@ -324,7 +340,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -345,10 +361,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.1" state_notifier: dependency: transitive description: @@ -361,10 +377,10 @@ packages: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.4" string_scanner: dependency: transitive description: @@ -385,10 +401,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.7.10" typed_data: dependency: transitive description: @@ -409,10 +425,18 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "046d3928e16fa4dc46e8350415661755ab759d9fc97fc21b5ab295f71e4f0499" + url: "https://pub.dev" + source: hosted + version: "15.1.0" win32: dependency: transitive description: @@ -430,5 +454,5 @@ packages: source: hosted version: "1.0.4" sdks: - dart: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + dart: ">=3.9.0-0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/packages/core/lib/state.dart b/packages/core/lib/state.dart index e8f8cb2..bbeee77 100644 --- a/packages/core/lib/state.dart +++ b/packages/core/lib/state.dart @@ -160,7 +160,7 @@ abstract class PersistedState implements AsyncStateNotifier { } void init(ErrorHandler errorHandler, bool storageJson) { - this._errorHandler = errorHandler; + _errorHandler = errorHandler; addListener((state) { if (_persistance != null) { _hasUpdated = true; diff --git a/packages/core/pubspec.yaml b/packages/core/pubspec.yaml index 95d500f..1f50bd9 100644 --- a/packages/core/pubspec.yaml +++ b/packages/core/pubspec.yaml @@ -31,8 +31,8 @@ dev_dependencies: sdk: flutter fake_async: ^1.0.0 flutter_lints: ^5.0.0 - json_serializable: ^6.8.0 - pigeon: ^25.3.1 + json_serializable: '>=6.8.0 <6.9.0' + pigeon: ^22.7.2 mockito: ^5.3.2 flutter: diff --git a/packages/core/test/mocks/mocks.mocks.dart b/packages/core/test/mocks/mocks.mocks.dart index 2566cda..ca0ec9e 100644 --- a/packages/core/test/mocks/mocks.mocks.dart +++ b/packages/core/test/mocks/mocks.mocks.dart @@ -9,13 +9,13 @@ import 'dart:developer' as _i27; import 'dart:typed_data' as _i15; import 'dart:ui' as _i9; -import 'package:flutter/foundation.dart' as _i8; +import 'package:flutter/foundation.dart' as _i7; import 'package:flutter/gestures.dart' as _i11; import 'package:flutter/rendering.dart' as _i12; import 'package:flutter/scheduler.dart' as _i26; import 'package:flutter/services.dart' as _i10; import 'package:flutter/src/widgets/binding.dart' as _i25; -import 'package:flutter/src/widgets/focus_manager.dart' as _i7; +import 'package:flutter/src/widgets/focus_manager.dart' as _i8; import 'package:flutter/src/widgets/framework.dart' as _i13; import 'package:flutter/src/widgets/platform_menu_bar.dart' as _i6; import 'package:http/http.dart' as _i3; @@ -44,6 +44,7 @@ import 'package:state_notifier/state_notifier.dart' as _i23; // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class +// ignore_for_file: invalid_use_of_internal_member class _FakeEncoding_0 extends _i1.SmartFake implements _i2.Encoding { _FakeEncoding_0( @@ -107,34 +108,34 @@ class _FakePlatformMenuDelegate_5 extends _i1.SmartFake ); } -class _FakeFocusManager_6 extends _i1.SmartFake implements _i7.FocusManager { - _FakeFocusManager_6( +class _FakeValueNotifier_6 extends _i1.SmartFake + implements _i7.ValueNotifier { + _FakeValueNotifier_6( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); - - @override - String toString({_i8.DiagnosticLevel? minLevel = _i8.DiagnosticLevel.info}) => - super.toString(); } -class _FakeSingletonFlutterWindow_7 extends _i1.SmartFake - implements _i9.SingletonFlutterWindow { - _FakeSingletonFlutterWindow_7( +class _FakeFocusManager_7 extends _i1.SmartFake implements _i8.FocusManager { + _FakeFocusManager_7( Object parent, Invocation parentInvocation, ) : super( parent, parentInvocation, ); + + @override + String toString({_i7.DiagnosticLevel? minLevel = _i7.DiagnosticLevel.info}) => + super.toString(); } -class _FakePlatformDispatcher_8 extends _i1.SmartFake - implements _i9.PlatformDispatcher { - _FakePlatformDispatcher_8( +class _FakeSingletonFlutterWindow_8 extends _i1.SmartFake + implements _i9.SingletonFlutterWindow { + _FakeSingletonFlutterWindow_8( Object parent, Invocation parentInvocation, ) : super( @@ -143,9 +144,9 @@ class _FakePlatformDispatcher_8 extends _i1.SmartFake ); } -class _FakeValueNotifier_9 extends _i1.SmartFake - implements _i8.ValueNotifier { - _FakeValueNotifier_9( +class _FakePlatformDispatcher_9 extends _i1.SmartFake + implements _i9.PlatformDispatcher { + _FakePlatformDispatcher_9( Object parent, Invocation parentInvocation, ) : super( @@ -274,7 +275,7 @@ class _FakePipelineOwner_20 extends _i1.SmartFake ); @override - String toString({_i8.DiagnosticLevel? minLevel = _i8.DiagnosticLevel.info}) => + String toString({_i7.DiagnosticLevel? minLevel = _i7.DiagnosticLevel.info}) => super.toString(); } @@ -288,7 +289,7 @@ class _FakeRenderView_21 extends _i1.SmartFake implements _i12.RenderView { ); @override - String toString({_i8.DiagnosticLevel? minLevel = _i8.DiagnosticLevel.info}) => + String toString({_i7.DiagnosticLevel? minLevel = _i7.DiagnosticLevel.info}) => super.toString(); } @@ -323,7 +324,7 @@ class _FakeWidget_24 extends _i1.SmartFake implements _i13.Widget { ); @override - String toString({_i8.DiagnosticLevel? minLevel = _i8.DiagnosticLevel.info}) => + String toString({_i7.DiagnosticLevel? minLevel = _i7.DiagnosticLevel.info}) => super.toString(); } @@ -338,9 +339,40 @@ class _FakeViewConfiguration_25 extends _i1.SmartFake ); } -class _FakeSemanticsHandle_26 extends _i1.SmartFake +class _FakeSceneBuilder_26 extends _i1.SmartFake implements _i9.SceneBuilder { + _FakeSceneBuilder_26( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePictureRecorder_27 extends _i1.SmartFake + implements _i9.PictureRecorder { + _FakePictureRecorder_27( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeCanvas_28 extends _i1.SmartFake implements _i9.Canvas { + _FakeCanvas_28( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSemanticsHandle_29 extends _i1.SmartFake implements _i12.SemanticsHandle { - _FakeSemanticsHandle_26( + _FakeSemanticsHandle_29( Object parent, Invocation parentInvocation, ) : super( @@ -349,9 +381,9 @@ class _FakeSemanticsHandle_26 extends _i1.SmartFake ); } -class _FakeSemanticsUpdateBuilder_27 extends _i1.SmartFake +class _FakeSemanticsUpdateBuilder_30 extends _i1.SmartFake implements _i9.SemanticsUpdateBuilder { - _FakeSemanticsUpdateBuilder_27( + _FakeSemanticsUpdateBuilder_30( Object parent, Invocation parentInvocation, ) : super( @@ -789,6 +821,16 @@ class MockStore extends _i1.Mock implements _i21.Store { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override + _i4.Future deletePersisted(String? key) => (super.noSuchMethod( + Invocation.method( + #deletePersisted, + [key], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override void dispose() => super.noSuchMethod( Invocation.method( @@ -1231,17 +1273,47 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { ); @override - _i7.FocusManager get focusManager => (super.noSuchMethod( + bool get debugShowWidgetInspectorOverride => (super.noSuchMethod( + Invocation.getter(#debugShowWidgetInspectorOverride), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @override + set debugShowWidgetInspectorOverride(bool? value) => super.noSuchMethod( + Invocation.setter( + #debugShowWidgetInspectorOverride, + value, + ), + returnValueForMissingStub: null, + ); + + @override + _i7.ValueNotifier get debugShowWidgetInspectorOverrideNotifier => + (super.noSuchMethod( + Invocation.getter(#debugShowWidgetInspectorOverrideNotifier), + returnValue: _FakeValueNotifier_6( + this, + Invocation.getter(#debugShowWidgetInspectorOverrideNotifier), + ), + returnValueForMissingStub: _FakeValueNotifier_6( + this, + Invocation.getter(#debugShowWidgetInspectorOverrideNotifier), + ), + ) as _i7.ValueNotifier); + + @override + _i8.FocusManager get focusManager => (super.noSuchMethod( Invocation.getter(#focusManager), - returnValue: _FakeFocusManager_6( + returnValue: _FakeFocusManager_7( this, Invocation.getter(#focusManager), ), - returnValueForMissingStub: _FakeFocusManager_6( + returnValueForMissingStub: _FakeFocusManager_7( this, Invocation.getter(#focusManager), ), - ) as _i7.FocusManager); + ) as _i8.FocusManager); @override bool get firstFrameRasterized => (super.noSuchMethod( @@ -1281,11 +1353,11 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override _i9.SingletonFlutterWindow get window => (super.noSuchMethod( Invocation.getter(#window), - returnValue: _FakeSingletonFlutterWindow_7( + returnValue: _FakeSingletonFlutterWindow_8( this, Invocation.getter(#window), ), - returnValueForMissingStub: _FakeSingletonFlutterWindow_7( + returnValueForMissingStub: _FakeSingletonFlutterWindow_8( this, Invocation.getter(#window), ), @@ -1294,11 +1366,11 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override _i9.PlatformDispatcher get platformDispatcher => (super.noSuchMethod( Invocation.getter(#platformDispatcher), - returnValue: _FakePlatformDispatcher_8( + returnValue: _FakePlatformDispatcher_9( this, Invocation.getter(#platformDispatcher), ), - returnValueForMissingStub: _FakePlatformDispatcher_8( + returnValueForMissingStub: _FakePlatformDispatcher_9( this, Invocation.getter(#platformDispatcher), ), @@ -1312,17 +1384,17 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { ) as bool); @override - _i8.ValueNotifier get accessibilityFocus => (super.noSuchMethod( + _i7.ValueNotifier get accessibilityFocus => (super.noSuchMethod( Invocation.getter(#accessibilityFocus), - returnValue: _FakeValueNotifier_9( + returnValue: _FakeValueNotifier_6( this, Invocation.getter(#accessibilityFocus), ), - returnValueForMissingStub: _FakeValueNotifier_9( + returnValueForMissingStub: _FakeValueNotifier_6( this, Invocation.getter(#accessibilityFocus), ), - ) as _i8.ValueNotifier); + ) as _i7.ValueNotifier); @override _i10.HardwareKeyboard get keyboard => (super.noSuchMethod( @@ -1667,6 +1739,15 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { returnValueForMissingStub: null, ); + @override + void resetInternalState() => super.noSuchMethod( + Invocation.method( + #resetInternalState, + [], + ), + returnValueForMissingStub: null, + ); + @override void initServiceExtensions() => super.noSuchMethod( Invocation.method( @@ -1777,8 +1858,8 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { #handlePopRoute, [], ), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(true), + returnValue: _i4.Future.value(false), + returnValueForMissingStub: _i4.Future.value(false), ) as _i4.Future); @override @@ -1787,8 +1868,8 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { #handlePushRoute, [route], ), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(true), + returnValue: _i4.Future.value(false), + returnValueForMissingStub: _i4.Future.value(false), ) as _i4.Future); @override @@ -1801,6 +1882,15 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { returnValueForMissingStub: null, ); + @override + void handleViewFocusChanged(_i9.ViewFocusEvent? event) => super.noSuchMethod( + Invocation.method( + #handleViewFocusChanged, + [event], + ), + returnValueForMissingStub: null, + ); + @override void handleMemoryPressure() => super.noSuchMethod( Invocation.method( @@ -1933,7 +2023,7 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override void registerSignalServiceExtension({ required String? name, - required _i8.AsyncCallback? callback, + required _i7.AsyncCallback? callback, }) => super.noSuchMethod( Invocation.method( @@ -1950,8 +2040,8 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override void registerBoolServiceExtension({ required String? name, - required _i8.AsyncValueGetter? getter, - required _i8.AsyncValueSetter? setter, + required _i7.AsyncValueGetter? getter, + required _i7.AsyncValueSetter? setter, }) => super.noSuchMethod( Invocation.method( @@ -1969,8 +2059,8 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override void registerNumericServiceExtension({ required String? name, - required _i8.AsyncValueGetter? getter, - required _i8.AsyncValueSetter? setter, + required _i7.AsyncValueGetter? getter, + required _i7.AsyncValueSetter? setter, }) => super.noSuchMethod( Invocation.method( @@ -2004,8 +2094,8 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override void registerStringServiceExtension({ required String? name, - required _i8.AsyncValueGetter? getter, - required _i8.AsyncValueSetter? setter, + required _i7.AsyncValueGetter? getter, + required _i7.AsyncValueSetter? setter, }) => super.noSuchMethod( Invocation.method( @@ -2023,7 +2113,7 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { @override void registerServiceExtension({ required String? name, - required _i8.ServiceExtensionCallback? callback, + required _i7.ServiceExtensionCallback? callback, }) => super.noSuchMethod( Invocation.method( @@ -2589,6 +2679,72 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { ), ) as _i12.ViewConfiguration); + @override + _i9.SceneBuilder createSceneBuilder() => (super.noSuchMethod( + Invocation.method( + #createSceneBuilder, + [], + ), + returnValue: _FakeSceneBuilder_26( + this, + Invocation.method( + #createSceneBuilder, + [], + ), + ), + returnValueForMissingStub: _FakeSceneBuilder_26( + this, + Invocation.method( + #createSceneBuilder, + [], + ), + ), + ) as _i9.SceneBuilder); + + @override + _i9.PictureRecorder createPictureRecorder() => (super.noSuchMethod( + Invocation.method( + #createPictureRecorder, + [], + ), + returnValue: _FakePictureRecorder_27( + this, + Invocation.method( + #createPictureRecorder, + [], + ), + ), + returnValueForMissingStub: _FakePictureRecorder_27( + this, + Invocation.method( + #createPictureRecorder, + [], + ), + ), + ) as _i9.PictureRecorder); + + @override + _i9.Canvas createCanvas(_i9.PictureRecorder? recorder) => (super.noSuchMethod( + Invocation.method( + #createCanvas, + [recorder], + ), + returnValue: _FakeCanvas_28( + this, + Invocation.method( + #createCanvas, + [recorder], + ), + ), + returnValueForMissingStub: _FakeCanvas_28( + this, + Invocation.method( + #createCanvas, + [recorder], + ), + ), + ) as _i9.Canvas); + @override void initMouseTracker([_i12.MouseTracker? tracker]) => super.noSuchMethod( Invocation.method( @@ -2661,14 +2817,14 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { #ensureSemantics, [], ), - returnValue: _FakeSemanticsHandle_26( + returnValue: _FakeSemanticsHandle_29( this, Invocation.method( #ensureSemantics, [], ), ), - returnValueForMissingStub: _FakeSemanticsHandle_26( + returnValueForMissingStub: _FakeSemanticsHandle_29( this, Invocation.method( #ensureSemantics, @@ -2684,14 +2840,14 @@ class MockWidgetsBinding extends _i1.Mock implements _i25.WidgetsBinding { #createSemanticsUpdateBuilder, [], ), - returnValue: _FakeSemanticsUpdateBuilder_27( + returnValue: _FakeSemanticsUpdateBuilder_30( this, Invocation.method( #createSemanticsUpdateBuilder, [], ), ), - returnValueForMissingStub: _FakeSemanticsUpdateBuilder_27( + returnValueForMissingStub: _FakeSemanticsUpdateBuilder_30( this, Invocation.method( #createSemanticsUpdateBuilder, diff --git a/packages/plugins/plugin_idfa/ios/Classes/PluginIdfaPlugin.swift b/packages/plugins/plugin_idfa/ios/Classes/PluginIdfaPlugin.swift index 3ae041b..de9380b 100644 --- a/packages/plugins/plugin_idfa/ios/Classes/PluginIdfaPlugin.swift +++ b/packages/plugins/plugin_idfa/ios/Classes/PluginIdfaPlugin.swift @@ -7,11 +7,11 @@ public class PluginIdfaPlugin: NSObject, FlutterPlugin, NativeIdfaApi { func getTrackingAuthorizationStatus(completion: @escaping (Result) -> Void) { if #available(iOS 14, *) { ATTrackingManager.requestTrackingAuthorization { status in - let idfa = status == .authorized ? ASIdentifierManager.shared().advertisingIdentifier.uuidString : self.fallbackValue + let idfa = status == .authorized ? ASIdentifierManager.shared().advertisingIdentifier.uuidString : "00000000-0000-0000-0000-000000000000" completion(.success(NativeIdfaData( adTrackingEnabled: status == .authorized, - advertisingId: idfa!, + advertisingId: idfa, trackingStatus: status == .authorized ? TrackingStatus.authorized : status == .denied ? TrackingStatus.denied : status == .notDetermined ? TrackingStatus.notDetermined : status == .restricted ? TrackingStatus.restricted : TrackingStatus.unknown //self.statusToString(status) ))); } diff --git a/packages/plugins/plugin_idfa/lib/plugin_idfa.dart b/packages/plugins/plugin_idfa/lib/plugin_idfa.dart index a439330..cb7313a 100644 --- a/packages/plugins/plugin_idfa/lib/plugin_idfa.dart +++ b/packages/plugins/plugin_idfa/lib/plugin_idfa.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:segment_analytics/event.dart'; import 'package:segment_analytics/plugin.dart'; import 'package:segment_analytics_plugin_idfa/native_idfa.dart'; @@ -15,6 +16,8 @@ class IdfaData { } class PluginIdfa extends Plugin { + Future? _trackingStatusFuture; + PluginIdfa({bool shouldAskPermission = true}) : super(PluginType.enrichment) { if (kIsWeb) { return; @@ -23,15 +26,24 @@ class PluginIdfa extends Plugin { return; } if (shouldAskPermission) { - getTrackingStatus(); + _trackingStatusFuture = getTrackingStatus(); } } + @override + Future execute(RawEvent event) async { + // Wait for the initial IDFA fetch to complete before allowing events through, + // so that Application Installed / Application Opened are stamped with IDFA data. + await _trackingStatusFuture; + return event; + } + /// `requestTrackingPermission()` will prompt the user for /// tracking permission and returns a promise you can use to /// make additional tracking decisions based on the user response Future requestTrackingPermission() async { - final idfaData = await getTrackingStatus(); + _trackingStatusFuture = getTrackingStatus(); + final idfaData = await _trackingStatusFuture!; return idfaData.adTrackingEnabled; }