VKCOM / vkid-android-sdk

MIT License
28 stars 3 forks source link

[DOC]: Помарка в комментарии с объяснением в IPCClientBaseProvider #16

Closed radkoff26 closed 5 months ago

radkoff26 commented 7 months ago

Описание

В IPCClientBaseProvider.prepareSpecificApp() объясняется маловероятный кейс, когда onServiceDisconnected() вызывается без onServiceConnected(). Однако там есть небольшая помарка, которая путает при попытке понять объяснение:

} else if (connectionInfo.connectionState == ConnectionInfo.CONNECTION_STATE_DISCONNECTED) {
  // Refresh latch because we've tried to connect to service, but onServiceDisconnected()
  // was called and we did reset provider, so we need wait for onServiceConnected() again.
  //
  // IMPORTANT!
  // I'm not sure if onServiceDisconnected() can be called without onServiceConnected(). Because
  // if it does, there is possibility of this situation:
  // We have called bind() during prepare() on some thread (T1), then we called prepareSpecificApp() in
  // getSpecificAppSilentAuthInfos() so we called latch.await() on this thread (T2). Then onServiceConnected()
  // is called on T1. We have to call bind again() without blocking the T2 (or have to wait until
  // system recreates service, but c'mon...).
  //
  // But I hope this situation will never become.
  connectionInfo.latch.countDown()
  connectionInfo.latch = latch
}

Ошибка в следующей фразе: Then onServiceConnected() is called on T1.

Так как речь идёт о вызове onServiceDisconnected() без onServiceСonnected(), то правильно будет сказать Then onServiceDisconnected() is called on T1 - то есть после bind() вызовется не onServiceConnected(), а сразу onServiceDisconnected().

diklimchuk commented 7 months ago

Спасибо, что указали на ошибку, поправим

diklimchuk commented 5 months ago

Зарелизили изменения в документации