Skip to content

Commit

Permalink
Refactoring changes WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
michalrentka committed Aug 1, 2024
1 parent 0f48301 commit aad5e74
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Zotero.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4289,7 +4289,7 @@
B3CF8840266E0FE6009CFC20 /* Run Script */,
B3593F142668D37900FA4BB2 /* Run Script */,
B34A85AC243CB1E4003D5638 /* ShellScript */,
B3052A912C412E12008C8596 /* ShellScript */,
B3052A912C412E12008C8596 /* Bundle Reader */,
B337A5AD244F229400AFD13D /* SwiftGen */,
B30D59512206F60400884C4A /* Sources */,
B30D59522206F60400884C4A /* Frameworks */,
Expand Down Expand Up @@ -4624,7 +4624,7 @@
shellPath = /bin/sh;
shellScript = "swiftlint\n";
};
B3052A912C412E12008C8596 /* ShellScript */ = {
B3052A912C412E12008C8596 /* Bundle Reader */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -4634,6 +4634,7 @@
inputPaths = (
"$(SRCROOT)/scripts/bundle_reader.sh",
);
name = "Bundle Reader";
outputFileListPaths = (
);
outputPaths = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final class AnnotationView: UIView {

// MARK: - Setups

func setup(with annotation: HtmlEpubAnnotation, comment: Comment?, selected: Bool, availableWidth: CGFloat, library: Library, currentUserId: Int) {
func setup(with annotation: HtmlEpubAnnotation, text: NSAttributedString?, comment: Comment?, selected: Bool, availableWidth: CGFloat, library: Library, currentUserId: Int) {
let color = UIColor(hex: annotation.color)
let canEdit = library.metadataEditable && selected
let author = library.identifier == .custom(.myLibrary) ? "" : annotation.author
Expand All @@ -110,7 +110,7 @@ final class AnnotationView: UIView {
setupContent(
type: annotation.type,
comment: annotation.comment,
text: annotation.text,
text: text,
preview: nil,
color: color,
canEdit: canEdit,
Expand Down
20 changes: 17 additions & 3 deletions scripts/bundle_reader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ realpath() {

SCRIPT_PATH=`realpath "$0"`
SCRIPT_DIR=`dirname "$SCRIPT_PATH"`
READER_SUBMODULE_DIR="$SCRIPT_DIR/../reader"
READER_DIR="$SCRIPT_DIR/../bundled/reader"
HASH_FILE="$READER_DIR/reader_hash.txt"
CURRENT_HASH=`git ls-tree --object-only HEAD "$READER_SUBMODULE_DIR"`

if [ -d "$READER_DIR" ]; then
rm -rf "$READER_DIR"
if [ -d "$HASH_FILE" ]; then
CACHED_HASH=`cat "$HASH_FILE"`
else
CACHED_HASH=0
fi

if [ $CACHED_HASH == $CURRENT_HASH ]; then
exit
else
rm -rf "$READER_DIR"
fi
fi

cd "$SCRIPT_DIR/../reader"
cd "$READER_SUBMODULE_DIR"
NODE_OPTIONS=--openssl-legacy-provider npm ci
NODE_OPTIONS=--openssl-legacy-provider npm run build:ios
mv "$SCRIPT_DIR/../reader/build/ios" "$READER_DIR"
mv "$READER_SUBMODULE_DIR/build/ios" "$READER_DIR"
echo "$CURRENT_HASH" > "$HASH_FILE"

0 comments on commit aad5e74

Please sign in to comment.