-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: watchOS/tvOS/visionOS/SwiftUI support (#300)
* chore: add watchOS demo for test * feat: watchOS/tvOS/visionOS support * style: code format * fix: add default value to device info in order to prevent new platform in future * style: code format * fix: some UIKit-based class and categories are only used on iOS platform * style: code format * chore: add visionOS demo for test * style: code format * chore: add tvOS demo for test * fix: use nw_path_monitor_t to determine network status * style: code format * ci: update ci * fix: target condition judge * style: code format * chore: remove using of RealityKitContent in visionOS demo * ci: update ci * chore: swift macro is not compatible in Xcode 14 * fix: device orientation logic * chore: update spi.yml * style: code format * fix: update version of GrowingUtils and GrowingAPM * fix: bugs * chore: update podfile lock * chore: code coverage ignore Package@swift-*.swift * fix: adapt deep link to SwiftUI * fix: null safety * style: code format * test: add SwiftUI Demo * chore: update GrowingUtils to 1.2.3 * chore: update pod dep * style: add comment about undetermined reachability * fix: path 为空时,mobiledebugger 上无法显示该字段 * fix: path 为空时,mobiledebugger 上无法显示该字段 (仅无埋点事件) * style: code format * fix: ignore nw_path_status on watchOS --------- Co-authored-by: GIOSDK <[email protected]>
- Loading branch information
Showing
112 changed files
with
3,155 additions
and
636 deletions.
There are no files selected for viewing
This file contains 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 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
11 changes: 11 additions & 0 deletions
11
Example/Example-SwiftUI/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains 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,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Example/Example-SwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains 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,13 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains 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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains 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,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() | ||
} |
This file contains 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,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 | ||
} | ||
} |
This file contains 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,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) | ||
}) | ||
} | ||
} | ||
} |
This file contains 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,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> |
6 changes: 6 additions & 0 deletions
6
Example/Example-SwiftUI/Preview Content/Preview Assets.xcassets/Contents.json
This file contains 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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.