Repository navigation
Download the Intercom iOS SDK from its GitHub release instead of CocoaPods #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
37ca8cc
Download the Intercom iOS SDK from its GitHub release
niamh-coleman 3c2ae9c
Run pod install in CI and harden the iOS SDK bump
niamh-coleman 00374d1
Use Xcode 26.4 for the pod-install job
niamh-coleman 5c42ef3
Install the pinned Ruby before the CI pod install
niamh-coleman 933e588
Only treat SDK bump PRs as existing dependency PRs by title
niamh-coleman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ examples/*/vendor/ | |
| # Cocoapods | ||
| # | ||
| examples/*/ios/Pods | ||
| intercom-ios-sdk/ | ||
|
|
||
| # node.js | ||
| # | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| require 'digest' | ||
| require 'fileutils' | ||
| require 'tmpdir' | ||
|
|
||
| # The Intercom pod is no longer published to the CocoaPods trunk; fetch the GitHub release instead. | ||
| module IntercomIosSdk | ||
| RELEASE_URL = 'https://github.com/intercom/intercom-ios/releases/download/%s/Intercom.xcframework.zip'.freeze | ||
|
|
||
| module_function | ||
|
|
||
| def install_xcframework(version:, sha256:, package_root:) | ||
| relative_path = File.join('intercom-ios-sdk', version, 'Intercom.xcframework') | ||
|
niamh-coleman marked this conversation as resolved.
Resolved
|
||
| framework_path = File.join(package_root, relative_path) | ||
| unless File.exist?(File.join(framework_path, 'Info.plist')) | ||
| extract(cached_zip(version, sha256), File.dirname(framework_path)) | ||
| remove_other_versions(File.join(package_root, 'intercom-ios-sdk'), version) | ||
| end | ||
| relative_path | ||
| end | ||
|
|
||
| def remove_other_versions(sdk_root, version) | ||
| (Dir.children(sdk_root) - [version]).each { |entry| FileUtils.rm_rf(File.join(sdk_root, entry)) } | ||
| end | ||
|
|
||
| def log(message) | ||
| defined?(Pod::UI) ? Pod::UI.puts(message) : puts(message) | ||
| end | ||
|
|
||
| def cache_dir | ||
| ENV['INTERCOM_IOS_SDK_CACHE_DIR'] || File.join(Dir.home, 'Library', 'Caches', 'intercom-react-native') | ||
| end | ||
|
|
||
| def cached_zip(version, sha256) | ||
| zip_path = File.join(cache_dir, version, 'Intercom.xcframework.zip') | ||
| return zip_path if File.exist?(zip_path) && Digest::SHA256.file(zip_path).hexdigest == sha256 | ||
|
|
||
| url = format(RELEASE_URL, version) | ||
| download_path = "#{zip_path}.download" | ||
| FileUtils.mkdir_p(File.dirname(zip_path)) | ||
| log "[Intercom] Downloading the Intercom iOS SDK #{version} from #{url}" | ||
| unless system('curl', '--fail', '--silent', '--show-error', '--location', '--retry', '3', '--output', download_path, url) | ||
| FileUtils.rm_f(download_path) | ||
| raise "[Intercom] Could not download #{url}. Check your network, or place the zip at #{zip_path} " \ | ||
| '(set INTERCOM_IOS_SDK_CACHE_DIR to use another cache directory).' | ||
| end | ||
|
|
||
| actual = Digest::SHA256.file(download_path).hexdigest | ||
| unless actual == sha256 | ||
| FileUtils.rm_f(download_path) | ||
| raise "[Intercom] Checksum mismatch for #{url}: expected #{sha256}, got #{actual}." | ||
| end | ||
| File.rename(download_path, zip_path) | ||
| zip_path | ||
| end | ||
|
|
||
| def extract(zip_path, destination) | ||
| FileUtils.mkdir_p(destination) | ||
| Dir.mktmpdir('extract-', destination) do |tmp| | ||
| raise "[Intercom] Could not unzip #{zip_path}." unless system('unzip', '-q', zip_path, '-d', tmp) | ||
|
|
||
| target = File.join(destination, 'Intercom.xcframework') | ||
| FileUtils.rm_rf(target) | ||
| File.rename(File.join(tmp, 'Intercom.xcframework'), target) | ||
| end | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.