Skip to content

Commit

Permalink
Release 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
王洋洋 committed Apr 28, 2023
1 parent 365cc7d commit 8f5aff1
Show file tree
Hide file tree
Showing 171 changed files with 6,656 additions and 1,924 deletions.
Binary file added .DS_Store
Binary file not shown.
1,608 changes: 786 additions & 822 deletions Assembly-CSharp-Editor.csproj

Large diffs are not rendered by default.

1,494 changes: 736 additions & 758 deletions Assembly-CSharp.csproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Assets/Editor/MediationAdapterDependencies.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- auto-generated. do not modify by hand. -->
<dependencies>
<androidPackages>
<repositories>
<repository>https://unity3ddist.jfrog.io/artifactory/unity-mediation-mvn-prod-local/</repository>
</repositories>
<!-- Mediation Android SDK -->
<androidPackage spec="com.unity3d.mediation:mediation-sdk:[1.0,2.0[" mediation-identifier="mediation-sdk" mediation-version="1.0" />
<!-- Mediation SDK Android Adapters -->
<androidPackage spec="com.unity3d.mediation:unityads-adapter:[1.0,2.0[" mediation-identifier="unityads-adapter" mediation-version="latest" />
</androidPackages>
<iosPods>
<!-- Mediation iOS SDK -->
<iosPod name="UnityMediationSdk" version="~> 1.0" source="'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'" mediation-identifier="mediation-sdk" mediation-version="1.0" />
<!-- Mediation Dependency Required For resolution -->
<iosPod name="Protobuf" />
<!-- Mediation SDK iOS Adapters -->
<iosPod name="UnityMediationUnityAdapter" version="" source="'https://github.com/Unity-Technologies/unity-mediation-cocoapods-prod.git'" mediation-identifier="unityads-adapter" mediation-version="latest" />
</iosPods>
</dependencies>
7 changes: 7 additions & 0 deletions Assets/Editor/MediationAdapterDependencies.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/MobileDependencyResolver.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/MobileDependencyResolver/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
90 changes: 90 additions & 0 deletions Assets/MobileDependencyResolver/Editor/Google.IOSResolver.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
37 changes: 37 additions & 0 deletions Assets/MobileDependencyResolver/Editor/Google.JarResolver.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Assets/PlayServicesResolver/Editor/Google.IOSResolver.dll
Assets/PlayServicesResolver/Editor/Google.JarResolver.dll
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl.dll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/PC/.DS_Store
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Plugins/PC/Builder/.DS_Store
Binary file not shown.
40 changes: 40 additions & 0 deletions Assets/Plugins/PC/Builder/SAAppInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Created by 储强盛 on 2023/03/07.
* Copyright 2015-2023 Sensors Data Co., Ltd. All rights reserved
*
* 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.
*/

using UnityEngine;

namespace SensorsAnalyticsPCSDK.Builder
{
public class SAAppInfo
{

/* App 信息 */
// App 名称
public static string AppName() {
return Application.productName;
}

// App 标识,包名
public static string AppIdentifier() {
return Application.identifier;
}

public static string AppVersion() {
return Application.version;
}
}
}
11 changes: 11 additions & 0 deletions Assets/Plugins/PC/Builder/SAAppInfo.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Assets/Plugins/PC/Builder/SABaseEventObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//// Created by 储强盛 on 2023/3/9.// Copyright © 2015-2023 Sensors Data Co., Ltd. All rights reserved.//// 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.//using System;
using System.Collections.Generic;
using SensorsAnalyticsPCSDK.Builder;
using SensorsAnalyticsPCSDK.Constant;
using SensorsAnalyticsPCSDK.Utils;

namespace SensorsAnalyticsPCSDK.Builder{
public class SABaseEventObject { private readonly string kSAEventPresetPropertyLibPluginVersion = "$lib_plugin_version"; // 未登录时: 匿名 ID; 登录后: 登录 ID public string DistinctId; // 登录 ID public string LoginId; // 匿名 ID public string AnonymousId; // 登录事件中的 匿名 ID public string OriginalId; // 事件名称,可能包含 UUID public string EventId; // 事件类型 public string Type; // lib 信息 public SAEventLibObject LibObject; // 系统时间戳,用于记录事件触发时间 public Int64 TimeStamp; // 事件 Id public int TrackId; // 项目 public string Project; // token public string Token; // 事件属性 public Dictionary<string, object> Properties; // 当前时刻,用于统计事件时长,毫秒数 public int CurrentSystemUpTime; public SABaseEventObject() { LibObject = new SAEventLibObject(); TimeStamp = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds; Random random = new Random(); TrackId = random.Next(Int32.MinValue, Int32.MaxValue); Properties = new Dictionary<string, object>(); // 系统启动毫秒数 // 返回的是一个32位有符号整数类型的值,当自操作系统启动以来经过的毫秒数超过Int32.MaxValue时(约为24.8天),它会重新从零开始计数 CurrentSystemUpTime = Environment.TickCount; } public virtual bool IsSignUp() { return false; } /// <summary> /// 添加事件属性,track 类型子类实现 /// </summary> /// <param name="properties">事件属性</param> public virtual void AddEventProperties(Dictionary<string, object> properties) { } /// <summary> /// 添加公共属性,track 类型子类实现 /// </summary> /// <param name="superProperties">公共属性</param> public virtual void AddSuperProperties(Dictionary<string, object> superProperties) { } /// <summary> /// 添加自定义属性 /// </summary> /// <param name="properties">自定义属性内容</param> public virtual void AddCustomProperties(Dictionary<string, object> properties) { // 属性合法性校验和处理 Dictionary<string, object> validProperties = ValidProperties(properties); if(!SAValidator.IsValidDictionary(validProperties)) { return; } //移除外部传入的 $lib_plugin_version,在 PC 上作为一个完整 SDK,不采集 $lib_plugin_version if(validProperties.ContainsKey(kSAEventPresetPropertyLibPluginVersion)) { validProperties.Remove(kSAEventPresetPropertyLibPluginVersion); } foreach (KeyValuePair<string, object> kvp in validProperties)
{
Properties[kvp.Key] = kvp.Value;
} // 修正 $lib_method // 事件、公共属性和动态公共属性都需要支持修改 $project, $token, $time // $project, $token, $time 处理完毕后需要移除 if (Properties.ContainsKey(SAConstant.kSAEventPropertyProject)) { Project = (string)Properties[SAConstant.kSAEventPropertyProject]; Properties.Remove(SAConstant.kSAEventPropertyProject); } if (Properties.ContainsKey(SAConstant.kSAEventPropertyToken)) { Token = (string)Properties[SAConstant.kSAEventPropertyToken]; Properties.Remove(SAConstant.kSAEventPropertyToken); } if (Properties.ContainsKey(SAConstant.kSAEventPropertyTime)) { Int64 time = (Int64)Properties[SAConstant.kSAEventPropertyTime]; if(time > SAConstant.kSAEventCommonOptionalPropertyTimeInt) { TimeStamp = time; } else { SALogger.Error("$time invalid, Please check the value"+ Properties[SAConstant.kSAEventPropertyTime]); } Properties.Remove(SAConstant.kSAEventPropertyTime); } } /// <summary> /// 添加事件时长,track 类型子类实现 /// </summary> /// <param name="duration">事件时长,单位:秒</param> public virtual void AddDurationProperty(float duration) { } /// <summary> /// 校验事件名称,track 类型子类实现 /// </summary> public virtual void ValidateEventName() { } /// <summary> /// 自定义属性合法性校验和修正 /// </summary> /// <param name="dic">属性内容</param> /// <returns></returns> public Dictionary<string, object>ValidProperties(Dictionary<string, object> dic) { Dictionary<string, object> properties = dic as Dictionary<string, object>; if (!SAValidator.IsValidDictionary(properties)) { return null; } Dictionary<string, object> result = new Dictionary<string, object>(); foreach (KeyValuePair<string, object> kvp in properties) { object value = ValidPropertyValue(kvp.Key, kvp.Value); if(value == null) { SALogger.Error("properties invalid,key:" + kvp.Key + ",value: " + kvp.Value); continue; } if (!SAValidator.IsValidPropertyValue(value))
{
continue;
} result[kvp.Key] = value; } return result; } /// <summary> /// 属性值合法性判断,子类可能需要再扩展实现 /// </summary> /// <param name="key"></param> /// <returns></returns> public virtual object ValidPropertyValue(string key,object value) { if(string.IsNullOrEmpty(key)) { SALogger.Error("Property:" + key + ", key or Event name is empty"); return null; } // 内置关键字等正则判断 if(!SAValidator.ValidateKey(key)) { return null; } // 长度判断,只报错,不移除 if(key.Length > SAConstant.kSAEventNameMaxLength) { SALogger.Error("Property key or Event name" + key + " length is longer than " + SAConstant.kSAEventNameMaxLength); } // value 合法性判断:包括类型、处理。超长只做提示,不做截取 if(value is string && ((string)value).Length > SAConstant.kSAPropertyValueMaxLength) { SALogger.Warn(value + " length is longer than " + SAConstant.kSAPropertyValueMaxLength); } return value; } // 生成最终的事件信息 public virtual Dictionary<string, object>JsonObject() { Dictionary<string, object>eventInfo = new Dictionary<string, object>(); eventInfo.Add(SAConstant.kSAEventDistinctId, DistinctId); if(!string.IsNullOrEmpty(LoginId)) { eventInfo.Add(SAConstant.kSAEventLoginId, LoginId); } eventInfo.Add(SAConstant.kSAEventAnonymousId, AnonymousId); eventInfo.Add(SAConstant.kSAEventType, Type); eventInfo.Add(SAConstant.kSAEventTime, TimeStamp); eventInfo.Add(SAConstant.kSAEventLib, LibObject.LibJsonObject()); eventInfo.Add(SAConstant.kSAEventTrackId, TrackId); if (!string.IsNullOrEmpty(Project)) { eventInfo.Add(SAConstant.kSAEventProject, Project); } if (!string.IsNullOrEmpty(Token)) { eventInfo.Add(SAConstant.kSAEventToken, Token); } // 自定义事件属性 eventInfo.Add(SAConstant.kSAEventProperties, Properties); // 暂未支持 kSAEventIdentities // TODO: 待支持 ID-Mapping3.0; return eventInfo; } }
}


Expand Down
11 changes: 11 additions & 0 deletions Assets/Plugins/PC/Builder/SABaseEventObject.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f5aff1

Please sign in to comment.