Skip to content

Commit

Permalink
fix: message for strings based project when download (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina20 authored Feb 26, 2024
1 parent 19f2aa8 commit c280608
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
16 changes: 6 additions & 10 deletions src/main/java/com/crowdin/cli/commands/actions/DownloadAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.crowdin.cli.utils.Utils;
import com.crowdin.cli.utils.console.ConsoleSpinner;
import com.crowdin.client.languages.model.Language;
import com.crowdin.client.projectsgroups.model.Type;
import com.crowdin.client.sourcefiles.model.Branch;
import com.crowdin.client.translations.model.BuildProjectTranslationRequest;
import com.crowdin.client.translations.model.CrowdinTranslationCreateProjectBuildForm;
Expand All @@ -29,16 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -94,6 +86,10 @@ public void act(Outputter out, PropertiesWithFiles pb, ProjectClient client) {
.execute(out, "message.spinner.fetching_project_info", "error.collect_project_info",
this.noProgress, this.plainView, () -> client.downloadFullProject(this.branchName));

if (Objects.equals(project.getType(), Type.STRINGS_BASED)) {
throw new RuntimeException(RESOURCE_BUNDLE.getString("message.no_file_string_project"));
}

if (!project.isManagerAccess()) {
if (!plainView) {
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("message.no_manager_access")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.crowdin.cli.utils.Utils;
import com.crowdin.cli.utils.concurrency.ConcurrencyUtil;
import com.crowdin.cli.utils.console.ConsoleSpinner;
import com.crowdin.client.projectsgroups.model.Type;
import com.crowdin.client.sourcefiles.model.Branch;
import com.crowdin.client.sourcefiles.model.BuildReviewedSourceFilesRequest;
import com.crowdin.client.sourcefiles.model.File;
Expand Down Expand Up @@ -87,14 +88,18 @@ public void act(Outputter out, PropertiesWithFiles properties, ProjectClient cli
return;
}

if (!plainView && !properties.getPreserveHierarchy()) {
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("message.download_sources.preserve_hierarchy_warning")));
}

CrowdinProjectFull project = ConsoleSpinner
.execute(out, "message.spinner.fetching_project_info", "error.collect_project_info",
this.noProgress, this.plainView, () -> client.downloadFullProject(this.branchName));

if (Objects.equals(project.getType(), Type.STRINGS_BASED)) {
throw new RuntimeException(RESOURCE_BUNDLE.getString("message.no_file_string_project"));
}

if (!plainView && !properties.getPreserveHierarchy()) {
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("message.download_sources.preserve_hierarchy_warning")));
}

Long branchId = Optional.ofNullable(project.getBranch())
.map(Branch::getId)
.orElse(null);
Expand Down

0 comments on commit c280608

Please sign in to comment.