diff --git a/Plugins/TestFairy.cs b/Plugins/TestFairy.cs index 61892e6..20dd103 100644 --- a/Plugins/TestFairy.cs +++ b/Plugins/TestFairy.cs @@ -7,100 +7,47 @@ namespace TestFairyUnity { public class TestFairy : MonoBehaviour { -#if UNITY_IPHONE && !UNITY_EDITOR - [DllImport("__Internal")] private static extern void TestFairy_begin(string APIKey); - [DllImport("__Internal")] private static extern void TestFairy_pushFeedbackController(); - - [DllImport("__Internal")] - private static extern void TestFairy_showFeedbackForm(string appToken, bool takeScreenshot); - - [DllImport("__Internal")] - private static extern void TestFairy_checkpoint(string name); - - [DllImport("__Internal")] - private static extern void TestFairy_setServerEndpoint(string endpoint); - - [DllImport("__Internal")] - private static extern void TestFairy_setCorrelationId(string correlationId); - - [DllImport("__Internal")] - private static extern void TestFairy_identify(string correlationId, string traits); - - [DllImport("__Internal")] - private static extern void TestFairy_pause(); - - [DllImport("__Internal")] - private static extern void TestFairy_resume(); - - [DllImport("__Internal")] - private static extern void TestFairy_stop(); - - [DllImport("__Internal")] - private static extern string TestFairy_sessionUrl(); - - [DllImport("__Internal")] - private static extern string TestFairy_version(); - - [DllImport("__Internal")] - private static extern void TestFairy_sendUserFeedback(string feedback); - - [DllImport("__Internal")] - private static extern void TestFairy_takeScreenshot(); - - [DllImport("__Internal")] - private static extern void TestFairy_setScreenName(string name); - - [DllImport("__Internal")] - private static extern void TestFairy_log(string name); - - [DllImport("__Internal")] - private static extern void TestFairy_logException(string name, string trace); - - [DllImport("__Internal")] - private static extern void TestFairy_hideWebViewElements(string cssSelector); - - [DllImport("__Internal")] - private static extern void TestFairy_setUserId(string userId); - - [DllImport("__Internal")] - private static extern bool TestFairy_setAttribute(string aKey, string aValue); - - [DllImport("__Internal")] - private static extern void TestFairy_enableCrashHandler(); - - [DllImport("__Internal")] - private static extern void TestFairy_disableCrashHandler(); - - [DllImport("__Internal")] - private static extern void TestFairy_enableFeedbackForm(string method); - - [DllImport("__Internal")] - private static extern void TestFairy_disableFeedbackForm(); - - [DllImport("__Internal")] - private static extern void TestFairy_enableMetric(string metric); - - [DllImport("__Internal")] - private static extern void TestFairy_disableMetric(string metric); - - [DllImport("__Internal")] - private static extern void TestFairy_disableAutoUpdate(); - - [DllImport("__Internal")] - private static extern void TestFairy_disableVideo(); - - [DllImport("__Internal")] - private static extern void TestFairy_enableVideo(string policy, string quality, float framesPerSecond); + public static void begin(string APIKey) { + TestFairy.installUnityCrashHandler(); +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR + TestFairy_begin(APIKey); +#elif UNITY_ANDROID && !UNITY_EDITOR + AndroidJavaObject activityContext = null; + using (AndroidJavaClass activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { + activityContext = activityClass.GetStatic("currentActivity"); + } + TestFairy.callMethod("begin", activityContext, APIKey); +#endif + } + public static void setScreenName(string name) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR + TestFairy_setScreenName(name); #elif UNITY_ANDROID && !UNITY_EDITOR - void Start () { - AndroidJNI.AttachCurrentThread(); + TestFairy.callMethod("setScreenName", name); +#endif } - private static AndroidJavaClass getTestFairyClass() { - return new AndroidJavaClass("com.testfairy.TestFairy"); + public static void setUserId(string userId) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR + TestFairy_setUserId(userId); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("setUserId", userId); +#endif } + + public static bool setAttribute(string aKey, string aValue) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) + return false; +#elif UNITY_IPHONE && !UNITY_EDITOR + return TestFairy_setAttribute(aKey, aValue); +#elif UNITY_ANDROID && !UNITY_EDITOR + return TestFairy.callBoolMethod("setAttribute", aKey, aValue); #endif + } /// /// Push the feedback view controller. Hook a button to this method @@ -108,34 +55,25 @@ private static AndroidJavaClass getTestFairyClass() { /// feedback will appear in your build report page, and in the /// recorded session page. /// - public static void pushFeedbackController() - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void pushFeedbackController() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_pushFeedbackController(); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("showFeedbackForm"); - } - } + TestFairy.callMethod("showFeedbackForm"); #endif } - public static void showFeedbackForm(string appToken, bool takeScreenshot) - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void showFeedbackForm(string appToken, bool takeScreenshot) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_showFeedbackForm(appToken, takeScreenshot); #elif UNITY_ANDROID && !UNITY_EDITOR AndroidJavaObject activityContext = null; using(AndroidJavaClass activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { activityContext = activityClass.GetStatic("currentActivity"); } - - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("showFeedbackForm", activityContext, appToken, takeScreenshot); - } - } + TestFairy.callMethod("showFeedbackForm", activityContext, appToken, takeScreenshot); #endif } @@ -146,16 +84,12 @@ public static void showFeedbackForm(string appToken, bool takeScreenshot) /// user experience and behavior. /// /// Name of checkpoint, make it short. - public static void checkpoint(string name) - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void checkpoint(string name) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_checkpoint(name); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("addCheckpoint", name); - } - } + TestFairy.callMethod("addCheckpoint", name); #endif } @@ -166,16 +100,12 @@ public static void checkpoint(string name) /// only once per session (subsequent calls will be ignored.) /// /// Correlation value - public static void setCorrelationId(string correlationId) - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void setCorrelationId(string correlationId) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_setCorrelationId(correlationId); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("setCorrelationId", correlationId); - } - } + TestFairy.callMethod("setCorrelationId", correlationId); #endif } @@ -186,8 +116,7 @@ public static void setCorrelationId(string correlationId) /// only once per session (subsequent calls will be ignored.) /// /// Correlation value - public static void identify(string correlationId, Dictionary traits = null) - { + public static void identify(string correlationId, Dictionary traits = null) { string traitsString = null; if (traits != null) { traitsString = ""; @@ -199,14 +128,11 @@ public static void identify(string correlationId, Dictionary tra traitsString += encodedKey + "=" + type + "/" + encodedValue + "\n"; } } -#if UNITY_IPHONE && !UNITY_EDITOR +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_identify(correlationId, traitsString); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("identify", correlationId, traitsString); - } - } + TestFairy.callMethod("identify", correlationId, traitsString); #endif } @@ -214,16 +140,12 @@ public static void identify(string correlationId, Dictionary tra /// Pauses the current session. This method stops recoding of /// the current session until Resume() has been called. /// - public static void pause() - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void pause() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_pause(); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("pause"); - } - } + TestFairy.callMethod("pause"); #endif } @@ -231,32 +153,24 @@ public static void pause() /// Resumes the recording of the current session. This method /// resumes a session after it was paused or stopped. /// - public static void resume() - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void resume() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_resume(); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("resume"); - } - } + TestFairy.callMethod("resume"); #endif } /// /// Stops the recording of the current session. /// - public static void stop() - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void stop() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_stop(); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("stop"); - } - } + TestFairy.callMethod("stop"); #endif } @@ -265,164 +179,201 @@ public static void stop() /// Will return null if session hasn't started yet. /// /// The session URL. - public static string sessionUrl() - { - string sessionUrlStr = null; -#if UNITY_IPHONE && !UNITY_EDITOR - sessionUrlStr = TestFairy_sessionUrl(); + public static string sessionUrl() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) + return null; +#elif UNITY_IPHONE && !UNITY_EDITOR + return TestFairy_sessionUrl(); #elif UNITY_ANDROID && !UNITY_EDITOR + string sessionUrlStr = null; using(AndroidJavaClass pluginClass = getTestFairyClass()) { if(pluginClass != null) { sessionUrlStr = pluginClass.CallStatic("getSessionUrl"); } } -#endif return sessionUrlStr; +#endif } /// /// Returns the current installed version of TestFairy SDK. /// /// TestFairy version string. - public static string version() - { - string versionStr = null; -#if UNITY_IPHONE && !UNITY_EDITOR - versionStr = TestFairy_version (); + public static string version() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) + return null; +#elif UNITY_IPHONE && !UNITY_EDITOR + return TestFairy_version(); #elif UNITY_ANDROID && !UNITY_EDITOR + string versionStr = null; using(AndroidJavaClass pluginClass = getTestFairyClass()) { if(pluginClass != null) { versionStr = pluginClass.CallStatic("getVersion"); } } -#endif return versionStr; +#endif } /// - /// Sends a feedback to TestFairy + /// Sends a feedback string to TestFairy /// - /// Feedback string. - public static void sendUserFeedback(string feedback) - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void sendUserFeedback(string feedback) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_sendUserFeedback(feedback); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("sendUserFeedback", feedback); - } - } + TestFairy.callMethod("sendUserFeedback", feedback); #endif } /// /// Takes a screenshot /// - public static void takeScreenshot() - { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void takeScreenshot() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_takeScreenshot(); #elif UNITY_ANDROID && !UNITY_EDITOR - // TODO: no-op on android + TestFairy.callMethod("takeScreenshot"); #endif } public static void log(string message) { -#if UNITY_IPHONE && !UNITY_EDITOR +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_log(message); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("log", "TestFairyUnity", message); - } - } + TestFairy.callMethod("log", "TestFairyUnity", message); #endif } - public static void logException(string message, string stacktrace) { -#if UNITY_IPHONE && !UNITY_EDITOR + public static void logException(string message, string stacktrace) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_logException(message, stacktrace); #elif UNITY_ANDROID && !UNITY_EDITOR - using(AndroidJavaClass pluginClass = getTestFairyClass()) { - if(pluginClass != null) { - pluginClass.CallStatic("logThrowable", "TestFairyUnity", stacktrace); - } - } + TestFairy.callMethod("logThrowable", stacktrace); #endif } public static void hideWebViewElements(string cssSelector) { -#if UNITY_IPHONE && !UNITY_EDITOR +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_hideWebViewElements(cssSelector); #elif UNITY_ANDROID && !UNITY_EDITOR - // no op on Android + TestFairy.callMethod("hideWebViewElements", cssSelector); #endif } -#if UNITY_IPHONE && !UNITY_EDITOR public static void disableVideo() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_disableVideo(); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("disableVideo"); +#endif } public static void enableVideo(string policy, string quality, float framesPerSecond) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_enableVideo(policy, quality, framesPerSecond); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("enableVideo", policy, quality, framesPerSecond); +#endif + } + + public static void enableCrashHandler() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR + TestFairy_enableCrashHandler(); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("enableCrashHandler"); +#endif } public static void disableCrashHandler() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_disableCrashHandler(); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("disableCrashHandler"); +#endif } public static void enableMetric(string metric) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_enableMetric(metric); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("disableCrashHandler"); +#endif } public static void disableMetric(string metric) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_disableMetric(metric); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("disableMetric", metric); +#endif } public static void enableFeedbackForm(string method) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_enableFeedbackForm(method); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("enableFeedbackForm"); +#endif } public static void disableFeedbackForm() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_disableFeedbackForm(); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("disableFeedbackForm"); +#endif } public static void disableAutoUpdate() { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_disableAutoUpdate(); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("disableAutoUpdate"); +#endif } - public static void setServerEndpoint(string endpoint) - { + public static void setServerEndpoint(string endpoint) { +#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) +#elif UNITY_IPHONE && !UNITY_EDITOR TestFairy_setServerEndpoint(endpoint); +#elif UNITY_ANDROID && !UNITY_EDITOR + TestFairy.callMethod("setServerEndpoint", endpoint); +#endif } - public static void begin(string APIKey) - { - TestFairy.installUnityCrashHandler(); - TestFairy_begin(APIKey); - } - - public static void setScreenName(string name) { - TestFairy_setScreenName(name); + private static void installUnityCrashHandler() { + Application.logMessageReceivedThreaded += TestFairy.logMsgRecvThreaded; } - public static void setUserId(string userId) { - TestFairy_setUserId(userId); + private static void logMsgRecvThreaded(string _condition, string _stackTrace, LogType _type) { + if (_type==LogType.Exception) { + TestFairy.logException(_condition, _stackTrace); + } } - - public static bool setAttribute(string aKey, string aValue) { - return TestFairy_setAttribute(aKey, aValue); +#if UNITY_ANDROID && !UNITY_EDITOR + void Start () { + AndroidJNI.AttachCurrentThread(); } - public static void enableCrashHandler() { - TestFairy_enableCrashHandler(); + private static AndroidJavaClass getTestFairyClass() { + return new AndroidJavaClass("com.testfairy.TestFairy"); } -#endif - -#if UNITY_ANDROID && !UNITY_EDITOR private static void callMethod(string methodName, params object[] args) { using (AndroidJavaClass pluginClass = getTestFairyClass()) { if (pluginClass != null) { @@ -456,127 +407,93 @@ private static bool callBoolMethod(string methodName, params object[] args) { return false; } +#elif UNITY_IPHONE && !UNITY_EDITOR + [DllImport("__Internal")] + private static extern void TestFairy_begin(string APIKey); - public static void begin(string APIKey) - { - AndroidJavaObject activityContext = null; - using (AndroidJavaClass activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { - activityContext = activityClass.GetStatic("currentActivity"); - } - - TestFairy.installUnityCrashHandler(); - TestFairy.callMethod("begin", activityContext, APIKey); - } - - public static void setServerEndpoint(string endpoint) - { - TestFairy.callMethod("setServerEndpoint", endpoint); - } - - public static void setScreenName(string name) { - TestFairy.callMethod("setScreenName", name); - } - - public static void disableVideo() { - TestFairy.callMethod("disableVideo"); - } + [DllImport("__Internal")] + private static extern void TestFairy_pushFeedbackController(); - public static void enableVideo(string policy, string quality, float framesPerSecond) { - TestFairy.callMethod("enableVideo", policy, quality, framesPerSecond); - } + [DllImport("__Internal")] + private static extern void TestFairy_showFeedbackForm(string appToken, bool takeScreenshot); - public static void disableCrashHandler() { - TestFairy.callMethod("disableCrashHandler"); - } + [DllImport("__Internal")] + private static extern void TestFairy_checkpoint(string name); - public static void enableMetric(string metric) { - TestFairy.callMethod("enableMetric", metric); - } + [DllImport("__Internal")] + private static extern void TestFairy_setServerEndpoint(string endpoint); - public static void disableMetric(string metric) { - TestFairy.callMethod("disableMetric", metric); - } + [DllImport("__Internal")] + private static extern void TestFairy_setCorrelationId(string correlationId); - public static void enableFeedbackForm(string method) { - TestFairy.callMethod("enableFeedbackForm"); - } + [DllImport("__Internal")] + private static extern void TestFairy_identify(string correlationId, string traits); - public static void disableFeedbackForm() { - TestFairy.callMethod("disableFeedbackForm"); - } + [DllImport("__Internal")] + private static extern void TestFairy_pause(); - public static void disableAutoUpdate() { - TestFairy.callMethod("disableAutoUpdate"); - } + [DllImport("__Internal")] + private static extern void TestFairy_resume(); - public static void setUserId(string userId) { - TestFairy.callMethod("setUserId", userId); - } + [DllImport("__Internal")] + private static extern void TestFairy_stop(); - public static bool setAttribute(string aKey, string aValue) { - return TestFairy.callBoolMethod("setAttribute", aKey, aValue); - } + [DllImport("__Internal")] + private static extern string TestFairy_sessionUrl(); - public static void enableCrashHandler() { - TestFairy.callMethod("enableCrashHandler"); - } + [DllImport("__Internal")] + private static extern string TestFairy_version(); + [DllImport("__Internal")] + private static extern void TestFairy_sendUserFeedback(string feedback); -#endif + [DllImport("__Internal")] + private static extern void TestFairy_takeScreenshot(); -#if UNITY_EDITOR || (!UNITY_ANDROID && !UNITY_IPHONE) + [DllImport("__Internal")] + private static extern void TestFairy_setScreenName(string name); - public static void begin(string APIKey) { - } + [DllImport("__Internal")] + private static extern void TestFairy_log(string name); - public static void setServerEndpoint(string endpoint) { - } + [DllImport("__Internal")] + private static extern void TestFairy_logException(string name, string trace); - public static void setScreenName(string name) { - } + [DllImport("__Internal")] + private static extern void TestFairy_hideWebViewElements(string cssSelector); - public static void disableVideo() { - } + [DllImport("__Internal")] + private static extern void TestFairy_setUserId(string userId); - public static void enableVideo(string policy, string quality, float framesPerSecond) { - } + [DllImport("__Internal")] + private static extern bool TestFairy_setAttribute(string aKey, string aValue); - public static void enableCrashHandler() { - } + [DllImport("__Internal")] + private static extern void TestFairy_enableCrashHandler(); - public static void disableCrashHandler() { - } + [DllImport("__Internal")] + private static extern void TestFairy_disableCrashHandler(); - public static void enableMetric(string metric) { - } + [DllImport("__Internal")] + private static extern void TestFairy_enableFeedbackForm(string method); - public static void disableMetric(string metric) { - } + [DllImport("__Internal")] + private static extern void TestFairy_disableFeedbackForm(); - public static void enableFeedbackForm(string method) { - } + [DllImport("__Internal")] + private static extern void TestFairy_enableMetric(string metric); - public static void disableFeedbackForm() { - } + [DllImport("__Internal")] + private static extern void TestFairy_disableMetric(string metric); - public static void disableAutoUpdate() { - } + [DllImport("__Internal")] + private static extern void TestFairy_disableAutoUpdate(); - public static void setUserId(string userId) { - } + [DllImport("__Internal")] + private static extern void TestFairy_disableVideo(); - public static bool setAttribute(string aKey, string aValue) { - return false; - } + [DllImport("__Internal")] + private static extern void TestFairy_enableVideo(string policy, string quality, float framesPerSecond); #endif - private static void installUnityCrashHandler() { - Application.logMessageReceivedThreaded += TestFairy.logMsgRecvThreaded; - } - - private static void logMsgRecvThreaded(string _condition, string _stackTrace, LogType _type) { - if (_type==LogType.Exception) { - TestFairy.logException(_condition, _stackTrace); - } - } } }