Browse Source

Defer DI injection: move injectServices call from init to handleExpireDateChange.

Jonas Björkert 1 năm trước cách đây
mục cha
commit
9e7c7c24f6
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      Trio/Sources/Helpers/BuildDetails.swift

+ 4 - 1
Trio/Sources/Helpers/BuildDetails.swift

@@ -17,7 +17,6 @@ class BuildDetails: Injectable {
             return
         }
         dict = parsed
-        injectServices(TrioApp.resolver)
     }
 
     var buildDateString: String? {
@@ -97,6 +96,10 @@ class BuildDetails: Injectable {
     // Upload new profile if expire date has changed
     func handleExpireDateChange() async throws
     {
+        if nightscoutManager == nil {
+            await injectServices(TrioApp.resolver)
+        }
+
         let previousExpireDate = UserDefaults.standard.object(forKey: previousExpireDateKey) as? Date
         let expireDate = calculateExpirationDate()