Skip to content

Commit fc03b46

Browse files
committed
Demo project: Display url in the logs
1 parent dcbc5fa commit fc03b46

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Runtime/Scripts/BugReportUI.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public enum MediaUploadType
2727

2828
public class BugReportUI : MonoBehaviour
2929
{
30+
public const string DEMO_PROJECT_ID = "pr-5287510306";
31+
3032
private static BugReportUI _instance;
3133

3234
[FormerlySerializedAs("bugReportPanel")]

Runtime/Scripts/Issue.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class Issue
1313
// set if the issue is persistent on BetaHub
1414
public string Id { get; private set; }
1515

16+
public string Url { get; private set; }
17+
1618
// returns true if the media upload is complete
1719
public bool IsMediaUploadComplete { get { return _mediaUploadComplete; } }
1820

@@ -120,6 +122,7 @@ public IEnumerator PostIssue(string description, string steps = null,
120122
_isPublished = false;
121123

122124
string issueIdLocal = null; // Use local variables for draft result callback
125+
string issueUrlLocal = null;
123126
string updateIssueAuthTokenLocal = null;
124127
string error = null;
125128

@@ -128,6 +131,7 @@ public IEnumerator PostIssue(string description, string steps = null,
128131
issueIdLocal = draftResult.IssueId;
129132
updateIssueAuthTokenLocal = draftResult.UpdateIssueAuthToken;
130133
error = draftResult.Error;
134+
issueUrlLocal = draftResult.Url;
131135
});
132136

133137
if (error != null)
@@ -139,6 +143,7 @@ public IEnumerator PostIssue(string description, string steps = null,
139143

140144
// Draft created successfully, store ID and token in member variables
141145
this.Id = issueIdLocal;
146+
this.Url = issueUrlLocal;
142147
this._updateIssueAuthToken = updateIssueAuthTokenLocal;
143148

144149
if (mediaUploadType == MediaUploadType.UploadInBackground)
@@ -271,13 +276,13 @@ private IEnumerator PostIssueDraft(string description, string steps, Action<Draf
271276
}
272277

273278
Debug.LogError("Response code: " + www.responseCode);
274-
onResult?.Invoke(new DraftResult { IssueId = null, UpdateIssueAuthToken = null, Error = errorMessage });
279+
onResult?.Invoke(new DraftResult { IssueId = null, UpdateIssueAuthToken = null, Url = null, Error = errorMessage });
275280
yield break;
276281
}
277282

278283
string response = www.downloadHandler.text;
279284
IssueResponse issueResponse = JsonUtility.FromJson<IssueResponse>(response);
280-
onResult?.Invoke(new DraftResult { IssueId = issueResponse.id, UpdateIssueAuthToken = issueResponse.token, Error = null });
285+
onResult?.Invoke(new DraftResult { IssueId = issueResponse.id, UpdateIssueAuthToken = issueResponse.token, Url = issueResponse.url, Error = null });
281286
}
282287
}
283288

@@ -426,6 +431,11 @@ private IEnumerator PublishNow()
426431
else
427432
{
428433
Debug.Log("Issue published successfully!");
434+
435+
if (_projectId == BugReportUI.DEMO_PROJECT_ID)
436+
{
437+
Debug.Log("Demo project published issue: " + Url);
438+
}
429439
}
430440
}
431441
}
@@ -441,12 +451,14 @@ private class IssueResponse
441451
{
442452
public string id;
443453
public string token;
454+
public string url;
444455
}
445456

446457
private struct DraftResult {
447458
public string IssueId;
448459
public string UpdateIssueAuthToken;
449460
public string Error;
461+
public string Url;
450462
}
451463
}
452464
}

0 commit comments

Comments
 (0)