Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 721ffed265 | |||
| e0d18f945f | |||
| 3489b6e8c8 | |||
| aa5ba0f79e | |||
| 86b1752e91 | |||
| d11ea5421f | |||
| 26fd547160 | |||
| 9dabc84f22 | |||
| 0234f2c8ff | |||
| 6e03523c4f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@
|
|||||||
buildServer.json
|
buildServer.json
|
||||||
.swiftlint.yml
|
.swiftlint.yml
|
||||||
/ImageViewer.xcodeproj/xcuserdata
|
/ImageViewer.xcodeproj/xcuserdata
|
||||||
|
/ImageViewer.xcodeproj/project.xcworkspace/xcuserdata
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>method</key>
|
<key>method</key>
|
||||||
<string>debugging</string>
|
<string>development</string>
|
||||||
<key>signingStyle</key>
|
<key>signingStyle</key>
|
||||||
<string>automatic</string>
|
<string>automatic</string>
|
||||||
<key>destination</key>
|
<key>destination</key>
|
||||||
|
|||||||
@@ -3,320 +3,142 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 90;
|
objectVersion = 56;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXBuildFile section */
|
||||||
22FB3BA32E18135B00A9B407 /* PBXContainerItemProxy */ = {
|
840F62692E7B65B700C8A64A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840F62682E7B65B700C8A64A /* AppDelegate.swift */; };
|
||||||
isa = PBXContainerItemProxy;
|
840F626D2E7B65B700C8A64A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840F626C2E7B65B700C8A64A /* ViewController.swift */; };
|
||||||
containerPortal = 22FB3B842E18135A00A9B407 /* Project object */;
|
840F62722E7B65B900C8A64A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 840F62712E7B65B900C8A64A /* Assets.xcassets */; };
|
||||||
proxyType = 1;
|
/* End PBXBuildFile section */
|
||||||
remoteGlobalIDString = 22FB3B8B2E18135A00A9B407;
|
|
||||||
remoteInfo = ImageViewer;
|
|
||||||
};
|
|
||||||
22FB3BAD2E18135B00A9B407 /* PBXContainerItemProxy */ = {
|
|
||||||
isa = PBXContainerItemProxy;
|
|
||||||
containerPortal = 22FB3B842E18135A00A9B407 /* Project object */;
|
|
||||||
proxyType = 1;
|
|
||||||
remoteGlobalIDString = 22FB3B8B2E18135A00A9B407;
|
|
||||||
remoteInfo = ImageViewer;
|
|
||||||
};
|
|
||||||
/* End PBXContainerItemProxy section */
|
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
22FB3B8C2E18135A00A9B407 /* ImageViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImageViewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
840F62652E7B65B700C8A64A /* ImageViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImageViewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
22FB3BA22E18135B00A9B407 /* ImageViewerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImageViewerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
840F62682E7B65B700C8A64A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
22FB3BAC2E18135B00A9B407 /* ImageViewerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImageViewerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
840F626C2E7B65B700C8A64A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||||
|
840F62712E7B65B900C8A64A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
|
840F62762E7B65B900C8A64A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
|
||||||
22FB3BB42E18135B00A9B407 /* Exceptions for "ImageViewer" folder in "ImageViewer" target */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
|
|
||||||
membershipExceptions = (
|
|
||||||
Info.plist,
|
|
||||||
);
|
|
||||||
target = 22FB3B8B2E18135A00A9B407 /* ImageViewer */;
|
|
||||||
};
|
|
||||||
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
|
|
||||||
|
|
||||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
|
||||||
22FB3B8E2E18135A00A9B407 /* ImageViewer */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
|
||||||
exceptions = (
|
|
||||||
22FB3BB42E18135B00A9B407 /* Exceptions for "ImageViewer" folder in "ImageViewer" target */,
|
|
||||||
);
|
|
||||||
path = ImageViewer;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
22FB3BA52E18135B00A9B407 /* ImageViewerTests */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
|
||||||
path = ImageViewerTests;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
22FB3BAF2E18135B00A9B407 /* ImageViewerUITests */ = {
|
|
||||||
isa = PBXFileSystemSynchronizedRootGroup;
|
|
||||||
path = ImageViewerUITests;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
22FB3B892E18135A00A9B407 /* Frameworks */ = {
|
840F62622E7B65B700C8A64A /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
};
|
|
||||||
22FB3B9F2E18135B00A9B407 /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
};
|
|
||||||
22FB3BA92E18135B00A9B407 /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
22FB3B832E18135A00A9B407 = {
|
840F625C2E7B65B700C8A64A = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
22FB3B8E2E18135A00A9B407 /* ImageViewer */,
|
840F62672E7B65B700C8A64A /* ImageViewer */,
|
||||||
22FB3BA52E18135B00A9B407 /* ImageViewerTests */,
|
840F62662E7B65B700C8A64A /* Products */,
|
||||||
22FB3BAF2E18135B00A9B407 /* ImageViewerUITests */,
|
|
||||||
22FB3B8D2E18135A00A9B407 /* Products */,
|
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
22FB3B8D2E18135A00A9B407 /* Products */ = {
|
840F62662E7B65B700C8A64A /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
22FB3B8C2E18135A00A9B407 /* ImageViewer.app */,
|
840F62652E7B65B700C8A64A /* ImageViewer.app */,
|
||||||
22FB3BA22E18135B00A9B407 /* ImageViewerTests.xctest */,
|
|
||||||
22FB3BAC2E18135B00A9B407 /* ImageViewerUITests.xctest */,
|
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
840F62672E7B65B700C8A64A /* ImageViewer */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
840F62682E7B65B700C8A64A /* AppDelegate.swift */,
|
||||||
|
840F626C2E7B65B700C8A64A /* ViewController.swift */,
|
||||||
|
840F62712E7B65B900C8A64A /* Assets.xcassets */,
|
||||||
|
840F62762E7B65B900C8A64A /* Info.plist */,
|
||||||
|
);
|
||||||
|
path = ImageViewer;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
22FB3B8B2E18135A00A9B407 /* ImageViewer */ = {
|
840F62642E7B65B700C8A64A /* ImageViewer */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 22FB3BB52E18135B00A9B407 /* Build configuration list for PBXNativeTarget "ImageViewer" */;
|
buildConfigurationList = 840F62792E7B65B900C8A64A /* Build configuration list for PBXNativeTarget "ImageViewer" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
22FB3B882E18135A00A9B407 /* Sources */,
|
840F62612E7B65B700C8A64A /* Sources */,
|
||||||
22FB3B892E18135A00A9B407 /* Frameworks */,
|
840F62622E7B65B700C8A64A /* Frameworks */,
|
||||||
22FB3B8A2E18135A00A9B407 /* Resources */,
|
840F62632E7B65B700C8A64A /* Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
fileSystemSynchronizedGroups = (
|
dependencies = (
|
||||||
22FB3B8E2E18135A00A9B407 /* ImageViewer */,
|
|
||||||
);
|
);
|
||||||
name = ImageViewer;
|
name = ImageViewer;
|
||||||
productName = ImageViewer;
|
productName = ImageViewer;
|
||||||
productReference = 22FB3B8C2E18135A00A9B407 /* ImageViewer.app */;
|
productReference = 840F62652E7B65B700C8A64A /* ImageViewer.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
22FB3BA12E18135B00A9B407 /* ImageViewerTests */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 22FB3BBA2E18135B00A9B407 /* Build configuration list for PBXNativeTarget "ImageViewerTests" */;
|
|
||||||
buildPhases = (
|
|
||||||
22FB3B9E2E18135B00A9B407 /* Sources */,
|
|
||||||
22FB3B9F2E18135B00A9B407 /* Frameworks */,
|
|
||||||
22FB3BA02E18135B00A9B407 /* Resources */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
22FB3BA42E18135B00A9B407 /* PBXTargetDependency */,
|
|
||||||
);
|
|
||||||
fileSystemSynchronizedGroups = (
|
|
||||||
22FB3BA52E18135B00A9B407 /* ImageViewerTests */,
|
|
||||||
);
|
|
||||||
name = ImageViewerTests;
|
|
||||||
productName = ImageViewerTests;
|
|
||||||
productReference = 22FB3BA22E18135B00A9B407 /* ImageViewerTests.xctest */;
|
|
||||||
productType = "com.apple.product-type.bundle.unit-test";
|
|
||||||
};
|
|
||||||
22FB3BAB2E18135B00A9B407 /* ImageViewerUITests */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 22FB3BBD2E18135B00A9B407 /* Build configuration list for PBXNativeTarget "ImageViewerUITests" */;
|
|
||||||
buildPhases = (
|
|
||||||
22FB3BA82E18135B00A9B407 /* Sources */,
|
|
||||||
22FB3BA92E18135B00A9B407 /* Frameworks */,
|
|
||||||
22FB3BAA2E18135B00A9B407 /* Resources */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
22FB3BAE2E18135B00A9B407 /* PBXTargetDependency */,
|
|
||||||
);
|
|
||||||
fileSystemSynchronizedGroups = (
|
|
||||||
22FB3BAF2E18135B00A9B407 /* ImageViewerUITests */,
|
|
||||||
);
|
|
||||||
name = ImageViewerUITests;
|
|
||||||
productName = ImageViewerUITests;
|
|
||||||
productReference = 22FB3BAC2E18135B00A9B407 /* ImageViewerUITests.xctest */;
|
|
||||||
productType = "com.apple.product-type.bundle.ui-testing";
|
|
||||||
};
|
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
/* Begin PBXProject section */
|
||||||
22FB3B842E18135A00A9B407 /* Project object */ = {
|
840F625D2E7B65B700C8A64A /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
BuildIndependentTargetsInParallel = 1;
|
BuildIndependentTargetsInParallel = 1;
|
||||||
LastSwiftUpdateCheck = 1640;
|
LastSwiftUpdateCheck = 1420;
|
||||||
LastUpgradeCheck = 1640;
|
LastUpgradeCheck = 1420;
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
22FB3B8B2E18135A00A9B407 = {
|
840F62642E7B65B700C8A64A = {
|
||||||
CreatedOnToolsVersion = 16.4;
|
CreatedOnToolsVersion = 14.2;
|
||||||
};
|
|
||||||
22FB3BA12E18135B00A9B407 = {
|
|
||||||
CreatedOnToolsVersion = 16.4;
|
|
||||||
TestTargetID = 22FB3B8B2E18135A00A9B407;
|
|
||||||
};
|
|
||||||
22FB3BAB2E18135B00A9B407 = {
|
|
||||||
CreatedOnToolsVersion = 16.4;
|
|
||||||
TestTargetID = 22FB3B8B2E18135A00A9B407;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = 22FB3B872E18135A00A9B407 /* Build configuration list for PBXProject "ImageViewer" */;
|
buildConfigurationList = 840F62602E7B65B700C8A64A /* Build configuration list for PBXProject "ImageViewer" */;
|
||||||
|
compatibilityVersion = "Xcode 14.0";
|
||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
en,
|
en,
|
||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
mainGroup = 22FB3B832E18135A00A9B407;
|
mainGroup = 840F625C2E7B65B700C8A64A;
|
||||||
minimizedProjectReferenceProxies = 1;
|
productRefGroup = 840F62662E7B65B700C8A64A /* Products */;
|
||||||
preferredProjectObjectVersion = 90;
|
|
||||||
productRefGroup = 22FB3B8D2E18135A00A9B407 /* Products */;
|
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
22FB3B8B2E18135A00A9B407 /* ImageViewer */,
|
840F62642E7B65B700C8A64A /* ImageViewer */,
|
||||||
22FB3BA12E18135B00A9B407 /* ImageViewerTests */,
|
|
||||||
22FB3BAB2E18135B00A9B407 /* ImageViewerUITests */,
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
||||||
/* Begin PBXResourcesBuildPhase section */
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
22FB3B8A2E18135A00A9B407 /* Resources */ = {
|
840F62632E7B65B700C8A64A /* Resources */ = {
|
||||||
isa = PBXResourcesBuildPhase;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
};
|
|
||||||
22FB3BA02E18135B00A9B407 /* Resources */ = {
|
|
||||||
isa = PBXResourcesBuildPhase;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
};
|
|
||||||
22FB3BAA2E18135B00A9B407 /* Resources */ = {
|
|
||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
840F62722E7B65B900C8A64A /* Assets.xcassets in Resources */,
|
||||||
);
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
22FB3B882E18135A00A9B407 /* Sources */ = {
|
840F62612E7B65B700C8A64A /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
};
|
|
||||||
22FB3B9E2E18135B00A9B407 /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
};
|
|
||||||
22FB3BA82E18135B00A9B407 /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
840F626D2E7B65B700C8A64A /* ViewController.swift in Sources */,
|
||||||
|
840F62692E7B65B700C8A64A /* AppDelegate.swift in Sources */,
|
||||||
);
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXTargetDependency section */
|
|
||||||
22FB3BA42E18135B00A9B407 /* PBXTargetDependency */ = {
|
|
||||||
isa = PBXTargetDependency;
|
|
||||||
target = 22FB3B8B2E18135A00A9B407 /* ImageViewer */;
|
|
||||||
targetProxy = 22FB3BA32E18135B00A9B407 /* PBXContainerItemProxy */;
|
|
||||||
};
|
|
||||||
22FB3BAE2E18135B00A9B407 /* PBXTargetDependency */ = {
|
|
||||||
isa = PBXTargetDependency;
|
|
||||||
target = 22FB3B8B2E18135A00A9B407 /* ImageViewer */;
|
|
||||||
targetProxy = 22FB3BAD2E18135B00A9B407 /* PBXContainerItemProxy */;
|
|
||||||
};
|
|
||||||
/* End PBXTargetDependency section */
|
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
/* Begin XCBuildConfiguration section */
|
||||||
22FB3BB62E18135B00A9B407 /* Debug configuration for PBXNativeTarget "ImageViewer" */ = {
|
840F62772E7B65B900C8A64A /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
|
||||||
DEVELOPMENT_TEAM = U5B4RH73LN;
|
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
|
||||||
INFOPLIST_FILE = ImageViewer/Info.plist;
|
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
|
||||||
"$(inherited)",
|
|
||||||
"@executable_path/Frameworks",
|
|
||||||
);
|
|
||||||
MARKETING_VERSION = 1.0;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewer;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
|
||||||
SWIFT_VERSION = 5.0;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
22FB3BB72E18135B00A9B407 /* Release configuration for PBXNativeTarget "ImageViewer" */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
|
||||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
|
||||||
DEVELOPMENT_TEAM = U5B4RH73LN;
|
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
|
||||||
INFOPLIST_FILE = ImageViewer/Info.plist;
|
|
||||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
|
||||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
|
||||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
|
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
|
||||||
"$(inherited)",
|
|
||||||
"@executable_path/Frameworks",
|
|
||||||
);
|
|
||||||
MARKETING_VERSION = 1.0;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewer;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
|
||||||
SWIFT_VERSION = 5.0;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
22FB3BB82E18135B00A9B407 /* Debug configuration for PBXProject "ImageViewer" */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
@@ -349,8 +171,7 @@
|
|||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
@@ -364,22 +185,21 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
|
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
|
||||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
22FB3BB92E18135B00A9B407 /* Release configuration for PBXProject "ImageViewer" */ = {
|
840F62782E7B65B900C8A64A /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
|
||||||
CLANG_ANALYZER_NONNULL = YES;
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
@@ -412,8 +232,7 @@
|
|||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_NS_ASSERTIONS = NO;
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
@@ -421,120 +240,92 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
|
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
22FB3BBB2E18135B00A9B407 /* Debug configuration for PBXNativeTarget "ImageViewerTests" */ = {
|
840F627A2E7B65B900C8A64A /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
|
INFOPLIST_FILE = ImageViewer/Info.plist;
|
||||||
|
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
|
||||||
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewer;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImageViewer.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ImageViewer";
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
22FB3BBC2E18135B00A9B407 /* Release configuration for PBXNativeTarget "ImageViewerTests" */ = {
|
840F627B2E7B65B900C8A64A /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEVELOPMENT_TEAM = U5B4RH73LN;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 18.5;
|
INFOPLIST_FILE = ImageViewer/Info.plist;
|
||||||
|
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
|
||||||
|
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
|
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
);
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewer;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImageViewer.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ImageViewer";
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
22FB3BBE2E18135B00A9B407 /* Debug configuration for PBXNativeTarget "ImageViewerUITests" */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
|
||||||
MARKETING_VERSION = 1.0;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewerUITests;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
|
||||||
SWIFT_VERSION = 5.0;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
|
||||||
TEST_TARGET_NAME = ImageViewer;
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
22FB3BBF2E18135B00A9B407 /* Release configuration for PBXNativeTarget "ImageViewerUITests" */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
|
||||||
MARKETING_VERSION = 1.0;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = ImageViewer.ImageViewerUITests;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
|
||||||
SWIFT_VERSION = 5.0;
|
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
|
||||||
TEST_TARGET_NAME = ImageViewer;
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
22FB3B872E18135A00A9B407 /* Build configuration list for PBXProject "ImageViewer" */ = {
|
840F62602E7B65B700C8A64A /* Build configuration list for PBXProject "ImageViewer" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
22FB3BB82E18135B00A9B407 /* Debug configuration for PBXProject "ImageViewer" */,
|
840F62772E7B65B900C8A64A /* Debug */,
|
||||||
22FB3BB92E18135B00A9B407 /* Release configuration for PBXProject "ImageViewer" */,
|
840F62782E7B65B900C8A64A /* Release */,
|
||||||
);
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
22FB3BB52E18135B00A9B407 /* Build configuration list for PBXNativeTarget "ImageViewer" */ = {
|
840F62792E7B65B900C8A64A /* Build configuration list for PBXNativeTarget "ImageViewer" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
22FB3BB62E18135B00A9B407 /* Debug configuration for PBXNativeTarget "ImageViewer" */,
|
840F627A2E7B65B900C8A64A /* Debug */,
|
||||||
22FB3BB72E18135B00A9B407 /* Release configuration for PBXNativeTarget "ImageViewer" */,
|
840F627B2E7B65B900C8A64A /* Release */,
|
||||||
);
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
22FB3BBA2E18135B00A9B407 /* Build configuration list for PBXNativeTarget "ImageViewerTests" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
22FB3BBB2E18135B00A9B407 /* Debug configuration for PBXNativeTarget "ImageViewerTests" */,
|
|
||||||
22FB3BBC2E18135B00A9B407 /* Release configuration for PBXNativeTarget "ImageViewerTests" */,
|
|
||||||
);
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
22FB3BBD2E18135B00A9B407 /* Build configuration list for PBXNativeTarget "ImageViewerUITests" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
22FB3BBE2E18135B00A9B407 /* Debug configuration for PBXNativeTarget "ImageViewerUITests" */,
|
|
||||||
22FB3BBF2E18135B00A9B407 /* Release configuration for PBXNativeTarget "ImageViewerUITests" */,
|
|
||||||
);
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
};
|
};
|
||||||
rootObject = 22FB3B842E18135A00A9B407 /* Project object */;
|
rootObject = 840F625D2E7B65B700C8A64A /* Project object */;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,7 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>SchemeUserState</key>
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
<dict>
|
<true/>
|
||||||
<key>ImageViewer.xcscheme_^#shared#^_</key>
|
|
||||||
<dict>
|
|
||||||
<key>orderHint</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1420"
|
||||||
|
version = "1.3">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "840F62642E7B65B700C8A64A"
|
||||||
|
BuildableName = "ImageViewer.app"
|
||||||
|
BlueprintName = "ImageViewer"
|
||||||
|
ReferencedContainer = "container:ImageViewer.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
|
<Testables>
|
||||||
|
</Testables>
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "840F62642E7B65B700C8A64A"
|
||||||
|
BuildableName = "ImageViewer.app"
|
||||||
|
BlueprintName = "ImageViewer"
|
||||||
|
ReferencedContainer = "container:ImageViewer.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "OS_ACTIVITY_MODE"
|
||||||
|
value = "disable"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "840F62642E7B65B700C8A64A"
|
||||||
|
BuildableName = "ImageViewer.app"
|
||||||
|
BlueprintName = "ImageViewer"
|
||||||
|
ReferencedContainer = "container:ImageViewer.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -2,12 +2,11 @@ import UIKit
|
|||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
|
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
|
||||||
func application(
|
func application(
|
||||||
_ application: UIApplication,
|
_: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
window = UIWindow(frame: UIScreen.main.bounds)
|
window = UIWindow(frame: UIScreen.main.bounds)
|
||||||
window?.rootViewController = ViewController()
|
window?.rootViewController = ViewController()
|
||||||
|
|||||||
@@ -5,28 +5,6 @@
|
|||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"size" : "1024x1024"
|
"size" : "1024x1024"
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "dark"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"appearances" : [
|
|
||||||
{
|
|
||||||
"appearance" : "luminosity",
|
|
||||||
"value" : "tinted"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"idiom" : "universal",
|
|
||||||
"platform" : "ios",
|
|
||||||
"size" : "1024x1024"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
//TODO: Anilist support?
|
// TODO: Anilist support?
|
||||||
//TODO: Properly avoid swallowing of input from UICollectionView used for scrolling
|
// TODO: Properly avoid swallowing of input from UICollectionView used for scrolling
|
||||||
//TODO: Convert between state for normal and scrolling page turn
|
// TODO: Convert between state for normal and scrolling page turn
|
||||||
//TODO: Support reading with scrolling and landscape mode
|
// TODO: Support reading with scrolling and landscape mode
|
||||||
//FIXME: Update comicCollectionView when switching between landscape and portrait mode
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
@@ -102,9 +101,10 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
|
|
||||||
var imageView = UIImageView()
|
var imageView = UIImageView()
|
||||||
var mode = PageTurnMode.leftToRight
|
var mode = PageTurnMode.leftToRight
|
||||||
|
var metadataList: [URL: Metadata] = [:]
|
||||||
var metadata: Metadata!
|
var metadata: Metadata!
|
||||||
var currentPage: Int! = nil
|
var currentPage: Int!
|
||||||
var progress = ProgressIndices.init(v: 0, c: 0, i: 0)
|
var progress = ProgressIndices(v: 0, c: 0, i: 0)
|
||||||
var currentPath: URL!
|
var currentPath: URL!
|
||||||
|
|
||||||
var changedOrientation = false
|
var changedOrientation = false
|
||||||
@@ -136,7 +136,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
var comics: [Comic] = []
|
var comics: [Comic] = []
|
||||||
@IBOutlet var comicCollectionView: UICollectionView!
|
@IBOutlet var comicCollectionView: UICollectionView!
|
||||||
|
|
||||||
let imageLoader = ImageLoader.init()
|
let imageLoader = ImageLoader()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@@ -198,7 +198,8 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
comicCollectionView.delegate = self
|
comicCollectionView.delegate = self
|
||||||
comicCollectionView.backgroundColor = .white
|
comicCollectionView.backgroundColor = .white
|
||||||
comicCollectionView.register(
|
comicCollectionView.register(
|
||||||
ComicImageCell.self, forCellWithReuseIdentifier: "ComicImageCell")
|
ComicImageCell.self, forCellWithReuseIdentifier: "ComicImageCell"
|
||||||
|
)
|
||||||
homeView.addSubview(comicCollectionView)
|
homeView.addSubview(comicCollectionView)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,23 +228,26 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
getMetadataFromFileName(path: dir)
|
getMetadataFromFileName(path: dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentPath = dir
|
||||||
|
|
||||||
|
metadata = try JSONDecoder().decode(
|
||||||
|
Metadata.self,
|
||||||
|
from:
|
||||||
|
Data(
|
||||||
|
String(
|
||||||
|
contentsOfFile: dir.appendingPathComponent(
|
||||||
|
"metadata.json"
|
||||||
|
)
|
||||||
|
.path
|
||||||
|
).utf8)
|
||||||
|
)
|
||||||
|
metadataList[dir] = metadata
|
||||||
|
loadLocalState()
|
||||||
comics.append(
|
comics.append(
|
||||||
Comic(
|
Comic(
|
||||||
cover:
|
cover: UIImage(contentsOfFile: getImagePath(progress: ProgressIndices(v: progress.v, c: 0, i: 0)).path)!,
|
||||||
UIImage(
|
metadata: metadata,
|
||||||
contentsOfFile: dir.appendingPathComponent("cover.jpg").path)!,
|
path: dir
|
||||||
metadata: try JSONDecoder().decode(
|
|
||||||
Metadata.self,
|
|
||||||
from:
|
|
||||||
Data(
|
|
||||||
try String(
|
|
||||||
contentsOfFile: dir.appendingPathComponent(
|
|
||||||
"metadata.json"
|
|
||||||
)
|
|
||||||
.path
|
|
||||||
).utf8),
|
|
||||||
),
|
|
||||||
path: dir,
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -261,25 +265,29 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func convertColorToString(color: UIColor) -> String {
|
func convertColorToString(color: UIColor) -> String {
|
||||||
return switch color {
|
let r: String!
|
||||||
case .white: "white"
|
switch color {
|
||||||
case .gray: "gray"
|
case .white: r = "white"
|
||||||
case .black: "black"
|
case .gray: r = "gray"
|
||||||
case .red: "red"
|
case .black: r = "black"
|
||||||
case .blue: "blue"
|
case .red: r = "red"
|
||||||
default: "black"
|
case .blue: r = "blue"
|
||||||
|
default: r = "black"
|
||||||
}
|
}
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertStringToColor(str: String) -> UIColor {
|
func convertStringToColor(str: String) -> UIColor {
|
||||||
return switch str {
|
let r: UIColor!
|
||||||
case "white": .white
|
switch str {
|
||||||
case "gray": .gray
|
case "white": r = .white
|
||||||
case "black": .black
|
case "gray": r = .gray
|
||||||
case "red": .red
|
case "black": r = .black
|
||||||
case "blue": .blue
|
case "red": r = .red
|
||||||
default: .black
|
case "blue": r = .blue
|
||||||
|
default: r = .black
|
||||||
}
|
}
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMetadataFromFileName(path: URL) {
|
func getMetadataFromFileName(path: URL) {
|
||||||
@@ -298,11 +306,11 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var metadata = Metadata.init(
|
var newMetadata = Metadata(
|
||||||
title: "",
|
title: "",
|
||||||
original_language: "",
|
original_language: "",
|
||||||
last_volume: MetaValue.init(main: 0, bonus: nil),
|
last_volume: MetaValue(main: 0, bonus: nil),
|
||||||
last_chapter: MetaValue.init(main: 0, bonus: nil),
|
last_chapter: MetaValue(main: 0, bonus: nil),
|
||||||
chapter_count: 0,
|
chapter_count: 0,
|
||||||
publication_demographic: "",
|
publication_demographic: "",
|
||||||
status: "",
|
status: "",
|
||||||
@@ -342,61 +350,71 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
|
|
||||||
if currentVolume != nil {
|
if currentVolume != nil {
|
||||||
if volume != currentVolume {
|
if volume != currentVolume {
|
||||||
metadata.chapter_count += 1
|
newMetadata.chapter_count += 1
|
||||||
assert(volume > currentVolume)
|
assert(volume > currentVolume)
|
||||||
metadata.volumes.append(
|
newMetadata.volumes.append(
|
||||||
VolumeMetadata.init(
|
VolumeMetadata(
|
||||||
volume: MetaValue.init(main: volume, bonus: nil), name: nil,
|
volume: MetaValue(main: volume, bonus: nil), name: nil,
|
||||||
chapters: [
|
chapters: [
|
||||||
ChapterMetadata.init(
|
ChapterMetadata(
|
||||||
chapter: MetaValue.init(
|
chapter: MetaValue(
|
||||||
main: chapter.0, bonus: chapter.1),
|
main: chapter.0, bonus: chapter.1
|
||||||
|
),
|
||||||
name: "",
|
name: "",
|
||||||
images: [
|
images: [
|
||||||
ImageMetadata.init(
|
ImageMetadata(
|
||||||
doublePage: doublePage, fileName: fileName,
|
doublePage: doublePage, fileName: fileName,
|
||||||
firstPage: page)
|
firstPage: page
|
||||||
])
|
),
|
||||||
]))
|
]
|
||||||
|
),
|
||||||
|
]
|
||||||
|
))
|
||||||
} else if chapter != currentChapter {
|
} else if chapter != currentChapter {
|
||||||
metadata.chapter_count += 1
|
newMetadata.chapter_count += 1
|
||||||
if chapter.0 == currentChapter.0 {
|
if chapter.0 == currentChapter.0 {
|
||||||
assert(chapter.1! == currentChapter.1 ?? 1)
|
assert(chapter.1! == currentChapter.1 ?? 1)
|
||||||
} else {
|
} else {
|
||||||
assert(chapter.0 == currentChapter.0 + 1)
|
assert(chapter.0 == currentChapter.0 + 1)
|
||||||
}
|
}
|
||||||
metadata.volumes[metadata.volumes.count - 1].chapters.append(
|
newMetadata.volumes[newMetadata.volumes.count - 1].chapters.append(
|
||||||
ChapterMetadata.init(
|
ChapterMetadata(
|
||||||
chapter: MetaValue.init(main: chapter.0, bonus: chapter.1),
|
chapter: MetaValue(main: chapter.0, bonus: chapter.1),
|
||||||
name: "",
|
name: "",
|
||||||
images: [
|
images: [
|
||||||
ImageMetadata.init(
|
ImageMetadata(
|
||||||
doublePage: doublePage, fileName: fileName,
|
doublePage: doublePage, fileName: fileName,
|
||||||
firstPage: page)
|
firstPage: page
|
||||||
]))
|
),
|
||||||
|
]
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
metadata.volumes[metadata.volumes.count - 1].chapters[
|
newMetadata.volumes[newMetadata.volumes.count - 1].chapters[
|
||||||
metadata.volumes[metadata.volumes.count - 1].chapters.count - 1
|
newMetadata.volumes[newMetadata.volumes.count - 1].chapters.count - 1
|
||||||
].images.append(
|
].images.append(
|
||||||
ImageMetadata.init(
|
ImageMetadata(
|
||||||
doublePage: doublePage, fileName: fileName, firstPage: page)
|
doublePage: doublePage, fileName: fileName, firstPage: page
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
metadata.chapter_count += 1
|
newMetadata.chapter_count += 1
|
||||||
metadata.volumes.append(
|
newMetadata.volumes.append(
|
||||||
VolumeMetadata.init(
|
VolumeMetadata(
|
||||||
volume: MetaValue.init(main: volume, bonus: nil), name: nil,
|
volume: MetaValue(main: volume, bonus: nil), name: nil,
|
||||||
chapters: [
|
chapters: [
|
||||||
ChapterMetadata.init(
|
ChapterMetadata(
|
||||||
chapter: MetaValue.init(main: chapter.0, bonus: chapter.1),
|
chapter: MetaValue(main: chapter.0, bonus: chapter.1),
|
||||||
name: "",
|
name: "",
|
||||||
images: [
|
images: [
|
||||||
ImageMetadata.init(
|
ImageMetadata(
|
||||||
doublePage: doublePage, fileName: fileName,
|
doublePage: doublePage, fileName: fileName,
|
||||||
firstPage: page)
|
firstPage: page
|
||||||
])
|
),
|
||||||
]))
|
]
|
||||||
|
),
|
||||||
|
]
|
||||||
|
))
|
||||||
}
|
}
|
||||||
currentVolume = volume
|
currentVolume = volume
|
||||||
currentChapter = chapter
|
currentChapter = chapter
|
||||||
@@ -406,16 +424,18 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
print("failed reading image file names")
|
print("failed reading image file names")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metadata = newMetadata
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let encoder = JSONEncoder()
|
let encoder = JSONEncoder()
|
||||||
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
|
encoder.outputFormatting = [.prettyPrinted]
|
||||||
encoder.keyEncodingStrategy = .useDefaultKeys
|
encoder.keyEncodingStrategy = .useDefaultKeys
|
||||||
try encoder.encode(
|
try encoder.encode(
|
||||||
metadata
|
newMetadata
|
||||||
).write(
|
).write(
|
||||||
to: path.appendingPathComponent(outFileName))
|
to: path.appendingPathComponent(outFileName))
|
||||||
} catch {
|
} catch {
|
||||||
print("failed to save metadata")
|
print("failed to save generated metadata")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,23 +446,29 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
if screenSize.width > screenSize.height {
|
if screenSize.width > screenSize.height {
|
||||||
scrollOffset.y *= (screenSize.height / screenSize.width)
|
scrollOffset.y *= (screenSize.height / screenSize.width)
|
||||||
}
|
}
|
||||||
let progress: ReadProgress =
|
var newProgress =
|
||||||
switch mode {
|
ReadProgress.leftToRight(
|
||||||
case .leftToRight:
|
volumeIndex: progress.v, chapterIndex: progress.c,
|
||||||
ReadProgress.leftToRight(
|
imageIndex: progress.i
|
||||||
volumeIndex: progress.v, chapterIndex: progress.c,
|
)
|
||||||
imageIndex: progress.i)
|
|
||||||
case .rightToLeft:
|
switch mode {
|
||||||
ReadProgress.rightToLeft(
|
case .leftToRight:
|
||||||
volumeIndex: progress.v, chapterIndex: progress.c,
|
newProgress = ReadProgress.leftToRight(
|
||||||
imageIndex: progress.i)
|
volumeIndex: progress.v, chapterIndex: progress.c,
|
||||||
case .scroll: ReadProgress.scroll(scrollOffset)
|
imageIndex: progress.i
|
||||||
}
|
)
|
||||||
|
case .rightToLeft: newProgress = ReadProgress.rightToLeft(
|
||||||
|
volumeIndex: progress.v, chapterIndex: progress.c,
|
||||||
|
imageIndex: progress.i
|
||||||
|
)
|
||||||
|
case .scroll: newProgress = ReadProgress.scroll(scrollOffset)
|
||||||
|
}
|
||||||
queue.async {
|
queue.async {
|
||||||
do {
|
do {
|
||||||
try JSONEncoder().encode(
|
try JSONEncoder().encode(
|
||||||
LocalState(
|
LocalState(
|
||||||
progress: progress, backgroundColor: self.convertColorToString(color: color)
|
progress: newProgress, backgroundColor: self.convertColorToString(color: color)
|
||||||
)
|
)
|
||||||
).write(
|
).write(
|
||||||
to: self.currentPath.appendingPathComponent("state.json"))
|
to: self.currentPath.appendingPathComponent("state.json"))
|
||||||
@@ -454,23 +480,23 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
|
|
||||||
func loadLocalState() {
|
func loadLocalState() {
|
||||||
do {
|
do {
|
||||||
let json = Data(
|
let json = try Data(
|
||||||
try String(
|
String(
|
||||||
contentsOfFile: currentPath.appendingPathComponent("state.json").path
|
contentsOfFile: currentPath.appendingPathComponent("state.json").path
|
||||||
).utf8)
|
).utf8)
|
||||||
let local = try JSONDecoder().decode(LocalState.self, from: json)
|
let local = try JSONDecoder().decode(LocalState.self, from: json)
|
||||||
switch local.progress {
|
switch local.progress {
|
||||||
case .leftToRight(let volumeIndex, let chapterIndex, let imageIndex):
|
case let .leftToRight(volumeIndex, chapterIndex, imageIndex):
|
||||||
progress.v = volumeIndex
|
progress.v = volumeIndex
|
||||||
progress.c = chapterIndex
|
progress.c = chapterIndex
|
||||||
progress.i = imageIndex
|
progress.i = imageIndex
|
||||||
mode = .leftToRight
|
mode = .leftToRight
|
||||||
case .rightToLeft(let volumeIndex, let chapterIndex, let imageIndex):
|
case let .rightToLeft(volumeIndex, chapterIndex, imageIndex):
|
||||||
progress.v = volumeIndex
|
progress.v = volumeIndex
|
||||||
progress.c = chapterIndex
|
progress.c = chapterIndex
|
||||||
progress.i = imageIndex
|
progress.i = imageIndex
|
||||||
mode = .rightToLeft
|
mode = .rightToLeft
|
||||||
case .scroll(let point):
|
case let .scroll(point):
|
||||||
if scrollPos == nil {
|
if scrollPos == nil {
|
||||||
scrollPos = point
|
scrollPos = point
|
||||||
let screenSize = UIScreen.main.bounds.size
|
let screenSize = UIScreen.main.bounds.size
|
||||||
@@ -480,13 +506,13 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
}
|
}
|
||||||
if let indexPath = scrollingCollectionView.indexPathForItem(at: scrollOffset) {
|
if let indexPath = scrollingCollectionView.indexPathForItem(at: scrollOffset) {
|
||||||
var theProgress = ProgressIndices(v: 0, c: 0, i: 0)
|
var theProgress = ProgressIndices(v: 0, c: 0, i: 0)
|
||||||
for _ in 0...indexPath.item {
|
for _ in 0 ... indexPath.item {
|
||||||
theProgress = getProgressIndicesFromTurn(
|
theProgress = getProgressIndicesFromTurn(
|
||||||
turn: .next, progress: theProgress)
|
turn: .next, progress: theProgress
|
||||||
|
)
|
||||||
}
|
}
|
||||||
progress = theProgress
|
progress = theProgress
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
mode = .scroll
|
mode = .scroll
|
||||||
}
|
}
|
||||||
@@ -510,11 +536,12 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
setupTapZones()
|
setupTapZones()
|
||||||
}
|
}
|
||||||
|
|
||||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
func scrollViewDidScroll(_: UIScrollView) {
|
||||||
if scrollingCollectionView.isHidden { return }
|
if scrollingCollectionView.isHidden { return }
|
||||||
let centerPoint = CGPoint(
|
let centerPoint = CGPoint(
|
||||||
x: scrollingCollectionView.bounds.midX + scrollingCollectionView.contentOffset.x,
|
x: scrollingCollectionView.bounds.midX + scrollingCollectionView.contentOffset.x,
|
||||||
y: scrollingCollectionView.bounds.midY + scrollingCollectionView.contentOffset.y)
|
y: scrollingCollectionView.bounds.midY + scrollingCollectionView.contentOffset.y
|
||||||
|
)
|
||||||
|
|
||||||
if let indexPath = scrollingCollectionView.indexPathForItem(at: centerPoint) {
|
if let indexPath = scrollingCollectionView.indexPathForItem(at: centerPoint) {
|
||||||
let (chapter, page) = chapterAndPages[indexPath.item]
|
let (chapter, page) = chapterAndPages[indexPath.item]
|
||||||
@@ -533,7 +560,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !hasSetContentOffset && scrollPos != nil {
|
if !hasSetContentOffset, scrollPos != nil {
|
||||||
let screenSize = UIScreen.main.bounds.size
|
let screenSize = UIScreen.main.bounds.size
|
||||||
var offset = scrollPos!
|
var offset = scrollPos!
|
||||||
if screenSize.width > screenSize.height {
|
if screenSize.width > screenSize.height {
|
||||||
@@ -557,7 +584,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
if let path = getPathFromComicName(name: name) {
|
if let path = getPathFromComicName(name: name) {
|
||||||
currentPath = path
|
currentPath = path
|
||||||
|
|
||||||
metadata = getMetadata(path: path)!
|
metadata = metadataList[path]
|
||||||
|
|
||||||
globalState.comicName = metadata.title
|
globalState.comicName = metadata.title
|
||||||
saveGlobalState()
|
saveGlobalState()
|
||||||
@@ -586,17 +613,17 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
var count = 0
|
var count = 0
|
||||||
if let enumerator = fileManager.enumerator(
|
if let enumerator = fileManager.enumerator(
|
||||||
at: currentPath, includingPropertiesForKeys: [.isDirectoryKey],
|
at: currentPath, includingPropertiesForKeys: [.isDirectoryKey],
|
||||||
options: [.skipsHiddenFiles])
|
options: [.skipsHiddenFiles]
|
||||||
{
|
) {
|
||||||
for case let dir as URL in enumerator {
|
for case let dir as URL in enumerator {
|
||||||
do {
|
do {
|
||||||
if let enumerator = fileManager.enumerator(
|
if let enumerator = fileManager.enumerator(
|
||||||
at: dir, includingPropertiesForKeys: [.isRegularFileKey],
|
at: dir, includingPropertiesForKeys: [.isRegularFileKey],
|
||||||
options: [.skipsHiddenFiles])
|
options: [.skipsHiddenFiles]
|
||||||
{
|
) {
|
||||||
for case let file as URL in enumerator {
|
for case let file as URL in enumerator {
|
||||||
let resourceValues = try file.resourceValues(forKeys: [
|
let resourceValues = try file.resourceValues(forKeys: [
|
||||||
.isRegularFileKey
|
.isRegularFileKey,
|
||||||
])
|
])
|
||||||
if resourceValues.isRegularFile == true {
|
if resourceValues.isRegularFile == true {
|
||||||
count += 1
|
count += 1
|
||||||
@@ -617,14 +644,16 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
layout.minimumInteritemSpacing = 0
|
layout.minimumInteritemSpacing = 0
|
||||||
layout.minimumLineSpacing = 0
|
layout.minimumLineSpacing = 0
|
||||||
scrollingCollectionView = UICollectionView(
|
scrollingCollectionView = UICollectionView(
|
||||||
frame: view.bounds, collectionViewLayout: layout)
|
frame: view.bounds, collectionViewLayout: layout
|
||||||
|
)
|
||||||
scrollingCollectionView.translatesAutoresizingMaskIntoConstraints = false
|
scrollingCollectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
scrollingCollectionView.dataSource = self
|
scrollingCollectionView.dataSource = self
|
||||||
scrollingCollectionView.delegate = self
|
scrollingCollectionView.delegate = self
|
||||||
scrollingCollectionView.backgroundColor = .white
|
scrollingCollectionView.backgroundColor = .white
|
||||||
scrollingCollectionView.isHidden = true
|
scrollingCollectionView.isHidden = true
|
||||||
scrollingCollectionView.register(
|
scrollingCollectionView.register(
|
||||||
ScrollingImageCell.self, forCellWithReuseIdentifier: "ScrollingImageCell")
|
ScrollingImageCell.self, forCellWithReuseIdentifier: "ScrollingImageCell"
|
||||||
|
)
|
||||||
readerView.addSubview(scrollingCollectionView)
|
readerView.addSubview(scrollingCollectionView)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
@@ -690,7 +719,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
readerView.addSubview(bottomBarView)
|
readerView.addSubview(bottomBarView)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
topBarView.topAnchor.constraint(equalTo: readerView.safeAreaLayoutGuide.topAnchor),
|
topBarView.topAnchor.constraint(equalTo: readerView.topAnchor),
|
||||||
topBarView.leadingAnchor.constraint(equalTo: readerView.leadingAnchor),
|
topBarView.leadingAnchor.constraint(equalTo: readerView.leadingAnchor),
|
||||||
topBarView.trailingAnchor.constraint(equalTo: readerView.trailingAnchor),
|
topBarView.trailingAnchor.constraint(equalTo: readerView.trailingAnchor),
|
||||||
topBarView.heightAnchor.constraint(equalToConstant: 64),
|
topBarView.heightAnchor.constraint(equalToConstant: 64),
|
||||||
@@ -901,7 +930,8 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
} else {
|
} else {
|
||||||
imageLoader.loadImage(
|
imageLoader.loadImage(
|
||||||
at: getImagePath(progress: progress),
|
at: getImagePath(progress: progress),
|
||||||
scaling: .scaleAspectFit
|
scaling: .scaleAspectFit,
|
||||||
|
screenSize: UIScreen.main.bounds.size
|
||||||
) { [weak self] image in
|
) { [weak self] image in
|
||||||
self?.imageView.image = image
|
self?.imageView.image = image
|
||||||
}
|
}
|
||||||
@@ -938,8 +968,8 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func gestureRecognizer(
|
func gestureRecognizer(
|
||||||
_ gestureRecognizer: UIGestureRecognizer,
|
_: UIGestureRecognizer,
|
||||||
shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer
|
shouldRecognizeSimultaneouslyWith _: UIGestureRecognizer
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -954,13 +984,13 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
func scrollViewDidEndDecelerating(_: UIScrollView) {
|
||||||
if scrollingCollectionView.isHidden { return }
|
if scrollingCollectionView.isHidden { return }
|
||||||
updateInfo()
|
updateInfo()
|
||||||
saveLocalState()
|
saveLocalState()
|
||||||
}
|
}
|
||||||
|
|
||||||
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
func scrollViewDidEndDragging(_: UIScrollView, willDecelerate decelerate: Bool) {
|
||||||
if scrollingCollectionView.isHidden { return }
|
if scrollingCollectionView.isHidden { return }
|
||||||
if !decelerate {
|
if !decelerate {
|
||||||
updateInfo()
|
updateInfo()
|
||||||
@@ -1033,13 +1063,12 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
let scaling = UIView.ContentMode.scaleAspectFit
|
let scaling = UIView.ContentMode.scaleAspectFit
|
||||||
var newProgress = progress
|
var newProgress = progress
|
||||||
newProgress = getProgressIndicesFromTurn(turn: turn, progress: newProgress)
|
newProgress = getProgressIndicesFromTurn(turn: turn, progress: newProgress)
|
||||||
if newProgress.v == progress.v && newProgress.c == progress.c && newProgress.i == progress.i
|
if newProgress.v == progress.v, newProgress.c == progress.c, newProgress.i == progress.i {
|
||||||
{
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
progress = newProgress
|
progress = newProgress
|
||||||
if let path = getImagePath(progress: progress) {
|
if let path = getImagePath(progress: progress) {
|
||||||
imageLoader.loadImage(at: path, scaling: scaling) { [weak self] image in
|
imageLoader.loadImage(at: path, scaling: scaling, screenSize: UIScreen.main.bounds.size) { [weak self] image in
|
||||||
self?.imageView.image = image
|
self?.imageView.image = image
|
||||||
self?.updateInfo()
|
self?.updateInfo()
|
||||||
}
|
}
|
||||||
@@ -1047,10 +1076,10 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _ in 0...preloadCount {
|
for _ in 0 ... preloadCount {
|
||||||
newProgress = getProgressIndicesFromTurn(turn: .next, progress: newProgress)
|
newProgress = getProgressIndicesFromTurn(turn: .next, progress: newProgress)
|
||||||
if let path = getImagePath(progress: newProgress) {
|
if let path = getImagePath(progress: newProgress) {
|
||||||
imageLoader.preloadImage(at: path, scaling: scaling)
|
imageLoader.preloadImage(at: path, scaling: scaling, screenSize: UIScreen.main.bounds.size)
|
||||||
} else {
|
} else {
|
||||||
print("could not preload image")
|
print("could not preload image")
|
||||||
}
|
}
|
||||||
@@ -1060,11 +1089,13 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func metaValueToString(m: MetaValue) -> String {
|
func metaValueToString(m: MetaValue) -> String {
|
||||||
|
var r = ""
|
||||||
if let bonus = m.bonus {
|
if let bonus = m.bonus {
|
||||||
String(m.main) + "." + String(bonus)
|
r = String(m.main) + "." + String(bonus)
|
||||||
} else {
|
} else {
|
||||||
String(m.main)
|
r = String(m.main)
|
||||||
}
|
}
|
||||||
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateInfo() {
|
func updateInfo() {
|
||||||
@@ -1088,27 +1119,27 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
let lastVolumeValue = metadata.last_volume
|
let lastVolumeValue = metadata.last_volume
|
||||||
let lastVolumeString = metaValueToString(m: lastVolumeValue)
|
let lastVolumeString = metaValueToString(m: lastVolumeValue)
|
||||||
|
|
||||||
let lastVolumeIndex = metadata.volumes.count - 1
|
let lastChapterIndex = metadata.volumes[progress.v].chapters.count - 1
|
||||||
let lastChapterIndex = metadata.volumes[lastVolumeIndex].chapters.count - 1
|
|
||||||
let lastImageIndex =
|
let lastImageIndex =
|
||||||
metadata.volumes[lastVolumeIndex].chapters[lastChapterIndex].images.count - 1
|
metadata.volumes[progress.v].chapters[lastChapterIndex].images.count - 1
|
||||||
|
|
||||||
let lastImage = metadata.volumes[lastVolumeIndex].chapters[lastChapterIndex].images[
|
let lastImage = metadata.volumes[progress.v].chapters[lastChapterIndex].images[
|
||||||
lastImageIndex]
|
lastImageIndex
|
||||||
let lastPageString =
|
]
|
||||||
if lastImage.doublePage {
|
var lastPageString = ""
|
||||||
String(lastImage.firstPage + 1)
|
if lastImage.doublePage {
|
||||||
} else {
|
lastPageString = String(lastImage.firstPage + 1)
|
||||||
String(lastImage.firstPage)
|
} else {
|
||||||
}
|
lastPageString = String(lastImage.firstPage)
|
||||||
|
}
|
||||||
|
|
||||||
let currentImage = metadata.volumes[progress.v].chapters[progress.c].images[progress.i]
|
let currentImage = metadata.volumes[progress.v].chapters[progress.c].images[progress.i]
|
||||||
let pageString =
|
var pageString = ""
|
||||||
if currentImage.doublePage {
|
if currentImage.doublePage {
|
||||||
String(currentImage.firstPage) + "-" + String(currentImage.firstPage + 1)
|
pageString = String(currentImage.firstPage) + "-" + String(currentImage.firstPage + 1)
|
||||||
} else {
|
} else {
|
||||||
String(currentImage.firstPage)
|
pageString = String(currentImage.firstPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
text +=
|
text +=
|
||||||
"""
|
"""
|
||||||
@@ -1122,19 +1153,6 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
info.text = text
|
info.text = text
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatNumber(_ value: Float) -> String {
|
|
||||||
let integerPart = Int(value)
|
|
||||||
let fractionalPart = value - Float(integerPart)
|
|
||||||
|
|
||||||
if fractionalPart == 0 {
|
|
||||||
return String(format: "%04d", integerPart)
|
|
||||||
} else {
|
|
||||||
// Convert fractional part to string without leading "0"
|
|
||||||
let fractionalString = String(String(value).split(separator: ".")[1])
|
|
||||||
return String(format: "%04d.%@", integerPart, fractionalString)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getImagePath(progress: ProgressIndices) -> URL! {
|
func getImagePath(progress: ProgressIndices) -> URL! {
|
||||||
let (v, c, i) = (progress.v, progress.c, progress.i)
|
let (v, c, i) = (progress.v, progress.c, progress.i)
|
||||||
let modernPath = currentPath.appendingPathComponent("images").appendingPathComponent(
|
let modernPath = currentPath.appendingPathComponent("images").appendingPathComponent(
|
||||||
@@ -1151,37 +1169,39 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
switch turn {
|
switch turn {
|
||||||
case .next:
|
case .next:
|
||||||
if metadata.volumes[v].chapters[c].images.count > i + 1 {
|
if metadata.volumes[v].chapters[c].images.count > i + 1 {
|
||||||
return ProgressIndices.init(v: v, c: c, i: i + 1)
|
return ProgressIndices(v: v, c: c, i: i + 1)
|
||||||
}
|
}
|
||||||
if metadata.volumes[v].chapters.count > c + 1 {
|
if metadata.volumes[v].chapters.count > c + 1 {
|
||||||
return ProgressIndices.init(v: v, c: c + 1, i: 0)
|
return ProgressIndices(v: v, c: c + 1, i: 0)
|
||||||
}
|
}
|
||||||
if metadata.volumes.count > v + 1 {
|
if metadata.volumes.count > v + 1 {
|
||||||
return ProgressIndices.init(v: v + 1, c: 0, i: 0)
|
return ProgressIndices(v: v + 1, c: 0, i: 0)
|
||||||
}
|
}
|
||||||
case .previous:
|
case .previous:
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
return ProgressIndices.init(v: v, c: c, i: i - 1)
|
return ProgressIndices(v: v, c: c, i: i - 1)
|
||||||
}
|
}
|
||||||
if c > 0 {
|
if c > 0 {
|
||||||
return ProgressIndices.init(
|
return ProgressIndices(
|
||||||
v: v, c: c - 1, i: metadata.volumes[v].chapters[c - 1].images.count - 1)
|
v: v, c: c - 1, i: metadata.volumes[v].chapters[c - 1].images.count - 1
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if v > 0 {
|
if v > 0 {
|
||||||
return ProgressIndices.init(
|
return ProgressIndices(
|
||||||
v: v - 1, c: metadata.volumes[v - 1].chapters.count - 1,
|
v: v - 1, c: metadata.volumes[v - 1].chapters.count - 1,
|
||||||
i: metadata.volumes[v - 1].chapters[
|
i: metadata.volumes[v - 1].chapters[
|
||||||
metadata.volumes[v - 1].chapters.count - 1
|
metadata.volumes[v - 1].chapters.count - 1
|
||||||
].images.count - 1)
|
].images.count - 1
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ProgressIndices.init(v: v, c: c, i: i)
|
return ProgressIndices(v: v, c: c, i: i)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMetadata(path: URL) -> Metadata? {
|
func getMetadata(path: URL) -> Metadata? {
|
||||||
do {
|
do {
|
||||||
let json = Data(
|
let json = try Data(
|
||||||
try String(contentsOfFile: path.appendingPathComponent("metadata.json").path)
|
String(contentsOfFile: path.appendingPathComponent("metadata.json").path)
|
||||||
.utf8)
|
.utf8)
|
||||||
let metadata = try JSONDecoder().decode(Metadata.self, from: json)
|
let metadata = try JSONDecoder().decode(Metadata.self, from: json)
|
||||||
return metadata
|
return metadata
|
||||||
@@ -1194,24 +1214,25 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setImages(path: URL) {
|
func setImages(path _: URL) {
|
||||||
let scaling: UIView.ContentMode =
|
let scaling: UIView.ContentMode!
|
||||||
if mode == .scroll {
|
if mode == .scroll {
|
||||||
.scaleAspectFill
|
scaling = UIView.ContentMode.scaleAspectFill
|
||||||
} else { .scaleAspectFit }
|
} else { scaling = UIView.ContentMode.scaleAspectFit }
|
||||||
imageLoader.loadImage(
|
imageLoader.loadImage(
|
||||||
at:
|
at:
|
||||||
getImagePath(progress: progress),
|
getImagePath(progress: progress),
|
||||||
scaling: scaling
|
scaling: scaling,
|
||||||
|
screenSize: UIScreen.main.bounds.size
|
||||||
) { [weak self] image in
|
) { [weak self] image in
|
||||||
self?.imageView.image = image
|
self?.imageView.image = image
|
||||||
self?.updateInfo()
|
self?.updateInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
var newProgress = progress
|
var newProgress = progress
|
||||||
for _ in 0...preloadCount {
|
for _ in 0 ... preloadCount {
|
||||||
newProgress = getProgressIndicesFromTurn(turn: .next, progress: newProgress)
|
newProgress = getProgressIndicesFromTurn(turn: .next, progress: newProgress)
|
||||||
imageLoader.preloadImage(at: getImagePath(progress: newProgress), scaling: scaling)
|
imageLoader.preloadImage(at: getImagePath(progress: newProgress), scaling: scaling, screenSize: UIScreen.main.bounds.size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1231,7 +1252,8 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate {
|
|||||||
if mode != .scroll {
|
if mode != .scroll {
|
||||||
imageLoader.loadImage(
|
imageLoader.loadImage(
|
||||||
at: getImagePath(progress: progress),
|
at: getImagePath(progress: progress),
|
||||||
scaling: .scaleAspectFit
|
scaling: .scaleAspectFit,
|
||||||
|
screenSize: size
|
||||||
) { image in
|
) { image in
|
||||||
self.imageView.image = image
|
self.imageView.image = image
|
||||||
}
|
}
|
||||||
@@ -1246,8 +1268,8 @@ func getGlobalState() -> GlobalState {
|
|||||||
let fileManager = FileManager.default
|
let fileManager = FileManager.default
|
||||||
if let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first {
|
if let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first {
|
||||||
do {
|
do {
|
||||||
let json = Data(
|
let json = try Data(
|
||||||
try String(
|
String(
|
||||||
contentsOfFile: documentsURL.appendingPathComponent("state.json").path
|
contentsOfFile: documentsURL.appendingPathComponent("state.json").path
|
||||||
).utf8)
|
).utf8)
|
||||||
return try JSONDecoder().decode(GlobalState.self, from: json)
|
return try JSONDecoder().decode(GlobalState.self, from: json)
|
||||||
@@ -1269,9 +1291,8 @@ func getDocumentsURL() -> URL? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
|
extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
|
||||||
|
|
||||||
func collectionView(
|
func collectionView(
|
||||||
_ collectionView: UICollectionView, numberOfItemsInSection section: Int
|
_ collectionView: UICollectionView, numberOfItemsInSection _: Int
|
||||||
)
|
)
|
||||||
-> Int
|
-> Int
|
||||||
{
|
{
|
||||||
@@ -1288,7 +1309,8 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl
|
|||||||
if collectionView == comicCollectionView {
|
if collectionView == comicCollectionView {
|
||||||
let cell =
|
let cell =
|
||||||
collectionView.dequeueReusableCell(
|
collectionView.dequeueReusableCell(
|
||||||
withReuseIdentifier: "ComicImageCell", for: indexPath)
|
withReuseIdentifier: "ComicImageCell", for: indexPath
|
||||||
|
)
|
||||||
as! ComicImageCell
|
as! ComicImageCell
|
||||||
cell.imageView.image = comics[indexPath.item].cover
|
cell.imageView.image = comics[indexPath.item].cover
|
||||||
return cell
|
return cell
|
||||||
@@ -1296,7 +1318,8 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl
|
|||||||
// let scaling = UIView.ContentMode.scaleAspectFill
|
// let scaling = UIView.ContentMode.scaleAspectFill
|
||||||
let cell =
|
let cell =
|
||||||
collectionView.dequeueReusableCell(
|
collectionView.dequeueReusableCell(
|
||||||
withReuseIdentifier: "ScrollingImageCell", for: indexPath)
|
withReuseIdentifier: "ScrollingImageCell", for: indexPath
|
||||||
|
)
|
||||||
as! ScrollingImageCell
|
as! ScrollingImageCell
|
||||||
if metadata == nil {
|
if metadata == nil {
|
||||||
return cell
|
return cell
|
||||||
@@ -1304,20 +1327,21 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl
|
|||||||
// TODO: Fix scrolling again
|
// TODO: Fix scrolling again
|
||||||
return cell
|
return cell
|
||||||
} else {
|
} else {
|
||||||
assert(false)
|
assertionFailure()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Xcode profiling sucks:
|
// Xcode profiling sucks:
|
||||||
return
|
return
|
||||||
collectionView.dequeueReusableCell(
|
collectionView.dequeueReusableCell(
|
||||||
withReuseIdentifier: "ScrollingImageCell", for: indexPath)
|
withReuseIdentifier: "ScrollingImageCell", for: indexPath
|
||||||
|
)
|
||||||
as! ScrollingImageCell
|
as! ScrollingImageCell
|
||||||
}
|
}
|
||||||
|
|
||||||
func collectionView(
|
func collectionView(
|
||||||
_ collectionView: UICollectionView,
|
_ collectionView: UICollectionView,
|
||||||
layout collectionViewLayout: UICollectionViewLayout,
|
layout _: UICollectionViewLayout,
|
||||||
sizeForItemAt indexPath: IndexPath
|
sizeForItemAt _: IndexPath
|
||||||
) -> CGSize {
|
) -> CGSize {
|
||||||
if collectionView == comicCollectionView {
|
if collectionView == comicCollectionView {
|
||||||
let spacing: CGFloat = 8
|
let spacing: CGFloat = 8
|
||||||
@@ -1332,7 +1356,7 @@ extension ViewController: UICollectionViewDataSource, UICollectionViewDelegateFl
|
|||||||
// TODO: Fix scrolling again
|
// TODO: Fix scrolling again
|
||||||
return CGSize()
|
return CGSize()
|
||||||
} else {
|
} else {
|
||||||
assert(false)
|
assertionFailure()
|
||||||
}
|
}
|
||||||
// Xcode profiling sucks:
|
// Xcode profiling sucks:
|
||||||
return CGSize()
|
return CGSize()
|
||||||
@@ -1368,7 +1392,8 @@ class ScrollingImageCell: UICollectionViewCell {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
@available(*, unavailable)
|
||||||
|
required init?(coder _: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1391,7 +1416,8 @@ class ComicImageCell: UICollectionViewCell {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
@available(*, unavailable)
|
||||||
|
required init?(coder _: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1404,7 +1430,7 @@ enum Rotation {
|
|||||||
class ImageLoader {
|
class ImageLoader {
|
||||||
private let cache = NSCache<NSString, UIImage>()
|
private let cache = NSCache<NSString, UIImage>()
|
||||||
private let horCache = NSCache<NSString, UIImage>()
|
private let horCache = NSCache<NSString, UIImage>()
|
||||||
private var loadingTasks: [String: [((UIImage?) -> Void)]] = [:]
|
private var loadingTasks: [String: [(UIImage?) -> Void]] = [:]
|
||||||
var size: [String: CGSize] = [:]
|
var size: [String: CGSize] = [:]
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@@ -1412,19 +1438,19 @@ class ImageLoader {
|
|||||||
cache.totalCostLimit = 128 * 1024 * 1024
|
cache.totalCostLimit = 128 * 1024 * 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
func preloadImage(at path: URL, scaling: UIView.ContentMode) {
|
func preloadImage(at path: URL, scaling: UIView.ContentMode, screenSize: CGSize) {
|
||||||
loadImage(at: path, scaling: scaling, completion: nil)
|
loadImage(at: path, scaling: scaling, screenSize: screenSize, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadImage(
|
func loadImage(
|
||||||
at path: URL, scaling: UIView.ContentMode,
|
at path: URL, scaling: UIView.ContentMode,
|
||||||
|
screenSize: CGSize,
|
||||||
completion: ((UIImage?) -> Void)?
|
completion: ((UIImage?) -> Void)?
|
||||||
) {
|
) {
|
||||||
let screenSize = UIScreen.main.bounds.size
|
let rotation: Rotation!
|
||||||
let rotation: Rotation =
|
if screenSize.width > screenSize.height {
|
||||||
if screenSize.width > screenSize.height {
|
rotation = Rotation.horizontal
|
||||||
.horizontal
|
} else { rotation = Rotation.vertical }
|
||||||
} else { .vertical }
|
|
||||||
|
|
||||||
if rotation == .vertical {
|
if rotation == .vertical {
|
||||||
if let cached = cache.object(forKey: path.path as NSString) {
|
if let cached = cache.object(forKey: path.path as NSString) {
|
||||||
@@ -1456,9 +1482,11 @@ class ImageLoader {
|
|||||||
if completion == nil || rotation == .vertical {
|
if completion == nil || rotation == .vertical {
|
||||||
let vertical = CGSize(
|
let vertical = CGSize(
|
||||||
width: min(screenSize.width, screenSize.height),
|
width: min(screenSize.width, screenSize.height),
|
||||||
height: max(screenSize.height, screenSize.width))
|
height: max(screenSize.height, screenSize.width)
|
||||||
|
)
|
||||||
let vScaledSize = aspectSize(
|
let vScaledSize = aspectSize(
|
||||||
for: image.size, in: vertical, scaling: scaling)
|
for: image.size, in: vertical, scaling: scaling
|
||||||
|
)
|
||||||
let vScaleImage = resizeImage(image, to: vScaledSize)
|
let vScaleImage = resizeImage(image, to: vScaledSize)
|
||||||
guard let cost = imageByteSize(vScaleImage) else { return }
|
guard let cost = imageByteSize(vScaleImage) else { return }
|
||||||
self.cache.setObject(vScaleImage, forKey: path.path as NSString, cost: cost)
|
self.cache.setObject(vScaleImage, forKey: path.path as NSString, cost: cost)
|
||||||
@@ -1470,9 +1498,11 @@ class ImageLoader {
|
|||||||
if completion == nil || rotation == .horizontal {
|
if completion == nil || rotation == .horizontal {
|
||||||
let horizontal = CGSize(
|
let horizontal = CGSize(
|
||||||
width: max(screenSize.width, screenSize.height),
|
width: max(screenSize.width, screenSize.height),
|
||||||
height: min(screenSize.height, screenSize.width))
|
height: min(screenSize.height, screenSize.width)
|
||||||
|
)
|
||||||
let hScaledSize = aspectSize(
|
let hScaledSize = aspectSize(
|
||||||
for: image.size, in: horizontal, scaling: scaling)
|
for: image.size, in: horizontal, scaling: scaling
|
||||||
|
)
|
||||||
let hScaleImage = resizeImage(image, to: hScaledSize)
|
let hScaleImage = resizeImage(image, to: hScaledSize)
|
||||||
guard let cost = imageByteSize(hScaleImage) else { return }
|
guard let cost = imageByteSize(hScaleImage) else { return }
|
||||||
self.horCache.setObject(hScaleImage, forKey: path.path as NSString, cost: cost)
|
self.horCache.setObject(hScaleImage, forKey: path.path as NSString, cost: cost)
|
||||||
@@ -1511,12 +1541,12 @@ func aspectSize(for imageSize: CGSize, in boundingSize: CGSize, scaling: UIView.
|
|||||||
{
|
{
|
||||||
let widthRatio = boundingSize.width / imageSize.width
|
let widthRatio = boundingSize.width / imageSize.width
|
||||||
let heightRatio = boundingSize.height / imageSize.height
|
let heightRatio = boundingSize.height / imageSize.height
|
||||||
let scale: CGFloat =
|
var scale = CGFloat()
|
||||||
switch scaling {
|
switch scaling {
|
||||||
case .scaleAspectFit: min(widthRatio, heightRatio)
|
case .scaleAspectFit: scale = min(widthRatio, heightRatio)
|
||||||
case .scaleAspectFill: max(widthRatio, heightRatio)
|
case .scaleAspectFill: scale = max(widthRatio, heightRatio)
|
||||||
default: 1
|
default: scale = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return CGSize(
|
return CGSize(
|
||||||
width: imageSize.width * scale,
|
width: imageSize.width * scale,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import Testing
|
|
||||||
@testable import ImageViewer
|
|
||||||
|
|
||||||
struct ImageViewerTests {
|
|
||||||
|
|
||||||
@Test func example() async throws {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import XCTest
|
|
||||||
|
|
||||||
final class ImageViewerUITests: XCTestCase {
|
|
||||||
|
|
||||||
override func setUpWithError() throws {
|
|
||||||
continueAfterFailure = false
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tearDownWithError() throws {
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
func testExample() throws {
|
|
||||||
let app = XCUIApplication()
|
|
||||||
app.launch()
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
func testLaunchPerformance() throws {
|
|
||||||
measure(metrics: [XCTApplicationLaunchMetric()]) {
|
|
||||||
XCUIApplication().launch()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import XCTest
|
|
||||||
|
|
||||||
final class ImageViewerUITestsLaunchTests: XCTestCase {
|
|
||||||
|
|
||||||
override class var runsForEachTargetApplicationUIConfiguration: Bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
override func setUpWithError() throws {
|
|
||||||
continueAfterFailure = false
|
|
||||||
}
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
func testLaunch() throws {
|
|
||||||
let app = XCUIApplication()
|
|
||||||
app.launch()
|
|
||||||
|
|
||||||
let attachment = XCTAttachment(screenshot: app.screenshot())
|
|
||||||
attachment.name = "Launch Screen"
|
|
||||||
attachment.lifetime = .keepAlways
|
|
||||||
add(attachment)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
2
run.sh
2
run.sh
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
APP_NAME='ImageViewer'
|
APP_NAME='ImageViewer'
|
||||||
SIM_DEVICE='iPad Air 11-inch (M3)'
|
SIM_DEVICE='iPad (10th generation)'
|
||||||
SCHEME='ImageViewer'
|
SCHEME='ImageViewer'
|
||||||
SIMULATOR='iOS Simulator'
|
SIMULATOR='iOS Simulator'
|
||||||
COMPANY='ImageViewer'
|
COMPANY='ImageViewer'
|
||||||
|
|||||||
Reference in New Issue
Block a user