-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: iOS native bridge for scope sync #296
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick first pass.
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- iOS native bridge for scope sync ([#296](https://github.com/getsentry/sentry-unity/pull/296)) If none of the above apply, you can opt out of this check by adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just small items, looks like we can merge this soon
@@ -1,6 +1,10 @@ | |||
using UnityEngine; | |||
using UnityEngine.Scripting; | |||
|
|||
#if UNITY_IOS && !UNITY_EDITOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea if this works:
#if UNITY_IOS && !UNITY_EDITOR | |
#define ENABLE_ISO_BRIDGE = UNITY_IOS && !UNITY_EDITOR | |
#if ENABLE_ISO_BRIDGE |
@@ -24,7 +24,7 @@ public static void OnPostProcessBuild(BuildTarget target, string pathToProject) | |||
return; | |||
} | |||
|
|||
if (!options!.IOSNativeSupportEnabled) | |||
if (!options!.IosNativeSupportEnabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Event though "we know it's checked in Validate" it's hard to tell from reading here.
So not against having the null
check in the extension method but it looks a bit magic or possibly looks like a bug from the outside. So better have a null
check before the use of options
here
string? extraValue = null; | ||
if (value is not null) | ||
{ | ||
extraValue = SerializeExtraValue(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraValue = SerializeExtraValue(value); | |
extraValue = SerializeExtraValue(value); | |
if (extraValue is null) | |
{ | |
// Failed to serialize, so lets just give up | |
return; | |
} |
@@ -45,7 +45,7 @@ internal static string GetConfigPath(string? notDefaultConfigName = null) | |||
[field: SerializeField] internal int ShutdownTimeout { get; set; } | |||
[field: SerializeField] internal int MaxQueueItems { get; set; } | |||
|
|||
[field: SerializeField] internal bool IOSNativeSupportEnabled { get; set; } | |||
[field: SerializeField] internal bool IosNativeSupportEnabled { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a new one bool?
and make this one [Obsolete]
and read from the old one so we can avoid losing the value when the users upgrade.
[Test] | ||
public void GetTimestamp_ReturnStringConformsToISO8601() | ||
{ | ||
var timestamp = SystemClock.Clock.GetUtcNow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SystemClock is used when we need to control which time is used at different places for testing.
Here you just need a timestamp, better to stick to the framework's API:
var timestamp = SystemClock.Clock.GetUtcNow(); | |
var timestamp = DateTimeOffset.UtcNow; |
|
||
var actualValue = sut.SerializeExtraValue(new SerializationTestClass()); | ||
|
||
Assert.AreEqual(null, actualValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert.AreEqual(null, actualValue); | |
Assert.IsNull(actualValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm the Objective-C code LGTM.
Sync between .NET and iOS native via the scope observer interface and a native bridge.
Things that get synched:
Remaining open: additional data for user (tracked by #314)