Remove unused dependencies, Optional QR code feature

This commit is contained in:
Andrea Cavalli 2023-01-03 02:10:36 +01:00
parent 0b0de0cd1a
commit 5de875cdcd
8 changed files with 19 additions and 23 deletions

View File

@ -49,15 +49,11 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>net.harawata</groupId>
<artifactId>appdirs</artifactId>
<version>1.2.1</version>
</dependency>
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<version>3.5.0</version> <version>3.5.0</version>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>

View File

@ -26,7 +26,7 @@
<dependency> <dependency>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>
<artifactId>tdlight-java-bom</artifactId> <artifactId>tdlight-java-bom</artifactId>
<version>2.8.9.4</version> <version>2.8.10.0</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

View File

@ -8,7 +8,7 @@ import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import java.util.Hashtable; import java.util.Hashtable;
class QrCodeTerminal { public class QrCodeTerminal {
public static String getQr(String url) { public static String getQr(String url) {
int width = 40; int width = 40;
@ -24,7 +24,7 @@ class QrCodeTerminal {
} }
} }
public static String toAscii(BitMatrix bitMatrix) { static String toAscii(BitMatrix bitMatrix) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int rows = 0; rows < bitMatrix.getHeight(); rows++) { for (int rows = 0; rows < bitMatrix.getHeight(); rows++) {
for (int cols = 0; cols < bitMatrix.getWidth(); cols++) { for (int cols = 0; cols < bitMatrix.getWidth(); cols++) {

View File

@ -4,9 +4,13 @@ import it.tdlight.common.utils.ScannerUtils;
import it.tdlight.jni.TdApi.TermsOfService; import it.tdlight.jni.TdApi.TermsOfService;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final class ScannerClientInteraction implements ClientInteraction { final class ScannerClientInteraction implements ClientInteraction {
private static final Logger LOG = LoggerFactory.getLogger(ScannerClientInteraction.class);
private final ExecutorService blockingExecutor; private final ExecutorService blockingExecutor;
private final Authenticable authenticable; private final Authenticable authenticable;
@ -83,8 +87,13 @@ final class ScannerClientInteraction implements ClientInteraction {
String link = ((ParameterInfoNotifyLink) parameterInfo).getLink(); String link = ((ParameterInfoNotifyLink) parameterInfo).getLink();
System.out.println("Please confirm this login link on another device: " + link); System.out.println("Please confirm this login link on another device: " + link);
System.out.println(); System.out.println();
System.out.println(QrCodeTerminal.getQr(link)); try {
System.out.println(); System.out.println(QrCodeTerminal.getQr(link));
System.out.println();
} catch (NoClassDefFoundError ex) {
LOG.warn("QR code library is missing!"
+ " Please add the following dependency to your project: com.google.zxing:core");
}
resultCons.accept(""); resultCons.accept("");
return; return;
case TERMS_OF_SERVICE: case TERMS_OF_SERVICE:

View File

@ -2,7 +2,7 @@ module tdlight.java {
requires tdlight.api; requires tdlight.api;
requires org.reactivestreams; requires org.reactivestreams;
requires org.slf4j; requires org.slf4j;
requires com.google.zxing; requires static com.google.zxing;
exports it.tdlight.tdlight; exports it.tdlight.tdlight;
exports it.tdlight.tdnative; exports it.tdlight.tdnative;
exports it.tdlight.tdlib; exports it.tdlight.tdlib;

View File

@ -60,13 +60,10 @@
<artifactId>reactive-streams</artifactId> <artifactId>reactive-streams</artifactId>
<version>1.0.3</version> <version>1.0.3</version>
</dependency> </dependency>
<dependency>
<groupId>net.harawata</groupId>
<artifactId>appdirs</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

View File

@ -58,13 +58,10 @@
<artifactId>reactive-streams</artifactId> <artifactId>reactive-streams</artifactId>
<version>1.0.4</version> <version>1.0.4</version>
</dependency> </dependency>
<dependency>
<groupId>net.harawata</groupId>
<artifactId>appdirs</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

View File

@ -58,13 +58,10 @@
<artifactId>reactive-streams</artifactId> <artifactId>reactive-streams</artifactId>
<version>1.0.4</version> <version>1.0.4</version>
</dependency> </dependency>
<dependency>
<groupId>net.harawata</groupId>
<artifactId>appdirs</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>com.google.zxing</groupId>
<artifactId>core</artifactId> <artifactId>core</artifactId>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>