Пример #1
0
  private void processUpdate(long authId, byte[] content) {
    if (authId != currentAuthId) {
      return;
    }

    ProtoStruct protoStruct;
    try {
      protoStruct = ProtoSerializer.readUpdate(content);
    } catch (IOException e) {
      e.printStackTrace();
      Log.w(TAG, "Broken mt update");
      return;
    }

    int type = ((Push) protoStruct).updateType;
    byte[] body = ((Push) protoStruct).body;

    RpcScope updateBox;
    try {
      updateBox = new RpcParser().read(type, body);
    } catch (IOException e) {
      e.printStackTrace();
      Log.w(TAG, "Broken update box");
      return;
    }

    // Log.w(TAG, "Box: " + updateBox + "");

    callback.onUpdateReceived(updateBox);
  }
Пример #2
0
  private void onNewSessionCreated(long authId) {
    if (authId != currentAuthId) {
      return;
    }

    Log.w(TAG, "New Session Created");

    callback.onNewSessionCreated();
  }
Пример #3
0
  private void onAuthIdInvalidated(long authId) {
    if (authId != currentAuthId) {
      return;
    }

    Log.w(TAG, "Auth id invalidated");

    keyStorage.saveAuthKey(0);
    currentAuthId = 0;
    proto = null;

    callback.onAuthIdInvalidated();

    self().send(new RequestAuthId());
  }
Пример #4
0
 void connectionCountChanged(int count) {
   callback.onConnectionsChanged(count);
 }