From 1b2ea00eb7131cc33c910910cbb306be41c2e038 Mon Sep 17 00:00:00 2001 From: Bruno Muniz Date: Fri, 10 Aug 2018 13:37:52 +0200 Subject: [PATCH] Convert the project to swift and the example --- Example/Podfile | 12 +- Example/Podfile.lock | 19 +- .../SCForceUpdate.xcodeproj/project.pbxproj | 442 ++++++++++++ .../contents.xcworkspacedata | 2 +- .../xcschemes/SCForceUpdate-Example.xcscheme} | 69 +- Example/SCForceUpdate/AppDelegate.swift | 28 + .../SCForceUpdate/Base.lproj/LaunchScreen.xib | 46 ++ .../Base.lproj/Main.storyboard} | 36 +- .../AppIcon.appiconset/Contents.json | 36 +- .../Info.plist} | 21 +- Example/SCForceUpdate/ViewController.swift | 17 + .../SCForceUpdater.xcodeproj/project.pbxproj | 633 ------------------ .../contents.xcworkspacedata | 10 - .../Base.lproj/Main_iPad.storyboard | 46 -- .../LaunchImage.launchimage/Contents.json | 51 -- Example/SCForceUpdater/SCAppDelegate.h | 15 - Example/SCForceUpdater/SCAppDelegate.m | 29 - .../SCForceUpdater/SCForceUpdater-Prefix.pch | 16 - Example/SCForceUpdater/SCViewController.h | 15 - Example/SCForceUpdater/SCViewController.m | 38 -- .../SCForceUpdater/en.lproj/InfoPlist.strings | 2 - Example/SCForceUpdater/main.m | 18 - Example/Tests/Tests-Info.plist | 22 - Example/Tests/Tests-Prefix.pch | 11 - Example/Tests/Tests.m | 9 - Example/Tests/en.lproj/InfoPlist.strings | 2 - LICENSE | 2 +- Pod/Classes/Categories/NSBundle+Versions.h | 17 - Pod/Classes/Categories/NSBundle+Versions.m | 23 - .../Categories/NSString+CompareToVersion.h | 22 - .../Categories/NSString+CompareToVersion.m | 78 --- Pod/Classes/Categories/UIAlertView+TapBlock.h | 17 - Pod/Classes/Categories/UIAlertView+TapBlock.m | 57 -- Pod/Classes/SCForceUpdater.h | 27 - Pod/Classes/SCForceUpdater.m | 295 -------- Pod/Classes/SCNetworkManager.h | 18 - Pod/Classes/SCNetworkManager.m | 111 --- SCForceUpdate.podspec | 20 + {Pod => SCForceUpdate}/Classes/.gitkeep | 0 .../Classes/AlertControllerExtension.swift | 38 ++ SCForceUpdate/Classes/BundleExtension.swift | 24 + SCForceUpdate/Classes/Constants.swift | 44 ++ SCForceUpdate/Classes/SCForceUpdater.swift | 150 +++++ .../SCForceUpdaterLocalizable.strings | 10 +- SCForceUpdate/Classes/SCNetworkManager.swift | 81 +++ SCForceUpdate/Classes/StringExtension.swift | 68 ++ SCForceUpdater.podspec | 21 - TestServer/.ruby-gemset | 0 TestServer/.ruby-version | 0 TestServer/Gemfile | 0 TestServer/Gemfile.lock | 0 TestServer/app.rb | 0 TestServer/versions.yaml | 4 +- TestServer/views/index.erb | 0 _Pods.xcodeproj | 1 + 55 files changed, 1071 insertions(+), 1702 deletions(-) create mode 100644 Example/SCForceUpdate.xcodeproj/project.pbxproj rename Example/{SCForceUpdater.xcodeproj => SCForceUpdate.xcodeproj}/project.xcworkspace/contents.xcworkspacedata (68%) rename Example/{SCForceUpdater.xcodeproj/xcshareddata/xcschemes/SCForceUpdater-Example.xcscheme => SCForceUpdate.xcodeproj/xcshareddata/xcschemes/SCForceUpdate-Example.xcscheme} (55%) create mode 100644 Example/SCForceUpdate/AppDelegate.swift create mode 100644 Example/SCForceUpdate/Base.lproj/LaunchScreen.xib rename Example/{SCForceUpdater/Base.lproj/Main_iPhone.storyboard => SCForceUpdate/Base.lproj/Main.storyboard} (51%) rename Example/{SCForceUpdater => SCForceUpdate}/Images.xcassets/AppIcon.appiconset/Contents.json (59%) rename Example/{SCForceUpdater/SCForceUpdater-Info.plist => SCForceUpdate/Info.plist} (63%) create mode 100644 Example/SCForceUpdate/ViewController.swift delete mode 100644 Example/SCForceUpdater.xcodeproj/project.pbxproj delete mode 100644 Example/SCForceUpdater.xcworkspace/contents.xcworkspacedata delete mode 100644 Example/SCForceUpdater/Base.lproj/Main_iPad.storyboard delete mode 100644 Example/SCForceUpdater/Images.xcassets/LaunchImage.launchimage/Contents.json delete mode 100644 Example/SCForceUpdater/SCAppDelegate.h delete mode 100644 Example/SCForceUpdater/SCAppDelegate.m delete mode 100644 Example/SCForceUpdater/SCForceUpdater-Prefix.pch delete mode 100644 Example/SCForceUpdater/SCViewController.h delete mode 100644 Example/SCForceUpdater/SCViewController.m delete mode 100644 Example/SCForceUpdater/en.lproj/InfoPlist.strings delete mode 100644 Example/SCForceUpdater/main.m delete mode 100644 Example/Tests/Tests-Info.plist delete mode 100644 Example/Tests/Tests-Prefix.pch delete mode 100644 Example/Tests/Tests.m delete mode 100644 Example/Tests/en.lproj/InfoPlist.strings delete mode 100644 Pod/Classes/Categories/NSBundle+Versions.h delete mode 100644 Pod/Classes/Categories/NSBundle+Versions.m delete mode 100644 Pod/Classes/Categories/NSString+CompareToVersion.h delete mode 100644 Pod/Classes/Categories/NSString+CompareToVersion.m delete mode 100644 Pod/Classes/Categories/UIAlertView+TapBlock.h delete mode 100644 Pod/Classes/Categories/UIAlertView+TapBlock.m delete mode 100644 Pod/Classes/SCForceUpdater.h delete mode 100644 Pod/Classes/SCForceUpdater.m delete mode 100644 Pod/Classes/SCNetworkManager.h delete mode 100644 Pod/Classes/SCNetworkManager.m create mode 100644 SCForceUpdate.podspec rename {Pod => SCForceUpdate}/Classes/.gitkeep (100%) create mode 100644 SCForceUpdate/Classes/AlertControllerExtension.swift create mode 100644 SCForceUpdate/Classes/BundleExtension.swift create mode 100644 SCForceUpdate/Classes/Constants.swift create mode 100644 SCForceUpdate/Classes/SCForceUpdater.swift rename {Pod/Classes/Localization/en.lproj => SCForceUpdate/Classes}/SCForceUpdaterLocalizable.strings (63%) create mode 100644 SCForceUpdate/Classes/SCNetworkManager.swift create mode 100644 SCForceUpdate/Classes/StringExtension.swift delete mode 100644 SCForceUpdater.podspec mode change 100644 => 100755 TestServer/.ruby-gemset mode change 100644 => 100755 TestServer/.ruby-version mode change 100644 => 100755 TestServer/Gemfile mode change 100644 => 100755 TestServer/Gemfile.lock mode change 100644 => 100755 TestServer/app.rb mode change 100644 => 100755 TestServer/versions.yaml mode change 100644 => 100755 TestServer/views/index.erb create mode 120000 _Pods.xcodeproj diff --git a/Example/Podfile b/Example/Podfile index d9a2bae..23c4be4 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,10 +1,8 @@ -source 'https://github.com/CocoaPods/Specs.git' +use_frameworks! -target 'SCForceUpdater', :exclusive => true do - pod "SCForceUpdater", :path => "../" -end +platform :ios, '8.0' -target 'Tests', :exclusive => true do - pod "SCForceUpdater", :path => "../" +target 'Example' do + pod 'SCForceUpdate', :path => '../' + pod 'SwiftLint' end - diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 604f568..ff3ef4b 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,14 +1,23 @@ PODS: - - SCForceUpdater (1.0.0) + - SCForceUpdate (1.1.1) + - SwiftLint (0.26.0) DEPENDENCIES: - - SCForceUpdater (from `../`) + - SCForceUpdate (from `../`) + - SwiftLint + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - SwiftLint EXTERNAL SOURCES: - SCForceUpdater: + SCForceUpdate: :path: "../" SPEC CHECKSUMS: - SCForceUpdater: 5316b97ea8ffc9222734ea5b972e1d2cf3aa95ed + SCForceUpdate: dace1acd6e5c2a0fb1d880d6eba02123bf0857c7 + SwiftLint: f6b83e8d95ee1e91e11932d843af4fdcbf3fc764 + +PODFILE CHECKSUM: b4642bc25768fc7b606e7d71232c82511b96a639 -COCOAPODS: 0.39.0 +COCOAPODS: 1.5.3 diff --git a/Example/SCForceUpdate.xcodeproj/project.pbxproj b/Example/SCForceUpdate.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d3a600e --- /dev/null +++ b/Example/SCForceUpdate.xcodeproj/project.pbxproj @@ -0,0 +1,442 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; + 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; + 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; + 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; + 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; + 87EA8BDED07760F96D6913E7 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DF550ADBD5B09FB016A852A /* Pods_Example.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 190C0B1F51AAC5D4511D07C8 /* Pods-SCForceUpdate_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCForceUpdate_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-SCForceUpdate_Tests/Pods-SCForceUpdate_Tests.release.xcconfig"; sourceTree = ""; }; + 2412ACA131762CBBD2F20E4F /* Pods_SCForceUpdate_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SCForceUpdate_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 34982D752F8E4047F88FAE1F /* Pods-SCForceUpdate_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCForceUpdate_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-SCForceUpdate_Example/Pods-SCForceUpdate_Example.release.xcconfig"; sourceTree = ""; }; + 37CF87E52DBB2B2966508A67 /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5031F7B8A4FD21B0088C1FDA /* Pods-SCForceUpdate_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCForceUpdate_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SCForceUpdate_Example/Pods-SCForceUpdate_Example.debug.xcconfig"; sourceTree = ""; }; + 607FACD01AFB9204008FA782 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + 6833041D5B64241EC21BBCF9 /* SCForceUpdate.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SCForceUpdate.podspec; path = ../SCForceUpdate.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 78B79067F41D7A42C55E5D04 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; + 7A7BE8E8192CD59C45D0E983 /* Pods-SCForceUpdate_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCForceUpdate_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SCForceUpdate_Tests/Pods-SCForceUpdate_Tests.debug.xcconfig"; sourceTree = ""; }; + 85D1A773CC67BCC89F12CB54 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; + 9DF550ADBD5B09FB016A852A /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B44B0F5B939F6A4BC181F05B /* Pods_SCForceUpdate_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SCForceUpdate_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F2271B4D574D7780CC60C22B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; + F7F7D97C942C0F249484EC2C /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 607FACCD1AFB9204008FA782 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 87EA8BDED07760F96D6913E7 /* Pods_Example.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1F6D53C2B4CD366345D8EF3D /* Pods */ = { + isa = PBXGroup; + children = ( + 5031F7B8A4FD21B0088C1FDA /* Pods-SCForceUpdate_Example.debug.xcconfig */, + 34982D752F8E4047F88FAE1F /* Pods-SCForceUpdate_Example.release.xcconfig */, + 7A7BE8E8192CD59C45D0E983 /* Pods-SCForceUpdate_Tests.debug.xcconfig */, + 190C0B1F51AAC5D4511D07C8 /* Pods-SCForceUpdate_Tests.release.xcconfig */, + 78B79067F41D7A42C55E5D04 /* Pods-Example.debug.xcconfig */, + 85D1A773CC67BCC89F12CB54 /* Pods-Example.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 4456D4646D67C85AAAED8FD2 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2412ACA131762CBBD2F20E4F /* Pods_SCForceUpdate_Example.framework */, + B44B0F5B939F6A4BC181F05B /* Pods_SCForceUpdate_Tests.framework */, + 9DF550ADBD5B09FB016A852A /* Pods_Example.framework */, + 37CF87E52DBB2B2966508A67 /* Pods_Tests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 607FACC71AFB9204008FA782 = { + isa = PBXGroup; + children = ( + 607FACF51AFB993E008FA782 /* Podspec Metadata */, + 607FACD21AFB9204008FA782 /* Example */, + 607FACD11AFB9204008FA782 /* Products */, + 1F6D53C2B4CD366345D8EF3D /* Pods */, + 4456D4646D67C85AAAED8FD2 /* Frameworks */, + ); + sourceTree = ""; + }; + 607FACD11AFB9204008FA782 /* Products */ = { + isa = PBXGroup; + children = ( + 607FACD01AFB9204008FA782 /* Example.app */, + ); + name = Products; + sourceTree = ""; + }; + 607FACD21AFB9204008FA782 /* Example */ = { + isa = PBXGroup; + children = ( + 607FACD51AFB9204008FA782 /* AppDelegate.swift */, + 607FACD71AFB9204008FA782 /* ViewController.swift */, + 607FACD91AFB9204008FA782 /* Main.storyboard */, + 607FACDC1AFB9204008FA782 /* Images.xcassets */, + 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, + 607FACD31AFB9204008FA782 /* Supporting Files */, + ); + name = Example; + path = SCForceUpdate; + sourceTree = ""; + }; + 607FACD31AFB9204008FA782 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 607FACD41AFB9204008FA782 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { + isa = PBXGroup; + children = ( + 6833041D5B64241EC21BBCF9 /* SCForceUpdate.podspec */, + F2271B4D574D7780CC60C22B /* README.md */, + F7F7D97C942C0F249484EC2C /* LICENSE */, + ); + name = "Podspec Metadata"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 607FACCF1AFB9204008FA782 /* Example */ = { + isa = PBXNativeTarget; + buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Example" */; + buildPhases = ( + 34BCCC0C6884052C3B371910 /* [CP] Check Pods Manifest.lock */, + 607FACCC1AFB9204008FA782 /* Sources */, + 607FACCD1AFB9204008FA782 /* Frameworks */, + 607FACCE1AFB9204008FA782 /* Resources */, + D92895B8E519370D52130834 /* [CP] Embed Pods Frameworks */, + 277E0773212446A800FD2A1C /* SwiftLint */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Example; + productName = SCForceUpdate; + productReference = 607FACD01AFB9204008FA782 /* Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 607FACC81AFB9204008FA782 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = CocoaPods; + TargetAttributes = { + 607FACCF1AFB9204008FA782 = { + CreatedOnToolsVersion = 6.3.1; + LastSwiftMigration = 0900; + }; + }; + }; + buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "SCForceUpdate" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 607FACC71AFB9204008FA782; + productRefGroup = 607FACD11AFB9204008FA782 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 607FACCF1AFB9204008FA782 /* Example */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 607FACCE1AFB9204008FA782 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, + 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, + 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 277E0773212446A800FD2A1C /* SwiftLint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = SwiftLint; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\""; + }; + 34BCCC0C6884052C3B371910 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + D92895B8E519370D52130834 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/SCForceUpdate/SCForceUpdate.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SCForceUpdate.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 607FACCC1AFB9204008FA782 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, + 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 607FACD91AFB9204008FA782 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 607FACDA1AFB9204008FA782 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + 607FACDF1AFB9204008FA782 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 607FACED1AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + 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; + 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; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 607FACEE1AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + 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; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 607FACF01AFB9204008FA782 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 78B79067F41D7A42C55E5D04 /* Pods-Example.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SCForceUpdate/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + 607FACF11AFB9204008FA782 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 85D1A773CC67BCC89F12CB54 /* Pods-Example.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = SCForceUpdate/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "SCForceUpdate" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACED1AFB9204008FA782 /* Debug */, + 607FACEE1AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "Example" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 607FACF01AFB9204008FA782 /* Debug */, + 607FACF11AFB9204008FA782 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 607FACC81AFB9204008FA782 /* Project object */; +} diff --git a/Example/SCForceUpdater.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/SCForceUpdate.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 68% rename from Example/SCForceUpdater.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Example/SCForceUpdate.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 0e37fc4..a6dd4ab 100644 --- a/Example/SCForceUpdater.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/Example/SCForceUpdate.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:SCForceUpdate.xcodeproj"> diff --git a/Example/SCForceUpdater.xcodeproj/xcshareddata/xcschemes/SCForceUpdater-Example.xcscheme b/Example/SCForceUpdate.xcodeproj/xcshareddata/xcschemes/SCForceUpdate-Example.xcscheme similarity index 55% rename from Example/SCForceUpdater.xcodeproj/xcshareddata/xcschemes/SCForceUpdater-Example.xcscheme rename to Example/SCForceUpdate.xcodeproj/xcshareddata/xcschemes/SCForceUpdate-Example.xcscheme index f283446..b517b37 100644 --- a/Example/SCForceUpdater.xcodeproj/xcshareddata/xcschemes/SCForceUpdater-Example.xcscheme +++ b/Example/SCForceUpdate.xcodeproj/xcshareddata/xcschemes/SCForceUpdate-Example.xcscheme @@ -1,6 +1,6 @@ + BlueprintIdentifier = "607FACCF1AFB9204008FA782" + BuildableName = "Example.app" + BlueprintName = "Example" + ReferencedContainer = "container:SCForceUpdate.xcodeproj"> + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> + ReferencedContainer = "container:SCForceUpdate.xcodeproj"> + BlueprintIdentifier = "607FACCF1AFB9204008FA782" + BuildableName = "Example.app" + BlueprintName = "Example" + ReferencedContainer = "container:SCForceUpdate.xcodeproj"> + + - + + BlueprintIdentifier = "607FACCF1AFB9204008FA782" + BuildableName = "Example.app" + BlueprintName = "Example" + ReferencedContainer = "container:SCForceUpdate.xcodeproj"> - + + BlueprintIdentifier = "607FACCF1AFB9204008FA782" + BuildableName = "Example.app" + BlueprintName = "Example" + ReferencedContainer = "container:SCForceUpdate.xcodeproj"> diff --git a/Example/SCForceUpdate/AppDelegate.swift b/Example/SCForceUpdate/AppDelegate.swift new file mode 100644 index 0000000..4ee5c9d --- /dev/null +++ b/Example/SCForceUpdate/AppDelegate.swift @@ -0,0 +1,28 @@ +// +// AppDelegate.swift +// SCForceUpdate +// +// Created by Bruno Muniz on 08/07/2018. +// Copyright (c) 2018 Bruno Muniz. All rights reserved. +// + +import UIKit +import SCForceUpdate + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + + SCForceUpdater.sharedUpdater.set(itunesAppId: "iTunesAppId", + baseURL: "http://localhost:4567", + versionAPIEndpoint: "versions/ios") + return true + } + + func applicationDidBecomeActive(_ application: UIApplication) { + SCForceUpdater.sharedUpdater.checkForUpdate() + } +} diff --git a/Example/SCForceUpdate/Base.lproj/LaunchScreen.xib b/Example/SCForceUpdate/Base.lproj/LaunchScreen.xib new file mode 100644 index 0000000..72fa283 --- /dev/null +++ b/Example/SCForceUpdate/Base.lproj/LaunchScreen.xib @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/SCForceUpdater/Base.lproj/Main_iPhone.storyboard b/Example/SCForceUpdate/Base.lproj/Main.storyboard similarity index 51% rename from Example/SCForceUpdater/Base.lproj/Main_iPhone.storyboard rename to Example/SCForceUpdate/Base.lproj/Main.storyboard index 9abb2c9..833131e 100644 --- a/Example/SCForceUpdater/Base.lproj/Main_iPhone.storyboard +++ b/Example/SCForceUpdate/Base.lproj/Main.storyboard @@ -1,47 +1,43 @@ - - + + + + + - + + - + - + - - + - - + + - - - - - - diff --git a/Example/SCForceUpdater/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/SCForceUpdate/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 59% rename from Example/SCForceUpdater/Images.xcassets/AppIcon.appiconset/Contents.json rename to Example/SCForceUpdate/Images.xcassets/AppIcon.appiconset/Contents.json index f697f61..7006c9e 100644 --- a/Example/SCForceUpdater/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/SCForceUpdate/Images.xcassets/AppIcon.appiconset/Contents.json @@ -2,48 +2,48 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", + "size" : "20x20", "scale" : "2x" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "size" : "20x20", + "scale" : "3x" }, { "idiom" : "iphone", - "size" : "60x60", + "size" : "29x29", "scale" : "2x" }, { - "idiom" : "ipad", + "idiom" : "iphone", "size" : "29x29", - "scale" : "1x" + "scale" : "3x" }, { - "idiom" : "ipad", - "size" : "29x29", + "idiom" : "iphone", + "size" : "40x40", "scale" : "2x" }, { - "idiom" : "ipad", + "idiom" : "iphone", "size" : "40x40", - "scale" : "1x" + "scale" : "3x" }, { - "idiom" : "ipad", - "size" : "40x40", + "idiom" : "iphone", + "size" : "60x60", "scale" : "2x" }, { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" }, { - "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Example/SCForceUpdater/SCForceUpdater-Info.plist b/Example/SCForceUpdate/Info.plist similarity index 63% rename from Example/SCForceUpdater/SCForceUpdater-Info.plist rename to Example/SCForceUpdate/Info.plist index edfbad3..5cb02cd 100644 --- a/Example/SCForceUpdater/SCForceUpdater-Info.plist +++ b/Example/SCForceUpdate/Info.plist @@ -5,15 +5,15 @@ CFBundleDevelopmentRegion en CFBundleDisplayName - ${PRODUCT_NAME} + $(PRODUCT_NAME) CFBundleExecutable - ${EXECUTABLE_NAME} + $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - ${PRODUCT_NAME} + $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString @@ -29,10 +29,10 @@ NSAllowsArbitraryLoads + UILaunchStoryboardName + LaunchScreen UIMainStoryboardFile - Main_iPhone - UIMainStoryboardFile~ipad - Main_iPad + Main UIRequiredDeviceCapabilities armv7 @@ -40,15 +40,6 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight diff --git a/Example/SCForceUpdate/ViewController.swift b/Example/SCForceUpdate/ViewController.swift new file mode 100644 index 0000000..af07c34 --- /dev/null +++ b/Example/SCForceUpdate/ViewController.swift @@ -0,0 +1,17 @@ +// +// ViewController.swift +// SCForceUpdate +// +// Created by Bruno Muniz on 08/07/2018. +// Copyright (c) 2018 Bruno Muniz. All rights reserved. +// + +import UIKit +import SCForceUpdate + +final class ViewController: UIViewController { + // MARK: - Actions + @IBAction private func checkForUpdates() { + SCForceUpdater.sharedUpdater.checkForUpdate() + } +} diff --git a/Example/SCForceUpdater.xcodeproj/project.pbxproj b/Example/SCForceUpdater.xcodeproj/project.pbxproj deleted file mode 100644 index 6e1c6e4..0000000 --- a/Example/SCForceUpdater.xcodeproj/project.pbxproj +++ /dev/null @@ -1,633 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 2E2CB61207B9546D63619AB7 /* libPods-Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 529858A7DCB973187C313303 /* libPods-Tests.a */; }; - 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; - 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; - 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; - 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; - 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; - 6003F59E195388D20070C39A /* SCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* SCAppDelegate.m */; }; - 6003F5A1195388D20070C39A /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6003F59F195388D20070C39A /* Main_iPhone.storyboard */; }; - 6003F5A4195388D20070C39A /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A2195388D20070C39A /* Main_iPad.storyboard */; }; - 6003F5A7195388D20070C39A /* SCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* SCViewController.m */; }; - 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; - 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; - 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; - 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; - 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; - 6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; }; - EA9C71F94AA66EC95FB47148 /* libPods-SCForceUpdater.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADDED870CFB20C3EF4395E39 /* libPods-SCForceUpdater.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 6003F5B3195388D20070C39A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6003F582195388D10070C39A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 6003F589195388D20070C39A; - remoteInfo = SCForceUpdater; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0A3DE1EE2ED0600164489E13 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = ""; }; - 1F7A1E4F69FD8FE758C33816 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; - 25A2D0948FD4D6802D0CD7ED /* SCForceUpdater.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SCForceUpdater.podspec; path = ../SCForceUpdater.podspec; sourceTree = ""; }; - 4EF7FFE51346EAECEC429F0D /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = ""; }; - 529858A7DCB973187C313303 /* libPods-Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 6003F58A195388D20070C39A /* SCForceUpdater.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SCForceUpdater.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 6003F591195388D20070C39A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 6003F595195388D20070C39A /* SCForceUpdater-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SCForceUpdater-Info.plist"; sourceTree = ""; }; - 6003F597195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 6003F599195388D20070C39A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 6003F59B195388D20070C39A /* SCForceUpdater-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SCForceUpdater-Prefix.pch"; sourceTree = ""; }; - 6003F59C195388D20070C39A /* SCAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCAppDelegate.h; sourceTree = ""; }; - 6003F59D195388D20070C39A /* SCAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SCAppDelegate.m; sourceTree = ""; }; - 6003F5A0195388D20070C39A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; - 6003F5A3195388D20070C39A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; - 6003F5A5195388D20070C39A /* SCViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SCViewController.h; sourceTree = ""; }; - 6003F5A6195388D20070C39A /* SCViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SCViewController.m; sourceTree = ""; }; - 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 6003F5AE195388D20070C39A /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; - 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 6003F5BB195388D20070C39A /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; - 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; - 624C3C99061D5F274078BE9D /* Pods-SCForceUpdater.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCForceUpdater.release.xcconfig"; path = "Pods/Target Support Files/Pods-SCForceUpdater/Pods-SCForceUpdater.release.xcconfig"; sourceTree = ""; }; - 6ECDD26502D464C6DCFAF60C /* Pods-SCForceUpdater.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SCForceUpdater.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SCForceUpdater/Pods-SCForceUpdater.debug.xcconfig"; sourceTree = ""; }; - ADDED870CFB20C3EF4395E39 /* libPods-SCForceUpdater.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SCForceUpdater.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - E5E585EA0617EA0D7242D421 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 6003F587195388D20070C39A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, - 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, - 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, - EA9C71F94AA66EC95FB47148 /* libPods-SCForceUpdater.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6003F5AB195388D20070C39A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, - 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, - 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, - 2E2CB61207B9546D63619AB7 /* libPods-Tests.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 19E47B75403EA9F5AD93B0F2 /* Pods */ = { - isa = PBXGroup; - children = ( - 6ECDD26502D464C6DCFAF60C /* Pods-SCForceUpdater.debug.xcconfig */, - 624C3C99061D5F274078BE9D /* Pods-SCForceUpdater.release.xcconfig */, - 0A3DE1EE2ED0600164489E13 /* Pods-Tests.debug.xcconfig */, - 4EF7FFE51346EAECEC429F0D /* Pods-Tests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; - 6003F581195388D10070C39A = { - isa = PBXGroup; - children = ( - 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */, - 6003F593195388D20070C39A /* SCForceUpdater */, - 6003F5B5195388D20070C39A /* Tests */, - 6003F58C195388D20070C39A /* Frameworks */, - 6003F58B195388D20070C39A /* Products */, - 19E47B75403EA9F5AD93B0F2 /* Pods */, - ); - sourceTree = ""; - }; - 6003F58B195388D20070C39A /* Products */ = { - isa = PBXGroup; - children = ( - 6003F58A195388D20070C39A /* SCForceUpdater.app */, - 6003F5AE195388D20070C39A /* Tests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 6003F58C195388D20070C39A /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6003F58D195388D20070C39A /* Foundation.framework */, - 6003F58F195388D20070C39A /* CoreGraphics.framework */, - 6003F591195388D20070C39A /* UIKit.framework */, - 6003F5AF195388D20070C39A /* XCTest.framework */, - ADDED870CFB20C3EF4395E39 /* libPods-SCForceUpdater.a */, - 529858A7DCB973187C313303 /* libPods-Tests.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 6003F593195388D20070C39A /* SCForceUpdater */ = { - isa = PBXGroup; - children = ( - 6003F59C195388D20070C39A /* SCAppDelegate.h */, - 6003F59D195388D20070C39A /* SCAppDelegate.m */, - 6003F59F195388D20070C39A /* Main_iPhone.storyboard */, - 6003F5A2195388D20070C39A /* Main_iPad.storyboard */, - 6003F5A5195388D20070C39A /* SCViewController.h */, - 6003F5A6195388D20070C39A /* SCViewController.m */, - 6003F5A8195388D20070C39A /* Images.xcassets */, - 6003F594195388D20070C39A /* Supporting Files */, - ); - path = SCForceUpdater; - sourceTree = ""; - }; - 6003F594195388D20070C39A /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 6003F595195388D20070C39A /* SCForceUpdater-Info.plist */, - 6003F596195388D20070C39A /* InfoPlist.strings */, - 6003F599195388D20070C39A /* main.m */, - 6003F59B195388D20070C39A /* SCForceUpdater-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 6003F5B5195388D20070C39A /* Tests */ = { - isa = PBXGroup; - children = ( - 6003F5BB195388D20070C39A /* Tests.m */, - 6003F5B6195388D20070C39A /* Supporting Files */, - ); - path = Tests; - sourceTree = ""; - }; - 6003F5B6195388D20070C39A /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 6003F5B7195388D20070C39A /* Tests-Info.plist */, - 6003F5B8195388D20070C39A /* InfoPlist.strings */, - 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 60FF7A9C1954A5C5007DD14C /* Podspec Metadata */ = { - isa = PBXGroup; - children = ( - 25A2D0948FD4D6802D0CD7ED /* SCForceUpdater.podspec */, - E5E585EA0617EA0D7242D421 /* README.md */, - 1F7A1E4F69FD8FE758C33816 /* LICENSE */, - ); - name = "Podspec Metadata"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 6003F589195388D20070C39A /* SCForceUpdater */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SCForceUpdater" */; - buildPhases = ( - 0BABDF16A3962A42B19EC380 /* Check Pods Manifest.lock */, - 6003F586195388D20070C39A /* Sources */, - 6003F587195388D20070C39A /* Frameworks */, - 6003F588195388D20070C39A /* Resources */, - 638193CE683BDCE699E5488B /* Embed Pods Frameworks */, - 8058A36A31B798D3DC1224E5 /* Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SCForceUpdater; - productName = SCForceUpdater; - productReference = 6003F58A195388D20070C39A /* SCForceUpdater.app */; - productType = "com.apple.product-type.application"; - }; - 6003F5AD195388D20070C39A /* Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "Tests" */; - buildPhases = ( - A3DC0423BDD88AE82D200A04 /* Check Pods Manifest.lock */, - 6003F5AA195388D20070C39A /* Sources */, - 6003F5AB195388D20070C39A /* Frameworks */, - 6003F5AC195388D20070C39A /* Resources */, - 27639361B7221BFE86BD486E /* Embed Pods Frameworks */, - 40227591AD28ECE1F6DA86A1 /* Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 6003F5B4195388D20070C39A /* PBXTargetDependency */, - ); - name = Tests; - productName = SCForceUpdaterTests; - productReference = 6003F5AE195388D20070C39A /* Tests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 6003F582195388D10070C39A /* Project object */ = { - isa = PBXProject; - attributes = { - CLASSPREFIX = SC; - LastUpgradeCheck = 0510; - ORGANIZATIONNAME = "Richard Szabo"; - TargetAttributes = { - 6003F5AD195388D20070C39A = { - TestTargetID = 6003F589195388D20070C39A; - }; - }; - }; - buildConfigurationList = 6003F585195388D10070C39A /* Build configuration list for PBXProject "SCForceUpdater" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 6003F581195388D10070C39A; - productRefGroup = 6003F58B195388D20070C39A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 6003F589195388D20070C39A /* SCForceUpdater */, - 6003F5AD195388D20070C39A /* Tests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 6003F588195388D20070C39A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5A4195388D20070C39A /* Main_iPad.storyboard in Resources */, - 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, - 6003F5A1195388D20070C39A /* Main_iPhone.storyboard in Resources */, - 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6003F5AC195388D20070C39A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 0BABDF16A3962A42B19EC380 /* Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - 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; - }; - 27639361B7221BFE86BD486E /* Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 40227591AD28ECE1F6DA86A1 /* Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 638193CE683BDCE699E5488B /* Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SCForceUpdater/Pods-SCForceUpdater-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 8058A36A31B798D3DC1224E5 /* Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-SCForceUpdater/Pods-SCForceUpdater-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - A3DC0423BDD88AE82D200A04 /* Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - 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; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 6003F586195388D20070C39A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F59E195388D20070C39A /* SCAppDelegate.m in Sources */, - 6003F5A7195388D20070C39A /* SCViewController.m in Sources */, - 6003F59A195388D20070C39A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6003F5AA195388D20070C39A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6003F5BC195388D20070C39A /* Tests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 6003F5B4195388D20070C39A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 6003F589195388D20070C39A /* SCForceUpdater */; - targetProxy = 6003F5B3195388D20070C39A /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 6003F596195388D20070C39A /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 6003F597195388D20070C39A /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 6003F59F195388D20070C39A /* Main_iPhone.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 6003F5A0195388D20070C39A /* Base */, - ); - name = Main_iPhone.storyboard; - sourceTree = ""; - }; - 6003F5A2195388D20070C39A /* Main_iPad.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 6003F5A3195388D20070C39A /* Base */, - ); - name = Main_iPad.storyboard; - sourceTree = ""; - }; - 6003F5B8195388D20070C39A /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 6003F5B9195388D20070C39A /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 6003F5BD195388D20070C39A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 6003F5BE195388D20070C39A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 6003F5C0195388D20070C39A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 6ECDD26502D464C6DCFAF60C /* Pods-SCForceUpdater.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SCForceUpdater/SCForceUpdater-Prefix.pch"; - INFOPLIST_FILE = "SCForceUpdater/SCForceUpdater-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = io.supercharge.SCForceUpdater; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - 6003F5C1195388D20070C39A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 624C3C99061D5F274078BE9D /* Pods-SCForceUpdater.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "SCForceUpdater/SCForceUpdater-Prefix.pch"; - INFOPLIST_FILE = "SCForceUpdater/SCForceUpdater-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = io.supercharge.SCForceUpdater; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - 6003F5C3195388D20070C39A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 0A3DE1EE2ED0600164489E13 /* Pods-Tests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SCForceUpdater.app/SCForceUpdater"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "Tests/Tests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - 6003F5C4195388D20070C39A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4EF7FFE51346EAECEC429F0D /* Pods-Tests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SCForceUpdater.app/SCForceUpdater"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; - INFOPLIST_FILE = "Tests/Tests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 6003F585195388D10070C39A /* Build configuration list for PBXProject "SCForceUpdater" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6003F5BD195388D20070C39A /* Debug */, - 6003F5BE195388D20070C39A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "SCForceUpdater" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6003F5C0195388D20070C39A /* Debug */, - 6003F5C1195388D20070C39A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "Tests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6003F5C3195388D20070C39A /* Debug */, - 6003F5C4195388D20070C39A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 6003F582195388D10070C39A /* Project object */; -} diff --git a/Example/SCForceUpdater.xcworkspace/contents.xcworkspacedata b/Example/SCForceUpdater.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index e89f7d4..0000000 --- a/Example/SCForceUpdater.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/Example/SCForceUpdater/Base.lproj/Main_iPad.storyboard b/Example/SCForceUpdater/Base.lproj/Main_iPad.storyboard deleted file mode 100644 index 19fa406..0000000 --- a/Example/SCForceUpdater/Base.lproj/Main_iPad.storyboard +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/SCForceUpdater/Images.xcassets/LaunchImage.launchimage/Contents.json b/Example/SCForceUpdater/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 4458b40..0000000 --- a/Example/SCForceUpdater/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "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" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/Example/SCForceUpdater/SCAppDelegate.h b/Example/SCForceUpdater/SCAppDelegate.h deleted file mode 100644 index 89e4568..0000000 --- a/Example/SCForceUpdater/SCAppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SCAppDelegate.h -// SCForceUpdater -// -// Created by CocoaPods on 04/07/2015. -// Copyright (c) 2014 Richard Szabo. All rights reserved. -// - -#import - -@interface SCAppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/Example/SCForceUpdater/SCAppDelegate.m b/Example/SCForceUpdater/SCAppDelegate.m deleted file mode 100644 index d1268d5..0000000 --- a/Example/SCForceUpdater/SCAppDelegate.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// SCAppDelegate.m -// SCForceUpdater -// -// Created by CocoaPods on 04/07/2015. -// Copyright (c) 2014 Richard Szabo. All rights reserved. -// - -#import - -#import "SCAppDelegate.h" - -@implementation SCAppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - [SCForceUpdater initWithITunesAppId:@"iTunesAppId" - baseURL:@"http://localhost:4567" - versionAPIEndpoint:@"versions/ios"]; - - return YES; -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - [[SCForceUpdater sharedUpdater] checkForUpdate]; -} - -@end diff --git a/Example/SCForceUpdater/SCForceUpdater-Prefix.pch b/Example/SCForceUpdater/SCForceUpdater-Prefix.pch deleted file mode 100644 index 82a2bb4..0000000 --- a/Example/SCForceUpdater/SCForceUpdater-Prefix.pch +++ /dev/null @@ -1,16 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every source file. -// - -#import - -#ifndef __IPHONE_5_0 -#warning "This project uses features only available in iOS SDK 5.0 and later." -#endif - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/Example/SCForceUpdater/SCViewController.h b/Example/SCForceUpdater/SCViewController.h deleted file mode 100644 index ab73447..0000000 --- a/Example/SCForceUpdater/SCViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// SCViewController.h -// SCForceUpdater -// -// Created by Richard Szabo on 04/07/2015. -// Copyright (c) 2014 Richard Szabo. All rights reserved. -// - -#import - -@interface SCViewController : UIViewController - -- (IBAction)checkForUpdateButtonClicked:(id)sender; - -@end diff --git a/Example/SCForceUpdater/SCViewController.m b/Example/SCForceUpdater/SCViewController.m deleted file mode 100644 index 1433e84..0000000 --- a/Example/SCForceUpdater/SCViewController.m +++ /dev/null @@ -1,38 +0,0 @@ -// -// SCViewController.m -// SCForceUpdater -// -// Created by Richard Szabo on 04/07/2015. -// Copyright (c) 2014 Richard Szabo. All rights reserved. -// - -#import - -#import "SCViewController.h" - -@interface SCViewController () - -@end - -@implementation SCViewController - -#pragma mark - View lifecycle - -- (void)viewDidLoad -{ - [super viewDidLoad]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; -} - -#pragma mark - Button actions - -- (IBAction)checkForUpdateButtonClicked:(id)sender -{ - [[SCForceUpdater sharedUpdater] checkForUpdate]; -} - -@end diff --git a/Example/SCForceUpdater/en.lproj/InfoPlist.strings b/Example/SCForceUpdater/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28f..0000000 --- a/Example/SCForceUpdater/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/Example/SCForceUpdater/main.m b/Example/SCForceUpdater/main.m deleted file mode 100644 index fbc014f..0000000 --- a/Example/SCForceUpdater/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// SCForceUpdater -// -// Created by Richard Szabo on 04/07/2015. -// Copyright (c) 2014 Richard Szabo. All rights reserved. -// - -#import - -#import "SCAppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([SCAppDelegate class])); - } -} diff --git a/Example/Tests/Tests-Info.plist b/Example/Tests/Tests-Info.plist deleted file mode 100644 index 41520ed..0000000 --- a/Example/Tests/Tests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Example/Tests/Tests-Prefix.pch b/Example/Tests/Tests-Prefix.pch deleted file mode 100644 index 55d2257..0000000 --- a/Example/Tests/Tests-Prefix.pch +++ /dev/null @@ -1,11 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every test case source file. -// - -#ifdef __OBJC__ - - - -#endif diff --git a/Example/Tests/Tests.m b/Example/Tests/Tests.m deleted file mode 100644 index 3822510..0000000 --- a/Example/Tests/Tests.m +++ /dev/null @@ -1,9 +0,0 @@ -// -// SCForceUpdaterTests.m -// SCForceUpdaterTests -// -// Created by Richard Szabo on 04/07/2015. -// Copyright (c) 2014 Richard Szabo. All rights reserved. -// - -${TEST_EXAMPLE} diff --git a/Example/Tests/en.lproj/InfoPlist.strings b/Example/Tests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28f..0000000 --- a/Example/Tests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/LICENSE b/LICENSE index 82afb42..63fb469 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015 Richard Szabo +Copyright (c) 2018 Bruno Muniz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Pod/Classes/Categories/NSBundle+Versions.h b/Pod/Classes/Categories/NSBundle+Versions.h deleted file mode 100644 index baaa9db..0000000 --- a/Pod/Classes/Categories/NSBundle+Versions.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// NSBundle+Versions.h -// ipiit -// -// Created by Balazs on 31/01/15. -// Copyright (c) 2015 ipiit AB. All rights reserved. -// - -#import - -/** NSBundle (Versions) */ -@interface NSBundle (Versions) - -- (NSString *)versionNumber; -- (NSString *)buildNumber; - -@end diff --git a/Pod/Classes/Categories/NSBundle+Versions.m b/Pod/Classes/Categories/NSBundle+Versions.m deleted file mode 100644 index a8abf50..0000000 --- a/Pod/Classes/Categories/NSBundle+Versions.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// NSBundle+Versions.m -// ipiit -// -// Created by Balazs on 31/01/15. -// Copyright (c) 2015 ipiit AB. All rights reserved. -// - -#import "NSBundle+Versions.h" - -@implementation NSBundle (Versions) - -- (NSString *)versionNumber -{ - return [self objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; -} - -- (NSString *)buildNumber -{ - return [self objectForInfoDictionaryKey:@"CFBundleVersion"]; -} - -@end diff --git a/Pod/Classes/Categories/NSString+CompareToVersion.h b/Pod/Classes/Categories/NSString+CompareToVersion.h deleted file mode 100644 index d64b6d9..0000000 --- a/Pod/Classes/Categories/NSString+CompareToVersion.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// NSString+CompareToVersion.h -// Stijn Mathysen -// -// Created by Stijn Mathysen on 27/02/14. -// Copyright (c) 2014 Stijn Mathysen. Released under the MIT license -// - -#import - -/** NSString (CompareToVersion) */ -@interface NSString (CompareToVersion) - -- (NSComparisonResult)compareToVersion:(NSString *)version; - -- (BOOL)isOlderThanVersion:(NSString *)version; -- (BOOL)isNewerThanVersion:(NSString *)version; -- (BOOL)isEqualToVersion:(NSString *)version; -- (BOOL)isEqualOrOlderThanVersion:(NSString *)version; -- (BOOL)isEqualOrNewerThanVersion:(NSString *)version; - -@end diff --git a/Pod/Classes/Categories/NSString+CompareToVersion.m b/Pod/Classes/Categories/NSString+CompareToVersion.m deleted file mode 100644 index c6aa3cb..0000000 --- a/Pod/Classes/Categories/NSString+CompareToVersion.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// NSString+CompareToVersion.m -// Skylight BVBA -// -// Created by Stijn Mathysen on 27/02/14. -// Copyright (c) 2014 Stijn Mathysen. Released under the MIT license -// - -#import "NSString+CompareToVersion.h" - -@implementation NSString (CompareToVersion) - -- (NSComparisonResult)compareToVersion:(NSString *)version -{ - NSComparisonResult result; - - result = NSOrderedSame; - - if (![self isEqualToString:version]) - { - NSArray *thisVersion = [self componentsSeparatedByString:@"."]; - NSArray *compareVersion = [version componentsSeparatedByString:@"."]; - - for (NSInteger index = 0; index < [thisVersion count]; index++) - { - NSInteger thisSegment = [[thisVersion objectAtIndex:index] integerValue]; - NSInteger compareSegment = (index < [compareVersion count]) - ? [[compareVersion objectAtIndex:index] integerValue] - : 0; - - if (thisSegment < compareSegment) - { - result = NSOrderedAscending; - break; - } - - if (thisSegment > compareSegment) - { - result = NSOrderedDescending; - break; - } - } - - if ((result == NSOrderedSame) && ([compareVersion count] > [thisVersion count])) - { - result = NSOrderedAscending; - } - } - - return result; -} - -- (BOOL)isOlderThanVersion:(NSString *)version -{ - return ([self compareToVersion:version] == NSOrderedAscending); -} - -- (BOOL)isNewerThanVersion:(NSString *)version -{ - return ([self compareToVersion:version] == NSOrderedDescending); -} - -- (BOOL)isEqualToVersion:(NSString *)version -{ - return ([self compareToVersion:version] == NSOrderedSame); -} - -- (BOOL)isEqualOrOlderThanVersion:(NSString *)version -{ - return ([self compareToVersion:version] != NSOrderedDescending); -} - -- (BOOL)isEqualOrNewerThanVersion:(NSString *)version -{ - return ([self compareToVersion:version] != NSOrderedAscending); -} - -@end diff --git a/Pod/Classes/Categories/UIAlertView+TapBlock.h b/Pod/Classes/Categories/UIAlertView+TapBlock.h deleted file mode 100644 index f3764a8..0000000 --- a/Pod/Classes/Categories/UIAlertView+TapBlock.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIAlertView+TapBlock.h -// Pods -// -// Created by Richard Szabo on 10/6/16. -// -// - -#import - -typedef void (^UIAlertViewTapBlock)(UIAlertView *alertView, NSInteger buttonIndex); - -@interface UIAlertView (TapBlock) - -@property (nonatomic, copy) UIAlertViewTapBlock tapBlock; - -@end diff --git a/Pod/Classes/Categories/UIAlertView+TapBlock.m b/Pod/Classes/Categories/UIAlertView+TapBlock.m deleted file mode 100644 index cc3c249..0000000 --- a/Pod/Classes/Categories/UIAlertView+TapBlock.m +++ /dev/null @@ -1,57 +0,0 @@ -// -// UIAlertView+TapBlock.m -// Pods -// -// Created by Richard Szabo on 10/6/16. -// -// - -#import "UIAlertView+TapBlock.h" - -#import - -static const void *UIAlertViewOriginalDelegateKey = &UIAlertViewOriginalDelegateKey; -static const void *UIAlertViewTapBlockKey = &UIAlertViewTapBlockKey; - -@implementation UIAlertView (TapBlock) - -#pragma mark - Override -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex -{ - [self _checkAlertViewDelegate]; - UIAlertViewTapBlock tapBlock = alertView.tapBlock; - - if (tapBlock) - { - tapBlock(alertView, buttonIndex); - } - - id originalDelegate = objc_getAssociatedObject(self, UIAlertViewOriginalDelegateKey); - if ([originalDelegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) - { - [originalDelegate alertView:alertView clickedButtonAtIndex:buttonIndex]; - } -} - -- (UIAlertViewTapBlock)tapBlock -{ - return objc_getAssociatedObject(self, UIAlertViewTapBlockKey); -} - -- (void)setTapBlock:(UIAlertViewTapBlock)tapBlock -{ - [self _checkAlertViewDelegate]; - objc_setAssociatedObject(self, UIAlertViewTapBlockKey, tapBlock, OBJC_ASSOCIATION_COPY); -} - -#pragma mark - -- (void)_checkAlertViewDelegate -{ - if (self.delegate != (id)self) - { - objc_setAssociatedObject(self, UIAlertViewOriginalDelegateKey, self.delegate, OBJC_ASSOCIATION_ASSIGN); - self.delegate = (id)self; - } -} - -@end diff --git a/Pod/Classes/SCForceUpdater.h b/Pod/Classes/SCForceUpdater.h deleted file mode 100644 index 245f796..0000000 --- a/Pod/Classes/SCForceUpdater.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// IIForceUpdater.h -// ipiit -// -// Created by Balazs on 25/01/15. -// Copyright (c) 2015 ipiit AB. All rights reserved. -// - -#import - -/** SCForceUpdater */ -@interface SCForceUpdater : NSObject - -+ (id)initWithITunesAppId:(NSString *)ITunesAppId - baseURL:(NSString *)baseURL - versionAPIEndpoint:(NSString *)versionAPIEndpoint; -+ (id)sharedUpdater; -- (void)checkForUpdate; -- (void)checkForUpdateWithCompletionBlock:(void (^)(NSDictionary *jsonObject))completionBlock; - -// Configuration -+ (void)setAlwaysUseMainBundle:(bool)alwaysUseMainBundle; -+ (void)setDisplayName:(NSString *)displayName; -+ (void)setLastVersionResponseKey:(NSString *)lastVersionResponseKey; -+ (void)setUpdateTypeResponseKey:(NSString *)updateTypeResponseKey; - -@end diff --git a/Pod/Classes/SCForceUpdater.m b/Pod/Classes/SCForceUpdater.m deleted file mode 100644 index cd2b2f6..0000000 --- a/Pod/Classes/SCForceUpdater.m +++ /dev/null @@ -1,295 +0,0 @@ -// -// IIForceUpdater.m -// ipiit -// -// Created by Balazs on 25/01/15. -// Copyright (c) 2015 ipiit AB. All rights reserved. -// - -#import "SCForceUpdater.h" - -#import "NSString+CompareToVersion.h" -#import "UIAlertView+TapBlock.h" -#import "NSBundle+Versions.h" - -#import "SCNetworkManager.h" - -@interface SCForceUpdater () - -@property (nonatomic, strong) NSString *iTunesAppId; -@property (nonatomic, strong) SCNetworkManager *networkManager; - -@property (nonatomic, strong) UIAlertView *softUpdateAlertView; -@property (nonatomic, strong) UIAlertView *hardUpdateAlertView; - -@end - -static bool alwaysUseMainBundle; -static NSString *displayName; -static NSString *lastVersionResponseKey; -static NSString *updateTypeResponseKey; - -@implementation SCForceUpdater - -+ (id)initWithITunesAppId:(NSString *)ITunesAppId - baseURL:(NSString *)baseURL - versionAPIEndpoint:(NSString *)versionAPIEndpoint -{ - SCForceUpdater *sharedUpdater = [self sharedUpdater]; - - if (!sharedUpdater) - { - return nil; - } - - displayName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; - lastVersionResponseKey = @"last_version"; - updateTypeResponseKey = @"update_type"; - sharedUpdater.iTunesAppId = ITunesAppId; - sharedUpdater.networkManager = [[SCNetworkManager alloc] initWithBaseURL:baseURL - versionAPIEndpoint:versionAPIEndpoint]; - - return sharedUpdater; -} - -+ (id)sharedUpdater -{ - static SCForceUpdater *sharedUpdater = nil; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedUpdater = [self new]; - }); - - return sharedUpdater; -} - -- (void)checkForUpdate -{ - [_networkManager fetchCurrentVersionWithCompletion:^(NSDictionary *jsonObject) { - [self handleResponse:jsonObject]; - }]; -} - -- (void)checkForUpdateWithCompletionBlock:(void (^)(NSDictionary *jsonObject))completionBlock -{ - [_networkManager fetchCurrentVersionWithCompletion:^(NSDictionary *jsonObject) { - [self handleResponse:jsonObject]; - - if (completionBlock) - { - completionBlock(jsonObject); - } - }]; -} - -#pragma mark - Utility methods - -- (void)handleResponse:(NSDictionary *)jsonObject -{ - // not a valid JSON object - if (!jsonObject) - { - return; - } - - NSString *version = jsonObject[lastVersionResponseKey]; - NSString *type = jsonObject[updateTypeResponseKey]; - - // check for available update - if (version == nil || type == nil) - { - return; - } - - // check for version - if ([version isEqualOrOlderThanVersion:[self currentVersion]]) - { - return; - } - - // on soft update - if ([type isEqualToString:@"soft"]) - { - // if "do not display again" - if ([[NSUserDefaults standardUserDefaults] objectForKey:[self defaultsKeyForVersion:version]]) - { - return; - } - - [self displaySoftUpdateAlertForVersion:version]; - return; - } - - // on hard upcate - if ([type isEqualToString:@"hard"]) - { - [self displayHardUpdateAlertForVersion:version]; - return; - } -} - -- (void)displaySoftUpdateAlertForVersion:(NSString *)version -{ - // dismiss hard update alert - if (_hardUpdateAlertView) - { - [_hardUpdateAlertView dismissWithClickedButtonIndex:0 animated:YES]; - _hardUpdateAlertView = nil; - } - - // do not display if already displayed - if (_softUpdateAlertView) - { - return; - } - - NSString *softMessage - = [NSString stringWithFormat:[self localize:@"sc.force-updater.soft.message" - withComment:@"Soft message text"], displayName, version]; - - // display alert - self.softUpdateAlertView = [[UIAlertView alloc] initWithTitle:[self localize:@"sc.force-updater.soft.title" - withComment:@"Soft title text"] - message:softMessage - delegate:nil - cancelButtonTitle:[self localize:@"sc.force-updater.soft.update" - withComment:@"Update button text"] - otherButtonTitles:[self localize:@"sc.force-updater.soft.no-thanks" - withComment:@"No thanks! button text"], - [self localize:@"sc.force-updater.soft.later" - withComment:@"Later button text"], nil]; - - __weak typeof(self) welf = self; - _softUpdateAlertView.tapBlock = ^(UIAlertView *alertView, NSInteger buttonIndex) - { - // update branch - if (buttonIndex == [alertView cancelButtonIndex]) - { - [[UIApplication sharedApplication] openURL:[welf iTunesAppURL]]; - - welf.softUpdateAlertView = nil; - return; - } - - // no, thanks branch - if (buttonIndex == 1) - { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults setObject:@"true" forKey:[welf defaultsKeyForVersion:version]]; - [defaults synchronize]; - - welf.softUpdateAlertView = nil; - return; - } - - // later branch - if (buttonIndex == 2) - { - welf.softUpdateAlertView = nil; - return; - } - }; - - [_softUpdateAlertView show]; -} - -- (void)displayHardUpdateAlertForVersion:(NSString *)version -{ - // dismiss soft if any - if (_softUpdateAlertView) - { - [_softUpdateAlertView dismissWithClickedButtonIndex:0 animated:YES]; - _softUpdateAlertView = nil; - } - - // do not display if already displayed - if (_hardUpdateAlertView) - { - return; - } - - NSString *hardMessage - = [NSString stringWithFormat:[self localize:@"sc.force-updater.hard.message" - withComment:@"Hard message text"], displayName, version]; - - // display alert - self.hardUpdateAlertView = [[UIAlertView alloc] initWithTitle:[self localize:@"sc.force-updater.hard.title" - withComment:@"Hard message title"] - message:hardMessage - delegate:nil - cancelButtonTitle:[self localize:@"sc.force-updater.hard.update" - withComment:@"Update button text"] - otherButtonTitles:nil]; - - __weak typeof(self) welf = self; - _hardUpdateAlertView.tapBlock = ^(UIAlertView *alertView, NSInteger buttonIndex) - { - // open iTunes store - [[UIApplication sharedApplication] openURL:[welf iTunesAppURL]]; - - welf.hardUpdateAlertView = nil; - [welf displayHardUpdateAlertForVersion:version]; - }; - - [_hardUpdateAlertView show]; -} - -- (NSString *)currentVersion -{ - return [[NSBundle mainBundle] versionNumber]; -} - -- (NSString *)defaultsKeyForVersion:(NSString *)version -{ - return [NSString stringWithFormat:@"dismiss-update-%@", version]; -} - -- (NSURL *)iTunesAppURL -{ - NSString *url = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@?mt=8", _iTunesAppId]; - return [NSURL URLWithString:url]; -} - -#pragma mark - Configuration methods - -+ (void)setAlwaysUseMainBundle:(bool)_alwaysUseMainBundle -{ - alwaysUseMainBundle = _alwaysUseMainBundle; -} - -+ (void)setDisplayName:(NSString *)_displayName -{ - displayName = _displayName; -} - -+ (void)setLastVersionResponseKey:(NSString *)_lastVersionResponseKey -{ - lastVersionResponseKey = _lastVersionResponseKey; -} - -+ (void)setUpdateTypeResponseKey:(NSString *)_updateTypeResponseKey -{ - updateTypeResponseKey = _updateTypeResponseKey; -} - -#pragma mark - Utility methods - -- (NSString *)localize:(NSString *)key withComment:(NSString *)comment -{ - return NSLocalizedStringFromTableInBundle(key, @"SCForceUpdaterLocalizable", [SCForceUpdater bundle], comment); -} - -+ (NSBundle *)bundle -{ - if (alwaysUseMainBundle) - { - return [NSBundle mainBundle]; - } - - NSURL *forceUpdaterBundleURL = [[NSBundle mainBundle] URLForResource:@"SCForceUpdater" withExtension:@"bundle"]; - - return [NSBundle bundleWithURL:forceUpdaterBundleURL]; -} - -@end diff --git a/Pod/Classes/SCNetworkManager.h b/Pod/Classes/SCNetworkManager.h deleted file mode 100644 index dbc7455..0000000 --- a/Pod/Classes/SCNetworkManager.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// NetworkManager.h -// Pods -// -// Created by Richard Szabo on 03/04/15. -// -// - -#import - -typedef void(^SCForceUpdaterCompletionCallback)(NSDictionary *jsonObject); - -@interface SCNetworkManager : NSObject - -- (id)initWithBaseURL:(NSString *)baseURL versionAPIEndpoint:(NSString *)versionAPIEndpoint; -- (void)fetchCurrentVersionWithCompletion:(SCForceUpdaterCompletionCallback)completionCallback; - -@end diff --git a/Pod/Classes/SCNetworkManager.m b/Pod/Classes/SCNetworkManager.m deleted file mode 100644 index e1a7bde..0000000 --- a/Pod/Classes/SCNetworkManager.m +++ /dev/null @@ -1,111 +0,0 @@ -// -// NetworkManager.m -// Pods -// -// Created by Richard Szabo on 03/04/15. -// -// - -#import "SCNetworkManager.h" - -#import "NSBundle+Versions.h" - -@interface SCNetworkManager () - -@property (nonatomic, strong) NSString *baseURL; -@property (nonatomic, strong) NSString *versionAPIEndpoint; - -@property (nonatomic, strong) NSMutableData *responseData; -@property (nonatomic, strong) SCForceUpdaterCompletionCallback completionCallback; - -@end - -@implementation SCNetworkManager - -- (id)initWithBaseURL:(NSString *)baseURL versionAPIEndpoint:(NSString *)versionAPIEndpoint -{ - self = [super init]; - - if (!self) - { - return nil; - } - - self.baseURL = baseURL; - self.versionAPIEndpoint = versionAPIEndpoint; - - return self; -} - -- (void)fetchCurrentVersionWithCompletion:(SCForceUpdaterCompletionCallback)completionCallback -{ - self.completionCallback = completionCallback; - - NSString *urlString = [NSString stringWithFormat:@"%@/%@?%@", _baseURL, - _versionAPIEndpoint, - [self params]]; - NSURL *requestURL = [NSURL URLWithString:urlString]; - - NSURLRequest *request = [NSURLRequest requestWithURL:requestURL]; - - NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; - - [conn start]; -} - -- (NSString *)params -{ - NSDictionary *params = @{ - @"platform" : @"ios", - @"version" : [[NSBundle mainBundle] versionNumber], - @"build_number" : [[NSBundle mainBundle] buildNumber] - }; - - NSMutableArray *parts = [NSMutableArray new]; - for (NSString *key in params) - { - NSString *value = [params objectForKey:key]; - - NSString *queryKey = [key stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSString *queryValue = [value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - - NSString *part = [NSString stringWithFormat:@"%@=%@", queryKey, queryValue]; - [parts addObject:part]; - } - - return [parts componentsJoinedByString:@"&"]; -} - -#pragma mark - NSURLConnectionDelegate methods - -- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { - self.responseData = [NSMutableData new]; -} - -- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { - [_responseData appendData:data]; -} - -- (NSCachedURLResponse *)connection:(NSURLConnection *)connection - willCacheResponse:(NSCachedURLResponse*)cachedResponse { - return nil; -} - -- (void)connectionDidFinishLoading:(NSURLConnection *)connection { - NSError *error = nil; - NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:_responseData options:kNilOptions error:&error]; - - if (error || !_completionCallback) - { - NSLog(@"[SCForceUpdater] error parsing JSON: %@", error); - return; - } - - _completionCallback(jsonObject); -} - -- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - NSLog(@"[SCForceUpdater] request failed: %@", error); -} - -@end diff --git a/SCForceUpdate.podspec b/SCForceUpdate.podspec new file mode 100644 index 0000000..83e38ab --- /dev/null +++ b/SCForceUpdate.podspec @@ -0,0 +1,20 @@ +Pod::Spec.new do |s| + s.name = 'SCForceUpdate' + s.version = '1.1.1' + s.summary = 'SCForceUpdate' + + s.description = <<-DESC + You can easily implement force update functionality into your application with this Pod. + DESC + + s.homepage = 'https://github.com/team-supercharge/SCForceUpdater' + s.license = 'MIT' + s.author = { 'Richard Szabo' => 'richard.szabo@supercharge.io' } + s.source = { git: 'https://github.com/team-supercharge/SCForceUpdater.git', tag: s.version.to_s } + + s.ios.deployment_target = '8.0' + s.source_files = 'SCForceUpdate/Classes/**/*' + s.resource_bundles = { + 'SCForceUpdate' => ['SCForceUpdate/Classes/*.strings'] + } +end diff --git a/Pod/Classes/.gitkeep b/SCForceUpdate/Classes/.gitkeep similarity index 100% rename from Pod/Classes/.gitkeep rename to SCForceUpdate/Classes/.gitkeep diff --git a/SCForceUpdate/Classes/AlertControllerExtension.swift b/SCForceUpdate/Classes/AlertControllerExtension.swift new file mode 100644 index 0000000..4f6ee71 --- /dev/null +++ b/SCForceUpdate/Classes/AlertControllerExtension.swift @@ -0,0 +1,38 @@ +// +// AlertControllerExtension.swift +// Pods-Example +// +// Created by Bruno Muniz on 8/8/18. +// + +import UIKit +import ObjectiveC + +private var alertWindowAssociationKey: UInt8 = 0 + +extension UIAlertController { + + var alertWindow: UIWindow? { + get { + return objc_getAssociatedObject(self, &alertWindowAssociationKey) as? UIWindow + } + set(newValue) { + objc_setAssociatedObject(self, &alertWindowAssociationKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + } + } + + func show() { + self.alertWindow = UIWindow(frame: UIScreen.main.bounds) + self.alertWindow?.rootViewController = UIViewController() + self.alertWindow?.windowLevel = UIWindowLevelAlert + 1 + self.alertWindow?.makeKeyAndVisible() + self.alertWindow?.rootViewController?.present(self, animated: true, completion: nil) + } + + override open func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + self.alertWindow?.isHidden = true + self.alertWindow = nil + } +} diff --git a/SCForceUpdate/Classes/BundleExtension.swift b/SCForceUpdate/Classes/BundleExtension.swift new file mode 100644 index 0000000..b3c5425 --- /dev/null +++ b/SCForceUpdate/Classes/BundleExtension.swift @@ -0,0 +1,24 @@ +// +// BundleExtension.swift +// Pods-SCForceUpdater +// +// Created by Bruno Muniz on 8/2/18. +// + +extension Bundle { + public func versionNumber() -> String { + guard let version = object(forInfoDictionaryKey: Constants.Others.versionNumber) as? String else { + fatalError(Constants.Errors.versionNumber) + } + + return version + } + + public func buildNumber() -> String { + guard let build = object(forInfoDictionaryKey: Constants.Others.buildNumber) as? String else { + fatalError(Constants.Errors.buildNumber) + } + + return build + } +} diff --git a/SCForceUpdate/Classes/Constants.swift b/SCForceUpdate/Classes/Constants.swift new file mode 100644 index 0000000..cc44443 --- /dev/null +++ b/SCForceUpdate/Classes/Constants.swift @@ -0,0 +1,44 @@ +// +// Constants.swift +// forceupdate-ios +// +// Created by Bruno Muniz on 8/3/18. +// Copyright © 2018 Bruno Muniz. All rights reserved. +// + +enum Constants { + enum Hard { + static let title = "sc.force-updater.hard.title" + static let message = "sc.force-updater.hard.message" + static let update = "sc.force-updater.hard.update" + } + + enum Soft { + static let title = "sc.force-updater.soft.title" + static let message = "sc.force-updater.soft.message" + static let update = "sc.force-updater.soft.update" + static let later = "sc.force-updater.soft.later" + static let noThanks = "sc.force-updater.soft.no-thanks" + } + + enum Errors { + static let jsonParsing = "[SCForceUpdater] Error: issue(s) parsing JSON" + static let dataLack = "[SCForceUpdater] Error: Did not receive data" + static let displayName = "[SCForceUpdater] Error: CFBundleDisplayName is nil" + static let buildNumber = "[SCForceUpdater] Error: build number is nil" + static let versionNumber = "[SCForceUpdater] Error: version number is nil" + } + + enum AlertType { + static let soft = "soft" + static let hard = "hard" + } + + enum Others { + static let displayName = "CFBundleDisplayName" + static let buildNumber = "CFBundleVersion" + static let versionNumber = "CFBundleShortVersionString" + static let lastVersionResponseKey = "last_version" + static let updateTypeResponseKey = "update_type" + } +} diff --git a/SCForceUpdate/Classes/SCForceUpdater.swift b/SCForceUpdate/Classes/SCForceUpdater.swift new file mode 100644 index 0000000..95ae392 --- /dev/null +++ b/SCForceUpdate/Classes/SCForceUpdater.swift @@ -0,0 +1,150 @@ +// +// SCForceUpdater.swift +// forceupdate-ios +// +// Created by Bruno Muniz on 8/2/18. +// Copyright © 2018 Bruno Muniz. All rights reserved. +// + +import Foundation +import UIKit + +final public class SCForceUpdater { + // MARK: - Properties + private var itunesAppId: String = "" + private var networkManager: SCNetworkManager? + private var alertController: UIAlertController? + private var alwaysUseMainBundle: Bool = false + static var displayName: String { + guard let name = Bundle.main.object(forInfoDictionaryKey: Constants.Others.displayName) as? String else { + fatalError(Constants.Errors.displayName) + } + + return name + } + + // MARK: - Singleton + public static let sharedUpdater = SCForceUpdater() +} + +// MARK: - Public +extension SCForceUpdater { + public func set(itunesAppId: String, baseURL: String, versionAPIEndpoint: String) { + self.itunesAppId = itunesAppId + self.networkManager = SCNetworkManager(baseURL, versionAPIEndpoint: versionAPIEndpoint) + } + + public func checkForUpdate(with completion: (([AnyHashable: Any]?) -> Void)? = nil) { + networkManager?.fetchCurrentVersion(completion: { [weak self] jsonObject in + self?.handleResponse(jsonObject) + completion?(jsonObject) + }) + } + + public var bundle: Bundle { + return alwaysUseMainBundle ? Bundle.main : Bundle(for: type(of: self)) + } +} + +// MARK: - Private +extension SCForceUpdater { + private func handleResponse(_ jsonObject: [AnyHashable: Any]?) { + guard let jsonObject = jsonObject, + let version = jsonObject[Constants.Others.lastVersionResponseKey] as? String, + let type = jsonObject[Constants.Others.updateTypeResponseKey] as? String else { + return + } + + if version.isEqualOrOlderThan(version: Bundle.main.versionNumber()) { + return + } + + if type == Constants.AlertType.soft { + let dontDisplayAgain = UserDefaults.standard.object(forKey: version) + + if dontDisplayAgain != nil { + return + } + } + + displayUpdateAlertFor(version: version, hard: type == Constants.AlertType.hard) + } + + private func displayUpdateAlertFor(version: String, hard: Bool) { + if alertController != nil { + return + } + + var title: String + var message: String + var cancelButtonTitle: String + + if hard { + title = Constants.Hard.title.localized + message = Constants.Hard.message.localized + cancelButtonTitle = Constants.Hard.update.localized + } else { + title = Constants.Soft.title.localized + message = Constants.Soft.message.localized + cancelButtonTitle = Constants.Soft.update.localized + } + + let noThanksButtonTitle = Constants.Soft.noThanks.localized + let laterButtonTitle = Constants.Soft.later.localized + let entireMessage = String(format: message, SCForceUpdater.displayName, version) + + DispatchQueue.main.async { [weak self] in + self?.alertController = UIAlertController(title: title, message: entireMessage, preferredStyle: .alert) + self?.alertController?.addAction(UIAlertAction(title: cancelButtonTitle, + style: .cancel, + handler: { action in + + guard let appUrl = self?.iTunesAppURL() else { return } + + if #available(iOS 10.0, *) { + UIApplication.shared.open(appUrl, + options: [:], + completionHandler: nil) + } else { + UIApplication.shared.openURL(appUrl) + } + + self?.alertController = nil + })) + + if !hard { + self?.alertController?.addAction(UIAlertAction(title: noThanksButtonTitle, + style: .default, + handler: { action in + guard let defaultKeys = self?.defaultKeysFor(version: version) else { return } + + let defaults = UserDefaults.standard + defaults.set("true", forKey: defaultKeys) + defaults.synchronize() + + self?.alertController = nil + return + })) + + self?.alertController?.addAction(UIAlertAction(title: laterButtonTitle, + style: .default, + handler: { action in + self?.alertController = nil + return + })) + } + } + + DispatchQueue.main.async { + self.alertController?.show() + } + } + + private func iTunesAppURL() -> URL? { + return URL(string: String(format: "itms-apps://itunes.apple.com/app/id%@?mt=8", itunesAppId)) + } + + private func defaultKeysFor(version: String) -> String? { + return "dismiss-update-\(version)" + } +} diff --git a/Pod/Classes/Localization/en.lproj/SCForceUpdaterLocalizable.strings b/SCForceUpdate/Classes/SCForceUpdaterLocalizable.strings similarity index 63% rename from Pod/Classes/Localization/en.lproj/SCForceUpdaterLocalizable.strings rename to SCForceUpdate/Classes/SCForceUpdaterLocalizable.strings index 90af532..2545d45 100644 --- a/Pod/Classes/Localization/en.lproj/SCForceUpdaterLocalizable.strings +++ b/SCForceUpdate/Classes/SCForceUpdaterLocalizable.strings @@ -6,12 +6,12 @@ */ -"sc.force-updater.soft.title" = "Hey!"; +"sc.force-updater.soft.title" = "Hey!"; "sc.force-updater.soft.message" = "Great news! There’s an updated version of %@ (%@), we recommend you install it."; -"sc.force-updater.soft.update" = "Update"; -"sc.force-updater.soft.later" = "Later"; +"sc.force-updater.soft.update" = "Update"; +"sc.force-updater.soft.later" = "Later"; "sc.force-updater.soft.no-thanks" = "No thanks!"; -"sc.force-updater.hard.title" = "Hey!"; +"sc.force-updater.hard.title" = "Hey!"; "sc.force-updater.hard.message" = "Great news! There’s an updated version of %@ (%@), thanks for updating!"; -"sc.force-updater.hard.update" = "Update"; +"sc.force-updater.hard.update" = "Update"; diff --git a/SCForceUpdate/Classes/SCNetworkManager.swift b/SCForceUpdate/Classes/SCNetworkManager.swift new file mode 100644 index 0000000..d542dd7 --- /dev/null +++ b/SCForceUpdate/Classes/SCNetworkManager.swift @@ -0,0 +1,81 @@ +// +// SCNetworkManager.swift +// forceupdate-ios +// +// Created by Bruno Muniz on 8/3/18. +// Copyright © 2018 Bruno Muniz. All rights reserved. +// + +import Foundation + +final public class SCNetworkManager { + private var baseUrl: String? + private var versionAPIEndpoint: String? + private var completionCallback: (([String: Any]) -> Void)? + + init(_ baseUrl: String, versionAPIEndpoint: String) { + self.baseUrl = baseUrl + self.versionAPIEndpoint = versionAPIEndpoint + } +} + +extension SCNetworkManager { + public func fetchCurrentVersion(completion: @escaping ([String: Any]) -> Void) { + completionCallback = completion + let urlString = String(format: "%@/%@?%@", baseUrl!, versionAPIEndpoint!, params()) + let session = URLSession(configuration: .default) + + if let requestUrl = URL(string: urlString) { + let task = createTask(session: session, requestUrl: requestUrl) + task.resume() + } + } +} + +extension SCNetworkManager { + private func createTask(session: URLSession, requestUrl: URL) -> URLSessionDataTask { + let task = session.dataTask(with: requestUrl) { (data, _, error) in + if let error = error { + print(error) + return + } + + guard let responseData = data else { + print(Constants.Errors.dataLack) + return + } + + do { + guard let json = try JSONSerialization.jsonObject(with: responseData, options: []) + as? [String: Any] else { + print(Constants.Errors.jsonParsing) + return + } + + self.completionCallback!(json) + } catch { + print(Constants.Errors.jsonParsing) + return + } + } + + return task + } + + private func params() -> String { + let params = ["platform": "ios", + "version": Bundle.main.versionNumber(), + "build_number": Bundle.main.buildNumber()] + + let parts = params.map { key, value -> String in + if let queryKey = key.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), + let queryValue = value.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { + return String(format: "%@=%@", queryKey, queryValue) + } + + return "" + } + + return parts.joined(separator: "&") + } +} diff --git a/SCForceUpdate/Classes/StringExtension.swift b/SCForceUpdate/Classes/StringExtension.swift new file mode 100644 index 0000000..fb8c6a6 --- /dev/null +++ b/SCForceUpdate/Classes/StringExtension.swift @@ -0,0 +1,68 @@ +// +// StringExtension.swift +// Pods-SCForceUpdater +// +// Created by Bruno Muniz on 8/2/18. +// + +import Foundation + +extension String { + var localized: String { + return NSLocalizedString(self, tableName: "SCForceUpdaterLocalizable", + bundle: SCForceUpdater.sharedUpdater.bundle, + comment: self) + } + + public func compareTo(version: String) -> ComparisonResult { + var result: ComparisonResult = .orderedSame + + if self != version { + let thisVersion = components(separatedBy: ".") + let compareVersion = version.components(separatedBy: ".") + + for index in 0.. compareSegment { + result = ComparisonResult.orderedDescending + break + } + } + + if result == ComparisonResult.orderedSame && compareVersion.count > thisVersion.count { + result = ComparisonResult.orderedAscending + } + } + + return result + } + + public func isOlderThan(version: String) -> Bool { + return compareTo(version: version) == ComparisonResult.orderedAscending + } + + public func isNewerThan(version: String) -> Bool { + return compareTo(version: version) == ComparisonResult.orderedDescending + } + + public func isEqualTo(version: String) -> Bool { + return compareTo(version: version) == ComparisonResult.orderedSame + } + + public func isEqualOrOlderThan(version: String) -> Bool { + return compareTo(version: version) != ComparisonResult.orderedDescending + } + + public func isEqualOrNewerThan(version: String) -> Bool { + return compareTo(version: version) != ComparisonResult.orderedAscending + } +} diff --git a/SCForceUpdater.podspec b/SCForceUpdater.podspec deleted file mode 100644 index 2641049..0000000 --- a/SCForceUpdater.podspec +++ /dev/null @@ -1,21 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'SCForceUpdater' - s.version = '1.1.0' - s.summary = 'SCForceUpdater' - s.description = <<-DESC - You can easily implement force update functionality into your application with this Pod. - DESC - s.homepage = 'https://github.com/team-supercharge/SCForceUpdater' - s.license = 'MIT' - s.author = { 'Richard Szabo' => 'richard.szabo@supercharge.io' } - s.source = { git: 'https://github.com/team-supercharge/SCForceUpdater.git', tag: s.version.to_s } - - s.platform = :ios, '7.0' - s.requires_arc = true - - s.source_files = 'Pod/Classes/**/*' - - s.public_header_files = 'Pod/Classes/**/*.h' - s.ios.resource_bundle = { SCForceUpdater: ['Pod/Classes/Localization/**/*.strings'] } -end - diff --git a/TestServer/.ruby-gemset b/TestServer/.ruby-gemset old mode 100644 new mode 100755 diff --git a/TestServer/.ruby-version b/TestServer/.ruby-version old mode 100644 new mode 100755 diff --git a/TestServer/Gemfile b/TestServer/Gemfile old mode 100644 new mode 100755 diff --git a/TestServer/Gemfile.lock b/TestServer/Gemfile.lock old mode 100644 new mode 100755 diff --git a/TestServer/app.rb b/TestServer/app.rb old mode 100644 new mode 100755 diff --git a/TestServer/versions.yaml b/TestServer/versions.yaml old mode 100644 new mode 100755 index 60aafda..d2dd787 --- a/TestServer/versions.yaml +++ b/TestServer/versions.yaml @@ -1,3 +1,3 @@ --- -version: 1.0.0 -type: soft +version: 1.0.2 +type: hard diff --git a/TestServer/views/index.erb b/TestServer/views/index.erb old mode 100644 new mode 100755 diff --git a/_Pods.xcodeproj b/_Pods.xcodeproj new file mode 120000 index 0000000..3c5a8e7 --- /dev/null +++ b/_Pods.xcodeproj @@ -0,0 +1 @@ +Example/Pods/Pods.xcodeproj \ No newline at end of file