private static extern void _zendeskRMAShowInViewWithConfiguration(string[] additionalTags, int additionalTagsLength, string additionalRequestInfo, ZDKRMAAction[] dialogActions, int dialogActionsLength, string successImageName, string errorImageName);
/// <summary> /// Raises the GUI event. /// /// Adds a number of buttons used to test the SDK. /// /// </summary> void OnGUI() { // 240 is a magical number, derived from a scale factor of 2 looking well on a 480*800 device and 4.5 on a 1080*1920 device float scaleFactor = Screen.width / 240f; float screenWidth = Screen.width / scaleFactor; float screenHeight = Screen.height / scaleFactor; float spacerSize = 10f; GUI.matrix = Matrix4x4.Scale(new Vector3(scaleFactor, scaleFactor, scaleFactor)); float buttonAreaOriginX = 0f; float buttonAreaOriginY = textureSize + 10f; float buttonAreaWidth = screenWidth; float buttonAreaHeight = screenHeight; GUI.skin.button.margin = new RectOffset(10, 10, 10, 10); GUI.DrawTexture(new Rect(10.0f, 10.0f, (float)textureSize, (float)textureSize), avatarTexture, ScaleMode.ScaleToFit, true); GUILayout.Space((float)textureSize + spacerSize); GUILayout.BeginVertical(); GUILayout.BeginArea(new Rect(buttonAreaOriginX, buttonAreaOriginY, buttonAreaWidth, buttonAreaHeight - textureSize)); scrollPosition = GUILayout.BeginScrollView(scrollPosition); GUILayoutOption buttonWidth = GUILayout.Width(screenWidth - (spacerSize * 2)); if (GUILayout.Button("Initialize SDK", buttonWidth)) { ZendeskSDK.ZDKConfig.Initialize(gameObject, "https://{subdomain}.zendesk.com", "{applicationId}", "{oauthClientId}"); ZendeskSDK.ZDKConfig.AuthenticateAnonymousIdentity(); // Uncomment this line if you want to override the langauge that Help Center content is requested in // ZendeskSDK.ZDKConfig.SetUserLocale ("en-US"); // If you use JWT identities, then comment out the AuthenticateAnonymousIdentity line above, and uncomment this line. //ZendeskSDK.ZDKConfig.AuthenticateJwtUserIdentity ("MyTestID"); } if (GUILayout.Button("Set Custom Fields", buttonWidth)) { Hashtable customFields = new Hashtable(); string customFieldId = "customFieldId"; customFields[customFieldId] = "customFieldValue"; ZendeskSDK.ZDKConfig.SetCustomFields(customFields); } if (GUILayout.Button(pushEnabled ? "Disable Push" : "Enable Push", buttonWidth)) { if (!pushEnabled) { ZendeskSDK.ZDKPush.EnableWithIdentifier("{deviceOrChannelId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKPush.Enable - " + error.Description); } else { pushEnabled = true; Debug.Log("ZDKPush.Enable Successful Callback - " + MakeResultString(result)); } }); } else { ZendeskSDK.ZDKPush.Disable("{deviceOrChannelId}", (result, error) => { if (error != null) { Debug.Log("ERROR: ZDKPush.Disable - " + error.Description); } else { pushEnabled = false; Debug.Log("ZDKPush.Disable Successful Callback - " + MakeResultString(result)); } }); } } if (GUILayout.Button("Show Help Center", buttonWidth)) { // Shows all Help Center content ZendeskSDK.ZDKHelpCenter.ShowHelpCenter(); } if (GUILayout.Button("Show Help Center With Options", buttonWidth)) { // Shows Help Center content with additional options ZendeskSDK.ZDKHelpCenter.HelpCenterOptions options = new ZendeskSDK.ZDKHelpCenter.HelpCenterOptions(); // Optional: Specify any category IDs that you wish to restrict your content to // options.IncludeCategoryIds = new [] { 203260428L, 203260368L }; // Optional: Specify any section IDs that you wish to restrict your content to // options.IncludeSectionIds = new [] { 205095568L, 205095528L }; // Optional: Specify any label names that you wish to use to filter the content. // options.IncludeLabelNames = new [] { "vip", "another_label" }; // Optional: Specify contact configuration // ZDKHelpCenter.ContactConfiguration config = new ZDKHelpCenter.ContactConfiguration (); // config.RequestSubject = "My printer is on fire!"; // config.Tags = new[] {"printer", "technical"}; // config.AdditionalInfo = " - Sent from Unity!"; // options.ContactConfiguration = config; // Optional: Show / hide the contact us button // options.ShowContactUsButton = false; ZendeskSDK.ZDKHelpCenter.ShowHelpCenter(options); } if (GUILayout.Button("Show Request Creation", buttonWidth)) { ZDKRequestCreationConfig config = new ZDKRequestCreationConfig(); config.RequestSubject = "My printer is still on fire"; config.Tags = new [] { "printer" }; config.AdditionalRequestInfo = " - Sent from Unity!"; ZendeskSDK.ZDKRequests.ShowRequestCreationWithConfig(config); } if (GUILayout.Button("Show Rate My App", buttonWidth)) { ZendeskSDK.ZDKRMA.ShowAlways(); } if (GUILayout.Button("Show Rate My App Config", buttonWidth)) { string[] additionalTags = new string[2]; additionalTags[0] = "Additional Config Tag 0"; additionalTags[1] = "Additional Config Tag 1"; ZDKRMAAction[] dialogActions = new ZDKRMAAction[3]; dialogActions[0] = ZDKRMAAction.ZDKRMARateApp; dialogActions[1] = ZDKRMAAction.ZDKRMASendFeedback; dialogActions[2] = ZDKRMAAction.ZDKRMADontAskAgain; ZDKRMAConfigObject config = new ZDKRMAConfigObject(); config.AdditionalTags = additionalTags; config.AdditionalRequestInfo = "AdditionalRequestInfo TEST"; config.DialogActions = dialogActions; config.SuccessImageName = null; config.ErrorImageName = null; ZendeskSDK.ZDKRMA.Show(config); } if (GUILayout.Button("Run Provider Tests", buttonWidth)) { RunProviderTests(); } if (GUILayout.Button("Run Appearance Tests", buttonWidth)) { RunAppearanceTests(); } GUI.EndScrollView(); GUILayout.EndArea(); GUILayout.EndVertical(); }
void OnGUI() { GUI.matrix = Matrix4x4.Scale (new Vector3 (5, 5, 5)); GUI.DrawTexture(new Rect(0.0f,0.0f,60.0f,60.0f), avatarTexture, ScaleMode.ScaleToFit, true); if (GUILayout.Button ("Initialize SDK")) { ZendeskSDK.ZDKConfig.Instance.InitializeWithAppId ("e5dd7520b178e21212f5cc2751a28f4b5a7dc76698dc79bd", "https://rememberthedate.zendesk.com", "client_for_rtd_jwt_endpoint"); //ZendeskSDK.ZDKConfig.Instance.AuthenticateAnonymousIdentity("","",""); ZendeskSDK.ZDKConfig.Instance.AuthenticateJwtUserIdentity ("MyTestID"); } if (GUILayout.Button ("Show Help Center")) { ZendeskSDK.ZDKHelpCenter.ShowHelpCenter (); //ZendeskSDK.ZDKHelpCenter.ShowHelpCenterFilterByArticleLabels(new string[]{"test", "test2"}); } if (GUILayout.Button ("Show Request Creation")) { ZendeskSDK.ZDKRequests.ShowRequestCreation (); } if (GUILayout.Button ("Show Request Creation Config")) { string[] tags = new string[2]; tags[0] = "Additional Config Tag 0"; tags[1] = "Additional Config Tag 1"; ZDKRequestCreationConfig config = new ZDKRequestCreationConfig(); config.Tags = tags; config.AdditionalRequestInfo= "AdditionalRequestInfo TEST"; ZendeskSDK.ZDKRequests.ShowRequestCreation (config); } if (GUILayout.Button ("Show Requests List")) { ZendeskSDK.ZDKRequests.ShowRequestList (); } if (GUILayout.Button ("Show Rate My App")) { ZendeskSDK.ZDKRMA.ShowAlways (); } if (GUILayout.Button ("Show Rate My App Config")) { string[] additionalTags = new string[2]; additionalTags[0] = "Additional Config Tag 0"; additionalTags[1] = "Additional Config Tag 1"; ZDKRMAAction[] dialogActions = new ZDKRMAAction[3]; dialogActions[0] = ZDKRMAAction.ZDKRMARateApp; dialogActions[1] = ZDKRMAAction.ZDKRMASendFeedback; dialogActions[2] = ZDKRMAAction.ZDKRMADontAskAgain; ZDKRMAConfigObject config = new ZDKRMAConfigObject(); config.AdditionalTags = additionalTags; config.AdditionalRequestInfo = "AdditionalRequestInfo TEST"; config.DialogActions = dialogActions; config.SuccessImageName = null; config.ErrorImageName = null; ZendeskSDK.ZDKRMA.Show (config); } if (GUILayout.Button ("Run Provider Tests")) { RunProviderTests (); } if (GUILayout.Button ("Run Appearance Tests")) { RunAppearanceTests (); } if (GUILayout.Button ("Run SDK Tests")) { ZendeskSDK.ZDKLogger.Enable(true); ZendeskSDK.ZDKDispatcher.SetDebugLoggingiOS(true); // ZDKDeviceInfo Tests Debug.Log (string.Format ("Device Type: {0}", ZendeskSDK.ZDKDeviceInfo.DeviceTypeiOS ())); Debug.Log (string.Format ("Total Device Memory: {0}", ZendeskSDK.ZDKDeviceInfo.TotalDeviceMemoryiOS ())); Debug.Log (string.Format ("Free Disk Space: {0}", ZendeskSDK.ZDKDeviceInfo.FreeDiskspaceiOS ())); Debug.Log (string.Format ("Total Disk Space: {0}", ZendeskSDK.ZDKDeviceInfo.TotalDiskspaceiOS ())); Debug.Log (string.Format ("Battery Level: {0}", ZendeskSDK.ZDKDeviceInfo.BatteryLeveliOS ())); Debug.Log (string.Format ("Region: {0}", ZendeskSDK.ZDKDeviceInfo.RegioniOS ())); Debug.Log (string.Format ("Language: {0}", ZendeskSDK.ZDKDeviceInfo.LanguageiOS ())); Debug.Log (string.Format ("Device Info String: {0}", ZendeskSDK.ZDKDeviceInfo.DeviceInfoString ())); Hashtable deviceInfoDict = ZendeskSDK.ZDKDeviceInfo.DeviceInfoDictionary (); Debug.Log (string.Format ("Device Info Dictionary:")); foreach (string key in deviceInfoDict.Keys) { Debug.Log (string.Format ("{0}: {1}", key, deviceInfoDict [key])); } // ZDKStringUtil Tests string[] strings = new string[2]; strings [0] = "one"; strings [1] = "second"; Debug.Log (string.Format ("CSVStringFromArray: {0}", ZendeskSDK.ZDKStringUtil.CsvStringFromArray (strings))); // ZDKLogger Tests ZendeskSDK.ZDKLogger.Enable (true); } }