Skip to content

Commit

Permalink
Mt 1480 - Moments API (#334)
Browse files Browse the repository at this point in the history
* initial commit

* initial commit of moments api

* small fix

* WIP

* Added tests

* Added tests

* WIP

* switched to new engine response format

* swiftlint changes

* accepted recommended project changes

* swiftlint updates

* sample updates

* updated consent expiry

* fix conflict

* updated test schemes

* updated imports

* updated tvos scheme

* Updated surfile

* Updates from PR review

* Added input field for moments API engine ID

* bumped ruby version

* Further code review updates

* Switched to using MockURLSession from core

* Handled missing/null responses from Moments API

* Made properties optional to align with visitor profile. Skipped null values

* Updated referrer spelling, added package.swift and podspec

* fix test build issue

* updated test.yml

* Updated project and fastlane config

* removed destination from test.yml

* re-added macOS test scheme

* updated test yaml

* fixed tests.yaml

* fixed tests.yaml

* changed simulator destination

* changed simulator destination for UI tests
  • Loading branch information
craigrouse authored Aug 7, 2024
1 parent 3845361 commit 7cbd2ec
Show file tree
Hide file tree
Showing 82 changed files with 2,680 additions and 269 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
ruby-version: '3.0'
- name: Install Fastlane
run: |
gem install fastlane
Expand All @@ -24,7 +24,7 @@ jobs:
working-directory: ./builder
strategy:
matrix:
destination: ["platform=iOS Simulator,OS=14.5,name=iPhone 14"]
destination: ["platform=iOS Simulator,OS=17.5,name=iPhone 15 Pro"]
scheme:
- TealiumAppDelegateProxyTests-iOS
- TealiumAttributionTests-iOS
Expand All @@ -40,14 +40,15 @@ jobs:
- TealiumTagManagementIntegrationTests-iOS
- TealiumTagManagementTests-iOS
- TealiumVisitorServiceTests-iOS
- TealiumMomentsAPITests-iOS
steps:
- name: Setup Xcode version
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- name: Test - "${{ matrix.scheme }}"
run: fastlane scan --scheme "${{ matrix.scheme }}" --output_files "${{ matrix.scheme }}".html
run: fastlane scan --scheme "${{ matrix.scheme }}" --output_files "${{ matrix.scheme }}" --derived-data-path "./build" --skip_build true --result_bundle true --output_types junit --xcodebuild_formatter "xcbeautify -q --is-ci" --destination "${{ matrix.destination }}"
working-directory: ${{env.working-directory}}
- name: Archive Code Coverage Report
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -86,22 +87,23 @@ jobs:
working-directory: ./builder
strategy:
matrix:
destination: ["platform=macOS,arch=x86_64"]
destination: ["platform=macOS"]
scheme:
- TealiumAutotrackingTests-macOS
- TealiumCoreTests-macOS
- TealiumCollectTests-macOS
- TealiumLifecycleTests-macOS
- TealiumMediaTests-macOS
- TealiumVisitorServiceTests-macOS
- TealiumMomentsAPITests-macOS
steps:
- name: Setup Xcode version
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- name: Test - "${{ matrix.scheme }}"
run: rm -rf output && fastlane scan --scheme "${{ matrix.scheme }}" --derived_data_path ./output --code_coverage true --skip_build true
run: rm -rf output && fastlane scan --scheme "${{ matrix.scheme }}" --derived_data_path ./output --code_coverage true --skip_build true --destination "${{ matrix.destination }}"
working-directory: ${{env.working-directory}}
- name: Archive Code Coverage Report
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -147,14 +149,15 @@ jobs:
- TealiumLifecycleTests-tvOS
- TealiumMediaTests-tvOS
- TealiumVisitorServiceTests-tvOS
- TealiumMomentsAPITests-tvOS
steps:
- name: Setup Xcode version
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- name: Test - "${{ matrix.scheme }}"
run: rm -rf output && fastlane scan --scheme "${{ matrix.scheme }}" --derived_data_path ./output --code_coverage true --skip_build true
run: rm -rf output && fastlane scan --scheme "${{ matrix.scheme }}" --derived_data_path ./output --code_coverage true --skip_build true --destination "${{ matrix.destination }}"
working-directory: ${{env.working-directory}}
- name: Archive Code Coverage Report
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -206,15 +209,15 @@ jobs:
working-directory: ./builder
strategy:
matrix:
destination: ["platform=iOS Simulator,OS=14.5,name=iPhone 14"]
destination: ["platform=iOS Simulator,OS=17.5,name=iPhone 15 Pro"]
steps:
- name: Setup Xcode version
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- name: Test TealiumAutotracking iOS UI Tests
run: rm -rf output && fastlane scan --scheme "TealiumAutotrackingUITests-iOS" --derived_data_path ./output --code_coverage false --skip_build true
run: rm -rf output && fastlane scan --scheme "TealiumAutotrackingUITests-iOS" --derived_data_path ./output --code_coverage false --skip_build true --destination "${{ matrix.destination }}"
working-directory: ${{ env.working-directory }}
test_Autotracking_macOS_uiTests:
needs: install
Expand All @@ -226,15 +229,15 @@ jobs:
working-directory: ./builder
strategy:
matrix:
destination: ["platform=macOS,arch=x86_64"]
destination: ["platform=macOS"]
steps:
- name: Setup Xcode version
uses: maxim-lobanov/[email protected]
with:
xcode-version: latest-stable
- uses: actions/checkout@v2
- name: Test TealiumAutotracking macOS UI Tests
run: rm -rf output && fastlane scan --scheme "TealiumAutotrackingUITests-macOS" --derived_data_path ./output --code_coverage false --skip_build true
run: rm -rf output && fastlane scan --scheme "TealiumAutotrackingUITests-macOS" --derived_data_path ./output --code_coverage false --skip_build true --destination "${{ matrix.destination }}"
working-directory: ${{ env.working-directory }}
test_Autotracking_tvOS_uiTests:
needs: install
Expand All @@ -254,5 +257,5 @@ jobs:
xcode-version: latest-stable
- uses: actions/checkout@v2
- name: Test TealiumAutotracking tvOS UI Tests
run: rm -rf output && fastlane scan --scheme "TealiumAutotrackingUITests-tvOS" --derived_data_path ./output --code_coverage false --skip_build true
run: rm -rf output && fastlane scan --scheme "TealiumAutotrackingUITests-tvOS" --derived_data_path ./output --code_coverage false --skip_build true --destination "${{ matrix.destination }}"
working-directory: ${{ env.working-directory }}
1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ file_length:
identifier_name:
excluded:
- id
severity: warning
line_length:
warning: 200
error: 500
Expand Down
11 changes: 10 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ let package = Package(
targets: ["TealiumTagManagement"]),
.library(
name: "TealiumVisitorService",
targets: ["TealiumVisitorService"])
targets: ["TealiumVisitorService"]),
.library(
name: "TealiumMomentsAPI",
targets: ["TealiumMomentsAPI"])

],
dependencies: [
Expand Down Expand Up @@ -124,5 +127,11 @@ let package = Package(
path: "tealium/collectors/visitorservice/",
swiftSettings: [.define("visitorservice")]
),
.target(
name: "TealiumMomentsAPI",
dependencies: ["TealiumCore"],
path: "tealium/collectors/momentsapi/",
swiftSettings: [.define("momentsapi")]
),
]
)
73 changes: 72 additions & 1 deletion builder/SM/Surfile
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,81 @@
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>TealiumMomentsAPI</string>
<key>targets</key>
<array>
<dict>
<key>sdk</key>
<string>iOS</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>iOSSimulator</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>watchSimulator</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>watchOS</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>macOS</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>macOSCatalyst</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>tvOS</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
<dict>
<key>sdk</key>
<string>tvOSSimulator</string>
<key>workspace</key>
<string>tealium-swift.xcworkspace</string>
<key>scheme</key>
<string>TealiumMomentsAPI</string>
</dict>
</array>
</dict>
</array>
<key>finalActions</key>
<array>
<string>openDirectory</string>
</array>
</dict>
</plist>
</plist>
22 changes: 22 additions & 0 deletions builder/TealiumMoments-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
14 changes: 14 additions & 0 deletions builder/iOSTealiumTest/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ struct ContentView: View {
@ObservedObject var iapHelper = IAPHelper.shared
@State private var traceId: String = ""
@State private var showAlert = false
@State private var navigateToMoments = false
@State private var navigateToVisitorService = false
@State private var email: String = TealiumHelper.shared.tealium?.dataLayer.all[TealiumDataKey.email] as? String ?? ""
let name = "Main Screen"
// Timed event start
Expand Down Expand Up @@ -152,6 +154,18 @@ struct ContentView: View {
TealiumTextButton(title: "VisitorProfileRequest") {
TealiumHelper.shared.tealium?.visitorService?.requestVisitorProfile()
}
TealiumTextButton(title: "Moments API") {
navigateToMoments = true
}
TealiumTextButton(title: "Visitor Service") {
navigateToVisitorService = true
}
NavigationLink(destination: MomentsView(), isActive: $navigateToMoments) {
EmptyView()
}
NavigationLink(destination: VisitorServiceView(), isActive: $navigateToVisitorService) {
EmptyView()
}
}
Spacer()
}
Expand Down
7 changes: 7 additions & 0 deletions builder/iOSTealiumTest/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@
<array>
<string>Intent</string>
</array>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>We'd like to access your location</string>
<key>NSLocationAlwaysUsageDescription</key>
Expand Down
Loading

0 comments on commit 7cbd2ec

Please sign in to comment.