Skip to content

Commit

Permalink
feat: add watchOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
YoloMao committed Nov 2, 2023
1 parent 0627a3a commit 3010516
Show file tree
Hide file tree
Showing 34 changed files with 767 additions and 291 deletions.
34 changes: 34 additions & 0 deletions Example/Example-watchOS Watch App/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// AppDelegate.swift
// GrowingAnalytics
//
// Created by YoloMao on 2023/10/27.
// Copyright (C) 2023 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 WatchKit
import GrowingAnalytics

class AppDelegate: NSObject, WKApplicationDelegate {
func applicationDidFinishLaunching() {
let config = GrowingTrackConfiguration(projectId: "bcc4fc9dea27f25d")
config?.dataSourceId = "be46cd165dcc3c7e"
config?.dataCollectionServerHost = "https://run.mocky.io/v3/08999138-a180-431d-a136-051f3c6bd306"
config?.idMappingEnabled = true
config?.debugEnabled = true
GrowingTracker.start(with: config!)
}

}
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" : "watchos",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
39 changes: 39 additions & 0 deletions Example/Example-watchOS Watch App/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// ContentView.swift
// GrowingAnalytics
//
// Created by YoloMao on 2023/10/27.
// Copyright (C) 2023 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

struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.padding()
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
32 changes: 32 additions & 0 deletions Example/Example-watchOS Watch App/Example_watchOSApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Example_watchOSApp.swift
// GrowingAnalytics
//
// Created by YoloMao on 2023/10/27.
// Copyright (C) 2023 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

@main
struct Example_watchOS_Watch_AppApp: App {
@WKApplicationDelegateAdaptor(AppDelegate.self) var delegate

var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
678 changes: 482 additions & 196 deletions Example/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ target 'Example-macOS' do
pod 'GrowingAnalytics/Tracker', :path => '../'
end

target 'Example-watchOS Watch App' do
platform :watchos, '7.0'
pod 'GrowingAnalytics/Tracker', :path => '../'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
Expand Down
122 changes: 62 additions & 60 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
PODS:
- GrowingAnalytics/Ads (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/APM (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Ads (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/APM (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAPM/Core (~> 1.0.0)
- GrowingAnalytics/Autotracker (4.0.0-beta.1):
- GrowingAnalytics/AutotrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/DefaultServices (= 4.0.0-beta.1)
- GrowingAnalytics/Hybrid (= 4.0.0-beta.1)
- GrowingAnalytics/MobileDebugger (= 4.0.0-beta.1)
- GrowingAnalytics/WebCircle (= 4.0.0-beta.1)
- GrowingAnalytics/AutotrackerCore (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Autotracker (4.0.0-beta.2):
- GrowingAnalytics/AutotrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/DefaultServices (= 4.0.0-beta.2)
- GrowingAnalytics/Hybrid (= 4.0.0-beta.2)
- GrowingAnalytics/MobileDebugger (= 4.0.0-beta.2)
- GrowingAnalytics/WebCircle (= 4.0.0-beta.2)
- GrowingAnalytics/AutotrackerCore (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingUtils/AutotrackerCore (~> 1.0.0)
- GrowingAnalytics/Compression (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Database (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/DefaultServices (4.0.0-beta.1):
- GrowingAnalytics/Compression (= 4.0.0-beta.1)
- GrowingAnalytics/Encryption (= 4.0.0-beta.1)
- GrowingAnalytics/JSON (= 4.0.0-beta.1)
- GrowingAnalytics/Network (= 4.0.0-beta.1)
- GrowingAnalytics/Protobuf (= 4.0.0-beta.1)
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Encryption (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Hybrid (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/ImpressionTrack (4.0.0-beta.1):
- GrowingAnalytics/AutotrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/JSON (4.0.0-beta.1):
- GrowingAnalytics/Database (= 4.0.0-beta.1)
- GrowingAnalytics/MobileDebugger (4.0.0-beta.1):
- GrowingAnalytics/Screenshot (= 4.0.0-beta.1)
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/WebSocket (= 4.0.0-beta.1)
- GrowingAnalytics/Network (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Protobuf (4.0.0-beta.1):
- GrowingAnalytics/Database (= 4.0.0-beta.1)
- GrowingAnalytics/Protobuf/Proto (= 4.0.0-beta.1)
- GrowingAnalytics/Protobuf/Proto (4.0.0-beta.1):
- GrowingAnalytics/Database (= 4.0.0-beta.1)
- GrowingAnalytics/Compression (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/Database (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/DefaultServices (4.0.0-beta.2):
- GrowingAnalytics/Compression (= 4.0.0-beta.2)
- GrowingAnalytics/Encryption (= 4.0.0-beta.2)
- GrowingAnalytics/JSON (= 4.0.0-beta.2)
- GrowingAnalytics/Network (= 4.0.0-beta.2)
- GrowingAnalytics/Protobuf (= 4.0.0-beta.2)
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/Encryption (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/Hybrid (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/ImpressionTrack (4.0.0-beta.2):
- GrowingAnalytics/AutotrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/JSON (4.0.0-beta.2):
- GrowingAnalytics/Database (= 4.0.0-beta.2)
- GrowingAnalytics/MobileDebugger (4.0.0-beta.2):
- GrowingAnalytics/Screenshot (= 4.0.0-beta.2)
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/WebSocket (= 4.0.0-beta.2)
- GrowingAnalytics/Network (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/Protobuf (4.0.0-beta.2):
- GrowingAnalytics/Database (= 4.0.0-beta.2)
- GrowingAnalytics/Protobuf/Proto (= 4.0.0-beta.2)
- GrowingAnalytics/Protobuf/Proto (4.0.0-beta.2):
- GrowingAnalytics/Database (= 4.0.0-beta.2)
- Protobuf (>= 3.22.0)
- GrowingAnalytics/Screenshot (4.0.0-beta.1):
- GrowingAnalytics/Screenshot (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore
- GrowingAnalytics/Tracker (4.0.0-beta.1):
- GrowingAnalytics/DefaultServices (= 4.0.0-beta.1)
- GrowingAnalytics/MobileDebugger (= 4.0.0-beta.1)
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/TrackerCore (4.0.0-beta.1):
- GrowingAnalytics/Tracker (4.0.0-beta.2):
- GrowingAnalytics/DefaultServices (= 4.0.0-beta.2)
- GrowingAnalytics/MobileDebugger (= 4.0.0-beta.2)
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/TrackerCore (4.0.0-beta.2):
- GrowingUtils/TrackerCore (~> 1.0.0)
- GrowingAnalytics/WebCircle (4.0.0-beta.1):
- GrowingAnalytics/AutotrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/Hybrid (= 4.0.0-beta.1)
- GrowingAnalytics/Screenshot (= 4.0.0-beta.1)
- GrowingAnalytics/WebSocket (= 4.0.0-beta.1)
- GrowingAnalytics/WebSocket (4.0.0-beta.1):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.1)
- GrowingAnalytics/WebCircle (4.0.0-beta.2):
- GrowingAnalytics/AutotrackerCore (= 4.0.0-beta.2)
- GrowingAnalytics/Hybrid (= 4.0.0-beta.2)
- GrowingAnalytics/Screenshot (= 4.0.0-beta.2)
- GrowingAnalytics/WebSocket (= 4.0.0-beta.2)
- GrowingAnalytics/WebSocket (4.0.0-beta.2):
- GrowingAnalytics/TrackerCore (= 4.0.0-beta.2)
- GrowingAPM (1.0.0):
- GrowingAPM/Core (= 1.0.0)
- GrowingAPM/CrashMonitor (= 1.0.0)
Expand Down Expand Up @@ -129,6 +129,7 @@ DEPENDENCIES:
- GrowingAnalytics/Tracker (from `../`)
- GrowingAPM
- GrowingToolsKit (>= 1.2.1)
- GrowingUtils/TrackerCore (from `../../growingio-sdk-ios-utilities`)
- KIF
- LBXScan/LBXNative (= 2.3)
- LBXScan/UI (= 2.3)
Expand All @@ -138,7 +139,6 @@ SPEC REPOS:
trunk:
- GrowingAPM
- GrowingToolsKit
- GrowingUtils
- KIF
- LBXScan
- Protobuf
Expand All @@ -148,18 +148,20 @@ SPEC REPOS:
EXTERNAL SOURCES:
GrowingAnalytics:
:path: "../"
GrowingUtils:
:path: "../../growingio-sdk-ios-utilities"

SPEC CHECKSUMS:
GrowingAnalytics: 3e66e18de41e54f94e0d71e787826b467ce25095
GrowingAnalytics: 5d6b5d45098d586ec98c3135a0ce37d4feb44db8
GrowingAPM: 6750d66ca6876c2c7d22c1c087625bc9ccc3430c
GrowingToolsKit: 134a78b023c4ab7da51e0a1111e9956a96e42dab
GrowingUtils: f0a9858cfd15dc584367957f24a784813a68d637
GrowingUtils: 9cb512ca42fcadc1e7b6045b283e1573e51c5d0c
KIF: 7660c626b0f2d4562533590960db70a36d640558
LBXScan: e51449f0832d1fe17da632af0d22adeb3cfa3543
Protobuf: 351e9022fe13a6e2af00e9aefc22077cb88520f8
SDCycleScrollView: a0d74c3384caa72bdfc81470bdbc8c14b3e1fbcf
SDWebImage: 96e0c18ef14010b7485210e92fac888587ebb958

PODFILE CHECKSUM: ab056def7c57fcd5747a7be922ee9fc2b5ce9783
PODFILE CHECKSUM: 7ef92e389d2f00bfa883c9096476728f1434dee2

COCOAPODS: 1.13.0
COCOAPODS: 1.14.2
1 change: 1 addition & 0 deletions GrowingAnalytics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GrowingAnalytics具备自动采集基本的用户行为事件,比如访问和
s.source = { :git => 'https://github.com/growingio/growingio-sdk-ios-autotracker.git', :tag => s.version.to_s }
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.watchos.deployment_target = '7.0'
s.ios.framework = 'WebKit'
s.requires_arc = true
s.default_subspec = "Autotracker"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import "GrowingTrackerCore/DeepLink/GrowingAppDelegateAutotracker.h"
#import <UIKit/UIKit.h>
#import <objc/message.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import "GrowingTrackerCore/DeepLink/GrowingSceneDelegateAutotracker.h"
#import <UIKit/UIKit.h>
#import <objc/message.h>
Expand Down
2 changes: 1 addition & 1 deletion GrowingTrackerCore/GrowingWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import <UIKit/UIKit.h>

@interface GrowingWindowView : UIView
Expand Down
2 changes: 1 addition & 1 deletion GrowingTrackerCore/GrowingWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import "GrowingTrackerCore/GrowingWindow.h"

@interface GrowingWindowViewController : UIViewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import <UIKit/UIKit.h>

@interface UIApplication (GrowingHelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import "GrowingTrackerCore/GrowingWindow.h"
#import "GrowingTrackerCore/Helpers/UIKit/UIApplication+GrowingHelper.h"
#import "GrowingTrackerCore/Helpers/UIKit/UIWindow+GrowingHelper.h"
Expand Down
2 changes: 1 addition & 1 deletion GrowingTrackerCore/Helpers/UIKit/UIControl+GrowingHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if __has_include(<UIKit/UIKit.h>)
#if __has_include(<UIKit/UIKit.h>) && !TARGET_OS_WATCH
#import <UIKit/UIKit.h>

@interface UIControl (GrowingHelper)
Expand Down
Loading

0 comments on commit 3010516

Please sign in to comment.