Skip to content

Commit

Permalink
update ffi native
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Jun 17, 2024
1 parent fd102a0 commit 627f677
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flutter/lib/src/native/cocoa/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36568,7 +36568,7 @@ class PrivateSentrySDKOnly extends objc.NSObject {

/// Start a profiler session associated with the given @c SentryId.
/// @return The system time when the profiler session started.
static int startProfilerForTrace_(SentryId traceId) {
static int startProfilerForTrace_(SentryId1 traceId) {
return _objc_msgSend_754(_class_PrivateSentrySDKOnly,
_sel_startProfilerForTrace_, traceId.pointer);
}
Expand Down
11 changes: 6 additions & 5 deletions flutter/lib/src/native/cocoa/sentry_native_cocoa.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import 'dart:ffi';
// import 'dart:ffi';

import 'package:meta/meta.dart';

import '../../../sentry_flutter.dart';
import '../sentry_native_channel.dart';
import 'binding.dart' as cocoa;
import 'package:objective_c/objective_c.dart' as objc;

@internal
class SentryNativeCocoa extends SentryNativeChannel {
late final _lib = cocoa.SentryCocoa(DynamicLibrary.process());
// late final _lib = cocoa.SentryCocoa(DynamicLibrary.process()); // No more dylib loading?

SentryNativeCocoa(super.channel);

@override
int? startProfiler(SentryId traceId) {
final cSentryId = cocoa.SentryId1.alloc(_lib)
..initWithUUIDString_(cocoa.NSString(_lib, traceId.toString()));
final cSentryId = cocoa.SentryId1.alloc()
..initWithUUIDString_(objc.NSString(traceId.toString()));
final startTime =
cocoa.PrivateSentrySDKOnly.startProfilerForTrace_(_lib, cSentryId);
cocoa.PrivateSentrySDKOnly.startProfilerForTrace_(cSentryId);
return startTime;
}
}
2 changes: 1 addition & 1 deletion flutter/scripts/generate-cocoa-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ mv "$temp/$subdir" $temp/Sentry.framework

dart run ffigen --config ffi-cocoa.yaml
#sed -i.bak 's|final class|class|g' lib/src/native/cocoa/binding.dart
#sed -i.bak 's|static int startProfilerForTrace_(SentryCocoa _lib, SentryId? traceId)|static int startProfilerForTrace_(SentryCocoa _lib, SentryId1? traceId)|g' lib/src/native/cocoa/binding.dart
sed -i.bak 's|static int startProfilerForTrace_(SentryId traceId)|static int startProfilerForTrace_(SentryId1 traceId)|g' lib/src/native/cocoa/binding.dart
rm lib/src/native/cocoa/binding.dart.bak

0 comments on commit 627f677

Please sign in to comment.