made: settings.fetchGifts default to true

This commit is contained in:
JW
2024-02-28 15:11:03 +01:00
parent 8581df7f49
commit faa1185b97
7 changed files with 70 additions and 40 deletions

View File

@@ -25,6 +25,7 @@ package io.github.jwdeveloper.tiktok.data.events.gift;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.Picture;
import io.github.jwdeveloper.tiktok.data.models.gifts.*;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
@@ -55,4 +56,20 @@ public class TikTokGiftEvent extends TikTokHeaderEvent {
}
combo = msg.getComboCount();
}
public TikTokGiftEvent(Gift gift) {
this.gift = gift;
user = new User(0L, "sender", new Picture(""));
toUser = new User(0L, "receiver", new Picture(""));
combo = 1;
}
public static TikTokGiftEvent of(Gift gift) {
return new TikTokGiftEvent(gift);
}
public static TikTokGiftEvent of(String name, int id, int diamonds) {
return null;
}
}

View File

@@ -38,7 +38,7 @@ public class LiveClientSettings {
* Determines if gifts data is downloaded before TikTokLive starts,
* when `false` then client.giftManager() does not contain initial gifts
*/
private boolean fetchGifts;
private boolean fetchGifts = true;
/**
* ISO-Language for Client

View File

@@ -78,6 +78,12 @@
<version>1.3.0-Release</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.jwdeveloper.worker</groupId>
<artifactId>extension-tester</artifactId>
<version>1.3.0-Release</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>

View File

@@ -0,0 +1,45 @@
package io.github.jwdeveloper.tiktok;
import io.github.jwdeveloper.tiktok.data.events.gift.TikTokGiftEvent;
import io.github.jwdeveloper.tiktok.live.LiveClient;
public class GiftTestingExample {
public static void main(String[] args) throws Exception {
LiveClient client = TikTokLive.newClient(SimpleExample.TIKTOK_HOSTNAME)
.configure(liveClientSettings ->
{
// liveClientSettings.setOffline(true);
})
.onConnected((liveClient, event) ->
{
liveClient.getLogger().info("Connected");
})
.onGiftCombo((liveClient, event) ->
{
})
.onGift((liveClient, event) ->
{
liveClient.getLogger().info("New fakeGift: " + event.getGift());
})
.buildAndConnect();
var gifts = TikTokLive.gifts();
var fakeGift = TikTokGiftEvent.of(gifts.getByName("Rose"));
var fakeGift2 = TikTokGiftEvent.of("Rose", 1, 23);
client.publishEvent(fakeGift);
client.publishEvent(fakeGift2);
}
public void GetTesterBuilder() {
}
public void GetBuilder() {
}
}

View File

@@ -1,4 +1,4 @@
package io.github.jwdeveloper.tiktok;
public class testerExample {
public class TestingGiftsExample {
}

View File

@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<artifactId>TikTokLiveJava</artifactId>
<version>1.3.0-Release</version>
</parent>
<groupId>io.github.jwdeveloper.worker</groupId>
<artifactId>extension-tester</artifactId>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<artifactId>Client</artifactId>
<version>1.3.0-Release</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -1,9 +0,0 @@
package io.github.jwdeveloper.tiktok.extension.tester;
import io.github.jwdeveloper.tiktok.live.LiveClient;
public class TikTokLiveTester {
public static LiveClient createFakeClient() {
throw new RuntimeException("Not implemented");
}
}