Skip to content

Commit 02707a1

Browse files
committed
Refactor async method usage and update initialization
Replaces 'async void' methods with non-async methods that call async methods using '.Forget()' to improve error handling and code clarity.
1 parent b6a0eb5 commit 02707a1

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

templates/unity/Assets/Runtime/AppwriteManager.cs.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ namespace {{ spec.title | caseUcfirst }}
7070
}
7171
}
7272

73-
private async void Start()
73+
private void Start()
7474
{
7575
if (initializeOnStart)
7676
{
77-
await Initialize();
77+
Initialize().Forget();
7878
}
7979
}
8080

templates/unity/Assets/Runtime/Realtime.cs.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,9 @@ namespace {{ spec.title | caseUcfirst }}
460460
await CloseConnection();
461461
}
462462

463-
private async void OnDestroy()
463+
private void OnDestroy()
464464
{
465-
await Disconnect();
465+
Disconnect().Forget();
466466
}
467467
}
468468
}

templates/unity/Assets/Runtime/Utilities/AppwriteUtilities.cs.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace {{ spec.title | caseUcfirst }}.Utilities
2626
manager.SetConfig(config);
2727

2828
// Initialize
29-
var success = await manager.Initialize();
29+
var success = await manager.Initialize(true);
3030
if (!success)
3131
{
3232
UnityEngine.Object.Destroy(managerGO);

templates/unity/Assets/Samples~/AppwriteExample/AppwriteExample.cs.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace Samples.{{ spec.title | caseUcfirst }}Example
4141
}
4242

4343
// Initialize
44-
var success = await _manager.Initialize();
44+
var success = await _manager.Initialize(true);
4545
if (!success)
4646
{
4747
Debug.LogError("Failed to initialize {{ spec.title | caseUcfirst }}Manager");

templates/unity/base/requests/oauth.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
// Create a Set-Cookie header format and parse it
2424
// This ensures consistent cookie processing with server responses
2525
var setCookieHeader = $"{key}={secret}; Path=/; Domain={parsedDomain}; Secure; HttpOnly; Max-Age={30 * 24 * 60 * 60}";
26-
Debug.Log($"Setting cookie: {setCookieHeader} for domain: {parsedDomain}");
26+
Debug.Log($"Setting session cookie for domain: {parsedDomain}");
2727
_client.CookieContainer.ParseSetCookieHeader(setCookieHeader, parsedDomain);
2828

2929
#if UNITY_EDITOR

0 commit comments

Comments
 (0)