diff --git a/.github/workflows/create_jira.yml b/.github/workflows/create_jira.yml new file mode 100644 index 0000000..8180ac0 --- /dev/null +++ b/.github/workflows/create_jira.yml @@ -0,0 +1,39 @@ +name: Create Jira Ticket + +on: + issues: + types: + - opened + +jobs: + create_jira: + name: Create Jira Ticket + runs-on: ubuntu-latest + environment: IssueTracker + steps: + - name: Checkout + uses: actions/checkout@master + - name: Login + uses: atlassian/gajira-login@master + env: + JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} + JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} + JIRA_API_TOKEN: ${{ secrets.JIRA_TOKEN }} + JIRA_EPIC_KEY: ${{ secrets.JIRA_EPIC_KEY }} + JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }} + + - name: Create + id: create + uses: atlassian/gajira-create@master + with: + project: ${{ secrets.JIRA_PROJECT }} + issuetype: Bug + summary: | + [${{ github.event.repository.name }}] (${{ github.event.issue.number }}): ${{ github.event.issue.title }} + description: | + Github Link: ${{ github.event.issue.html_url }} + ${{ github.event.issue.body }} + fields: '{"parent": {"key": "${{ secrets.JIRA_EPIC_KEY }}"}}' + + - name: Log created issue + run: echo "Issue ${{ steps.create.outputs.issue }} was created" \ No newline at end of file diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000..842b884 --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,36 @@ +name: Swift + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + cancel_previous: + permissions: write-all + runs-on: ubuntu-latest + steps: + - uses: styfle/cancel-workflow-action@0.9.1 + with: + workflow_id: ${{ github.event.workflow.id }} + + build_and_test_examples: + needs: cancel_previous + runs-on: macos-11 + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.0' + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: /Users/runner/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-spm-examples-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-spm-examples + - name: build for ios simulator + run: | + cd Example/BasicExample + xcodebuild -workspace "BasicExample.xcworkspace" -scheme "BasicExample" -sdk iphonesimulator + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2235608 --- /dev/null +++ b/.gitignore @@ -0,0 +1,93 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +# .swiftpm + +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ +# +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ +/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm +.DS_Store +/.swiftpm diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f220d1c --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,84 @@ +# Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of actions. + +**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, +available at . + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +. Translations are available at . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5700c11 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,30 @@ +# Contributing + +We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. + + +### Commit message convention + +We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: + +- `fix`: bug fixes, e.g. fix crash due to deprecated method. +- `feat`: new features, e.g. add new method to the module. +- `refactor`: code refactor, e.g. migrate from class components to hooks. +- `docs`: changes into documentation, e.g. add usage example for the module.. +- `test`: adding or updating tests, eg add integration tests using detox. +- `chore`: tooling changes, e.g. change CI config. + +Our pre-commit hooks verify that your commit message matches this format when committing. + + +### Sending a pull request + +> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). + +When you're sending a pull request: + +- Prefer small pull requests focused on one change. +- Verify that linters and tests are passing. +- Review the documentation to make sure it looks good. +- Follow the pull request template when opening a pull request. +- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. diff --git a/Example/BasicExample/BasicExample.xcodeproj/project.pbxproj b/Example/BasicExample/BasicExample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..38e358f --- /dev/null +++ b/Example/BasicExample/BasicExample.xcodeproj/project.pbxproj @@ -0,0 +1,626 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 46EDC6F627C6B8D100B870D7 /* BasicExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC6F527C6B8D100B870D7 /* BasicExampleApp.swift */; }; + 46EDC6F827C6B8D100B870D7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC6F727C6B8D100B870D7 /* ContentView.swift */; }; + 46EDC6FA27C6B8D200B870D7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 46EDC6F927C6B8D200B870D7 /* Assets.xcassets */; }; + 46EDC6FD27C6B8D200B870D7 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 46EDC6FC27C6B8D200B870D7 /* Preview Assets.xcassets */; }; + 46EDC70727C6B8D200B870D7 /* BasicExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC70627C6B8D200B870D7 /* BasicExampleTests.swift */; }; + 46EDC71127C6B8D200B870D7 /* BasicExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC71027C6B8D200B870D7 /* BasicExampleUITests.swift */; }; + 46EDC71327C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46EDC71227C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift */; }; + 46EDC72127C6B92C00B870D7 /* Segment in Frameworks */ = {isa = PBXBuildFile; productRef = 46EDC72027C6B92C00B870D7 /* Segment */; }; + 827C512828661FB5000B1B9E /* SegmentIntercom in Frameworks */ = {isa = PBXBuildFile; productRef = 827C512728661FB5000B1B9E /* SegmentIntercom */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 46EDC70327C6B8D200B870D7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 46EDC6EA27C6B8D100B870D7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 46EDC6F127C6B8D100B870D7; + remoteInfo = BasicExample; + }; + 46EDC70D27C6B8D200B870D7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 46EDC6EA27C6B8D100B870D7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 46EDC6F127C6B8D100B870D7; + remoteInfo = BasicExample; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 46EDC6F227C6B8D100B870D7 /* BasicExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BasicExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 46EDC6F527C6B8D100B870D7 /* BasicExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicExampleApp.swift; sourceTree = ""; }; + 46EDC6F727C6B8D100B870D7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 46EDC6F927C6B8D200B870D7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 46EDC6FC27C6B8D200B870D7 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 46EDC70227C6B8D200B870D7 /* BasicExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BasicExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 46EDC70627C6B8D200B870D7 /* BasicExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicExampleTests.swift; sourceTree = ""; }; + 46EDC70C27C6B8D200B870D7 /* BasicExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BasicExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 46EDC71027C6B8D200B870D7 /* BasicExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicExampleUITests.swift; sourceTree = ""; }; + 46EDC71227C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BasicExampleUITestsLaunchTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 46EDC6EF27C6B8D100B870D7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 46EDC72127C6B92C00B870D7 /* Segment in Frameworks */, + 827C512828661FB5000B1B9E /* SegmentIntercom in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 46EDC6FF27C6B8D200B870D7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 46EDC70927C6B8D200B870D7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 46EDC6E927C6B8D100B870D7 = { + isa = PBXGroup; + children = ( + 46EDC6F427C6B8D100B870D7 /* BasicExample */, + 46EDC70527C6B8D200B870D7 /* BasicExampleTests */, + 46EDC70F27C6B8D200B870D7 /* BasicExampleUITests */, + 46EDC6F327C6B8D100B870D7 /* Products */, + 827C512628661FB5000B1B9E /* Frameworks */, + ); + sourceTree = ""; + }; + 46EDC6F327C6B8D100B870D7 /* Products */ = { + isa = PBXGroup; + children = ( + 46EDC6F227C6B8D100B870D7 /* BasicExample.app */, + 46EDC70227C6B8D200B870D7 /* BasicExampleTests.xctest */, + 46EDC70C27C6B8D200B870D7 /* BasicExampleUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 46EDC6F427C6B8D100B870D7 /* BasicExample */ = { + isa = PBXGroup; + children = ( + 46EDC6F527C6B8D100B870D7 /* BasicExampleApp.swift */, + 46EDC6F727C6B8D100B870D7 /* ContentView.swift */, + 46EDC6F927C6B8D200B870D7 /* Assets.xcassets */, + 46EDC6FB27C6B8D200B870D7 /* Preview Content */, + ); + path = BasicExample; + sourceTree = ""; + }; + 46EDC6FB27C6B8D200B870D7 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 46EDC6FC27C6B8D200B870D7 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 46EDC70527C6B8D200B870D7 /* BasicExampleTests */ = { + isa = PBXGroup; + children = ( + 46EDC70627C6B8D200B870D7 /* BasicExampleTests.swift */, + ); + path = BasicExampleTests; + sourceTree = ""; + }; + 46EDC70F27C6B8D200B870D7 /* BasicExampleUITests */ = { + isa = PBXGroup; + children = ( + 46EDC71027C6B8D200B870D7 /* BasicExampleUITests.swift */, + 46EDC71227C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift */, + ); + path = BasicExampleUITests; + sourceTree = ""; + }; + 827C512628661FB5000B1B9E /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 46EDC6F127C6B8D100B870D7 /* BasicExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 46EDC71627C6B8D200B870D7 /* Build configuration list for PBXNativeTarget "BasicExample" */; + buildPhases = ( + 46EDC6EE27C6B8D100B870D7 /* Sources */, + 46EDC6EF27C6B8D100B870D7 /* Frameworks */, + 46EDC6F027C6B8D100B870D7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BasicExample; + packageProductDependencies = ( + 46EDC72027C6B92C00B870D7 /* Segment */, + 827C512728661FB5000B1B9E /* SegmentIntercom */, + ); + productName = BasicExample; + productReference = 46EDC6F227C6B8D100B870D7 /* BasicExample.app */; + productType = "com.apple.product-type.application"; + }; + 46EDC70127C6B8D200B870D7 /* BasicExampleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 46EDC71927C6B8D200B870D7 /* Build configuration list for PBXNativeTarget "BasicExampleTests" */; + buildPhases = ( + 46EDC6FE27C6B8D200B870D7 /* Sources */, + 46EDC6FF27C6B8D200B870D7 /* Frameworks */, + 46EDC70027C6B8D200B870D7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 46EDC70427C6B8D200B870D7 /* PBXTargetDependency */, + ); + name = BasicExampleTests; + productName = BasicExampleTests; + productReference = 46EDC70227C6B8D200B870D7 /* BasicExampleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 46EDC70B27C6B8D200B870D7 /* BasicExampleUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 46EDC71C27C6B8D200B870D7 /* Build configuration list for PBXNativeTarget "BasicExampleUITests" */; + buildPhases = ( + 46EDC70827C6B8D200B870D7 /* Sources */, + 46EDC70927C6B8D200B870D7 /* Frameworks */, + 46EDC70A27C6B8D200B870D7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 46EDC70E27C6B8D200B870D7 /* PBXTargetDependency */, + ); + name = BasicExampleUITests; + productName = BasicExampleUITests; + productReference = 46EDC70C27C6B8D200B870D7 /* BasicExampleUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 46EDC6EA27C6B8D100B870D7 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1320; + LastUpgradeCheck = 1320; + TargetAttributes = { + 46EDC6F127C6B8D100B870D7 = { + CreatedOnToolsVersion = 13.2.1; + }; + 46EDC70127C6B8D200B870D7 = { + CreatedOnToolsVersion = 13.2.1; + TestTargetID = 46EDC6F127C6B8D100B870D7; + }; + 46EDC70B27C6B8D200B870D7 = { + CreatedOnToolsVersion = 13.2.1; + TestTargetID = 46EDC6F127C6B8D100B870D7; + }; + }; + }; + buildConfigurationList = 46EDC6ED27C6B8D100B870D7 /* Build configuration list for PBXProject "BasicExample" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 46EDC6E927C6B8D100B870D7; + packageReferences = ( + 46EDC71F27C6B92C00B870D7 /* XCRemoteSwiftPackageReference "analytics-swift" */, + ); + productRefGroup = 46EDC6F327C6B8D100B870D7 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 46EDC6F127C6B8D100B870D7 /* BasicExample */, + 46EDC70127C6B8D200B870D7 /* BasicExampleTests */, + 46EDC70B27C6B8D200B870D7 /* BasicExampleUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 46EDC6F027C6B8D100B870D7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 46EDC6FD27C6B8D200B870D7 /* Preview Assets.xcassets in Resources */, + 46EDC6FA27C6B8D200B870D7 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 46EDC70027C6B8D200B870D7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 46EDC70A27C6B8D200B870D7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 46EDC6EE27C6B8D100B870D7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 46EDC6F827C6B8D100B870D7 /* ContentView.swift in Sources */, + 46EDC6F627C6B8D100B870D7 /* BasicExampleApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 46EDC6FE27C6B8D200B870D7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 46EDC70727C6B8D200B870D7 /* BasicExampleTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 46EDC70827C6B8D200B870D7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 46EDC71327C6B8D200B870D7 /* BasicExampleUITestsLaunchTests.swift in Sources */, + 46EDC71127C6B8D200B870D7 /* BasicExampleUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 46EDC70427C6B8D200B870D7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 46EDC6F127C6B8D100B870D7 /* BasicExample */; + targetProxy = 46EDC70327C6B8D200B870D7 /* PBXContainerItemProxy */; + }; + 46EDC70E27C6B8D200B870D7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 46EDC6F127C6B8D100B870D7 /* BasicExample */; + targetProxy = 46EDC70D27C6B8D200B870D7 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 46EDC71427C6B8D200B870D7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = 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_DOCUMENTATION_COMMENTS = YES; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + 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 = 15.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 46EDC71527C6B8D200B870D7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = 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_DOCUMENTATION_COMMENTS = YES; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 15.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 46EDC71727C6B8D200B870D7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"BasicExample/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.segment.BasicExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 46EDC71827C6B8D200B870D7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"BasicExample/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.segment.BasicExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 46EDC71A27C6B8D200B870D7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.2; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.segment.BasicExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BasicExample.app/BasicExample"; + }; + name = Debug; + }; + 46EDC71B27C6B8D200B870D7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.2; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.segment.BasicExampleTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BasicExample.app/BasicExample"; + }; + name = Release; + }; + 46EDC71D27C6B8D200B870D7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.segment.BasicExampleUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = BasicExample; + }; + name = Debug; + }; + 46EDC71E27C6B8D200B870D7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.segment.BasicExampleUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = BasicExample; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 46EDC6ED27C6B8D100B870D7 /* Build configuration list for PBXProject "BasicExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 46EDC71427C6B8D200B870D7 /* Debug */, + 46EDC71527C6B8D200B870D7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 46EDC71627C6B8D200B870D7 /* Build configuration list for PBXNativeTarget "BasicExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 46EDC71727C6B8D200B870D7 /* Debug */, + 46EDC71827C6B8D200B870D7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 46EDC71927C6B8D200B870D7 /* Build configuration list for PBXNativeTarget "BasicExampleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 46EDC71A27C6B8D200B870D7 /* Debug */, + 46EDC71B27C6B8D200B870D7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 46EDC71C27C6B8D200B870D7 /* Build configuration list for PBXNativeTarget "BasicExampleUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 46EDC71D27C6B8D200B870D7 /* Debug */, + 46EDC71E27C6B8D200B870D7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 46EDC71F27C6B92C00B870D7 /* XCRemoteSwiftPackageReference "analytics-swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/segmentio/analytics-swift"; + requirement = { + branch = main; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 46EDC72027C6B92C00B870D7 /* Segment */ = { + isa = XCSwiftPackageProductDependency; + package = 46EDC71F27C6B92C00B870D7 /* XCRemoteSwiftPackageReference "analytics-swift" */; + productName = Segment; + }; + 827C512728661FB5000B1B9E /* SegmentIntercom */ = { + isa = XCSwiftPackageProductDependency; + productName = SegmentIntercom; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 46EDC6EA27C6B8D100B870D7 /* Project object */; +} diff --git a/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/BasicExample/BasicExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/BasicExample/BasicExample.xcworkspace/contents.xcworkspacedata b/Example/BasicExample/BasicExample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..a885c73 --- /dev/null +++ b/Example/BasicExample/BasicExample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Example/BasicExample/BasicExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/BasicExample/BasicExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/BasicExample/BasicExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/BasicExample/BasicExample.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/BasicExample/BasicExample.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..30040c5 --- /dev/null +++ b/Example/BasicExample/BasicExample.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,34 @@ +{ + "object": { + "pins": [ + { + "package": "Segment", + "repositoryURL": "https://github.com/segmentio/analytics-swift", + "state": { + "branch": "main", + "revision": "4c7aab453b56a80d5d2577a378bced8dc20c8f2d", + "version": null + } + }, + { + "package": "Intercom", + "repositoryURL": "https://github.com/intercom/intercom-ios", + "state": { + "branch": null, + "revision": "7d1072dc39ebaf8af117b697730b6aaa834e5f48", + "version": "12.4.3" + } + }, + { + "package": "Sovran", + "repositoryURL": "https://github.com/segmentio/Sovran-Swift.git", + "state": { + "branch": null, + "revision": "64f3b5150c282a34af4578188dce2fd597e600e3", + "version": "1.1.0" + } + } + ] + }, + "version": 1 +} diff --git a/Example/BasicExample/BasicExample/Assets.xcassets/AccentColor.colorset/Contents.json b/Example/BasicExample/BasicExample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Example/BasicExample/BasicExample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/BasicExample/BasicExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/BasicExample/BasicExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/Example/BasicExample/BasicExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/BasicExample/BasicExample/Assets.xcassets/Contents.json b/Example/BasicExample/BasicExample/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/BasicExample/BasicExample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/BasicExample/BasicExample/BasicExampleApp.swift b/Example/BasicExample/BasicExample/BasicExampleApp.swift new file mode 100644 index 0000000..8f0612d --- /dev/null +++ b/Example/BasicExample/BasicExample/BasicExampleApp.swift @@ -0,0 +1,29 @@ +// +// BasicExampleApp.swift +// BasicExample +// +// Created by Brandon Sneed on 2/23/22. +// + +import SwiftUI +import Segment +import SegmentIntercom + +@main +struct BasicExampleApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} + +extension Analytics { + static var main: Analytics { + let analytics = Analytics(configuration: Configuration(writeKey: "") + .flushAt(3) + .trackApplicationLifecycleEvents(true)) + analytics.add(plugin: IntercomDestination()) + return analytics + } +} diff --git a/Example/BasicExample/BasicExample/ContentView.swift b/Example/BasicExample/BasicExample/ContentView.swift new file mode 100644 index 0000000..d06038c --- /dev/null +++ b/Example/BasicExample/BasicExample/ContentView.swift @@ -0,0 +1,53 @@ +// +// ContentView.swift +// BasicExample +// +// Created by Brandon Sneed on 2/23/22. +// + +import SwiftUI +import Segment + +struct ContentView: View { + var body: some View { + VStack { + HStack { + Button(action: { + Analytics.main.track(name: "Track") + }, label: { + Text("Track") + }).padding(6) + Button(action: { + Analytics.main.screen(title: "Screen appeared") + }, label: { + Text("Screen") + }).padding(6) + }.padding(8) + HStack { + Button(action: { + Analytics.main.group(groupId: "12345-Group") + Analytics.main.log(message: "Started group") + }, label: { + Text("Group") + }).padding(6) + Button(action: { + Analytics.main.identify(userId: "X-1234567890") + }, label: { + Text("Identify") + }).padding(6) + }.padding(8) + }.onAppear { + Analytics.main.track(name: "onAppear") + print("Executed Analytics onAppear()") + }.onDisappear { + Analytics.main.track(name: "onDisappear") + print("Executed Analytics onDisappear()") + } + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/Example/BasicExample/BasicExample/Preview Content/Preview Assets.xcassets/Contents.json b/Example/BasicExample/BasicExample/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Example/BasicExample/BasicExample/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/BasicExample/BasicExampleTests/BasicExampleTests.swift b/Example/BasicExample/BasicExampleTests/BasicExampleTests.swift new file mode 100644 index 0000000..7ca22a2 --- /dev/null +++ b/Example/BasicExample/BasicExampleTests/BasicExampleTests.swift @@ -0,0 +1,36 @@ +// +// BasicExampleTests.swift +// BasicExampleTests +// +// Created by Brandon Sneed on 2/23/22. +// + +import XCTest +@testable import BasicExample + +class BasicExampleTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/Example/BasicExample/BasicExampleUITests/BasicExampleUITests.swift b/Example/BasicExample/BasicExampleUITests/BasicExampleUITests.swift new file mode 100644 index 0000000..f065fbd --- /dev/null +++ b/Example/BasicExample/BasicExampleUITests/BasicExampleUITests.swift @@ -0,0 +1,42 @@ +// +// BasicExampleUITests.swift +// BasicExampleUITests +// +// Created by Brandon Sneed on 2/23/22. +// + +import XCTest + +class BasicExampleUITests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/Example/BasicExample/BasicExampleUITests/BasicExampleUITestsLaunchTests.swift b/Example/BasicExample/BasicExampleUITests/BasicExampleUITestsLaunchTests.swift new file mode 100644 index 0000000..86fad66 --- /dev/null +++ b/Example/BasicExample/BasicExampleUITests/BasicExampleUITestsLaunchTests.swift @@ -0,0 +1,32 @@ +// +// BasicExampleUITestsLaunchTests.swift +// BasicExampleUITests +// +// Created by Brandon Sneed on 2/23/22. +// + +import XCTest + +class BasicExampleUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..29e1ab6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Segment + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..462ad3f --- /dev/null +++ b/Package.resolved @@ -0,0 +1,34 @@ +{ + "object": { + "pins": [ + { + "package": "Segment", + "repositoryURL": "https://github.com/segmentio/analytics-swift.git", + "state": { + "branch": null, + "revision": "79fb17a5d4abf8f80e6a0935e57c7df7b670a6c0", + "version": "1.4.1" + } + }, + { + "package": "Intercom", + "repositoryURL": "https://github.com/intercom/intercom-ios", + "state": { + "branch": null, + "revision": "7d1072dc39ebaf8af117b697730b6aaa834e5f48", + "version": "12.4.3" + } + }, + { + "package": "Sovran", + "repositoryURL": "https://github.com/segmentio/Sovran-Swift.git", + "state": { + "branch": null, + "revision": "944c17d7c46bd95fc37f09136cabd172be5b413b", + "version": "1.0.3" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..ccbcad9 --- /dev/null +++ b/Package.swift @@ -0,0 +1,44 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SegmentIntercom", + platforms: [ + .macOS("10.15"), + .iOS("13.0"), + .tvOS("11.0"), + .watchOS("7.1") + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "SegmentIntercom", + targets: ["SegmentIntercom"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + .package( + name: "Segment", + url: "https://github.com/segmentio/analytics-swift.git", + from: "1.4.1" + ), + .package( + name: "Intercom", + url: "https://github.com/intercom/intercom-ios", + from: "12.4.3" + ) + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "SegmentIntercom", + dependencies: ["Segment", "Intercom"]), + + // TESTS ARE HANDLED VIA THE EXAMPLE APP. + ] +) + diff --git a/README.md b/README.md new file mode 100644 index 0000000..555406a --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +# Analytics-Swift Intercom + +Add Intercom device mode support to your applications via this plugin for [Analytics-Swift](https://github.com/segmentio/analytics-swift) + +## Adding the dependency + +***Note:** the Intercom library itself will be installed as an additional dependency.* + +### via Xcode +In the Xcode `File` menu, click `Add Packages`. You'll see a dialog where you can search for Swift packages. In the search field, enter the URL to this repo. + +https://github.com/segment-integrations/analytics-swift-intercom + +You'll then have the option to pin to a version, or specific branch, as well as which project in your workspace to add it to. Once you've made your selections, click the `Add Package` button. + +### via Package.swift + +Open your Package.swift file and add the following do your the `dependencies` section: + +``` +.package( + name: "Segment", + url: "https://github.com/segment-integrations/analytics-swift-intercom.git", + from: "1.1.3" + ), +``` + +*Note the Intercom library itself will be installed as an additional dependency.* + + +## Using the Plugin in your App + +Open the file where you setup and configure the Analytics-Swift library. Add this plugin to the list of imports. + +``` +import Segment +import SegmentIntercom // <-- Add this line +``` + +Just under your Analytics-Swift library setup, call `analytics.add(plugin: ...)` to add an instance of the plugin to the Analytics timeline. + +``` +let analytics = Analytics(configuration: Configuration(writeKey: "") + .flushAt(3) + .trackApplicationLifecycleEvents(true)) +analytics.add(plugin: IntercomDestination()) +``` + +Your events will now begin to flow to Intercom in device mode. + + +## Support + +Please use Github issues, Pull Requests, or feel free to reach out to our [support team](https://segment.com/help/). + +## Integrating with Segment + +Interested in integrating your service with us? Check out our [Partners page](https://segment.com/partners/) for more details. + +## License +``` +MIT License + +Copyright (c) 2021 Segment + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` diff --git a/Sources/SegmentIntercom/IntercomDestination.swift b/Sources/SegmentIntercom/IntercomDestination.swift new file mode 100644 index 0000000..97125ae --- /dev/null +++ b/Sources/SegmentIntercom/IntercomDestination.swift @@ -0,0 +1,244 @@ +// Created by Cody Garvin on 9/21/21. + +import Segment +import Intercom +import CoreMedia + +// Copyright (c) 2022 Twilio +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// + +@objc(SEGIntercomDestination) +public class ObjCSegmentIntercom: NSObject, ObjCPlugin, ObjCPluginShim { + public func instance() -> EventPlugin { return IntercomDestination() } +} +public class IntercomDestination: DestinationPlugin { + public let timeline = Timeline() + public let type = PluginType.destination + public let key = "Intercom" + public var analytics: Analytics? = nil + + private var intercomSettings: IntercomSettings? + private var configurationLabels = [String: Any]() + + public init() {} + + public func update(settings: Settings, type: UpdateType) { + // Skip if you have a singleton and don't want to keep updating via settings. + guard type == .initial else { return } + + // Grab the settings and assign them for potential later usage. + // Note: Since integrationSettings is generic, strongly type the variable. + guard let tempSettings: IntercomSettings = settings.integrationSettings(forPlugin: self) else { return } + intercomSettings = tempSettings + Intercom.setApiKey(tempSettings.mobileApiKey, forAppId: tempSettings.appId) + } + + public func identify(event: IdentifyEvent) -> IdentifyEvent? { + + if let userId = event.userId { + Intercom.registerUser(withUserId: userId) + } else if let _ = event.anonymousId { + Intercom.registerUnidentifiedUser() + } + + if let integration = event.integrations?.dictionaryValue?["Intercom"] as? [AnyHashable: Any], + let userHash = integration["user_hash"] as? String { + Intercom.setUserHash(userHash) + } + + if let traits = event.traits?.dictionaryValue { + // Set user attributes + setUserAttributes(traits, event: event) + } + + return event + } + + public func track(event: TrackEvent) -> TrackEvent? { + + // Properties can not be empty + guard let properties = event.properties?.dictionaryValue else { + + Intercom.logEvent(withName: event.event) + return event + } + + var output = [String: Any]() + var price = [String: Any]() + var isAmountSet = false + + for (key, value) in properties { + output[key] = value + + if let dataValue = value as? Double, + key == "revenue" || key == "total" && !isAmountSet { + let amountInCents = dataValue * 100 + price["amount"] = amountInCents + output.removeValue(forKey: key) + isAmountSet = true + } + + if key == "currency" { + price["currency"] = value + output.removeValue(forKey: "currency") + } + + if price.count > 0 { + output["price"] = price + } + + if value is [String: Any] || value is [Any] { + output.removeValue(forKey: key) + } + } + + Intercom.logEvent(withName: event.event, metaData: output) + + return event + } + + public func group(event: GroupEvent) -> GroupEvent? { + + // id is required field for adding or modifying a company + guard let traits = event.traits?.dictionaryValue, + let groupId = event.groupId else { return event } + + let company = setCompanyAttributes(traits) + company.companyId = groupId + + let userAttributes = ICMUserAttributes() + userAttributes.companies = [company] + + Intercom.updateUser(userAttributes) + + return event + } + + public func reset() { + Intercom.logout() + } +} + +// Example of what settings may look like. +private struct IntercomSettings: Codable { + let appId: String + let mobileApiKey: String +} + +private extension IntercomDestination { + + func setUserAttributes(_ traits: [String: Any], event: RawEvent?) { + let userAttributes = ICMUserAttributes() + var customAttributes = traits + + if let email = traits["email"] as? String { + userAttributes.email = email + customAttributes.removeValue(forKey: "email") + } + + if let userId = traits["user_id"] as? String { + userAttributes.userId = userId + customAttributes.removeValue(forKey: "user_id") + } + + if let name = traits["name"] as? String { + userAttributes.name = name + customAttributes.removeValue(forKey: "name") + } + + if let phone = traits["phone"] as? String { + userAttributes.phone = phone + customAttributes.removeValue(forKey: "phone") + } + + if let createdAt = traits["created_at"] as? Double { + let date = Date(timeIntervalSince1970: createdAt) + userAttributes.signedUpAt = date + customAttributes.removeValue(forKey: "created_at") + } + + if let integration = event?.integrations?.dictionaryValue?["Intercom"] as? [AnyHashable: Any] { + if let languageOverride = integration["language_override"] as? String { + userAttributes.languageOverride = languageOverride + } + + if let unsubscribed = integration["unsubscribed"] as? Bool { + userAttributes.unsubscribedFromEmails = unsubscribed + } + } + + if let company = traits["company"] as? [String: Any] { + let companyData = setCompanyAttributes(company) + userAttributes.companies = [companyData] + } + + for (key, value) in traits { + if !(value is String) && + !(value is Int) && + !(value is Double) && + !(value is Bool) { + customAttributes.removeValue(forKey: key) + } + } + + userAttributes.customAttributes = customAttributes + Intercom.updateUser(userAttributes) + } + + func setCompanyAttributes(_ company: [String: Any]) -> ICMCompany { + let companyData = ICMCompany() + var customTraits = company + + if let companyId = company["id"] as? String { + companyData.companyId = companyId + customTraits.removeValue(forKey: "id") + } + + if let monthlySpending = company["monthly_spend"] as? Double { + companyData.monthlySpend = NSNumber(value: monthlySpending) + customTraits.removeValue(forKey: "monthly_spend") + } + + if let plan = company["plan"] as? String { + companyData.plan = plan + customTraits.removeValue(forKey: "plan") + } + + if let createdAt = company["created_at"] as? Double { + let date = Date(timeIntervalSince1970: createdAt) + companyData.createdAt = date + customTraits.removeValue(forKey: "created_at") + } + + for (key, value) in company { + if !(value is String) && + !(value is Int) && + !(value is Double) && + !(value is Bool) { + customTraits.removeValue(forKey: key) + } + } + + companyData.customAttributes = customTraits + + return companyData + } +} diff --git a/Sources/SegmentIntercom/Version.swift b/Sources/SegmentIntercom/Version.swift new file mode 100644 index 0000000..27a6012 --- /dev/null +++ b/Sources/SegmentIntercom/Version.swift @@ -0,0 +1,15 @@ +// +// File.swift +// +// +// Created by Alan Charles on 6/23/22. +// + + +// DO NOT MODIFY THIS FILE BY HAND!! +// DO NOT MODIFY THIS FILE BY HAND!! +// DO NOT MODIFY THIS FILE BY HAND!! +// DO NOT MODIFY THIS FILE BY HAND!! +// Use release.sh's automation. +// BREAKING.FEATURE.FIX +internal let __destination_version = "1.0.0" diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..82ddb06 --- /dev/null +++ b/release.sh @@ -0,0 +1,126 @@ +#!/bin/bash + +vercomp () { + if [[ $1 == $2 ]] + then + return 0 + fi + local IFS=. + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) + do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)) + do + if [[ -z ${ver2[i]} ]] + then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + return 2 + fi + done + return 0 +} + +# check if `gh` tool is installed. +if ! command -v gh &> /dev/null +then + echo "Github CLI tool is required, but could not be found." + echo "Install it via: $ brew install gh" + exit 1 +fi + +# check if `gh` tool has auth access. +# command will return non-zero if not auth'd. +authd=$(gh auth status -t) +if [[ $? != 0 ]]; then + echo "ex: $ gh auth login" + exit 1 +fi + +# check that we're on the `main` branch +branch=$(git rev-parse --abbrev-ref HEAD) +if [ $branch != 'main' ] +then + echo "The 'main' must be the current branch to make a release." + echo "You are currently on: $branch" + exit 1 +fi + +versionFile="./sources/SegmentAmplitude/Version.swift" + +# get last line in version.swift +versionLine=$(tail -n 1 $versionFile) +# split at the = +version=$(cut -d "=" -f2- <<< "$versionLine") +# remove quotes and spaces +version=$(sed "s/[' \"]//g" <<< "$version") + +echo "$(basename $(pwd)) current version: $version" + +# no args, so give usage. +if [ $# -eq 0 ] +then + echo "Release automation script" + echo "" + echo "Usage: $ ./release.sh " + echo " ex: $ ./release.sh \"1.0.2\"" + exit 0 +fi + +newVersion="${1%.*}.$((${1##*.}))" +echo "Preparing to release $newVersion..." + +vercomp $newVersion $version +case $? in + 0) op='=';; + 1) op='>';; + 2) op='<';; +esac + +if [ $op != '>' ] +then + echo "New version must be greater than previous version ($version)." + exit 1 +fi + +read -r -p "Are you sure you want to release $newVersion? [y/N] " response +case "$response" in + [yY][eE][sS]|[yY]) + ;; + *) + exit 1 + ;; +esac + +# get the commits since the last release... +# note: we do this here so the "Version x.x.x" commit doesn't show up in logs. +changelog=$(git log --pretty=format:"- (%an) %s" $(git describe --tags --abbrev=0 @^)..@) +tempFile=$(mktemp) +#write changelog to temp file. +echo -e "$changelog" >> $tempFile + +# update sources/Segment/Version.swift +# - remove last line... +sed -i '' -e '$ d' $versionFile +# - add new line w/ new version +echo "internal let __destination_version = \"$newVersion\"" >> $versionFile + +# commit the version change. +git commit -am "Version $newVersion" && git push +# gh release will make both the tag and the release itself. +gh release create $newVersion -F $tempFile -t "Version $newVersion" + +# remove the tempfile. +rm $tempFile + +