File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ ### Features
6
+
7
+ - Add support for script context and variables on Apple platforms ([ #306 ] ( https://github.com/getsentry/sentry-godot/pull/306 ) )
8
+
5
9
### Dependencies
6
10
7
11
- Bump Cocoa SDK from v8.54.0 to v8.55.0 ([ #318 ] ( https://github.com/getsentry/sentry-godot/pull/318 ) )
Original file line number Diff line number Diff line change 223
223
cocoa_frame.inApp = bool_to_objc (frame.in_app );
224
224
cocoa_frame.platform = string_to_objc (frame.platform );
225
225
226
- // TODO: unable to pass context_line, pre_context, post_context.
227
- // TODO: unable to pass local/member vars.
226
+ if (!frame.context_line .is_empty ()) {
227
+ cocoa_frame.contextLine = string_to_objc (frame.context_line );
228
+ cocoa_frame.preContext = string_array_to_objc (frame.pre_context );
229
+ cocoa_frame.postContext = string_array_to_objc (frame.post_context );
230
+ }
231
+
232
+ if (!frame.vars .is_empty ()) {
233
+ NSMutableDictionary *objc_vars = [NSMutableDictionary dictionaryWithCapacity: frame.vars.size ()];
234
+ for (const auto &var : frame.vars ) {
235
+ NSString *key = string_to_objc (var.first );
236
+ id value = variant_to_objc (var.second );
237
+ objc_vars[key] = value;
238
+ }
239
+ cocoa_frame.vars = objc_vars;
240
+ }
228
241
229
242
[mut_frames addObject: cocoa_frame];
230
243
}
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ _FORCE_INLINE_ NSNumber *double_to_objc(double p_num) {
72
72
73
73
NSObject *variant_to_objc (const godot::Variant &p_value, int p_depth = 0 );
74
74
NSDictionary *dictionary_to_objc (const godot::Dictionary &p_dictionary);
75
+ NSArray<NSString *> *string_array_to_objc (const godot::PackedStringArray &p_array);
75
76
76
77
} // namespace sentry::cocoa
77
78
Original file line number Diff line number Diff line change 79
79
return (NSDictionary *)variant_to_objc (p_dictionary);
80
80
}
81
81
82
+ NSArray <NSString *> *string_array_to_objc (const godot::PackedStringArray &p_array) {
83
+ NSMutableArray <NSString *> *objc_array = [NSMutableArray arrayWithCapacity: p_array.size ()];
84
+ for (int i = 0 ; i < p_array.size (); i++) {
85
+ [objc_array addObject: string_to_objc (p_array[i])];
86
+ }
87
+ return objc_array;
88
+ }
89
+
82
90
} // namespace sentry::cocoa
You can’t perform that action at this time.
0 commit comments