Partially added icloud support for console logo. Added iCloud utilities and tests

This commit is contained in:
2021-05-18 11:46:37 +02:00
parent bcf3098bfe
commit 0c40187409
16 changed files with 430 additions and 61 deletions

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,45 @@
//
// ZockerhoehleTests.swift
// ZockerhoehleTests
//
// Created by Julian-Steffen Müller on 17.05.21.
// Copyright © 2021 Julian-Steffen Müller. All rights reserved.
//
import XCTest
@testable import Zockerhoehle
class ZockerhoehleTests: XCTestCase {
let icloud_drive_seperators : [String] = ["iCloud~Zockerhoehle", "Documents"]
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func test_url_icloud_split() throws {
// VALID FILES
let url_valid_file : URL = URL(string: "file:///private/var/mobile/Library/Mobile%20Documents/iCloud~Zockerhoehle/Documents/backup.json")!
let url_valid_file_in_subfolder : URL = URL(string: "file:///private/var/mobile/Library/Mobile%20Documents/iCloud~Zockerhoehle/Documents/consoles/ps4.png")!
XCTAssertEqual(url_valid_file.relative_path_after(pathComponent: icloud_drive_seperators), "backup.json")
XCTAssertEqual(url_valid_file_in_subfolder.relative_path_after(pathComponent: icloud_drive_seperators), "consoles/ps4.png")
//INVALID URL
let url_unvalid_url_2 : URL = URL(string: "http://mueller.haus")!
XCTAssertEqual(url_unvalid_url_2.relative_path_after(pathComponent: icloud_drive_seperators), .none)
// INVALID FILE
let url_unvalid_file : URL = URL(string: "file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/photo.jpg")!
XCTAssertEqual(url_unvalid_file.relative_path_after(pathComponent: icloud_drive_seperators), .none)
}
}