Fix spelling of "update handler".

GitOrigin-RevId: 2137852d967606e909e82396b4103817b1b39386
This commit is contained in:
levlam 2020-10-05 20:13:15 +03:00
parent c72d18bcd3
commit 5f605d2dd2
4 changed files with 28 additions and 28 deletions

View File

@ -33,7 +33,7 @@ namespace TdExample
private static Td.Client CreateTdClient() private static Td.Client CreateTdClient()
{ {
Td.Client result = Td.Client.Create(new UpdatesHandler()); Td.Client result = Td.Client.Create(new UpdateHandler());
new Thread(() => new Thread(() =>
{ {
Thread.CurrentThread.IsBackground = true; Thread.CurrentThread.IsBackground = true;
@ -250,7 +250,7 @@ namespace TdExample
} }
} }
private class UpdatesHandler : Td.ClientResultHandler private class UpdateHandler : Td.ClientResultHandler
{ {
void Td.ClientResultHandler.OnResult(TdApi.BaseObject @object) void Td.ClientResultHandler.OnResult(TdApi.BaseObject @object)
{ {

View File

@ -106,27 +106,27 @@ public final class Client implements Runnable {
/** /**
* Replaces handler for incoming updates from the TDLib. * Replaces handler for incoming updates from the TDLib.
* *
* @param updatesHandler Handler with onResult method which will be called for every incoming * @param updateHandler Handler with onResult method which will be called for every incoming
* update from the TDLib. * update from the TDLib.
* @param exceptionHandler Exception handler with onException method which will be called on * @param exceptionHandler Exception handler with onException method which will be called on
* exception thrown from updatesHandler, if it is null, defaultExceptionHandler will be invoked. * exception thrown from updateHandler, if it is null, defaultExceptionHandler will be invoked.
*/ */
public void setUpdatesHandler(ResultHandler updatesHandler, ExceptionHandler exceptionHandler) { public void setUpdateHandler(ResultHandler updateHandler, ExceptionHandler exceptionHandler) {
updateHandlers.put(nativeClientId, new Handler(updatesHandler, exceptionHandler)); updateHandlers.put(nativeClientId, new Handler(updateHandler, exceptionHandler));
} }
/** /**
* Replaces handler for incoming updates from the TDLib. Sets empty ExceptionHandler. * Replaces handler for incoming updates from the TDLib. Sets empty ExceptionHandler.
* *
* @param updatesHandler Handler with onResult method which will be called for every incoming * @param updateHandler Handler with onResult method which will be called for every incoming
* update from the TDLib. * update from the TDLib.
*/ */
public void setUpdatesHandler(ResultHandler updatesHandler) { public void setUpdateHandler(ResultHandler updateHandler) {
setUpdatesHandler(updatesHandler, null); setUpdateHandler(updateHandler, null);
} }
/** /**
* Replaces default exception handler to be invoked on exceptions thrown from updatesHandler and all other ResultHandler. * Replaces default exception handler to be invoked on exceptions thrown from updateHandler and all other ResultHandler.
* *
* @param defaultExceptionHandler Default exception handler. If null Exceptions are ignored. * @param defaultExceptionHandler Default exception handler. If null Exceptions are ignored.
*/ */
@ -147,13 +147,13 @@ public final class Client implements Runnable {
/** /**
* Creates new Client. * Creates new Client.
* *
* @param updatesHandler Handler for incoming updates. * @param updateHandler Handler for incoming updates.
* @param updatesExceptionHandler Handler for exceptions thrown from updatesHandler. If it is null, exceptions will be iggnored. * @param updateExceptionHandler Handler for exceptions thrown from updateHandler. If it is null, exceptions will be iggnored.
* @param defaultExceptionHandler Default handler for exceptions thrown from all ResultHandler. If it is null, exceptions will be iggnored. * @param defaultExceptionHandler Default handler for exceptions thrown from all ResultHandler. If it is null, exceptions will be iggnored.
* @return created Client * @return created Client
*/ */
public static Client create(ResultHandler updatesHandler, ExceptionHandler updatesExceptionHandler, ExceptionHandler defaultExceptionHandler) { public static Client create(ResultHandler updateHandler, ExceptionHandler updateExceptionHandler, ExceptionHandler defaultExceptionHandler) {
Client client = new Client(updatesHandler, updatesExceptionHandler, defaultExceptionHandler); Client client = new Client(updateHandler, updateExceptionHandler, defaultExceptionHandler);
new Thread(client, "TDLib thread").start(); new Thread(client, "TDLib thread").start();
return client; return client;
} }
@ -213,9 +213,9 @@ public final class Client implements Runnable {
} }
} }
private Client(ResultHandler updatesHandler, ExceptionHandler updateExceptionHandler, ExceptionHandler defaultExceptionHandler) { private Client(ResultHandler updateHandler, ExceptionHandler updateExceptionHandler, ExceptionHandler defaultExceptionHandler) {
nativeClientId = createNativeClient(); nativeClientId = createNativeClient();
updateHandlers.put(nativeClientId, new Handler(updatesHandler, updateExceptionHandler)); updateHandlers.put(nativeClientId, new Handler(updateHandler, updateExceptionHandler));
this.defaultExceptionHandler = defaultExceptionHandler; this.defaultExceptionHandler = defaultExceptionHandler;
} }

View File

@ -161,7 +161,7 @@ public final class Example {
case TdApi.AuthorizationStateClosed.CONSTRUCTOR: case TdApi.AuthorizationStateClosed.CONSTRUCTOR:
print("Closed"); print("Closed");
if (!quiting) { if (!quiting) {
client = Client.create(new UpdatesHandler(), null, null); // recreate client after previous has closed client = Client.create(new UpdateHandler(), null, null); // recreate client after previous has closed
} }
break; break;
default: default:
@ -310,7 +310,7 @@ public final class Example {
} }
// create client // create client
client = Client.create(new UpdatesHandler(), null, null); client = Client.create(new UpdateHandler(), null, null);
// test Client.execute // test Client.execute
defaultHandler.onResult(Client.execute(new TdApi.GetTextEntities("@telegram /test_command https://telegram.org telegram.me @gif @test"))); defaultHandler.onResult(Client.execute(new TdApi.GetTextEntities("@telegram /test_command https://telegram.org telegram.me @gif @test")));
@ -367,7 +367,7 @@ public final class Example {
} }
} }
private static class UpdatesHandler implements Client.ResultHandler { private static class UpdateHandler implements Client.ResultHandler {
@Override @Override
public void onResult(TdApi.Object object) { public void onResult(TdApi.Object object) {
switch (object.getConstructor()) { switch (object.getConstructor()) {

View File

@ -79,9 +79,9 @@ public:
/// <summary> /// <summary>
/// Replaces handler for incoming updates from the TDLib. /// Replaces handler for incoming updates from the TDLib.
/// </summary> /// </summary>
/// <param name="updatesHandler">Handler with OnResult method which will be called for every incoming update from the TDLib.</param> /// <param name="updateHandler">Handler with OnResult method which will be called for every incoming update from the TDLib.</param>
void SetUpdatesHandler(ClientResultHandler^ updatesHandler) { void SetUpdateHandler(ClientResultHandler^ updateHandler) {
handlers[0] = updatesHandler; handlers[0] = updateHandler;
} }
/// <summary> /// <summary>
@ -107,16 +107,16 @@ public:
/// <summary> /// <summary>
/// Creates new Client. /// Creates new Client.
/// </summary> /// </summary>
/// <param name="updatesHandler">Handler for incoming updates.</param> /// <param name="updateHandler">Handler for incoming updates.</param>
/// <returns>Returns created Client.</returns> /// <returns>Returns created Client.</returns>
static Client^ Create(ClientResultHandler^ updatesHandler) { static Client^ Create(ClientResultHandler^ updateHandler) {
return REF_NEW Client(updatesHandler); return REF_NEW Client(updateHandler);
} }
private: private:
Client(ClientResultHandler^ updatesHandler) { Client(ClientResultHandler^ updateHandler) {
client = new td::Client(); client = new td::Client();
handlers[0] = updatesHandler; handlers[0] = updateHandler;
} }
~Client() { ~Client() {