From 09e8780fa3d8147a2b22ef07cdc4bd1418a0f761 Mon Sep 17 00:00:00 2001 From: maross Date: Wed, 14 Sep 2016 12:22:02 +0200 Subject: [PATCH 1/4] Update Podfile to support CocoaPods 1.0. --- FiltersExample/Podfile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/FiltersExample/Podfile b/FiltersExample/Podfile index 3cbd6e2..bf65b62 100644 --- a/FiltersExample/Podfile +++ b/FiltersExample/Podfile @@ -1,6 +1,6 @@ source 'https://github.com/CocoaPods/Specs.git' -xcodeproj 'FastttCameraDemo' +project 'FastttCameraDemo' platform :ios, '7.0' @@ -9,14 +9,13 @@ def install_pods pod 'Masonry', '0.6.1' end -target 'FastttCameraDemo', :exclusive => true do +target 'FastttCameraDemo' do install_pods -end -target 'FastttCameraDemoTests', :exclusive => true do - install_pods - pod 'Specta' - pod 'Expecta' - pod 'Expecta+Snapshots' - pod 'OCMock' + target 'FastttCameraDemoTests' do + pod 'Specta' + pod 'Expecta' + pod 'Expecta+Snapshots' + pod 'OCMock' + end end From ff8c5f3252ad7621b4e9b5da8e0a9e69e05ead64 Mon Sep 17 00:00:00 2001 From: maross Date: Wed, 14 Sep 2016 12:33:57 +0200 Subject: [PATCH 2/4] fix project settings --- .../FastttCamera.xcodeproj/project.pbxproj | 36 +++--- Example/Podfile.lock | 4 +- .../project.pbxproj | 109 +++++++++++------- .../xcschemes/FastttCameraDemo.xcscheme | 13 ++- FiltersExample/FastttCameraDemo/Info.plist | 2 +- .../FastttCameraDemoTests/Info.plist | 2 +- FiltersExample/Podfile.lock | 20 ++-- 7 files changed, 110 insertions(+), 76 deletions(-) diff --git a/Example/FastttCamera.xcodeproj/project.pbxproj b/Example/FastttCamera.xcodeproj/project.pbxproj index 759e608..5d9fe37 100644 --- a/Example/FastttCamera.xcodeproj/project.pbxproj +++ b/Example/FastttCamera.xcodeproj/project.pbxproj @@ -212,12 +212,12 @@ isa = PBXNativeTarget; buildConfigurationList = FAC389B61A8928440005EFDD /* Build configuration list for PBXNativeTarget "FastttCamera" */; buildPhases = ( - A523EB39C390B0E416B33C5E /* 📦 Check Pods Manifest.lock */, + A523EB39C390B0E416B33C5E /* [CP] Check Pods Manifest.lock */, FAC3898F1A8928440005EFDD /* Sources */, FAC389901A8928440005EFDD /* Frameworks */, FAC389911A8928440005EFDD /* Resources */, - 6DDD63F078028E0F3152F696 /* 📦 Embed Pods Frameworks */, - 0C722632AE5B4ADF4323027F /* 📦 Copy Pods Resources */, + 6DDD63F078028E0F3152F696 /* [CP] Embed Pods Frameworks */, + 0C722632AE5B4ADF4323027F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -232,12 +232,12 @@ isa = PBXNativeTarget; buildConfigurationList = FAC389B91A8928440005EFDD /* Build configuration list for PBXNativeTarget "FastttCameraTests" */; buildPhases = ( - 85418A2F1F4A10F69A7359CF /* 📦 Check Pods Manifest.lock */, + 85418A2F1F4A10F69A7359CF /* [CP] Check Pods Manifest.lock */, FAC389A81A8928440005EFDD /* Sources */, FAC389A91A8928440005EFDD /* Frameworks */, FAC389AA1A8928440005EFDD /* Resources */, - 48EDCB104F0C53B3DD9BD263 /* 📦 Embed Pods Frameworks */, - A658D0FD67F6FCC2199E491E /* 📦 Copy Pods Resources */, + 48EDCB104F0C53B3DD9BD263 /* [CP] Embed Pods Frameworks */, + A658D0FD67F6FCC2199E491E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -309,14 +309,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0C722632AE5B4ADF4323027F /* 📦 Copy Pods Resources */ = { + 0C722632AE5B4ADF4323027F /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Copy Pods Resources"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -324,14 +324,14 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCamera/Pods-FastttCamera-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 48EDCB104F0C53B3DD9BD263 /* 📦 Embed Pods Frameworks */ = { + 48EDCB104F0C53B3DD9BD263 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Embed Pods Frameworks"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -339,14 +339,14 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCamera-FastttCameraTests/Pods-FastttCamera-FastttCameraTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 6DDD63F078028E0F3152F696 /* 📦 Embed Pods Frameworks */ = { + 6DDD63F078028E0F3152F696 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Embed Pods Frameworks"; + name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -354,14 +354,14 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCamera/Pods-FastttCamera-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 85418A2F1F4A10F69A7359CF /* 📦 Check Pods Manifest.lock */ = { + 85418A2F1F4A10F69A7359CF /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Check Pods Manifest.lock"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -369,14 +369,14 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - A523EB39C390B0E416B33C5E /* 📦 Check Pods Manifest.lock */ = { + A523EB39C390B0E416B33C5E /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Check Pods Manifest.lock"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -384,14 +384,14 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - A658D0FD67F6FCC2199E491E /* 📦 Copy Pods Resources */ = { + A658D0FD67F6FCC2199E491E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "📦 Copy Pods Resources"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 1a951e1..93bd54b 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -21,7 +21,7 @@ DEPENDENCIES: EXTERNAL SOURCES: FastttCamera: - :path: "../FastttCamera.podspec" + :path: ../FastttCamera.podspec SPEC CHECKSUMS: Expecta: 9d1bff6c8b0eeee73a166a2ee898892478927a15 @@ -34,4 +34,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 8b803b068d0f7869491602ceaa035cda38f4a00b -COCOAPODS: 1.0.0 +COCOAPODS: 1.0.1 diff --git a/FiltersExample/FastttCameraDemo.xcodeproj/project.pbxproj b/FiltersExample/FastttCameraDemo.xcodeproj/project.pbxproj index 8c061e8..c31fc40 100644 --- a/FiltersExample/FastttCameraDemo.xcodeproj/project.pbxproj +++ b/FiltersExample/FastttCameraDemo.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 483DDAA9BBF02B077024403A /* libPods-FastttCameraDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 584097491FEF9A8DD4FFB985 /* libPods-FastttCameraDemo.a */; }; - 6B51047A6A0945C8D18CDE51 /* libPods-FastttCameraDemoTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0539E4652A206C1051AF65AB /* libPods-FastttCameraDemoTests.a */; }; FAA260301B790CA700A2174A /* FastttCameraTest.png in Resources */ = {isa = PBXBuildFile; fileRef = FAA2602C1B790CA700A2174A /* FastttCameraTest.png */; }; FAA260311B790CA700A2174A /* FastttCameraTestLeftMirrored.png in Resources */ = {isa = PBXBuildFile; fileRef = FAA2602D1B790CA700A2174A /* FastttCameraTestLeftMirrored.png */; }; FAA260321B790CA700A2174A /* FastttCameraTestRight.png in Resources */ = {isa = PBXBuildFile; fileRef = FAA2602E1B790CA700A2174A /* FastttCameraTestRight.png */; }; @@ -30,6 +29,7 @@ FAC594371B790A9000EBAA93 /* IFTTTDeviceOrientationSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC5942E1B790A9000EBAA93 /* IFTTTDeviceOrientationSpec.m */; }; FAC594381B790A9000EBAA93 /* UIImageFastttCameraSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC5942F1B790A9000EBAA93 /* UIImageFastttCameraSpec.m */; }; FAC594391B790A9000EBAA93 /* UIViewControllerFastttCameraSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = FAC594301B790A9000EBAA93 /* UIViewControllerFastttCameraSpec.m */; }; + FD503F077D5927DBEC687DD5 /* libPods-FastttCameraDemo-FastttCameraDemoTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D7FFC6440253B644F6E75E6 /* libPods-FastttCameraDemo-FastttCameraDemoTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -43,12 +43,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 0539E4652A206C1051AF65AB /* libPods-FastttCameraDemoTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FastttCameraDemoTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 401024D4E281DBF8463341AF /* Pods-FastttCameraDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemo/Pods-FastttCameraDemo.release.xcconfig"; sourceTree = ""; }; - 5675D70A9EDCBB77E2F3D6F1 /* Pods-FastttCameraDemoTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemoTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemoTests/Pods-FastttCameraDemoTests.release.xcconfig"; sourceTree = ""; }; + 16439BB86273479A6010124A /* Pods-FastttCameraDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemo/Pods-FastttCameraDemo.release.xcconfig"; sourceTree = ""; }; + 273B9DA374CB100834E2C2B3 /* Pods-FastttCameraDemo-FastttCameraDemoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemo-FastttCameraDemoTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemo-FastttCameraDemoTests/Pods-FastttCameraDemo-FastttCameraDemoTests.debug.xcconfig"; sourceTree = ""; }; 584097491FEF9A8DD4FFB985 /* libPods-FastttCameraDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FastttCameraDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - DD464D591C1267739978B593 /* Pods-FastttCameraDemoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemoTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemoTests/Pods-FastttCameraDemoTests.debug.xcconfig"; sourceTree = ""; }; - DFF517813E814CBB00C64ACB /* Pods-FastttCameraDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemo/Pods-FastttCameraDemo.debug.xcconfig"; sourceTree = ""; }; + 7D7FFC6440253B644F6E75E6 /* libPods-FastttCameraDemo-FastttCameraDemoTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FastttCameraDemo-FastttCameraDemoTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + BE42F7103DA7A9A0F0DEAF48 /* Pods-FastttCameraDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemo/Pods-FastttCameraDemo.debug.xcconfig"; sourceTree = ""; }; + D1CBC39335A280B1FBA65D05 /* Pods-FastttCameraDemo-FastttCameraDemoTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCameraDemo-FastttCameraDemoTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCameraDemo-FastttCameraDemoTests/Pods-FastttCameraDemo-FastttCameraDemoTests.release.xcconfig"; sourceTree = ""; }; FAA2602C1B790CA700A2174A /* FastttCameraTest.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = FastttCameraTest.png; sourceTree = ""; }; FAA2602D1B790CA700A2174A /* FastttCameraTestLeftMirrored.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = FastttCameraTestLeftMirrored.png; sourceTree = ""; }; FAA2602E1B790CA700A2174A /* FastttCameraTestRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = FastttCameraTestRight.png; sourceTree = ""; }; @@ -95,20 +95,20 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 6B51047A6A0945C8D18CDE51 /* libPods-FastttCameraDemoTests.a in Frameworks */, + FD503F077D5927DBEC687DD5 /* libPods-FastttCameraDemo-FastttCameraDemoTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 2BF746406D5E0AC10D082974 /* Pods */ = { + 7E65E1AAB5B7794600C74E00 /* Pods */ = { isa = PBXGroup; children = ( - DFF517813E814CBB00C64ACB /* Pods-FastttCameraDemo.debug.xcconfig */, - 401024D4E281DBF8463341AF /* Pods-FastttCameraDemo.release.xcconfig */, - DD464D591C1267739978B593 /* Pods-FastttCameraDemoTests.debug.xcconfig */, - 5675D70A9EDCBB77E2F3D6F1 /* Pods-FastttCameraDemoTests.release.xcconfig */, + BE42F7103DA7A9A0F0DEAF48 /* Pods-FastttCameraDemo.debug.xcconfig */, + 16439BB86273479A6010124A /* Pods-FastttCameraDemo.release.xcconfig */, + 273B9DA374CB100834E2C2B3 /* Pods-FastttCameraDemo-FastttCameraDemoTests.debug.xcconfig */, + D1CBC39335A280B1FBA65D05 /* Pods-FastttCameraDemo-FastttCameraDemoTests.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -117,7 +117,7 @@ isa = PBXGroup; children = ( 584097491FEF9A8DD4FFB985 /* libPods-FastttCameraDemo.a */, - 0539E4652A206C1051AF65AB /* libPods-FastttCameraDemoTests.a */, + 7D7FFC6440253B644F6E75E6 /* libPods-FastttCameraDemo-FastttCameraDemoTests.a */, ); name = Frameworks; sourceTree = ""; @@ -139,8 +139,8 @@ FAC593EF1B7909A800EBAA93 /* FastttCameraDemo */, FAC594091B7909A900EBAA93 /* FastttCameraDemoTests */, FAC593EE1B7909A800EBAA93 /* Products */, - 2BF746406D5E0AC10D082974 /* Pods */, D7B78F50656EC97599AAB575 /* Frameworks */, + 7E65E1AAB5B7794600C74E00 /* Pods */, ); sourceTree = ""; }; @@ -216,11 +216,12 @@ isa = PBXNativeTarget; buildConfigurationList = FAC594101B7909A900EBAA93 /* Build configuration list for PBXNativeTarget "FastttCameraDemo" */; buildPhases = ( - 5E596DF4A084E3C491BC7AA3 /* Check Pods Manifest.lock */, + 5E596DF4A084E3C491BC7AA3 /* [CP] Check Pods Manifest.lock */, FAC593E91B7909A800EBAA93 /* Sources */, FAC593EA1B7909A800EBAA93 /* Frameworks */, FAC593EB1B7909A800EBAA93 /* Resources */, - 38B461BBB27EBFBFA8CB1620 /* Copy Pods Resources */, + 38B461BBB27EBFBFA8CB1620 /* [CP] Copy Pods Resources */, + 051F56B732E9FE541C2BB980 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -235,11 +236,12 @@ isa = PBXNativeTarget; buildConfigurationList = FAC594131B7909A900EBAA93 /* Build configuration list for PBXNativeTarget "FastttCameraDemoTests" */; buildPhases = ( - 1C0E9F11DDC2AD391A26FF9E /* Check Pods Manifest.lock */, + 1C0E9F11DDC2AD391A26FF9E /* [CP] Check Pods Manifest.lock */, FAC594021B7909A900EBAA93 /* Sources */, FAC594031B7909A900EBAA93 /* Frameworks */, FAC594041B7909A900EBAA93 /* Resources */, - DA1E845DA2CCE50D4C1232FD /* Copy Pods Resources */, + DA1E845DA2CCE50D4C1232FD /* [CP] Copy Pods Resources */, + 19B24C52915FF11F5ECDA6FD /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -257,7 +259,7 @@ FAC593E51B7909A800EBAA93 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0640; + LastUpgradeCheck = 0730; ORGANIZATIONNAME = IFTTT; TargetAttributes = { FAC593EC1B7909A800EBAA93 = { @@ -311,14 +313,44 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1C0E9F11DDC2AD391A26FF9E /* Check Pods Manifest.lock */ = { + 051F56B732E9FE541C2BB980 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCameraDemo/Pods-FastttCameraDemo-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 19B24C52915FF11F5ECDA6FD /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCameraDemo-FastttCameraDemoTests/Pods-FastttCameraDemo-FastttCameraDemoTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 1C0E9F11DDC2AD391A26FF9E /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -326,14 +358,14 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - 38B461BBB27EBFBFA8CB1620 /* Copy Pods Resources */ = { + 38B461BBB27EBFBFA8CB1620 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -341,14 +373,14 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCameraDemo/Pods-FastttCameraDemo-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 5E596DF4A084E3C491BC7AA3 /* Check Pods Manifest.lock */ = { + 5E596DF4A084E3C491BC7AA3 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Check Pods Manifest.lock"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; @@ -356,19 +388,19 @@ shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; - DA1E845DA2CCE50D4C1232FD /* Copy Pods Resources */ = { + DA1E845DA2CCE50D4C1232FD /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "Copy Pods Resources"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCameraDemoTests/Pods-FastttCameraDemoTests-resources.sh\"\n"; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FastttCameraDemo-FastttCameraDemoTests/Pods-FastttCameraDemo-FastttCameraDemoTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -436,6 +468,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -499,43 +532,42 @@ }; FAC594111B7909A900EBAA93 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DFF517813E814CBB00C64ACB /* Pods-FastttCameraDemo.debug.xcconfig */; + baseConfigurationReference = BE42F7103DA7A9A0F0DEAF48 /* Pods-FastttCameraDemo.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FastttCameraDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; FAC594121B7909A900EBAA93 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 401024D4E281DBF8463341AF /* Pods-FastttCameraDemo.release.xcconfig */; + baseConfigurationReference = 16439BB86273479A6010124A /* Pods-FastttCameraDemo.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FastttCameraDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; }; FAC594141B7909A900EBAA93 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DD464D591C1267739978B593 /* Pods-FastttCameraDemoTests.debug.xcconfig */; + baseConfigurationReference = 273B9DA374CB100834E2C2B3 /* Pods-FastttCameraDemo-FastttCameraDemoTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = FastttCameraDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FastttCameraDemo.app/FastttCameraDemo"; }; @@ -543,15 +575,12 @@ }; FAC594151B7909A900EBAA93 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5675D70A9EDCBB77E2F3D6F1 /* Pods-FastttCameraDemoTests.release.xcconfig */; + baseConfigurationReference = D1CBC39335A280B1FBA65D05 /* Pods-FastttCameraDemo-FastttCameraDemoTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); INFOPLIST_FILE = FastttCameraDemoTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FastttCameraDemo.app/FastttCameraDemo"; }; diff --git a/FiltersExample/FastttCameraDemo.xcodeproj/xcshareddata/xcschemes/FastttCameraDemo.xcscheme b/FiltersExample/FastttCameraDemo.xcodeproj/xcshareddata/xcschemes/FastttCameraDemo.xcscheme index 623b1e7..2b44d31 100644 --- a/FiltersExample/FastttCameraDemo.xcodeproj/xcshareddata/xcschemes/FastttCameraDemo.xcscheme +++ b/FiltersExample/FastttCameraDemo.xcodeproj/xcshareddata/xcschemes/FastttCameraDemo.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -62,15 +62,18 @@ ReferencedContainer = "container:FastttCameraDemo.xcodeproj"> + + @@ -86,10 +89,10 @@ diff --git a/FiltersExample/FastttCameraDemo/Info.plist b/FiltersExample/FastttCameraDemo/Info.plist index be65dfe..fb4115c 100644 --- a/FiltersExample/FastttCameraDemo/Info.plist +++ b/FiltersExample/FastttCameraDemo/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ifttt.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/FiltersExample/FastttCameraDemoTests/Info.plist b/FiltersExample/FastttCameraDemoTests/Info.plist index 857e912..ba72822 100644 --- a/FiltersExample/FastttCameraDemoTests/Info.plist +++ b/FiltersExample/FastttCameraDemoTests/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ifttt.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/FiltersExample/Podfile.lock b/FiltersExample/Podfile.lock index e12f92f..d5b1214 100644 --- a/FiltersExample/Podfile.lock +++ b/FiltersExample/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Expecta (1.0.3) + - Expecta (1.0.5) - Expecta+Snapshots (2.0.0): - Expecta (~> 1.0) - FBSnapshotTestCase/Core (~> 2.0.3) @@ -7,11 +7,11 @@ PODS: - FastttCamera/Filters (0.3.4): - FastttCamera/Default - GPUImage (~> 0.1.0) - - FBSnapshotTestCase/Core (2.0.4) + - FBSnapshotTestCase/Core (2.0.7) - GPUImage (0.1.7) - Masonry (0.6.1) - - OCMock (3.2) - - Specta (1.0.4) + - OCMock (3.3.1) + - Specta (1.0.5) DEPENDENCIES: - Expecta @@ -26,13 +26,15 @@ EXTERNAL SOURCES: :path: ../FastttCamera.podspec SPEC CHECKSUMS: - Expecta: 9d1bff6c8b0eeee73a166a2ee898892478927a15 + Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba FastttCamera: 51f16712cbd5bdb08bc6231b957325c6be5e478d - FBSnapshotTestCase: d94cf34841c9e77390e29009e8e2713479d48753 + FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547 GPUImage: 733a5f0fab92df9de1c37ba9df520a833ccb406d Masonry: 4972309f2f134de9dd312f4dc4a21359b50e6caa - OCMock: 28def049ef47f996b515a8eeea958be7ccab2dbb - Specta: 69bb134672aae190a1379ff91df07dad8dd1f869 + OCMock: f3f61e6eaa16038c30caa5798c5e49d3307b6f22 + Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 -COCOAPODS: 0.38.2 +PODFILE CHECKSUM: 39184fa5faa0fd247cfe1a6dffeebdfa208a8e86 + +COCOAPODS: 1.0.1 From d6e66a186bd3b42ca60f6b2733e07c6e531f4696 Mon Sep 17 00:00:00 2001 From: maross Date: Wed, 21 Sep 2016 15:08:29 +0200 Subject: [PATCH 3/4] a lot of improvements --- Example/Example/ExampleViewController.m | 16 +- .../AppIcon.appiconset/Contents.json | 10 + Example/Example/Images.xcassets/Contents.json | 6 + .../LaunchImage.launchimage/Contents.json | 129 +++ Example/Example/Info.plist | 6 +- .../FastttCamera.xcodeproj/project.pbxproj | 29 +- .../xcschemes/FastttCamera.xcscheme | 19 +- Example/FastttCameraTests/Info.plist | 2 +- Example/Launch Screen.storyboard | 48 + Example/Podfile.lock | 16 +- FastttCamera/CYNCamera.h | 18 + FastttCamera/CYNCamera.m | 977 ++++++++++++++++++ FastttCamera/CYNCameraInterface.h | 24 + 13 files changed, 1272 insertions(+), 28 deletions(-) create mode 100644 Example/Example/Images.xcassets/Contents.json create mode 100644 Example/Launch Screen.storyboard create mode 100644 FastttCamera/CYNCamera.h create mode 100644 FastttCamera/CYNCamera.m create mode 100644 FastttCamera/CYNCameraInterface.h diff --git a/Example/Example/ExampleViewController.m b/Example/Example/ExampleViewController.m index b3df614..54c6c36 100644 --- a/Example/Example/ExampleViewController.m +++ b/Example/Example/ExampleViewController.m @@ -8,12 +8,14 @@ #import "ExampleViewController.h" #import +#import #import #import "ConfirmViewController.h" @interface ExampleViewController () -@property (nonatomic, strong) FastttCamera *fastCamera; +//@property (nonatomic, strong) FastttCamera *fastCamera; +@property (nonatomic, strong) CYNCamera *fastCamera; @property (nonatomic, strong) UIButton *takePhotoButton; @property (nonatomic, strong) UIButton *flashButton; @property (nonatomic, strong) UIButton *torchButton; @@ -39,18 +41,20 @@ - (void)viewDidLoad { [super viewDidLoad]; - _fastCamera = [FastttCamera new]; +// _fastCamera = [FastttCamera new]; + _fastCamera = [CYNCamera new]; self.fastCamera.delegate = self; self.fastCamera.maxScaledDimension = 600.f; + self.fastCamera.showsFocusView = YES; [self fastttAddChildViewController:self.fastCamera]; [self.fastCamera.view mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(self.view); - make.height.and.width.lessThanOrEqualTo(self.view.mas_width).with.priorityHigh(); - make.height.and.width.lessThanOrEqualTo(self.view.mas_height).with.priorityHigh(); - make.height.and.width.equalTo(self.view.mas_width).with.priorityLow(); - make.height.and.width.equalTo(self.view.mas_height).with.priorityLow(); +// make.height.and.width.lessThanOrEqualTo(self.view.mas_width).with.priorityHigh(); +// make.height.and.width.lessThanOrEqualTo(self.view.mas_height).with.priorityHigh(); + make.width.equalTo(self.view.mas_width).with.priorityLow(); + make.height.equalTo(self.view.mas_height).with.priorityLow(); }]; _takePhotoButton = [UIButton new]; diff --git a/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json index 118c98f..b8236c6 100644 --- a/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Example/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", diff --git a/Example/Example/Images.xcassets/Contents.json b/Example/Example/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Example/Example/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json b/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json index e37b649..ce3fb1a 100644 --- a/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/Example/Example/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -3,15 +3,144 @@ { "orientation" : "portrait", "idiom" : "iphone", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "subtype" : "retina4", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "8.0", + "subtype" : "736h", + "scale" : "3x" + }, + { + "orientation" : "landscape", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "8.0", + "subtype" : "736h", + "scale" : "3x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "8.0", + "subtype" : "667h", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "8.0", + "subtype" : "1366h", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", "minimum-system-version" : "7.0", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", + "extent" : "full-screen", "minimum-system-version" : "7.0", "subtype" : "retina4", "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" } ], "info" : { diff --git a/Example/Example/Info.plist b/Example/Example/Info.plist index be65dfe..caceed3 100644 --- a/Example/Example/Info.plist +++ b/Example/Example/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ifttt.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -22,6 +22,8 @@ 1 LSRequiresIPhoneOS + UILaunchStoryboardName + Launch Screen UIRequiredDeviceCapabilities armv7 @@ -29,8 +31,6 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight diff --git a/Example/FastttCamera.xcodeproj/project.pbxproj b/Example/FastttCamera.xcodeproj/project.pbxproj index 5d9fe37..56da94b 100644 --- a/Example/FastttCamera.xcodeproj/project.pbxproj +++ b/Example/FastttCamera.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 4A1C079C1D914E6A00C6F9EA /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4A1C079B1D914E6A00C6F9EA /* Launch Screen.storyboard */; }; 4C919A752452D6B889592318 /* libPods-FastttCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D67EFF1504E0A50EB57D1275 /* libPods-FastttCamera.a */; }; DC0A33DB4A0EE2F1F41FA5B0 /* libPods-FastttCamera-FastttCameraTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F9AB7CE82B7818B5AD9623F /* libPods-FastttCamera-FastttCameraTests.a */; }; FA1916571AA68D1F00C51681 /* FastttFocusSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = FA1916561AA68D1F00C51681 /* FastttFocusSpec.m */; }; @@ -43,6 +44,7 @@ /* Begin PBXFileReference section */ 027C9048D236E26032130398 /* Pods-FastttCamera.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCamera.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCamera/Pods-FastttCamera.debug.xcconfig"; sourceTree = ""; }; + 4A1C079B1D914E6A00C6F9EA /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = "Launch Screen.storyboard"; path = "../Launch Screen.storyboard"; sourceTree = ""; }; 6F9AB7CE82B7818B5AD9623F /* libPods-FastttCamera-FastttCameraTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FastttCamera-FastttCameraTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B34120259D718FF104495E4E /* Pods-FastttCamera-FastttCameraTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCamera-FastttCameraTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCamera-FastttCameraTests/Pods-FastttCamera-FastttCameraTests.release.xcconfig"; sourceTree = ""; }; B382500DAE4F9FCE2C3784FD /* Pods-FastttCamera.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FastttCamera.release.xcconfig"; path = "Pods/Target Support Files/Pods-FastttCamera/Pods-FastttCamera.release.xcconfig"; sourceTree = ""; }; @@ -174,6 +176,7 @@ FAC389961A8928440005EFDD /* Supporting Files */ = { isa = PBXGroup; children = ( + 4A1C079B1D914E6A00C6F9EA /* Launch Screen.storyboard */, FAC389971A8928440005EFDD /* Info.plist */, FAC389981A8928440005EFDD /* main.m */, ); @@ -255,14 +258,16 @@ FAC3898B1A8928440005EFDD /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0610; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = IFTTT; TargetAttributes = { FAC389921A8928440005EFDD = { CreatedOnToolsVersion = 6.1.1; + DevelopmentTeam = DNG3JLER88; }; FAC389AB1A8928440005EFDD = { CreatedOnToolsVersion = 6.1.1; + DevelopmentTeam = DNG3JLER88; TestTargetID = FAC389921A8928440005EFDD; }; }; @@ -291,6 +296,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4A1C079C1D914E6A00C6F9EA /* Launch Screen.storyboard in Resources */, FA28C5461A9BB488009DBB83 /* FastttCameraTestLeftMirrored.png in Resources */, FA58AAA11A9BEB2B002CB34B /* FastttCameraTestRight.png in Resources */, FA5A120B1A9C309900C8A236 /* LargeTestPhoto.jpg in Resources */, @@ -454,17 +460,21 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -497,8 +507,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -508,6 +520,7 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -540,6 +553,7 @@ CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = DNG3JLER88; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; @@ -557,11 +571,13 @@ GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; RUN_CLANG_STATIC_ANALYZER = YES; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -584,6 +600,7 @@ CLANG_WARN__EXIT_TIME_DESTRUCTORS = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = DNG3JLER88; GCC_GENERATE_TEST_COVERAGE_FILES = YES; GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; @@ -601,11 +618,13 @@ GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_LABEL = YES; INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; RUN_CLANG_STATIC_ANALYZER = YES; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; @@ -614,6 +633,7 @@ baseConfigurationReference = E067B6C029ECAA7B4C5AE191 /* Pods-FastttCamera-FastttCameraTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = DNG3JLER88; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -624,6 +644,7 @@ ); INFOPLIST_FILE = FastttCameraTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FastttCamera.app/FastttCamera"; }; @@ -634,12 +655,14 @@ baseConfigurationReference = B34120259D718FF104495E4E /* Pods-FastttCamera-FastttCameraTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + DEVELOPMENT_TEAM = DNG3JLER88; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); INFOPLIST_FILE = FastttCameraTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "ifttt.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FastttCamera.app/FastttCamera"; }; diff --git a/Example/FastttCamera.xcodeproj/xcshareddata/xcschemes/FastttCamera.xcscheme b/Example/FastttCamera.xcodeproj/xcshareddata/xcschemes/FastttCamera.xcscheme index 67d4bee..1b619d9 100644 --- a/Example/FastttCamera.xcodeproj/xcshareddata/xcschemes/FastttCamera.xcscheme +++ b/Example/FastttCamera.xcodeproj/xcshareddata/xcschemes/FastttCamera.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -62,17 +62,21 @@ ReferencedContainer = "container:FastttCamera.xcodeproj"> + + - + - + CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ifttt.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Example/Launch Screen.storyboard b/Example/Launch Screen.storyboard new file mode 100644 index 0000000..967ffc9 --- /dev/null +++ b/Example/Launch Screen.storyboard @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 93bd54b..6639a3a 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,15 +1,15 @@ PODS: - - Expecta (1.0.3) + - Expecta (1.0.5) - Expecta+Snapshots (2.0.0): - Expecta (~> 1.0) - FBSnapshotTestCase/Core (~> 2.0.3) - FastttCamera (0.3.4): - FastttCamera/Default (= 0.3.4) - FastttCamera/Default (0.3.4) - - FBSnapshotTestCase/Core (2.0.4) + - FBSnapshotTestCase/Core (2.0.7) - Masonry (0.6.1) - - OCMock (3.2) - - Specta (1.0.4) + - OCMock (3.3.1) + - Specta (1.0.5) DEPENDENCIES: - Expecta @@ -24,13 +24,13 @@ EXTERNAL SOURCES: :path: ../FastttCamera.podspec SPEC CHECKSUMS: - Expecta: 9d1bff6c8b0eeee73a166a2ee898892478927a15 + Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe Expecta+Snapshots: 29b38dd695bc72a0ed2bea833937d78df41943ba FastttCamera: 51f16712cbd5bdb08bc6231b957325c6be5e478d - FBSnapshotTestCase: d94cf34841c9e77390e29009e8e2713479d48753 + FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547 Masonry: 4972309f2f134de9dd312f4dc4a21359b50e6caa - OCMock: 28def049ef47f996b515a8eeea958be7ccab2dbb - Specta: 69bb134672aae190a1379ff91df07dad8dd1f869 + OCMock: f3f61e6eaa16038c30caa5798c5e49d3307b6f22 + Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 PODFILE CHECKSUM: 8b803b068d0f7869491602ceaa035cda38f4a00b diff --git a/FastttCamera/CYNCamera.h b/FastttCamera/CYNCamera.h new file mode 100644 index 0000000..45c22f1 --- /dev/null +++ b/FastttCamera/CYNCamera.h @@ -0,0 +1,18 @@ +// +// CYNCamera.h +// CYNCamera +// +// Created by Marco Rossi on 19/09/16. +// +// + +#import +#import "CYNCameraInterface.h" + +/** + * Cynny improved version of FastttCamera + * + */ +@interface CYNCamera : UIViewController + +@end diff --git a/FastttCamera/CYNCamera.m b/FastttCamera/CYNCamera.m new file mode 100644 index 0000000..a51c61f --- /dev/null +++ b/FastttCamera/CYNCamera.m @@ -0,0 +1,977 @@ +// +// CYNCamera.m +// CYNCamera +// +// Created by Marco Rossi on 19/09/16. +// +// + +#import + +#import "CYNCamera.h" + +#import "IFTTTDeviceOrientation.h" +#import "UIImage+FastttCamera.h" +#import "AVCaptureDevice+FastttCamera.h" +#import "FastttFocus.h" +#import "FastttZoom.h" +#import "FastttCapturedImage+Process.h" + +@interface CYNCamera () + +@property (nonatomic, strong) IFTTTDeviceOrientation *deviceOrientation; +@property (nonatomic, strong) FastttFocus *fastFocus; +@property (nonatomic, strong) FastttZoom *fastZoom; +@property (nonatomic, strong) AVCaptureSession *session; +@property (nonatomic, strong) AVCaptureVideoPreviewLayer *previewLayer; +@property (nonatomic, strong) AVCaptureStillImageOutput *stillImageOutput; +@property (nonatomic, assign) BOOL deviceAuthorized; +@property (nonatomic, assign) BOOL isCapturingImage; + +@property (nonatomic) dispatch_queue_t sessionQueue; + +@end + +@implementation CYNCamera + +@synthesize delegate = _delegate, + returnsRotatedPreview = _returnsRotatedPreview, + showsFocusView = _showsFocusView, + maxScaledDimension = _maxScaledDimension, + normalizesImageOrientations = _normalizesImageOrientations, + cropsImageToVisibleAspectRatio = _cropsImageToVisibleAspectRatio, + interfaceRotatesWithOrientation = _interfaceRotatesWithOrientation, + fixedInterfaceOrientation = _fixedInterfaceOrientation, + handlesTapFocus = _handlesTapFocus, + handlesZoom = _handlesZoom, + maxZoomFactor = _maxZoomFactor, + showsZoomView = _showsZoomView, + gestureView = _gestureView, + gestureDelegate = _gestureDelegate, + scalesImage = _scalesImage, + cameraDevice = _cameraDevice, + cameraFlashMode = _cameraFlashMode, + cameraTorchMode = _cameraTorchMode; + +- (instancetype)init +{ + if ((self = [super init])) { + + [self cyn_setupCaptureSession]; + + _handlesTapFocus = YES; + _showsFocusView = YES; + _handlesZoom = YES; + _showsZoomView = YES; + _cropsImageToVisibleAspectRatio = YES; + _scalesImage = YES; + _maxScaledDimension = 0.f; + _maxZoomFactor = 1.f; + _normalizesImageOrientations = YES; + _returnsRotatedPreview = YES; + _interfaceRotatesWithOrientation = YES; + _fixedInterfaceOrientation = UIDeviceOrientationPortrait; + _cameraDevice = FastttCameraDeviceRear; + _cameraFlashMode = FastttCameraFlashModeOff; + _cameraTorchMode = FastttCameraTorchModeOff; + + // Communicate with the session and other session objects on this queue. + _sessionQueue = dispatch_queue_create("cyncamera_session_queue", DISPATCH_QUEUE_SERIAL); + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillEnterForeground:) + name:UIApplicationWillEnterForegroundNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationDidBecomeActive:) + name:UIApplicationDidBecomeActiveNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillResignActive:) + name:UIApplicationWillResignActiveNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationDidEnterBackground:) + name:UIApplicationDidEnterBackgroundNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(subjectAreaDidChange:) name:AVCaptureDeviceSubjectAreaDidChangeNotification + object:[self _currentCameraDevice]]; + } + + return self; +} + +- (void)dealloc +{ + _fastFocus = nil; + _fastZoom = nil; + + [self _teardownCaptureSession]; + + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - View Events + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + [self _insertPreviewLayer]; + + UIView *viewForGestures = self.view; + + if (self.gestureView) { + viewForGestures = self.gestureView; + } + + _fastFocus = [FastttFocus fastttFocusWithView:viewForGestures gestureDelegate:self.gestureDelegate]; + self.fastFocus.delegate = self; + + if (!self.handlesTapFocus) { + self.fastFocus.detectsTaps = NO; + } + + _fastZoom = [FastttZoom fastttZoomWithView:viewForGestures gestureDelegate:self.gestureDelegate]; + self.fastZoom.delegate = self; + + if (!self.handlesZoom) { + self.fastZoom.detectsPinch = NO; + } +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + [self startRunning]; + + [self _insertPreviewLayer]; + + [self _setPreviewVideoOrientation]; +} + +- (void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + + [self stopRunning]; +} + +- (void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + _previewLayer.frame = self.view.layer.bounds; +} + +#pragma mark - Notifications + +- (void)applicationWillEnterForeground:(NSNotification *)notification +{ + [self cyn_setupCaptureSession]; +} + +- (void)applicationDidBecomeActive:(NSNotification *)notification +{ + if (self.isViewLoaded && self.view.window) { + [self startRunning]; + [self _insertPreviewLayer]; + [self _setPreviewVideoOrientation]; + } +} + +- (void)applicationWillResignActive:(NSNotification *)notification +{ + [self stopRunning]; +} + +- (void)applicationDidEnterBackground:(NSNotification *)notification +{ + [self _teardownCaptureSession]; +} + +- (void)subjectAreaDidChange:(NSNotification *)notification +{ + CGPoint devicePoint = CGPointMake(0.5, 0.5); + [self _focusAtPointOfInterest:devicePoint continuousMode:YES]; +} + +#pragma mark - Autorotation + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations +{ + return UIInterfaceOrientationMaskAll; +} + +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + [self _setPreviewVideoOrientation]; +} + +#pragma mark - Taking a Photo + +- (BOOL)isReadyToCapturePhoto +{ + return !self.isCapturingImage; +} + +- (void)takePicture +{ + if (!_deviceAuthorized) { + return; + } + + [self _takePhoto]; +} + +- (void)cancelImageProcessing +{ + if (_isCapturingImage) { + _isCapturingImage = NO; + } +} + +#pragma mark - Processing a Photo + +- (void)processImage:(UIImage *)image withMaxDimension:(CGFloat)maxDimension +{ + [self _processImage:image withCropRect:CGRectNull maxDimension:maxDimension fromCamera:NO needsPreviewRotation:NO previewOrientation:UIDeviceOrientationUnknown]; +} + +- (void)processImage:(UIImage *)image withCropRect:(CGRect)cropRect +{ + [self _processImage:image withCropRect:cropRect maxDimension:0.f fromCamera:NO needsPreviewRotation:NO previewOrientation:UIDeviceOrientationUnknown]; +} + +- (void)processImage:(UIImage *)image withCropRect:(CGRect)cropRect maxDimension:(CGFloat)maxDimension +{ + [self _processImage:image withCropRect:cropRect maxDimension:maxDimension fromCamera:NO needsPreviewRotation:NO previewOrientation:UIDeviceOrientationUnknown]; +} + +#pragma mark - Camera State + ++ (BOOL)isPointFocusAvailableForCameraDevice:(FastttCameraDevice)cameraDevice +{ + return [AVCaptureDevice isPointFocusAvailableForCameraDevice:cameraDevice]; +} + +- (BOOL)focusAtPoint:(CGPoint)touchPoint +{ + CGPoint pointOfInterest = [self _focusPointOfInterestForTouchPoint:touchPoint]; + + return [self _focusAtPointOfInterest:pointOfInterest]; +} + +- (BOOL)zoomToScale:(CGFloat)scale +{ + return [[self _currentCameraDevice] zoomToScale:scale]; +} + +- (BOOL)isFlashAvailableForCurrentDevice +{ + AVCaptureDevice *device = [self _currentCameraDevice]; + + if ([device isFlashModeSupported:AVCaptureFlashModeOn]) { + return YES; + } + + return NO; +} + ++ (BOOL)isFlashAvailableForCameraDevice:(FastttCameraDevice)cameraDevice +{ + return [AVCaptureDevice isFlashAvailableForCameraDevice:cameraDevice]; +} + +- (BOOL)isTorchAvailableForCurrentDevice +{ + AVCaptureDevice *device = [self _currentCameraDevice]; + + if ([device isTorchModeSupported:AVCaptureTorchModeOn]) { + return YES; + } + + return NO; +} + ++ (BOOL)isTorchAvailableForCameraDevice:(FastttCameraDevice)cameraDevice +{ + return [AVCaptureDevice isTorchAvailableForCameraDevice:cameraDevice]; +} + ++ (BOOL)isCameraDeviceAvailable:(FastttCameraDevice)cameraDevice +{ + return ([AVCaptureDevice cameraDevice:cameraDevice] != nil); +} + +- (void)setCameraDevice:(FastttCameraDevice)cameraDevice +{ + [self _enqueueBlockOnSessionQueue:^{ + AVCaptureDevice *device = [AVCaptureDevice cameraDevice:cameraDevice]; + + if (!device) { + return; + } + + if (_cameraDevice != cameraDevice) { + _cameraDevice = cameraDevice; + + + AVCaptureDeviceInput *oldInput = [_session.inputs lastObject]; + AVCaptureDeviceInput *newInput = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil]; + + [_session beginConfiguration]; + [_session removeInput:oldInput]; + [_session addInput:newInput]; + [_session commitConfiguration]; + } + + [self setCameraFlashMode:_cameraFlashMode]; + [self _resetZoom]; + }]; +} + +- (void)setCameraFlashMode:(FastttCameraFlashMode)cameraFlashMode +{ + [self _enqueueBlockOnSessionQueue:^{ + AVCaptureDevice *device = [self _currentCameraDevice]; + + if ([AVCaptureDevice isFlashAvailableForCameraDevice:self.cameraDevice]) { + _cameraFlashMode = cameraFlashMode; + [device setCameraFlashMode:cameraFlashMode]; + return; + } + + _cameraFlashMode = FastttCameraFlashModeOff; + }]; +} + +- (void)setCameraTorchMode:(FastttCameraTorchMode)cameraTorchMode +{ + [self _enqueueBlockOnSessionQueue:^{ + AVCaptureDevice *device = [self _currentCameraDevice]; + + if ([AVCaptureDevice isTorchAvailableForCameraDevice:self.cameraDevice]) { + _cameraTorchMode = cameraTorchMode; + [device setCameraTorchMode:cameraTorchMode]; + return; + } + + _cameraTorchMode = FastttCameraTorchModeOff; + }]; +} + +#pragma mark - Capture Session Management + +- (void)startRunning +{ + [self _enqueueBlockOnSessionQueue:^{ + if (![_session isRunning]) { + [_session startRunning]; + } + }]; +} + +- (void)stopRunning +{ + [self _enqueueBlockOnSessionQueue:^{ + if ([_session isRunning]) { + [_session stopRunning]; + } + }]; +} + +- (void)_insertPreviewLayer +{ + if (!_deviceAuthorized) { + return; + } + + if ([_previewLayer superlayer] == [self.view layer] + && [_previewLayer session] == _session) { + return; + } + + [self _removePreviewLayer]; + + CALayer *rootLayer = [self.view layer]; + rootLayer.masksToBounds = YES; + + _previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:_session]; + _previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; + + _previewLayer.frame = rootLayer.bounds; + + [rootLayer insertSublayer:_previewLayer atIndex:0]; +} + +- (void)_removePreviewLayer +{ + [_previewLayer removeFromSuperlayer]; + _previewLayer = nil; +} + +- (void)cyn_setupCaptureSession { + if (_session) { + return; + } + +#if TARGET_IPHONE_SIMULATOR + _deviceAuthorized = YES; +#else + [self _checkDeviceAuthorizationWithCompletion:^(BOOL isAuthorized) { + _deviceAuthorized = isAuthorized; +#endif + + if (!_deviceAuthorized && [self.delegate respondsToSelector:@selector(userDeniedCameraPermissionsForCameraController:)]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate userDeniedCameraPermissionsForCameraController:self]; + }); + } + + if (_deviceAuthorized) { + _session = [AVCaptureSession new]; + _session.sessionPreset = AVCaptureSessionPresetPhoto; + + [self _enqueueBlockOnSessionQueue:^{ + AVCaptureDevice *device = [AVCaptureDevice cameraDevice:self.cameraDevice]; + + if (!device) { + device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + } + + if ([device lockForConfiguration:nil]) { + if([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]){ + device.focusMode = AVCaptureFocusModeContinuousAutoFocus; + } + + device.exposureMode = AVCaptureExposureModeContinuousAutoExposure; + + [device unlockForConfiguration]; + } + + [self.session beginConfiguration]; + +#if !TARGET_IPHONE_SIMULATOR + AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil]; + [_session addInput:deviceInput]; + + switch (device.position) { + case AVCaptureDevicePositionBack: + _cameraDevice = FastttCameraDeviceRear; + break; + + case AVCaptureDevicePositionFront: + _cameraDevice = FastttCameraDeviceFront; + break; + + default: + break; + } + + [self setCameraFlashMode:_cameraFlashMode]; +#endif + + NSDictionary *outputSettings = @{AVVideoCodecKey:AVVideoCodecJPEG}; + + _stillImageOutput = [AVCaptureStillImageOutput new]; + _stillImageOutput.outputSettings = outputSettings; + + [_session addOutput:_stillImageOutput]; + + [self.session commitConfiguration]; + + _deviceOrientation = [IFTTTDeviceOrientation new]; + + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.isViewLoaded && self.view.window) { + [self startRunning]; + [self _insertPreviewLayer]; + [self _setPreviewVideoOrientation]; + [self _resetZoom]; + } + }); + }]; + } + +#if !TARGET_IPHONE_SIMULATOR + }]; +#endif + +} + +- (void)_setupCaptureSession +{ + if (_session) { + return; + } + +#if !TARGET_IPHONE_SIMULATOR + [self _checkDeviceAuthorizationWithCompletion:^(BOOL isAuthorized) { + + _deviceAuthorized = isAuthorized; +#else + _deviceAuthorized = YES; +#endif + if (!_deviceAuthorized && [self.delegate respondsToSelector:@selector(userDeniedCameraPermissionsForCameraController:)]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate userDeniedCameraPermissionsForCameraController:self]; + }); + } + + if (_deviceAuthorized) { + + dispatch_async(dispatch_get_main_queue(), ^{ + + _session = [AVCaptureSession new]; + _session.sessionPreset = AVCaptureSessionPresetPhoto; + + AVCaptureDevice *device = [AVCaptureDevice cameraDevice:self.cameraDevice]; + + if (!device) { + device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; + } + + if ([device lockForConfiguration:nil]) { + if([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]){ + device.focusMode = AVCaptureFocusModeContinuousAutoFocus; + } + + device.exposureMode = AVCaptureExposureModeContinuousAutoExposure; + + [device unlockForConfiguration]; + } + +#if !TARGET_IPHONE_SIMULATOR + AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil]; + [_session addInput:deviceInput]; + + switch (device.position) { + case AVCaptureDevicePositionBack: + _cameraDevice = FastttCameraDeviceRear; + break; + + case AVCaptureDevicePositionFront: + _cameraDevice = FastttCameraDeviceFront; + break; + + default: + break; + } + + [self setCameraFlashMode:_cameraFlashMode]; +#endif + + NSDictionary *outputSettings = @{AVVideoCodecKey:AVVideoCodecJPEG}; + + _stillImageOutput = [AVCaptureStillImageOutput new]; + _stillImageOutput.outputSettings = outputSettings; + + [_session addOutput:_stillImageOutput]; + + _deviceOrientation = [IFTTTDeviceOrientation new]; + + if (self.isViewLoaded && self.view.window) { + [self startRunning]; + [self _insertPreviewLayer]; + [self _setPreviewVideoOrientation]; + [self _resetZoom]; + } + }); + } +#if !TARGET_IPHONE_SIMULATOR + }]; +#endif +} + +- (void)_teardownCaptureSession +{ + if (!_session) { + return; + } + + _deviceOrientation = nil; + + [self _enqueueBlockOnSessionQueue:^{ + if ([_session isRunning]) { + [_session stopRunning]; + } + + for (AVCaptureDeviceInput *input in [_session inputs]) { + [_session removeInput:input]; + } + + [_session removeOutput:_stillImageOutput]; + _stillImageOutput = nil; + }]; + + [self _removePreviewLayer]; + + _session = nil; +} + +#pragma mark - Queue helper methods + +typedef void (^CYNCameraBlock)(); + +- (void)_enqueueBlockOnSessionQueue:(CYNCameraBlock)block +{ + dispatch_async(_sessionQueue, ^{ + block(); + }); +} + +#pragma mark - Capturing a Photo + +- (void)_takePhoto +{ + if (self.isCapturingImage) { + return; + } + self.isCapturingImage = YES; + + BOOL needsPreviewRotation = ![self.deviceOrientation deviceOrientationMatchesInterfaceOrientation]; + + AVCaptureConnection *videoConnection = [self _currentCaptureConnection]; + + if ([videoConnection isVideoOrientationSupported]) { + [videoConnection setVideoOrientation:[self _currentCaptureVideoOrientationForDevice]]; + } + + if ([videoConnection isVideoMirroringSupported]) { + [videoConnection setVideoMirrored:(_cameraDevice == FastttCameraDeviceFront)]; + } + +#if TARGET_IPHONE_SIMULATOR + [self _insertPreviewLayer]; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + UIImage *fakeImage = [UIImage fastttFakeTestImage]; + [self _processCameraPhoto:fakeImage needsPreviewRotation:needsPreviewRotation previewOrientation:UIDeviceOrientationPortrait]; + }); +#else + UIDeviceOrientation previewOrientation = [self _currentPreviewDeviceOrientation]; + + [_stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection + completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) + { + if (!imageDataSampleBuffer) { + return; + } + + if (!self.isCapturingImage) { + return; + } + + NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; + + if ([self.delegate respondsToSelector:@selector(cameraController:didFinishCapturingImageData:)]) { + [self.delegate cameraController:self didFinishCapturingImageData:imageData]; + } + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + + UIImage *image = [UIImage imageWithData:imageData]; + + [self _processCameraPhoto:image needsPreviewRotation:needsPreviewRotation previewOrientation:previewOrientation]; + }); + }]; +#endif +} + +#pragma mark - Processing a Photo + +- (void)_processCameraPhoto:(UIImage *)image needsPreviewRotation:(BOOL)needsPreviewRotation previewOrientation:(UIDeviceOrientation)previewOrientation +{ + CGRect cropRect = CGRectNull; + if (self.cropsImageToVisibleAspectRatio) { + cropRect = [image fastttCropRectFromPreviewLayer:_previewLayer]; + } + + [self _processImage:image withCropRect:cropRect maxDimension:self.maxScaledDimension fromCamera:YES needsPreviewRotation:(needsPreviewRotation || !self.interfaceRotatesWithOrientation) previewOrientation:previewOrientation]; +} + +- (void)_processImage:(UIImage *)image withCropRect:(CGRect)cropRect maxDimension:(CGFloat)maxDimension fromCamera:(BOOL)fromCamera needsPreviewRotation:(BOOL)needsPreviewRotation previewOrientation:(UIDeviceOrientation)previewOrientation +{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + if (fromCamera && !self.isCapturingImage) { + return; + } + + FastttCapturedImage *capturedImage = [FastttCapturedImage fastttCapturedFullImage:image]; + + [capturedImage cropToRect:cropRect + returnsPreview:(fromCamera && self.returnsRotatedPreview) + needsPreviewRotation:needsPreviewRotation + withPreviewOrientation:previewOrientation + withCallback:^(FastttCapturedImage *capturedImage){ + if (fromCamera && !self.isCapturingImage) { + return; + } + if ([self.delegate respondsToSelector:@selector(cameraController:didFinishCapturingImage:)]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate cameraController:self didFinishCapturingImage:capturedImage]; + }); + } + }]; + + void (^scaleCallback)(FastttCapturedImage *capturedImage) = ^(FastttCapturedImage *capturedImage) { + if (fromCamera && !self.isCapturingImage) { + return; + } + if ([self.delegate respondsToSelector:@selector(cameraController:didFinishScalingCapturedImage:)]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate cameraController:self didFinishScalingCapturedImage:capturedImage]; + }); + } + }; + + if (fromCamera && !self.isCapturingImage) { + return; + } + + if (maxDimension > 0.f) { + [capturedImage scaleToMaxDimension:maxDimension + withCallback:scaleCallback]; + } else if (fromCamera && self.scalesImage) { + [capturedImage scaleToSize:self.view.bounds.size + withCallback:scaleCallback]; + } + + if (fromCamera && !self.isCapturingImage) { + return; + } + + if (self.normalizesImageOrientations) { + [capturedImage normalizeWithCallback:^(FastttCapturedImage *capturedImage){ + if (fromCamera && !self.isCapturingImage) { + return; + } + if ([self.delegate respondsToSelector:@selector(cameraController:didFinishNormalizingCapturedImage:)]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate cameraController:self didFinishNormalizingCapturedImage:capturedImage]; + }); + } + }]; + } + + self.isCapturingImage = NO; + }); +} + +#pragma mark - AV Orientation + +- (void)_setPreviewVideoOrientation +{ + AVCaptureConnection *videoConnection = [_previewLayer connection]; + + if ([videoConnection isVideoOrientationSupported]) { + [videoConnection setVideoOrientation:[self _currentPreviewVideoOrientationForDevice]]; + } +} + +- (AVCaptureVideoOrientation)_currentCaptureVideoOrientationForDevice +{ + UIDeviceOrientation actualOrientation = self.deviceOrientation.orientation; + + if (actualOrientation == UIDeviceOrientationFaceDown + || actualOrientation == UIDeviceOrientationFaceUp + || actualOrientation == UIDeviceOrientationUnknown) { + return [self _currentPreviewVideoOrientationForDevice]; + } + + return [self.class _videoOrientationForDeviceOrientation:actualOrientation]; +} + +- (UIDeviceOrientation)_currentPreviewDeviceOrientation +{ + if (!self.interfaceRotatesWithOrientation) { + return self.fixedInterfaceOrientation; + } + + return [[UIDevice currentDevice] orientation]; +} + +- (AVCaptureVideoOrientation)_currentPreviewVideoOrientationForDevice +{ + UIDeviceOrientation deviceOrientation = [self _currentPreviewDeviceOrientation]; + + return [self.class _videoOrientationForDeviceOrientation:deviceOrientation]; +} + ++ (AVCaptureVideoOrientation)_videoOrientationForDeviceOrientation:(UIDeviceOrientation)deviceOrientation +{ + switch (deviceOrientation) { + case UIDeviceOrientationPortrait: + return AVCaptureVideoOrientationPortrait; + + case UIDeviceOrientationPortraitUpsideDown: + return AVCaptureVideoOrientationPortraitUpsideDown; + + case UIDeviceOrientationLandscapeLeft: + return AVCaptureVideoOrientationLandscapeRight; + + case UIDeviceOrientationLandscapeRight: + return AVCaptureVideoOrientationLandscapeLeft; + + default: + break; + } + + return AVCaptureVideoOrientationPortrait; +} + +#pragma mark - Camera Permissions + +- (void)_checkDeviceAuthorizationWithCompletion:(void (^)(BOOL isAuthorized))completion +{ + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { + dispatch_async(dispatch_get_main_queue(), ^{ + if (completion) { + completion(granted); + } + }); + }]; +} + +#pragma mark - FastttCameraDevice + +- (AVCaptureDevice *)_currentCameraDevice +{ + return [_session.inputs.lastObject device]; +} + +- (AVCaptureConnection *)_currentCaptureConnection +{ + AVCaptureConnection *videoConnection = nil; + + for (AVCaptureConnection *connection in [_stillImageOutput connections]) { + for (AVCaptureInputPort *port in [connection inputPorts]) { + if ([[port mediaType] isEqual:AVMediaTypeVideo]) { + videoConnection = connection; + break; + } + } + + if (videoConnection) { + break; + } + } + + return videoConnection; +} + +- (CGPoint)_focusPointOfInterestForTouchPoint:(CGPoint)touchPoint +{ + return [_previewLayer captureDevicePointOfInterestForPoint:touchPoint]; +} + +- (BOOL)_focusAtPointOfInterest:(CGPoint)pointOfInterest +{ + return [[self _currentCameraDevice] focusAtPointOfInterest:pointOfInterest]; +} + +- (void)_focusAtPointOfInterest:(CGPoint)point continuousMode:(BOOL)continuousMode { + AVCaptureDevice *device = [self _currentCameraDevice]; + AVCaptureFocusMode focusMode = continuousMode ? AVCaptureFocusModeContinuousAutoFocus : AVCaptureFocusModeAutoFocus; + AVCaptureExposureMode exposureMode = continuousMode ? AVCaptureExposureModeContinuousAutoExposure : AVCaptureExposureModeAutoExpose; + AVCaptureWhiteBalanceMode whiteBalanceMode = continuousMode ? AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance : AVCaptureWhiteBalanceModeAutoWhiteBalance; + + dispatch_async(self.sessionQueue, ^{ + NSError *error; + if ([device lockForConfiguration:&error]) { + BOOL focusing = NO; + BOOL adjustingExposure = NO; + + if (device.isFocusPointOfInterestSupported) { + device.focusPointOfInterest = point; + } + if ([device isFocusModeSupported:focusMode]) { + device.focusMode = focusMode; + focusing = YES; + } + + if (device.isExposurePointOfInterestSupported) { + device.exposurePointOfInterest = point; + } + + if ([device isExposureModeSupported:exposureMode]) { + device.exposureMode = exposureMode; + adjustingExposure = YES; + } + + if ([device isWhiteBalanceModeSupported:whiteBalanceMode]) { + device.whiteBalanceMode = whiteBalanceMode; + } + + device.subjectAreaChangeMonitoringEnabled = !continuousMode; + + [device unlockForConfiguration]; + } + }); +} + +- (void)focusWithMode:(AVCaptureFocusMode)focusMode exposeWithMode:(AVCaptureExposureMode)exposureMode atDevicePoint:(CGPoint)point monitorSubjectAreaChange:(BOOL)monitorSubjectAreaChange +{ + dispatch_async(self.sessionQueue, ^{ + AVCaptureDevice *device = [self _currentCameraDevice]; + NSError *error = nil; + if ( [device lockForConfiguration:&error] ) { + // Setting (focus/exposure)PointOfInterest alone does not initiate a (focus/exposure) operation. + // Call -set(Focus/Exposure)Mode: to apply the new point of interest. + if ( device.isFocusPointOfInterestSupported && [device isFocusModeSupported:focusMode] ) { + device.focusPointOfInterest = point; + device.focusMode = focusMode; + } + + if ( device.isExposurePointOfInterestSupported && [device isExposureModeSupported:exposureMode] ) { + device.exposurePointOfInterest = point; + device.exposureMode = exposureMode; + } + + device.subjectAreaChangeMonitoringEnabled = monitorSubjectAreaChange; + [device unlockForConfiguration]; + } + else { + NSLog( @"Could not lock device for configuration: %@", error ); + } + }); +} + +- (void)_resetZoom +{ + [self.fastZoom resetZoom]; + + self.fastZoom.maxScale = [[self _currentCameraDevice] videoMaxZoomFactor]; + + self.maxZoomFactor = self.fastZoom.maxScale; +} + +#pragma mark - FastttFocusDelegate + +- (BOOL)handleTapFocusAtPoint:(CGPoint)touchPoint +{ + if ([AVCaptureDevice isPointFocusAvailableForCameraDevice:self.cameraDevice]) { + + CGPoint pointOfInterest = [self _focusPointOfInterestForTouchPoint:touchPoint]; + + [self _focusAtPointOfInterest:pointOfInterest continuousMode:NO]; + + return ([self _focusAtPointOfInterest:pointOfInterest] && self.showsFocusView); + } + + return NO; +} + +#pragma mark - FastttZoomDelegate + +- (BOOL)handlePinchZoomWithScale:(CGFloat)zoomScale +{ + return ([self zoomToScale:zoomScale] && self.showsZoomView); +} + +@end diff --git a/FastttCamera/CYNCameraInterface.h b/FastttCamera/CYNCameraInterface.h new file mode 100644 index 0000000..e4d146a --- /dev/null +++ b/FastttCamera/CYNCameraInterface.h @@ -0,0 +1,24 @@ +// +// CYNCameraInterface.h +// CYNCamera +// +// Created by Marco Rossi on 19/09/16. +// +// + +#import "FastttCameraInterface.h" + +@protocol CYNCameraInterface + ++ (BOOL)supportsVideoCapture; ++ (BOOL)isFrontCameraAvailable; ++ (BOOL)isRearCameraAvailable; + +//Video & audio permission ++ (BOOL)hasCameraPermission; ++ (void)requestCameraPermission:(void (^)(BOOL granted))completionBlock; + ++ (BOOL)hasMicrophonePermission; ++ (void)requestMicrophonePermission:(void (^)(BOOL granted))completionBlock; + +@end From 2f71b94db5c010cdaf303b6bc5a70dee2327b507 Mon Sep 17 00:00:00 2001 From: maross Date: Wed, 21 Sep 2016 15:15:42 +0200 Subject: [PATCH 4/4] added CYNCamera podpsec --- CYNCamera.podspec | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 CYNCamera.podspec diff --git a/CYNCamera.podspec b/CYNCamera.podspec new file mode 100644 index 0000000..a7c9d1d --- /dev/null +++ b/CYNCamera.podspec @@ -0,0 +1,32 @@ +Pod::Spec.new do |s| + s.name = "CYNCamera" + s.version = "0.0.1" + s.summary = "Cynny fork of FastttCamera project." + s.homepage = "https://github.com/maross/CYNCamera" + s.license = 'MIT' + s.author = { + "Laura Skelton" => "laura@ifttt.com", + "Jonathan Hersh" => "jonathan@ifttt.com", + "Max Meyers" => "max@ifttt.com", + "Devin Foley" => "devin@ifttt.com", + "Marco Rossi" => "marco.rossi@cynny.com" + } + s.source = { :git => "https://github.com/maross/CYNCamera.git", :tag => s.version.to_s } + s.social_media_url = '' + s.platform = :ios, '7.0' + s.requires_arc = true + s.compiler_flags = '-fmodules' + s.frameworks = 'UIKit', 'AVFoundation', 'CoreMotion' + + s.subspec 'Default' do |ss| + ss.source_files = 'FastttCamera/*.{h,m}' + end + + s.subspec 'Filters' do |ss| + ss.dependency 'GPUImage', '~> 0.1.0' + ss.dependency 'FastttCamera/Default' + ss.source_files = 'FastttCamera/Filters/*.{h,m}' + end + + s.default_subspec = 'Default' +end