diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f2166c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_* +fastlane/screenshots +xcshareddata \ No newline at end of file diff --git a/Cable.xcodeproj/project.pbxproj b/Cable.xcodeproj/project.pbxproj index 7ae9b59..b85f414 100644 --- a/Cable.xcodeproj/project.pbxproj +++ b/Cable.xcodeproj/project.pbxproj @@ -7,6 +7,13 @@ objects = { /* Begin PBXContainerItemProxy section */ + 3E37F65B2E93FB6F00836187 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 3E5C0BC42E72C0FD00247EC8 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3E5C0BCB2E72C0FD00247EC8; + remoteInfo = Cable; + }; 3E5C0BDE2E72C0FE00247EC8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 3E5C0BC42E72C0FD00247EC8 /* Project object */; @@ -24,6 +31,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3E37F6552E93FB6F00836187 /* CableUITestsScreenshot.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CableUITestsScreenshot.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3E5C0BCC2E72C0FD00247EC8 /* Cable.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Cable.app; sourceTree = BUILT_PRODUCTS_DIR; }; 3E5C0BDD2E72C0FE00247EC8 /* CableTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CableTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3E5C0BE72E72C0FE00247EC8 /* CableUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CableUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -40,6 +48,11 @@ /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ + 3E37F6562E93FB6F00836187 /* CableUITestsScreenshot */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = CableUITestsScreenshot; + sourceTree = ""; + }; 3E5C0BCE2E72C0FD00247EC8 /* Cable */ = { isa = PBXFileSystemSynchronizedRootGroup; exceptions = ( @@ -61,6 +74,13 @@ /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ + 3E37F6522E93FB6F00836187 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3E5C0BC92E72C0FD00247EC8 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -91,6 +111,7 @@ 3E5C0BCE2E72C0FD00247EC8 /* Cable */, 3E5C0BE02E72C0FE00247EC8 /* CableTests */, 3E5C0BEA2E72C0FE00247EC8 /* CableUITests */, + 3E37F6562E93FB6F00836187 /* CableUITestsScreenshot */, 3E5C0BCD2E72C0FD00247EC8 /* Products */, ); sourceTree = ""; @@ -101,6 +122,7 @@ 3E5C0BCC2E72C0FD00247EC8 /* Cable.app */, 3E5C0BDD2E72C0FE00247EC8 /* CableTests.xctest */, 3E5C0BE72E72C0FE00247EC8 /* CableUITests.xctest */, + 3E37F6552E93FB6F00836187 /* CableUITestsScreenshot.xctest */, ); name = Products; sourceTree = ""; @@ -108,6 +130,29 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 3E37F6542E93FB6F00836187 /* CableUITestsScreenshot */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3E37F65D2E93FB6F00836187 /* Build configuration list for PBXNativeTarget "CableUITestsScreenshot" */; + buildPhases = ( + 3E37F6512E93FB6F00836187 /* Sources */, + 3E37F6522E93FB6F00836187 /* Frameworks */, + 3E37F6532E93FB6F00836187 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 3E37F65C2E93FB6F00836187 /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 3E37F6562E93FB6F00836187 /* CableUITestsScreenshot */, + ); + name = CableUITestsScreenshot; + packageProductDependencies = ( + ); + productName = CableUITestsScreenshot; + productReference = 3E37F6552E93FB6F00836187 /* CableUITestsScreenshot.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 3E5C0BCB2E72C0FD00247EC8 /* Cable */ = { isa = PBXNativeTarget; buildConfigurationList = 3E5C0BF02E72C0FE00247EC8 /* Build configuration list for PBXNativeTarget "Cable" */; @@ -183,9 +228,13 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1640; + LastSwiftUpdateCheck = 2600; LastUpgradeCheck = 2600; TargetAttributes = { + 3E37F6542E93FB6F00836187 = { + CreatedOnToolsVersion = 26.0.1; + TestTargetID = 3E5C0BCB2E72C0FD00247EC8; + }; 3E5C0BCB2E72C0FD00247EC8 = { CreatedOnToolsVersion = 16.4; }; @@ -220,11 +269,19 @@ 3E5C0BCB2E72C0FD00247EC8 /* Cable */, 3E5C0BDC2E72C0FE00247EC8 /* CableTests */, 3E5C0BE62E72C0FE00247EC8 /* CableUITests */, + 3E37F6542E93FB6F00836187 /* CableUITestsScreenshot */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 3E37F6532E93FB6F00836187 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3E5C0BCA2E72C0FD00247EC8 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -249,6 +306,13 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 3E37F6512E93FB6F00836187 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 3E5C0BC82E72C0FD00247EC8 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -273,6 +337,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 3E37F65C2E93FB6F00836187 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3E5C0BCB2E72C0FD00247EC8 /* Cable */; + targetProxy = 3E37F65B2E93FB6F00836187 /* PBXContainerItemProxy */; + }; 3E5C0BDF2E72C0FE00247EC8 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 3E5C0BCB2E72C0FD00247EC8 /* Cable */; @@ -286,6 +355,48 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ + 3E37F65E2E93FB6F00836187 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = RE4FXQ754N; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 26.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.yuzuhub.CableUITestsScreenshot; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRING_CATALOG_GENERATE_SYMBOLS = NO; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Cable; + }; + name = Debug; + }; + 3E37F65F2E93FB6F00836187 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = RE4FXQ754N; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 26.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.yuzuhub.CableUITestsScreenshot; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRING_CATALOG_GENERATE_SYMBOLS = NO; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = Cable; + }; + name = Release; + }; 3E5C0BF12E72C0FE00247EC8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -293,7 +404,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Cable/Cable.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = RE4FXQ754N; ENABLE_APP_SANDBOX = YES; ENABLE_PREVIEWS = YES; @@ -310,7 +421,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 0.2; PRODUCT_BUNDLE_IDENTIFIER = app.voltplan.CableApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -326,7 +437,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = Cable/Cable.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = RE4FXQ754N; ENABLE_APP_SANDBOX = YES; ENABLE_PREVIEWS = YES; @@ -343,7 +454,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0; + MARKETING_VERSION = 0.2; PRODUCT_BUNDLE_IDENTIFIER = app.voltplan.CableApp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -550,6 +661,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 3E37F65D2E93FB6F00836187 /* Build configuration list for PBXNativeTarget "CableUITestsScreenshot" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3E37F65E2E93FB6F00836187 /* Debug */, + 3E37F65F2E93FB6F00836187 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 3E5C0BC72E72C0FD00247EC8 /* Build configuration list for PBXProject "Cable" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Cable.xcodeproj/xcuserdata/lange-hegermann.xcuserdatad/xcschemes/xcschememanagement.plist b/Cable.xcodeproj/xcuserdata/lange-hegermann.xcuserdatad/xcschemes/xcschememanagement.plist index 7c66504..ab3bf2a 100644 --- a/Cable.xcodeproj/xcuserdata/lange-hegermann.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Cable.xcodeproj/xcuserdata/lange-hegermann.xcuserdatad/xcschemes/xcschememanagement.plist @@ -9,6 +9,19 @@ orderHint 0 + CableScreenshots.xcscheme_^#shared#^_ + + orderHint + 1 + + + SuppressBuildableAutocreation + + 3E5C0BCB2E72C0FD00247EC8 + + primary + + diff --git a/Cable/Assets.xcassets/boat-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/boat-onboarding.imageset/Contents.json index 62c7129..1a31ca4 100644 --- a/Cable/Assets.xcassets/boat-onboarding.imageset/Contents.json +++ b/Cable/Assets.xcassets/boat-onboarding.imageset/Contents.json @@ -40,7 +40,7 @@ "value" : "dark" } ], - "filename" : "boat-ob-inv.png", + "filename" : "boat-dark.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Cable/Assets.xcassets/boat-onboarding.imageset/boat-dark.png b/Cable/Assets.xcassets/boat-onboarding.imageset/boat-dark.png new file mode 100644 index 0000000..13c887f Binary files /dev/null and b/Cable/Assets.xcassets/boat-onboarding.imageset/boat-dark.png differ diff --git a/Cable/Assets.xcassets/boat-onboarding.imageset/boat-ob-inv.png b/Cable/Assets.xcassets/boat-onboarding.imageset/boat-ob-inv.png deleted file mode 100644 index e8a73aa..0000000 Binary files a/Cable/Assets.xcassets/boat-onboarding.imageset/boat-ob-inv.png and /dev/null differ diff --git a/Cable/Assets.xcassets/cabin-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/cabin-onboarding.imageset/Contents.json index c8adade..0d53ded 100644 --- a/Cable/Assets.xcassets/cabin-onboarding.imageset/Contents.json +++ b/Cable/Assets.xcassets/cabin-onboarding.imageset/Contents.json @@ -40,7 +40,7 @@ "value" : "dark" } ], - "filename" : "cabin-ob-inv.png", + "filename" : "cabin-dark.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Cable/Assets.xcassets/cabin-onboarding.imageset/cabin-dark.png b/Cable/Assets.xcassets/cabin-onboarding.imageset/cabin-dark.png new file mode 100644 index 0000000..96dee0a Binary files /dev/null and b/Cable/Assets.xcassets/cabin-onboarding.imageset/cabin-dark.png differ diff --git a/Cable/Assets.xcassets/cabin-onboarding.imageset/cabin-ob-inv.png b/Cable/Assets.xcassets/cabin-onboarding.imageset/cabin-ob-inv.png deleted file mode 100644 index f48e8e9..0000000 Binary files a/Cable/Assets.xcassets/cabin-onboarding.imageset/cabin-ob-inv.png and /dev/null differ diff --git a/Cable/Assets.xcassets/charger-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/charger-onboarding.imageset/Contents.json new file mode 100644 index 0000000..123ca29 --- /dev/null +++ b/Cable/Assets.xcassets/charger-onboarding.imageset/Contents.json @@ -0,0 +1,52 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "charger-light.png", + "idiom" : "universal", + "scale" : "3x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "charger-dark.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Cable/Assets.xcassets/charger-onboarding.imageset/charger-dark.png b/Cable/Assets.xcassets/charger-onboarding.imageset/charger-dark.png new file mode 100644 index 0000000..6872c3a Binary files /dev/null and b/Cable/Assets.xcassets/charger-onboarding.imageset/charger-dark.png differ diff --git a/Cable/Assets.xcassets/charger-onboarding.imageset/charger-light.png b/Cable/Assets.xcassets/charger-onboarding.imageset/charger-light.png new file mode 100644 index 0000000..f0d75c2 Binary files /dev/null and b/Cable/Assets.xcassets/charger-onboarding.imageset/charger-light.png differ diff --git a/Cable/Assets.xcassets/coffee-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/coffee-onboarding.imageset/Contents.json index 26f42a3..3aa3785 100644 --- a/Cable/Assets.xcassets/coffee-onboarding.imageset/Contents.json +++ b/Cable/Assets.xcassets/coffee-onboarding.imageset/Contents.json @@ -1,7 +1,16 @@ { "images" : [ { - "filename" : "coffee-ob.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], "idiom" : "universal", "scale" : "1x" }, @@ -10,6 +19,28 @@ "scale" : "2x" }, { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "coffee-light.png", + "idiom" : "universal", + "scale" : "3x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "coffee-dark.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-dark.png b/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-dark.png new file mode 100644 index 0000000..66109e1 Binary files /dev/null and b/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-dark.png differ diff --git a/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-light.png b/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-light.png new file mode 100644 index 0000000..1c69287 Binary files /dev/null and b/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-light.png differ diff --git a/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-ob.png b/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-ob.png deleted file mode 100644 index 734eb54..0000000 Binary files a/Cable/Assets.xcassets/coffee-onboarding.imageset/coffee-ob.png and /dev/null differ diff --git a/Cable/Assets.xcassets/fridge-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/fridge-onboarding.imageset/Contents.json deleted file mode 100644 index 4131a6e..0000000 --- a/Cable/Assets.xcassets/fridge-onboarding.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "fridge-ob.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Cable/Assets.xcassets/fridge-onboarding.imageset/fridge-ob.png b/Cable/Assets.xcassets/fridge-onboarding.imageset/fridge-ob.png deleted file mode 100644 index 80d0a77..0000000 Binary files a/Cable/Assets.xcassets/fridge-onboarding.imageset/fridge-ob.png and /dev/null differ diff --git a/Cable/Assets.xcassets/light-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/light-onboarding.imageset/Contents.json deleted file mode 100644 index cdb722d..0000000 --- a/Cable/Assets.xcassets/light-onboarding.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "light-ob.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Cable/Assets.xcassets/light-onboarding.imageset/light-ob.png b/Cable/Assets.xcassets/light-onboarding.imageset/light-ob.png deleted file mode 100644 index 25cead7..0000000 Binary files a/Cable/Assets.xcassets/light-onboarding.imageset/light-ob.png and /dev/null differ diff --git a/Cable/Assets.xcassets/router-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/router-onboarding.imageset/Contents.json new file mode 100644 index 0000000..2f377e8 --- /dev/null +++ b/Cable/Assets.xcassets/router-onboarding.imageset/Contents.json @@ -0,0 +1,52 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "router-light.png", + "idiom" : "universal", + "scale" : "3x" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "router-dark.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Cable/Assets.xcassets/router-onboarding.imageset/router-dark.png b/Cable/Assets.xcassets/router-onboarding.imageset/router-dark.png new file mode 100644 index 0000000..c86a01b Binary files /dev/null and b/Cable/Assets.xcassets/router-onboarding.imageset/router-dark.png differ diff --git a/Cable/Assets.xcassets/router-onboarding.imageset/router-light.png b/Cable/Assets.xcassets/router-onboarding.imageset/router-light.png new file mode 100644 index 0000000..476201b Binary files /dev/null and b/Cable/Assets.xcassets/router-onboarding.imageset/router-light.png differ diff --git a/Cable/Assets.xcassets/van-onboarding.imageset/Contents.json b/Cable/Assets.xcassets/van-onboarding.imageset/Contents.json index 5c31066..3046586 100644 --- a/Cable/Assets.xcassets/van-onboarding.imageset/Contents.json +++ b/Cable/Assets.xcassets/van-onboarding.imageset/Contents.json @@ -40,7 +40,7 @@ "value" : "dark" } ], - "filename" : "van-ob-inv.png", + "filename" : "bus-dark.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Cable/Assets.xcassets/van-onboarding.imageset/bus-dark.png b/Cable/Assets.xcassets/van-onboarding.imageset/bus-dark.png new file mode 100644 index 0000000..db80429 Binary files /dev/null and b/Cable/Assets.xcassets/van-onboarding.imageset/bus-dark.png differ diff --git a/Cable/Assets.xcassets/van-onboarding.imageset/van-ob-inv.png b/Cable/Assets.xcassets/van-onboarding.imageset/van-ob-inv.png deleted file mode 100644 index f05404e..0000000 Binary files a/Cable/Assets.xcassets/van-onboarding.imageset/van-ob-inv.png and /dev/null differ diff --git a/Cable/ComponentLibraryView.swift b/Cable/ComponentLibraryView.swift index 6dbd2d0..a569d32 100644 --- a/Cable/ComponentLibraryView.swift +++ b/Cable/ComponentLibraryView.swift @@ -101,29 +101,55 @@ final class ComponentLibraryViewModel: ObservableObject { } private func fetchComponents() async throws -> [ComponentLibraryItem] { - var components = URLComponents(url: baseURL.appendingPathComponent("api/collections/components/records"), resolvingAgainstBaseURL: false) - components?.queryItems = [ - URLQueryItem(name: "filter", value: "(type='load')"), - URLQueryItem(name: "sort", value: "+name"), - URLQueryItem(name: "fields", value: "id,collectionId,name,icon,voltage_in,voltage_out,watt") - ] + let perPage = 200 + var page = 1 + var allRecords: [PocketBaseRecord] = [] - guard let url = components?.url else { - throw URLError(.badURL) + while true { + var components = URLComponents( + url: baseURL.appendingPathComponent("api/collections/components/records"), + resolvingAgainstBaseURL: false + ) + components?.queryItems = [ + URLQueryItem(name: "filter", value: "(type='load')"), + URLQueryItem(name: "sort", value: "+name"), + URLQueryItem(name: "fields", value: "id,collectionId,name,icon,voltage_in,voltage_out,watt"), + URLQueryItem(name: "page", value: "\(page)"), + URLQueryItem(name: "perPage", value: "\(perPage)") + ] + + guard let url = components?.url else { + throw URLError(.badURL) + } + + var request = URLRequest(url: url) + request.cachePolicy = .reloadIgnoringLocalCacheData + + let (data, response) = try await urlSession.data(for: request) + + guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else { + throw URLError(.badServerResponse) + } + + let decoded = try JSONDecoder().decode(PocketBaseResponse.self, from: data) + allRecords.append(contentsOf: decoded.items) + + let isLastPage: Bool + if let totalPages = decoded.totalPages, totalPages > 0 { + isLastPage = page >= totalPages + } else { + isLastPage = decoded.items.count < perPage + } + + if isLastPage { + break + } + + page += 1 } - var request = URLRequest(url: url) - request.cachePolicy = .reloadIgnoringLocalCacheData - - let (data, response) = try await urlSession.data(for: request) - - guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else { - throw URLError(.badServerResponse) - } - - let decoded = try JSONDecoder().decode(PocketBaseResponse.self, from: data) - let affiliateLinksByComponent = try await fetchAffiliateLinks(for: decoded.items.map(\.id)) - let mappedItems = decoded.items.map { record in + let affiliateLinksByComponent = try await fetchAffiliateLinks(for: allRecords.map(\.id)) + let mappedItems = allRecords.map { record in ComponentLibraryItem( id: record.id, name: record.name, @@ -264,6 +290,9 @@ final class ComponentLibraryViewModel: ObservableObject { } private struct PocketBaseResponse: Decodable { + let page: Int? + let perPage: Int? + let totalPages: Int? let items: [PocketBaseRecord] } diff --git a/Cable/ComponentsOnboardingView.swift b/Cable/ComponentsOnboardingView.swift index a0d9ce4..67c022c 100644 --- a/Cable/ComponentsOnboardingView.swift +++ b/Cable/ComponentsOnboardingView.swift @@ -6,9 +6,9 @@ struct ComponentsOnboardingView: View { let onBrowse: () -> Void private let imageNames = [ - "fridge-onboarding", + "router-onboarding", "coffee-onboarding", - "light-onboarding" + "charger-onboarding" ] private let timer = Timer.publish(every: 8, on: .main, in: .common).autoconnect() @@ -57,6 +57,7 @@ struct ComponentsOnboardingView: View { .background(Color.blue) .cornerRadius(12) } + .accessibilityIdentifier("create-component-button") .buttonStyle(.plain) Button(action: onBrowse) { diff --git a/Cable/SystemsOnboardingView.swift b/Cable/SystemsOnboardingView.swift index 7146fe8..64ce52b 100644 --- a/Cable/SystemsOnboardingView.swift +++ b/Cable/SystemsOnboardingView.swift @@ -81,6 +81,7 @@ struct SystemsOnboardingView: View { .background(Color.blue) .cornerRadius(12) } + .accessibilityIdentifier("create-system-button") .buttonStyle(.plain) } .padding(.horizontal, 24) diff --git a/CableScreenshots.xctestplan b/CableScreenshots.xctestplan new file mode 100644 index 0000000..a650a47 --- /dev/null +++ b/CableScreenshots.xctestplan @@ -0,0 +1,24 @@ +{ + "configurations" : [ + { + "id" : "4CA9C9AC-F09F-48D8-9822-3CB6AF4C6D36", + "name" : "Configuration 1", + "options" : { + + } + } + ], + "defaultOptions" : { + + }, + "testTargets" : [ + { + "target" : { + "containerPath" : "container:Cable.xcodeproj", + "identifier" : "3E37F6542E93FB6F00836187", + "name" : "CableUITestsScreenshot" + } + } + ], + "version" : 1 +} diff --git a/CableUITestsScreenshot/CableUITestsScreenshot.swift b/CableUITestsScreenshot/CableUITestsScreenshot.swift new file mode 100644 index 0000000..0059e4c --- /dev/null +++ b/CableUITestsScreenshot/CableUITestsScreenshot.swift @@ -0,0 +1,41 @@ +// +// CableUITestsScreenshot.swift +// CableUITestsScreenshot +// +// Created by Stefan Lange-Hegermann on 06.10.25. +// + +import XCTest + +final class CableUITestsScreenshot: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + @MainActor + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + +// @MainActor +// func testLaunchPerformance() throws { +// // This measures how long it takes to launch your application. +// measure(metrics: [XCTApplicationLaunchMetric()]) { +// XCUIApplication().launch() +// } +// } +} diff --git a/CableUITestsScreenshot/CableUITestsScreenshotLaunchTests.swift b/CableUITestsScreenshot/CableUITestsScreenshotLaunchTests.swift new file mode 100644 index 0000000..d7ac1cf --- /dev/null +++ b/CableUITestsScreenshot/CableUITestsScreenshotLaunchTests.swift @@ -0,0 +1,51 @@ +// +// CableUITestsScreenshotLaunchTests.swift +// CableUITestsScreenshot +// +// Created by Stefan Lange-Hegermann on 06.10.25. +// + +import XCTest + +final class CableUITestsScreenshotLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + false + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + @MainActor + func testLaunch() throws { + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } + + @MainActor + func testOnboardingLoadsView() throws { + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + snapshot("0OnboardingSystemsView") + let createSystemButton = app.buttons["create-system-button"] + XCTAssertTrue(createSystemButton.waitForExistence(timeout: 5)) + createSystemButton.tap() + + snapshot("1OnboardingLoadsView") + let createComponentButton = app.buttons["create-component-button"] + XCTAssertTrue(createComponentButton.waitForExistence(timeout: 5)) + createComponentButton.tap() + snapshot("2LoadEditorView") + } +} diff --git a/CableUITestsScreenshot/SnapshotHelper.swift b/CableUITestsScreenshot/SnapshotHelper.swift new file mode 100644 index 0000000..6dec130 --- /dev/null +++ b/CableUITestsScreenshot/SnapshotHelper.swift @@ -0,0 +1,313 @@ +// +// SnapshotHelper.swift +// Example +// +// Created by Felix Krause on 10/8/15. +// + +// ----------------------------------------------------- +// IMPORTANT: When modifying this file, make sure to +// increment the version number at the very +// bottom of the file to notify users about +// the new SnapshotHelper.swift +// ----------------------------------------------------- + +import Foundation +import XCTest + +@MainActor +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) +} + +@MainActor +func snapshot(_ name: String, waitForLoadingIndicator: Bool) { + if waitForLoadingIndicator { + Snapshot.snapshot(name) + } else { + Snapshot.snapshot(name, timeWaitingForIdle: 0) + } +} + +/// - Parameters: +/// - name: The name of the snapshot +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +@MainActor +func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + Snapshot.snapshot(name, timeWaitingForIdle: timeout) +} + +enum SnapshotError: Error, CustomDebugStringConvertible { + case cannotFindSimulatorHomeDirectory + case cannotRunOnPhysicalDevice + + var debugDescription: String { + switch self { + case .cannotFindSimulatorHomeDirectory: + return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." + case .cannotRunOnPhysicalDevice: + return "Can't use Snapshot on a physical device." + } + } +} + +@objcMembers +@MainActor +open class Snapshot: NSObject { + static var app: XCUIApplication? + static var waitForAnimations = true + static var cacheDirectory: URL? + static var screenshotsDirectory: URL? { + return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) + } + static var deviceLanguage = "" + static var currentLocale = "" + + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + + Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations + + do { + let cacheDir = try getCacheDirectory() + Snapshot.cacheDirectory = cacheDir + setLanguage(app) + setLocale(app) + setLaunchArguments(app) + } catch let error { + NSLog(error.localizedDescription) + } + } + + class func setLanguage(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("language.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] + } catch { + NSLog("Couldn't detect/set language...") + } + } + + class func setLocale(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("locale.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + currentLocale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + } catch { + NSLog("Couldn't detect/set locale...") + } + + if currentLocale.isEmpty && !deviceLanguage.isEmpty { + currentLocale = Locale(identifier: deviceLanguage).identifier + } + + if !currentLocale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(currentLocale)\""] + } + } + + class func setLaunchArguments(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") + app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] + + do { + let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) + let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) + let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count)) + let results = matches.map { result -> String in + (launchArguments as NSString).substring(with: result.range) + } + app.launchArguments += results + } catch { + NSLog("Couldn't detect/set launch_arguments...") + } + } + + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + if timeout > 0 { + waitForLoadingIndicatorToDisappear(within: timeout) + } + + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } + + #if os(OSX) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else + + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let screenshot = XCUIScreen.main.screenshot() + #if os(iOS) && !targetEnvironment(macCatalyst) + let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image + #else + let image = screenshot.image + #endif + + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + #if swift(<5.0) + try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) + #else + try image.pngData()?.write(to: path, options: .atomic) + #endif + } catch let error { + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) + } + #endif + } + + class func fixLandscapeOrientation(image: UIImage) -> UIImage { + #if os(watchOS) + return image + #else + if #available(iOS 10.0, *) { + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } + } else { + return image + } + #endif + } + + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { + #if os(tvOS) + return + #endif + + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element + let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) + _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) + } + + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" + // on OSX config is stored in /Users//Library + // and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) || arch(arm64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory + } + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) + #else + throw SnapshotError.cannotRunOnPhysicalDevice + #endif + } +} + +private extension XCUIElementAttributes { + var isNetworkLoadingIndicator: Bool { + if hasAllowListedIdentifier { return false } + + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) + let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) + + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize + } + + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + + return allowListedIdentifiers.contains(identifier) + } + + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { + if elementType == .statusBar { return true } + guard frame.origin == .zero else { return false } + + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) + let newStatusBarSize = CGSize(width: deviceWidth, height: 44) + + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) + } +} + +private extension XCUIElementQuery { + var networkLoadingIndicators: XCUIElementQuery { + let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isNetworkLoadingIndicator + } + + return self.containing(isNetworkLoadingIndicator) + } + + @MainActor + var deviceStatusBars: XCUIElementQuery { + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width + + let isStatusBar = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isStatusBar(deviceWidth) + } + + return self.containing(isStatusBar) + } +} + +private extension CGFloat { + func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool { + return numberA...numberB ~= self + } +} + +// Please don't remove the lines below +// They are used to detect outdated configuration files +// SnapshotHelperVersion [1.30] diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..7a118b4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..a9d8944 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,229 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + artifactory (3.0.17) + atomos (0.1.3) + aws-eventstream (1.4.0) + aws-partitions (1.1168.0) + aws-sdk-core (3.233.0) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + base64 + bigdecimal + jmespath (~> 1, >= 1.6.1) + logger + aws-sdk-kms (1.113.0) + aws-sdk-core (~> 3, >= 3.231.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.199.1) + aws-sdk-core (~> 3, >= 3.231.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.12.1) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.3.0) + bigdecimal (3.2.3) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.7.0) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.6.20240107) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.112.0) + faraday (1.10.4) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.1) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.1.1) + multipart-post (~> 2.0) + faraday-net_http (1.0.2) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.1) + faraday (~> 1.0) + fastimage (2.4.0) + fastlane (2.228.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored (~> 1.2) + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + http-cookie (~> 1.0.5) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (>= 2.0.0, < 3.0.0) + naturally (~> 2.2) + optparse (>= 0.1.1, < 1.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.5) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (~> 3) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.4.1) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-sirp (1.0.0) + sysrandom (~> 1.0) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.31.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.8.0) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.5.0) + google-cloud-storage (1.47.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.8) + domain_name (~> 0.5) + httpclient (2.9.0) + mutex_m + jmespath (1.6.2) + json (2.15.0) + jwt (2.10.2) + base64 + logger (1.7.0) + mini_magick (4.13.2) + mini_mime (1.1.5) + multi_json (1.17.0) + multipart-post (2.4.1) + mutex_m (0.3.0) + nanaimo (0.4.0) + naturally (2.3.0) + nkf (0.2.0) + optparse (0.6.0) + os (1.1.4) + plist (3.7.2) + public_suffix (6.0.2) + rake (13.3.0) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.4.4) + rouge (3.28.0) + ruby2_keywords (0.0.5) + rubyzip (2.4.1) + security (0.1.5) + signet (0.21.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 4.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + sysrandom (1.0.5) + terminal-notifier (2.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unicode-display_width (2.6.0) + word_wrap (1.0.0) + xcodeproj (1.27.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.4.0) + rexml (>= 3.3.6, < 4.0) + xcpretty (0.4.1) + rouge (~> 3.28.0) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-24 + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.7.2 diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 0000000..d131970 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,6 @@ +app_identifier("app.voltplan.CableApp") # The bundle identifier of your app +# apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username + + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..af8bfe7 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,23 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + desc "Generate new localized screenshots" + lane :screenshots do + capture_screenshots(scheme: "CableScreenshots") + end +end diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 0000000..a0e96bc --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,32 @@ +fastlane documentation +---- + +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +```sh +xcode-select --install +``` + +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) + +# Available Actions + +## iOS + +### ios screenshots + +```sh +[bundle exec] fastlane ios screenshots +``` + +Generate new localized screenshots + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/Snapfile b/fastlane/Snapfile new file mode 100644 index 0000000..69f7495 --- /dev/null +++ b/fastlane/Snapfile @@ -0,0 +1,54 @@ +# Uncomment the lines below you want to change by removing the # in the beginning +devices([ + "iPhone 17 Pro", + "iPhone 17 Pro Max" +]) + +languages([ + "en-US", + "de-DE", + "nl-NL", + "es-ES" +]) + +scheme("CableScreenshots") +clear_previous_screenshots(true) +localize_simulator(true) +erase_simulator(true) +override_status_bar(true) +# A list of devices you want to take the screenshots from +# devices([ +# "iPhone 8", +# "iPhone 8 Plus", +# "iPhone SE", +# "iPhone X", +# "iPad Pro (12.9-inch)", +# "iPad Pro (9.7-inch)", +# "Apple TV 1080p", +# "Apple Watch Series 6 - 44mm" +# ]) + +# languages([ +# "en-US", +# "de-DE", +# "it-IT", +# ["pt", "pt_BR"] # Portuguese with Brazilian locale +# ]) + +# The name of the scheme which contains the UI Tests +# scheme("SchemeName") + +# Where should the resulting screenshots be stored? +# output_directory("./screenshots") + +# remove the '#' to clear all previously generated screenshots before creating new ones +# clear_previous_screenshots(true) + +# Remove the '#' to set the status bar to 9:41 AM, and show full battery and reception. See also override_status_bar_arguments for custom options. +# override_status_bar(true) + +# Arguments to pass to the app on launch. See https://docs.fastlane.tools/actions/snapshot/#launch-arguments +# launch_arguments(["-favColor red"]) + +# For more information about all available options run +# fastlane action snapshot diff --git a/fastlane/SnapshotHelper.swift b/fastlane/SnapshotHelper.swift new file mode 100644 index 0000000..6dec130 --- /dev/null +++ b/fastlane/SnapshotHelper.swift @@ -0,0 +1,313 @@ +// +// SnapshotHelper.swift +// Example +// +// Created by Felix Krause on 10/8/15. +// + +// ----------------------------------------------------- +// IMPORTANT: When modifying this file, make sure to +// increment the version number at the very +// bottom of the file to notify users about +// the new SnapshotHelper.swift +// ----------------------------------------------------- + +import Foundation +import XCTest + +@MainActor +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) +} + +@MainActor +func snapshot(_ name: String, waitForLoadingIndicator: Bool) { + if waitForLoadingIndicator { + Snapshot.snapshot(name) + } else { + Snapshot.snapshot(name, timeWaitingForIdle: 0) + } +} + +/// - Parameters: +/// - name: The name of the snapshot +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +@MainActor +func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + Snapshot.snapshot(name, timeWaitingForIdle: timeout) +} + +enum SnapshotError: Error, CustomDebugStringConvertible { + case cannotFindSimulatorHomeDirectory + case cannotRunOnPhysicalDevice + + var debugDescription: String { + switch self { + case .cannotFindSimulatorHomeDirectory: + return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." + case .cannotRunOnPhysicalDevice: + return "Can't use Snapshot on a physical device." + } + } +} + +@objcMembers +@MainActor +open class Snapshot: NSObject { + static var app: XCUIApplication? + static var waitForAnimations = true + static var cacheDirectory: URL? + static var screenshotsDirectory: URL? { + return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) + } + static var deviceLanguage = "" + static var currentLocale = "" + + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + + Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations + + do { + let cacheDir = try getCacheDirectory() + Snapshot.cacheDirectory = cacheDir + setLanguage(app) + setLocale(app) + setLaunchArguments(app) + } catch let error { + NSLog(error.localizedDescription) + } + } + + class func setLanguage(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("language.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] + } catch { + NSLog("Couldn't detect/set language...") + } + } + + class func setLocale(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("locale.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + currentLocale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + } catch { + NSLog("Couldn't detect/set locale...") + } + + if currentLocale.isEmpty && !deviceLanguage.isEmpty { + currentLocale = Locale(identifier: deviceLanguage).identifier + } + + if !currentLocale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(currentLocale)\""] + } + } + + class func setLaunchArguments(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") + app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] + + do { + let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) + let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) + let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count)) + let results = matches.map { result -> String in + (launchArguments as NSString).substring(with: result.range) + } + app.launchArguments += results + } catch { + NSLog("Couldn't detect/set launch_arguments...") + } + } + + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + if timeout > 0 { + waitForLoadingIndicatorToDisappear(within: timeout) + } + + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } + + #if os(OSX) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else + + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let screenshot = XCUIScreen.main.screenshot() + #if os(iOS) && !targetEnvironment(macCatalyst) + let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image + #else + let image = screenshot.image + #endif + + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + #if swift(<5.0) + try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) + #else + try image.pngData()?.write(to: path, options: .atomic) + #endif + } catch let error { + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) + } + #endif + } + + class func fixLandscapeOrientation(image: UIImage) -> UIImage { + #if os(watchOS) + return image + #else + if #available(iOS 10.0, *) { + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } + } else { + return image + } + #endif + } + + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { + #if os(tvOS) + return + #endif + + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element + let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) + _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) + } + + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" + // on OSX config is stored in /Users//Library + // and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) || arch(arm64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory + } + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) + #else + throw SnapshotError.cannotRunOnPhysicalDevice + #endif + } +} + +private extension XCUIElementAttributes { + var isNetworkLoadingIndicator: Bool { + if hasAllowListedIdentifier { return false } + + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) + let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) + + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize + } + + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + + return allowListedIdentifiers.contains(identifier) + } + + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { + if elementType == .statusBar { return true } + guard frame.origin == .zero else { return false } + + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) + let newStatusBarSize = CGSize(width: deviceWidth, height: 44) + + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) + } +} + +private extension XCUIElementQuery { + var networkLoadingIndicators: XCUIElementQuery { + let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isNetworkLoadingIndicator + } + + return self.containing(isNetworkLoadingIndicator) + } + + @MainActor + var deviceStatusBars: XCUIElementQuery { + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width + + let isStatusBar = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isStatusBar(deviceWidth) + } + + return self.containing(isStatusBar) + } +} + +private extension CGFloat { + func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool { + return numberA...numberB ~= self + } +} + +// Please don't remove the lines below +// They are used to detect outdated configuration files +// SnapshotHelperVersion [1.30] diff --git a/fastlane/report.xml b/fastlane/report.xml new file mode 100644 index 0000000..ca3e709 --- /dev/null +++ b/fastlane/report.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +