From 512bf6fb1235e1f8279dfdd36e33f52b267118ab Mon Sep 17 00:00:00 2001 From: ourfor Date: Fri, 24 Jan 2025 21:23:42 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20add=20local=20drive=20model=20js?= =?UTF-8?q?on=20convert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/top/ourfor/app/iplayx/model/drive/Drive.java | 3 ++- .../main/java/top/ourfor/app/iplayx/store/GlobalStore.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/model/drive/Drive.java b/android/app/src/main/java/top/ourfor/app/iplayx/model/drive/Drive.java index fb02dcfd..4794d960 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/model/drive/Drive.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/model/drive/Drive.java @@ -11,7 +11,8 @@ @JsonSubTypes.Type(value = OneDriveModel.class, name = "onedrive"), @JsonSubTypes.Type(value = Cloud189Model.class, name = "cloud189"), @JsonSubTypes.Type(value = WebDAVModel.class, name = "webdav"), - @JsonSubTypes.Type(value = AlistDriveModel.class, name = "alist") + @JsonSubTypes.Type(value = AlistDriveModel.class, name = "alist"), + @JsonSubTypes.Type(value = LocalDriveModel.class, name = "local"), }) public interface Drive { default ServerType getType() { diff --git a/android/app/src/main/java/top/ourfor/app/iplayx/store/GlobalStore.java b/android/app/src/main/java/top/ourfor/app/iplayx/store/GlobalStore.java index 590a1477..44f5eba0 100644 --- a/android/app/src/main/java/top/ourfor/app/iplayx/store/GlobalStore.java +++ b/android/app/src/main/java/top/ourfor/app/iplayx/store/GlobalStore.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; @@ -79,6 +80,7 @@ public class GlobalStore { public static GlobalStore shared = defaultStore(); public GlobalStore() { + drives = new ArrayList<>(); sites = new ArrayList<>(); dataSource = createDataSource(); } @@ -107,6 +109,7 @@ public static GlobalStore defaultStore() { if (instance.dataSource == null) { instance.dataSource = createDataSource(); } + instance.drives.removeIf(Objects::isNull); } return instance; } @@ -744,7 +747,7 @@ public boolean hasValidSite() { } public boolean hasValidDrive() { - return drive != null && drives != null; + return drive != null && drives != null && !drives.isEmpty(); } public void searchSuggestion(Consumer> prompts) {