Skip to content
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

WIP feat: watchOS/tvOS/visionOS/SwiftUI support #300

Merged
merged 36 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b8580a7
chore: add watchOS demo for test
YoloMao Feb 2, 2024
99ac1b9
feat: watchOS/tvOS/visionOS support
YoloMao Feb 2, 2024
6513ea4
style: code format
GIOSDK Feb 2, 2024
ef12999
fix: add default value to device info in order to prevent new platfor…
YoloMao Feb 4, 2024
d097825
style: code format
GIOSDK Feb 4, 2024
7d0dce5
fix: some UIKit-based class and categories are only used on iOS platform
YoloMao Feb 4, 2024
ddda3ae
style: code format
GIOSDK Feb 4, 2024
26127ea
chore: add visionOS demo for test
YoloMao Feb 4, 2024
e46c55f
style: code format
GIOSDK Feb 4, 2024
ae54651
chore: add tvOS demo for test
YoloMao Feb 5, 2024
c0979b5
fix: use nw_path_monitor_t to determine network status
YoloMao Feb 5, 2024
1bb3b7b
style: code format
GIOSDK Feb 5, 2024
e3e3a92
ci: update ci
YoloMao Feb 6, 2024
1ce4deb
fix: target condition judge
YoloMao Feb 6, 2024
fd2227a
style: code format
GIOSDK Feb 6, 2024
1aec1e3
chore: remove using of RealityKitContent in visionOS demo
YoloMao Feb 6, 2024
da50b04
ci: update ci
YoloMao Feb 6, 2024
ba29954
chore: swift macro is not compatible in Xcode 14
YoloMao Feb 6, 2024
af95bf7
fix: device orientation logic
YoloMao Feb 7, 2024
f81c39d
chore: update spi.yml
YoloMao Feb 7, 2024
960c531
style: code format
GIOSDK Feb 7, 2024
9d8c5ac
fix: update version of GrowingUtils and GrowingAPM
YoloMao Feb 7, 2024
c47416a
fix: bugs
YoloMao Feb 18, 2024
f03a9ea
chore: update podfile lock
YoloMao Feb 18, 2024
b218514
chore: code coverage ignore Package@swift-*.swift
YoloMao Feb 18, 2024
eebd483
fix: adapt deep link to SwiftUI
YoloMao Feb 20, 2024
59bbf64
fix: null safety
YoloMao Feb 21, 2024
68f014a
style: code format
GIOSDK Feb 21, 2024
9b84689
test: add SwiftUI Demo
YoloMao Feb 21, 2024
8cfda67
chore: update GrowingUtils to 1.2.3
YoloMao Feb 21, 2024
4b53903
chore: update pod dep
YoloMao Mar 15, 2024
ff27c66
style: add comment about undetermined reachability
YoloMao Mar 18, 2024
76c1e93
fix: path 为空时,mobiledebugger 上无法显示该字段
YoloMao Mar 18, 2024
c4716ec
fix: path 为空时,mobiledebugger 上无法显示该字段 (仅无埋点事件)
YoloMao Mar 18, 2024
1ba06c5
style: code format
GIOSDK Mar 18, 2024
dec8daa
fix: ignore nw_path_status on watchOS
YoloMao Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 46 additions & 136 deletions .github/workflows/spm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,145 +11,55 @@ concurrency:
cancel-in-progress: true

jobs:
autotracker-build-iOS:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingAutotracker -destination 'platform=iOS Simulator,name=iPhone 14' \
| xcbeautify --renderer github-actions

autotracker-build-catalyst:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingAutotracker -destination 'platform=macOS,variant=Mac Catalyst' \
| xcbeautify --renderer github-actions

tracker-build-iOS:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingTracker -destination 'platform=iOS Simulator,name=iPhone 14' \
| xcbeautify --renderer github-actions

tracker-build-catalyst:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingTracker -destination 'platform=macOS,variant=Mac Catalyst' \
| xcbeautify --renderer github-actions

tracker-build-macos:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingTracker -destination 'platform=macOS' \
| xcbeautify --renderer github-actions

ads-build-iOS:
runs-on: macos-latest

spm-build:
strategy:
matrix:
target: [
iOS,
macOS,
macCatalyst,
tvOS,
watchOS
]
os: [macos-12, macos-13]
include:
- os: macos-12
xcode: Xcode_14.2
- os: macos-13
xcode: Xcode_15.2
- target: iOS
platform: iOS Simulator,name=iPhone 14 Pro Max
- target: macOS
platform: macOS
- target: macCatalyst
platform: macOS,variant=Mac Catalyst
- target: tvOS
platform: tvOS Simulator,name=Apple TV
- target: watchOS
platform: watchOS Simulator,name=Apple Watch Ultra (49mm)
- scheme: GrowingAnalytics-Package
target: iOS
- scheme: GrowingAutotracker
target: macCatalyst
- scheme: GrowingAutotracker
target: tvOS
- scheme: GrowingTracker
target: macOS
- scheme: GrowingTracker
target: watchOS
- target: visionOS
os: macos-14
xcode: Xcode_15.2
platform: visionOS Simulator,name=Apple Vision Pro
scheme: GrowingTracker
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingModule_Ads -destination 'platform=iOS Simulator,name=iPhone 14' \
| xcbeautify --renderer github-actions

apm-build-iOS:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingModule_APM -destination 'platform=iOS Simulator,name=iPhone 14' \
| xcbeautify --renderer github-actions

apm-build-catalyst:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingModule_APM -destination 'platform=macOS,variant=Mac Catalyst' \
| xcbeautify --renderer github-actions

hybrid-build-iOS:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingModule_Hybrid -destination 'platform=iOS Simulator,name=iPhone 14' \
| xcbeautify --renderer github-actions

hybrid-build-catalyst:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingModule_Hybrid -destination 'platform=macOS,variant=Mac Catalyst' \
| xcbeautify --renderer github-actions

imp-build-iOS:
runs-on: macos-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Xcode
run: sudo xcode-select -switch /Applications/${{ matrix.xcode }}.app
- name: Build
run: |
set -euo pipefail
xcodebuild build -scheme GrowingModule_ImpressionTrack -destination 'platform=iOS Simulator,name=iPhone 14' \
| xcbeautify --renderer github-actions
xcodebuild build -scheme ${{ matrix.scheme }} -destination 'platform=${{ matrix.platform }}' \
| xcbeautify --renderer github-actions
8 changes: 7 additions & 1 deletion .spi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ version: 1
builder:
configs:
- platform: ios
scheme: GrowingAutotracker
scheme: GrowingAnalytics-Package
- platform: macos-xcodebuild
scheme: GrowingTracker
- platform: macos-spm
target: GrowingTracker
- platform: tvos
scheme: GrowingAutotracker
- platform: watchos
scheme: GrowingTracker
- platform: visionos
scheme: GrowingTracker
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Example/Example-SwiftUI/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
41 changes: 41 additions & 0 deletions Example/Example-SwiftUI/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// ContentView.swift
// GrowingAnalytics
//
// Created by YoloMao on 2024/2/21.
// Copyright (C) 2024 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import SwiftUI
import GrowingAnalytics

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Button("TrackCustomEvent") {
GrowingAutotracker.sharedInstance().trackCustomEvent("SwiftUI_custom_event",
withAttributes: ["key": "value"])
}
}
.padding()
}
}

#Preview {
ContentView()
}
34 changes: 34 additions & 0 deletions Example/Example-SwiftUI/CustomAppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// CustomAppDelegate.swift
// GrowingAnalytics
//
// Created by YoloMao on 2024/2/21.
// Copyright (C) 2024 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import UIKit
import GrowingAnalytics

class CustomAppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
let config = GrowingAutotrackConfiguration(accountId: "0a1b4118dd954ec3bcc69da5138bdb96")
config?.dataSourceId = "ab555003531e0fd1"
config?.urlScheme = "growing.bf30ad277eaae1aa"
config?.debugEnabled = true
GrowingAutotracker.start(with: config!)

return true
}
}
39 changes: 39 additions & 0 deletions Example/Example-SwiftUI/Example_SwiftUIApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// Example_SwiftUIApp.swift
// GrowingAnalytics
//
// Created by YoloMao on 2024/2/21.
// Copyright (C) 2024 Beijing Yishu Technology Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import SwiftUI
import GrowingAnalytics

@main
struct Example_SwiftUIApp: App {

@UIApplicationDelegateAdaptor(CustomAppDelegate.self) var delegate

var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL(perform: { url in
DeepLink.handle(url)
})
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb, perform: { userActivity in
DeepLink.handle(userActivity.webpageURL)
})
}
}
}
25 changes: 25 additions & 0 deletions Example/Example-SwiftUI/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>growing.bf30ad277eaae1aa</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>growing.deeplink</string>
</array>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Loading