Merge branch 'krille/bootstrap-logs' into 'main'
refactor: Add verbose logs and refactor something See merge request famedly/famedlysdk!601
This commit is contained in:
		
						commit
						7fe183d527
					
				|  | @ -456,21 +456,29 @@ class Bootstrap { | ||||||
|       // aaaand set the SSSS secrets |       // aaaand set the SSSS secrets | ||||||
|       final futures = <Future<void>>[]; |       final futures = <Future<void>>[]; | ||||||
|       if (masterKey != null) { |       if (masterKey != null) { | ||||||
|         futures.add(client.onSync.stream.firstWhere((syncUpdate) => |         futures.add( | ||||||
|  |           client.onSync.stream | ||||||
|  |               .firstWhere((syncUpdate) => | ||||||
|                   client.userDeviceKeys.containsKey(client.userID) && |                   client.userDeviceKeys.containsKey(client.userID) && | ||||||
|                   client.userDeviceKeys[client.userID].masterKey != null && |                   client.userDeviceKeys[client.userID].masterKey != null && | ||||||
|                   client.userDeviceKeys[client.userID].masterKey.ed25519Key == |                   client.userDeviceKeys[client.userID].masterKey.ed25519Key == | ||||||
|                 masterKey.publicKey)); |                       masterKey.publicKey) | ||||||
|  |               .then((_) => Logs().v('New Master Key was created')), | ||||||
|  |         ); | ||||||
|       } |       } | ||||||
|       for (final entry in secretsToStore.entries) { |       for (final entry in secretsToStore.entries) { | ||||||
|         futures.add(client.onSync.stream.firstWhere((syncUpdate) => syncUpdate |         futures.add( | ||||||
|             .accountData |           client.onSync.stream | ||||||
|             .any((accountData) => accountData.type == entry.key))); |               .firstWhere((syncUpdate) => syncUpdate.accountData | ||||||
|  |                   .any((accountData) => accountData.type == entry.key)) | ||||||
|  |               .then((_) => | ||||||
|  |                   Logs().v('New Key with type ${entry.key} was created')), | ||||||
|  |         ); | ||||||
|         await newSsssKey.store(entry.key, entry.value); |         await newSsssKey.store(entry.key, entry.value); | ||||||
|       } |       } | ||||||
|       for (final f in futures) { |       Logs().v( | ||||||
|         await f; |           'Wait for MasterKey and ${secretsToStore.entries.length} keys to be created'); | ||||||
|       } |       await Future.wait<void>(futures); | ||||||
|       final keysToSign = <SignableKey>[]; |       final keysToSign = <SignableKey>[]; | ||||||
|       if (masterKey != null) { |       if (masterKey != null) { | ||||||
|         if (client.userDeviceKeys[client.userID].masterKey.ed25519Key != |         if (client.userDeviceKeys[client.userID].masterKey.ed25519Key != | ||||||
|  | @ -558,6 +566,7 @@ class Bootstrap { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   set state(BootstrapState newState) { |   set state(BootstrapState newState) { | ||||||
|  |     Logs().v('BootstrapState', newState); | ||||||
|     if (state != BootstrapState.error) { |     if (state != BootstrapState.error) { | ||||||
|       _state = newState; |       _state = newState; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue