Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc improvements #222

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 23 additions & 33 deletions LANreader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
7D772E78250515C600070860 /* UpdateSearchCategoryResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 7D772E77250515C600070860 /* UpdateSearchCategoryResponse.json */; };
7D7A6845250241D80051F232 /* ServerInfoResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 7D7A6844250241D80051F232 /* ServerInfoResponse.json */; };
7D7B26A224F4D13600149341 /* LICENSE.md in Resources */ = {isa = PBXBuildFile; fileRef = 7D7B26A124F4D13600149341 /* LICENSE.md */; };
7D7B26A924F52A7F00149341 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D7B26AB24F52A7F00149341 /* Localizable.strings */; };
7D80326C24F68AB500AA8BD2 /* ArchiveCategoriesResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 7D80326B24F68AB500AA8BD2 /* ArchiveCategoriesResponse.json */; };
7D80326E24F68F6900AA8BD2 /* ArchiveSearchResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = 7D80326D24F68F6900AA8BD2 /* ArchiveSearchResponse.json */; };
7DE399892578FB34003DC5F7 /* DatabaseSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE399882578FB34003DC5F7 /* DatabaseSettings.swift */; };
Expand All @@ -43,7 +42,6 @@
7DF7EA742564E1D2003B5A5A /* AppDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF7EA732564E1D2003B5A5A /* AppDatabase.swift */; };
7DF7EA7F2564E5D1003B5A5A /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF7EA7E2564E5D1003B5A5A /* Persistence.swift */; };
7DF7EA852564E675003B5A5A /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DF7EA842564E675003B5A5A /* Record.swift */; };
E90369C02AE72D64001BC558 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = E90369BF2AE72D64001BC558 /* ComposableArchitecture */; };
E90576B629F6BF8700C3CE3F /* WrappingHStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = E90576B529F6BF8700C3CE3F /* WrappingHStack.swift */; };
E90576BC29F7FB2900C3CE3F /* DraggableAndZoomableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E90576BB29F7FB2900C3CE3F /* DraggableAndZoomableView.swift */; };
E90576BF29F8C10700C3CE3F /* Puppy in Frameworks */ = {isa = PBXBuildFile; productRef = E90576BE29F8C10700C3CE3F /* Puppy */; };
Expand All @@ -57,6 +55,7 @@
E98B8B7D2A0A7B68004CBBC0 /* Action.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = E98B8B6F2A0A7B67004CBBC0 /* Action.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
E98B8B8E2A0B12F3004CBBC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E98B8B8D2A0B12F3004CBBC0 /* Assets.xcassets */; };
E98B8B902A0BA9D1004CBBC0 /* UploadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98B8B8F2A0BA9D1004CBBC0 /* UploadView.swift */; };
E995D4E52C12E46800D9D3F3 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = E995D4E42C12E46800D9D3F3 /* ComposableArchitecture */; };
E997D8002AF20EE2007C91F1 /* ArchiveGridV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = E997D7FF2AF20EE2007C91F1 /* ArchiveGridV2.swift */; };
E997D8042AF3C9BA007C91F1 /* LibraryListV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = E997D8032AF3C9BA007C91F1 /* LibraryListV2.swift */; };
E99D2B412B0176410029FDEC /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = E99D2B402B0176410029FDEC /* InfoPlist.xcstrings */; };
Expand All @@ -66,6 +65,7 @@
E9BFA2052AF51DB500DDE107 /* ArchiveReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9BFA2042AF51DB500DDE107 /* ArchiveReader.swift */; };
E9BFA2072AF52C3300DDE107 /* PageImageV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9BFA2062AF52C3300DDE107 /* PageImageV2.swift */; };
E9CBC0F02A3DD62F00CCD592 /* LogFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9CBC0EF2A3DD62F00CCD592 /* LogFormatter.swift */; };
E9DA93612C16960E003272B9 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = E9DA93602C16960E003272B9 /* Localizable.xcstrings */; };
E9DAEC552B07295D00ADC215 /* ArchiveDetailsV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9DAEC542B07295D00ADC215 /* ArchiveDetailsV2.swift */; };
E9DCE8992AF0665900C17236 /* ArchiveListV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9DCE8982AF0665900C17236 /* ArchiveListV2.swift */; };
E9DCE8A22AF0795600C17236 /* SearchViewV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9DCE8A12AF0795600C17236 /* SearchViewV2.swift */; };
Expand Down Expand Up @@ -140,8 +140,6 @@
7D772E77250515C600070860 /* UpdateSearchCategoryResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = UpdateSearchCategoryResponse.json; sourceTree = "<group>"; };
7D7A6844250241D80051F232 /* ServerInfoResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = ServerInfoResponse.json; sourceTree = "<group>"; };
7D7B26A124F4D13600149341 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = "<group>"; };
7D7B26AA24F52A7F00149341 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
7D7B26AC24F52A8200149341 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
7D80326B24F68AB500AA8BD2 /* ArchiveCategoriesResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = ArchiveCategoriesResponse.json; sourceTree = "<group>"; };
7D80326D24F68F6900AA8BD2 /* ArchiveSearchResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = ArchiveSearchResponse.json; sourceTree = "<group>"; };
7DE399882578FB34003DC5F7 /* DatabaseSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseSettings.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -176,6 +174,7 @@
E9BFA2042AF51DB500DDE107 /* ArchiveReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveReader.swift; sourceTree = "<group>"; };
E9BFA2062AF52C3300DDE107 /* PageImageV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageImageV2.swift; sourceTree = "<group>"; };
E9CBC0EF2A3DD62F00CCD592 /* LogFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogFormatter.swift; sourceTree = "<group>"; };
E9DA93602C16960E003272B9 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
E9DAEC542B07295D00ADC215 /* ArchiveDetailsV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveDetailsV2.swift; sourceTree = "<group>"; };
E9DCE8982AF0665900C17236 /* ArchiveListV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveListV2.swift; sourceTree = "<group>"; };
E9DCE8A12AF0795600C17236 /* SearchViewV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewV2.swift; sourceTree = "<group>"; };
Expand All @@ -192,7 +191,7 @@
files = (
E9E3631626F463F800C58D01 /* Logging in Frameworks */,
E9E3631826F463F800C58D01 /* GRDB in Frameworks */,
E90369C02AE72D64001BC558 /* ComposableArchitecture in Frameworks */,
E995D4E52C12E46800D9D3F3 /* ComposableArchitecture in Frameworks */,
E9E3631726F463F800C58D01 /* NotificationBannerSwift in Frameworks */,
E90576BF29F8C10700C3CE3F /* Puppy in Frameworks */,
E9E3631426F463F800C58D01 /* Alamofire in Frameworks */,
Expand Down Expand Up @@ -316,7 +315,7 @@
7D354C9324F1316800617F4A = {
isa = PBXGroup;
children = (
7D7B26AB24F52A7F00149341 /* Localizable.strings */,
E9DA93602C16960E003272B9 /* Localizable.xcstrings */,
7D7B26A124F4D13600149341 /* LICENSE.md */,
7D354CF224F222FC00617F4A /* README.md */,
7D354C9E24F1316800617F4A /* LANreader */,
Expand Down Expand Up @@ -470,7 +469,7 @@
7D7A6842250239750051F232 /* NotificationBannerSwift */,
7DF7EA792564E264003B5A5A /* GRDB */,
E90576BE29F8C10700C3CE3F /* Puppy */,
E90369BF2AE72D64001BC558 /* ComposableArchitecture */,
E995D4E42C12E46800D9D3F3 /* ComposableArchitecture */,
);
productName = DuManga;
productReference = 7D354C9C24F1316800617F4A /* LANreader.app */;
Expand Down Expand Up @@ -554,7 +553,7 @@
7D7A6841250239750051F232 /* XCRemoteSwiftPackageReference "NotificationBanner" */,
7DF7EA782564E264003B5A5A /* XCRemoteSwiftPackageReference "GRDB" */,
E90576BD29F8C10700C3CE3F /* XCRemoteSwiftPackageReference "Puppy" */,
E90369BB2AE72B11001BC558 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */,
E995D4E32C12E46800D9D3F3 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */,
);
productRefGroup = 7D354C9D24F1316800617F4A /* Products */;
projectDirPath = "";
Expand All @@ -573,7 +572,7 @@
buildActionMask = 2147483647;
files = (
7D7B26A224F4D13600149341 /* LICENSE.md in Resources */,
7D7B26A924F52A7F00149341 /* Localizable.strings in Resources */,
E9DA93612C16960E003272B9 /* Localizable.xcstrings in Resources */,
7D354CAC24F1316D00617F4A /* LaunchScreen.storyboard in Resources */,
7D354CA924F1316D00617F4A /* Preview Assets.xcassets in Resources */,
7D354CF324F222FC00617F4A /* README.md in Resources */,
Expand Down Expand Up @@ -721,15 +720,6 @@
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
7D7B26AB24F52A7F00149341 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
7D7B26AA24F52A7F00149341 /* en */,
7D7B26AC24F52A8200149341 /* zh-Hans */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -864,7 +854,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 101;
CURRENT_PROJECT_VERSION = 102;
DEVELOPMENT_ASSET_PATHS = "\"LANreader/Preview Content\"";
DEVELOPMENT_TEAM = UUEBW58SA6;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -893,7 +883,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 101;
CURRENT_PROJECT_VERSION = 102;
DEVELOPMENT_ASSET_PATHS = "\"LANreader/Preview Content\"";
DEVELOPMENT_TEAM = UUEBW58SA6;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -972,7 +962,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 101;
CURRENT_PROJECT_VERSION = 102;
DEVELOPMENT_TEAM = UUEBW58SA6;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Action/Info.plist;
Expand Down Expand Up @@ -1001,7 +991,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 101;
CURRENT_PROJECT_VERSION = 102;
DEVELOPMENT_TEAM = UUEBW58SA6;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Action/Info.plist;
Expand Down Expand Up @@ -1105,20 +1095,20 @@
minimumVersion = 6.14.0;
};
};
E90369BB2AE72B11001BC558 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = {
E90576BD29F8C10700C3CE3F /* XCRemoteSwiftPackageReference "Puppy" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture";
repositoryURL = "https://github.com/sushichop/Puppy";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.0;
minimumVersion = 0.7.0;
};
};
E90576BD29F8C10700C3CE3F /* XCRemoteSwiftPackageReference "Puppy" */ = {
E995D4E32C12E46800D9D3F3 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sushichop/Puppy";
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.7.0;
minimumVersion = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down Expand Up @@ -1149,16 +1139,16 @@
package = 7DF7EA782564E264003B5A5A /* XCRemoteSwiftPackageReference "GRDB" */;
productName = GRDB;
};
E90369BF2AE72D64001BC558 /* ComposableArchitecture */ = {
isa = XCSwiftPackageProductDependency;
package = E90369BB2AE72B11001BC558 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */;
productName = ComposableArchitecture;
};
E90576BE29F8C10700C3CE3F /* Puppy */ = {
isa = XCSwiftPackageProductDependency;
package = E90576BD29F8C10700C3CE3F /* XCRemoteSwiftPackageReference "Puppy" */;
productName = Puppy;
};
E995D4E42C12E46800D9D3F3 /* ComposableArchitecture */ = {
isa = XCSwiftPackageProductDependency;
package = E995D4E32C12E46800D9D3F3 /* XCRemoteSwiftPackageReference "swift-composable-architecture" */;
productName = ComposableArchitecture;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 7D354C9424F1316800617F4A /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "48ed4c8333428e3be278feb5f0454dd1dac62bc5e8f6a324964e8abff59f37aa",
"originHash" : "3ebd59855c807c61a66b524a1640afeb2a6f273baa7e6dea62b926a34f5ff5f6",
"pins" : [
{
"identity" : "alamofire",
Expand Down Expand Up @@ -78,8 +78,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "8d712376c99fc0267aa0e41fea732babe365270a",
"version" : "1.3.3"
"revision" : "ecb5b29e65bfc58b4c90216d4ca6ef3a573a28a7",
"version" : "1.4.1"
}
},
{
Expand All @@ -94,7 +94,7 @@
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
Expand All @@ -103,10 +103,10 @@
{
"identity" : "swift-composable-architecture",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture",
"location" : "https://github.com/pointfreeco/swift-composable-architecture.git",
"state" : {
"revision" : "433a23118f739078644ebeb4009e23d307af694a",
"version" : "1.10.4"
"revision" : "1eeca17b21b931fd6a5cc683a2cd659fb0441c66",
"version" : "1.11.0"
}
},
{
Expand Down Expand Up @@ -159,8 +159,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-perception",
"state" : {
"revision" : "9b77fbd07b9529312f7e9adb10f5131acd9e2363",
"version" : "1.2.0"
"revision" : "64f7f6c28c6a4d3c4b9da2ba02383e29ab48a8cf",
"version" : "1.2.2"
}
},
{
Expand Down
6 changes: 4 additions & 2 deletions LANreader/Common/ArchiveListV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ import NotificationBannerSwift
archives.forEach { item in
state.archiveItems.updateOrAppend(item)
}
let gridFeatureState = archives.map { item in
GridFeature.State(archive: state.$archiveItems[id: item.id]!)
let gridFeatureState = archives.compactMap { item in
state.$archiveItems[id: item.id]
}.map {
GridFeature.State(archive: $0)
}
if !append {
state.archives = .init()
Expand Down
4 changes: 2 additions & 2 deletions LANreader/Common/LockScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ struct LockScreen: View {
}

if store.showPin {
return store.pin.digits[index].numberString + ".circle"
return store.pin.digits[index].singleDigitNumberString + ".circle"
}

return "circle.fill"
Expand All @@ -280,7 +280,7 @@ extension String {
}

extension Int {
var numberString: String {
var singleDigitNumberString: String {
guard self < 10 else { return "0" }
return String(self)
}
Expand Down
6 changes: 4 additions & 2 deletions LANreader/Library/RandomView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ import NotificationBannerSwift
archives.forEach { item in
state.archiveItems.updateOrAppend(item)
}
let gridFeatureState = archives.map { item in
GridFeature.State(archive: state.$archiveItems[id: item.id]!)
let gridFeatureState = archives.compactMap { item in
state.$archiveItems[id: item.id]
}.map {
GridFeature.State(archive: $0)
}
state.archives = IdentifiedArray(uniqueElements: gridFeatureState)
state.loading = false
Expand Down
36 changes: 0 additions & 36 deletions LANreader/Models/AppModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,53 +85,23 @@ struct SettingsKey {
static let tapMiddleKey = "settings.read.tap.middle"
static let tapRightKey = "settings.read.tap.right"
static let readDirection = "settings.read.direction"
static let compressImageThreshold = "settings.read.image.compress.threshold"
static let showOriginal = "settings.read.image.showOriginal"
static let fallbackReader = "settings.read.fallback"
static let splitWideImage = "settings.read.split.Image"
static let splitPiorityLeft = "settings.read.split.piorityLeft"
static let autoPageInterval = "settings.read.auto.page.interval"

static let archiveListOrder = "settings.archive.list.order"
static let searchSort = "settings.search.sort"
static let searchSortCustom = "settings.search.sort.custom"
static let searchSortOrder = "settings.search.sort.order"
static let useListView = "settings.view.use.list"
static let blurInterfaceWhenInactive = "settings.view.blur.inactive"
static let enablePasscode = "settings.view.passcode.enable"
static let passcode = "settings.view.passcode"
static let hideRead = "settings.view.hideRead"

static let alwaysLoadFromServer = "settings.host.alwaysLoad"

static let lastTagRefresh = "lastTagRefresh"
}

struct ErrorCode: Equatable {

static func == (lhs: ErrorCode, rhs: ErrorCode) -> Bool {
lhs.name == rhs.name
&& lhs.code == rhs.code
}

let name: String
let code: Int

private init(name: String, code: Int) {
self.name = name
self.code = code
}

static let lanraragiServerError = ErrorCode(name: "error.host", code: 1000)

static let archiveFetchError = ErrorCode(name: "error.list", code: 2000)
static let archiveExtractError = ErrorCode(name: "error.extract", code: 2002)

static let categoryFetchError = ErrorCode(name: "error.category", code: 3000)

static let emptyPageError = ErrorCode(name: "error.page.empty", code: 4000)
}

extension Double {
var int: Int {
get { Int(self) }
Expand All @@ -150,9 +120,3 @@ extension PersistenceReaderKey where Self == InMemoryKey<IdentifiedArrayOf<Archi
inMemory("archive")
}
}

extension PersistenceReaderKey where Self == InMemoryKey<[String: Int]> {
static var totalDownloadPages: Self {
inMemory("totalDownloadPages")
}
}
Loading