# 1.0.0 Update
Official version of Tiktok live Java. Code has been restructure, improve and renamed to make
using simpler and more intuitive, since that library is no longer compatable with longer versions.
# Breaking changes:
## Configuration
- `clientSettings.setHandleExistingMessagesOnConnect(true)` Renamed to `setHandleExistingEvents()`
- `clientSettings.setDownloadGiftInfo(true);` Removed
- `clientSettings.setPrintMessageData(false);` Removed
## Events
### Added
- `onGiftCombo`
onGiftComboevent is invoked for all give events, it contains 3 combo stages
I would suggest to use it for somekind of visualizations
* `GiftSendType.Begin`
* `GiftSendType.Active`
* `GiftSendType.Finished`
- `onWebsocketResponse`
- `onRoomUserInfo`
- `onRoom`
- `onQuestion`
### Changed
- `onComment`
- `onGiftMessage -> onGift`
OnGift event is now invoked only when combo has been finished of gift is not strakeable (exprensive)
- `onRoomMessage -> onRoom`
### Removed
I wasn't sure if those events are working, so I decided to remove them for now
but they will be gradually added again with next updates
- `onLinkMicFanTicket`
- `onEnvelope`
- `onShop`
- `onDetect`
- `onLinkLayer`
- `onCaption`
- `onRoomPin`
- `onBarrage`
- `onLinkMicArmies`
- `onUnauthorizedMember`
- `onInRoomBanner`
- `onLinkMicMethod`
- `onPoll`
- `onGoalUpdate`
- `onRankUpdate`
- `onIMDelete`
- `onRankText`
- `onUnhandledMember`
- `onSubNotify`
- `onLinkMicBattle`
- `onUnhandledControl`
## Gifts
`Gitf` has been changed from `class` to `enum` that allows to simple use by checking avaliable values
and using `switch expression`
### Example
```java
Gift gift = Gift.GIFT_BOX;
switch (gift) {
case ROSE -> print(ConsoleColors.RED, "Rose!");
case GG -> print(ConsoleColors.YELLOW, " GOOD GAME!");
case TIKTOK -> print(ConsoleColors.CYAN,"Thanks for TikTok");
default -> print(ConsoleColors.GREEN, "[Thanks for gift] ", ConsoleColors.YELLOW, event.getGift().getName(), "x", event.getCombo());
}
```
## GiftManager
### New Methods
```java
Gift registerGift(int id, String name, int diamondCost, Picture picture);
Gift findById(int giftId);
Gift findByName(String giftName);
List<Gift> getGifts();
```
## LiveClient
### New Methods
```java
void connectAsync(Consumer<LiveClient> onConnection);
CompletableFuture<LiveClient> connectAsync();
Logger getLogger();
```
## LiveRoomInfo
### New Methods
```java
int getViewersCount();
int getLikesCount();
boolean isAgeRestricted();
```
- addListeners() was throwing exception
- 404 response code was return while connecting to tiktok for some users
- configure.setRoomId() method for people that want to set roomId manually
- client.roomInfo().isAgeRestricted() check if live has age restriction
LiveRoomInfo
+ new method getConnectionState() getting current state of connection
+ ListenersManager
getBindingModels() renamed to getListeners()
+ Introducing documentation, each public interface got small documentation
+ New property in config .setSessionId()
+ New event: onReconnecting()
Bugs:
CommentEvent was throwing mapping exception
`TikTokEventListener` new method of listening events
see it at TestApplication/ListenerExample.java
Bugs:
- Fixed bug: Websocket was sending ping after it was closed
`onWebsocketMessage()` TikTokWebsocketMessageEvent new event that is
triggered when new ProtocolBuffer message come from TikTok server.
Should be mainly use for debuging purpose
Bugs:
- Fixed bug: WebcastSocialMessage was always triggering `TikTokShareEvent` events such as `TikTokLikeEvent`, `TikTokFollowEvent`, `TikTokShareEvent`, `TikTokJoinEvent` was ignored
- Fixed bug: Websocket was disconnecting when there was no incoming events for the while. Fixed by implementing background loop that pinging TikTok server every few ms.
- Fixed bug: Disconnect method was not working