mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-28 09:19:40 -05:00
Compare commits
10 Commits
0.0.16-Rel
...
0.0.19-Rel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff9e75505d | ||
|
|
08379994fd | ||
|
|
cc871c70f6 | ||
|
|
32294cc3ec | ||
|
|
cea19abda7 | ||
|
|
30117917de | ||
|
|
11da8bf009 | ||
|
|
97f57912ad | ||
|
|
e2ccfee399 | ||
|
|
edba573ecc |
2
.github/workflows/maven-publish.yml
vendored
2
.github/workflows/maven-publish.yml
vendored
@@ -76,6 +76,8 @@ jobs:
|
|||||||
git add API/pom.xml
|
git add API/pom.xml
|
||||||
git add Client/pom.xml
|
git add Client/pom.xml
|
||||||
git add TestApplication/pom.xml
|
git add TestApplication/pom.xml
|
||||||
|
git add Tools-EventsCollector/pom.xml
|
||||||
|
git add Tools-ReadmeGenerator/pom.xml
|
||||||
git add Tools/pom.xml
|
git add Tools/pom.xml
|
||||||
git commit -m "Update version in pom.xml"
|
git commit -m "Update version in pom.xml"
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>API</artifactId>
|
<artifactId>API</artifactId>
|
||||||
|
|||||||
@@ -7,11 +7,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Value
|
@Getter
|
||||||
public class Picture {
|
public class Picture {
|
||||||
|
|
||||||
List<String> urls;
|
List<String> urls;
|
||||||
|
|
||||||
public Picture(io.github.jwdeveloper.tiktok.messages.Image profilePicture) {
|
public Picture(io.github.jwdeveloper.tiktok.messages.Image profilePicture) {
|
||||||
this.urls = profilePicture.getUrlListList();
|
this.urls = profilePicture.getUrlListList();
|
||||||
}
|
}
|
||||||
@@ -24,15 +23,6 @@ public class Picture {
|
|||||||
this.urls = Arrays.stream(urls).toList();
|
this.urls = Arrays.stream(urls).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void downlaod()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void downloadAsync()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Picture Map(io.github.jwdeveloper.tiktok.messages.Image profilePicture)
|
public static Picture Map(io.github.jwdeveloper.tiktok.messages.Image profilePicture)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -44,4 +44,11 @@ public class TikTokEventObserver {
|
|||||||
public <T extends TikTokEvent> void unsubscribeAll(Class<?> clazz) {
|
public <T extends TikTokEvent> void unsubscribeAll(Class<?> clazz) {
|
||||||
events.remove(clazz);
|
events.remove(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T extends TikTokEvent> void unsubscribe(TikTokEventConsumer<T> consumer) {
|
||||||
|
for(var entry : events.entrySet())
|
||||||
|
{
|
||||||
|
entry.getValue().remove(consumer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ package io.github.jwdeveloper.tiktok.listener;
|
|||||||
import io.github.jwdeveloper.tiktok.annotations.TikTokEventHandler;
|
import io.github.jwdeveloper.tiktok.annotations.TikTokEventHandler;
|
||||||
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
|
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.TikTokEventConsumer;
|
import io.github.jwdeveloper.tiktok.events.TikTokEventConsumer;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokWebsocketMessageEvent;
|
|
||||||
import io.github.jwdeveloper.tiktok.exceptions.TikTokEventListenerMethodException;
|
import io.github.jwdeveloper.tiktok.exceptions.TikTokEventListenerMethodException;
|
||||||
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
|
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
|
||||||
import io.github.jwdeveloper.tiktok.handlers.TikTokEventObserver;
|
import io.github.jwdeveloper.tiktok.handlers.TikTokEventObserver;
|
||||||
@@ -45,6 +44,13 @@ public class TikTokListenersManager implements ListenersManager {
|
|||||||
if (optional.isEmpty()) {
|
if (optional.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bindingModel =optional.get();
|
||||||
|
|
||||||
|
for(var consumer : bindingModel.getEvents())
|
||||||
|
{
|
||||||
|
eventObserver.unsubscribe(consumer);
|
||||||
|
}
|
||||||
bindingModels.remove(optional.get());
|
bindingModels.remove(optional.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,9 +67,9 @@ public class TikTokListenersManager implements ListenersManager {
|
|||||||
for (var method : methods)
|
for (var method : methods)
|
||||||
{
|
{
|
||||||
var eventClazz = method.getParameterTypes()[1];
|
var eventClazz = method.getParameterTypes()[1];
|
||||||
if(!eventClazz.isAssignableFrom(TikTokEvent.class))
|
if(eventClazz.isAssignableFrom(TikTokEvent.class) || eventClazz.equals(TikTokEvent.class))
|
||||||
{
|
{
|
||||||
throw new TikTokEventListenerMethodException("Method "+method.getName()+" 2nd parameter must instance of "+TikTokEvent.class.getName());
|
throw new TikTokEventListenerMethodException("Method "+method.getName()+"() 2nd parameter must instance of "+TikTokEvent.class.getName());
|
||||||
}
|
}
|
||||||
var tikTokEventConsumer = new TikTokEventConsumer() {
|
var tikTokEventConsumer = new TikTokEventConsumer() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -37,7 +37,7 @@ Do you prefer other programming languages?
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.jwdeveloper.TikTok-Live-Java</groupId>
|
<groupId>com.github.jwdeveloper.TikTok-Live-Java</groupId>
|
||||||
<artifactId>Client</artifactId>
|
<artifactId>Client</artifactId>
|
||||||
<version>0.0.14-Release</version>
|
<version>0.0.19-Release</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -131,6 +131,7 @@ public class ConfigurationExample {
|
|||||||
package io.github.jwdeveloper.tiktok;
|
package io.github.jwdeveloper.tiktok;
|
||||||
|
|
||||||
import io.github.jwdeveloper.tiktok.annotations.TikTokEventHandler;
|
import io.github.jwdeveloper.tiktok.annotations.TikTokEventHandler;
|
||||||
|
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokCommentEvent;
|
import io.github.jwdeveloper.tiktok.events.messages.TikTokCommentEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokErrorEvent;
|
import io.github.jwdeveloper.tiktok.events.messages.TikTokErrorEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftMessageEvent;
|
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftMessageEvent;
|
||||||
@@ -153,9 +154,17 @@ public class ListenerExample
|
|||||||
System.in.read();
|
System.in.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Method in TikTokEventListener should meet 4 requirements to be detected
|
||||||
|
- must have @TikTokEventHandler annotation
|
||||||
|
- must have 2 parameters
|
||||||
|
- first parameter must be LiveClient
|
||||||
|
- second must be class that extending TikTokEvent
|
||||||
|
*/
|
||||||
public static class CustomListener implements TikTokEventListener
|
public static class CustomListener implements TikTokEventListener
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@TikTokEventHandler
|
@TikTokEventHandler
|
||||||
public void onError(LiveClient liveClient, TikTokErrorEvent event)
|
public void onError(LiveClient liveClient, TikTokErrorEvent event)
|
||||||
{
|
{
|
||||||
@@ -173,6 +182,13 @@ public class ListenerExample
|
|||||||
{
|
{
|
||||||
System.out.println(event.getGift().getDescription());
|
System.out.println(event.getGift().getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TikTokEventHandler
|
||||||
|
public void onAnyEvent(LiveClient liveClient, TikTokEvent event)
|
||||||
|
{
|
||||||
|
System.out.println(event.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.github.jwdeveloper.tiktok;
|
package io.github.jwdeveloper.tiktok;
|
||||||
|
|
||||||
import io.github.jwdeveloper.tiktok.annotations.TikTokEventHandler;
|
import io.github.jwdeveloper.tiktok.annotations.TikTokEventHandler;
|
||||||
|
import io.github.jwdeveloper.tiktok.events.TikTokEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokCommentEvent;
|
import io.github.jwdeveloper.tiktok.events.messages.TikTokCommentEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokErrorEvent;
|
import io.github.jwdeveloper.tiktok.events.messages.TikTokErrorEvent;
|
||||||
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftMessageEvent;
|
import io.github.jwdeveloper.tiktok.events.messages.TikTokGiftMessageEvent;
|
||||||
@@ -23,9 +24,17 @@ public class ListenerExample
|
|||||||
System.in.read();
|
System.in.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Method in TikTokEventListener should meet 4 requirements to be detected
|
||||||
|
- must have @TikTokEventHandler annotation
|
||||||
|
- must have 2 parameters
|
||||||
|
- first parameter must be LiveClient
|
||||||
|
- second must be class that extending TikTokEvent
|
||||||
|
*/
|
||||||
public static class CustomListener implements TikTokEventListener
|
public static class CustomListener implements TikTokEventListener
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@TikTokEventHandler
|
@TikTokEventHandler
|
||||||
public void onError(LiveClient liveClient, TikTokErrorEvent event)
|
public void onError(LiveClient liveClient, TikTokErrorEvent event)
|
||||||
{
|
{
|
||||||
@@ -43,5 +52,12 @@ public class ListenerExample
|
|||||||
{
|
{
|
||||||
System.out.println(event.getGift().getDescription());
|
System.out.println(event.getGift().getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TikTokEventHandler
|
||||||
|
public void onAnyEvent(LiveClient liveClient, TikTokEvent event)
|
||||||
|
{
|
||||||
|
System.out.println(event.getClass().getSimpleName());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.0.15-Release</version>
|
<version>0.0.18-Release</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>API</module>
|
<module>API</module>
|
||||||
<module>Client</module>
|
<module>Client</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user