forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiOSDevice.bindings.cs
More file actions
185 lines (165 loc) · 6.52 KB
/
Copy pathiOSDevice.bindings.cs
File metadata and controls
185 lines (165 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using UnityEngine.Bindings;
namespace UnityEngine.iOS
{
// keep in sync with DeviceGeneration enum in trampoline.
public enum DeviceGeneration
{
Unknown = 0,
iPhone = 1,
iPhone3G = 2,
iPhone3GS = 3,
iPodTouch1Gen = 4,
iPodTouch2Gen = 5,
iPodTouch3Gen = 6,
iPad1Gen = 7,
iPhone4 = 8,
iPodTouch4Gen = 9,
iPad2Gen = 10,
iPhone4S = 11,
iPad3Gen = 12,
iPhone5 = 13,
iPodTouch5Gen = 14,
iPadMini1Gen = 15,
iPad4Gen = 16,
iPhone5C = 17,
iPhone5S = 18,
iPadAir1 = 19,
iPadMini2Gen = 20,
iPhone6 = 21,
iPhone6Plus = 22,
iPadMini3Gen = 23,
iPadAir2 = 24,
iPhone6S = 25,
iPhone6SPlus = 26,
iPadPro1Gen = 27,
iPadMini4Gen = 28,
iPhoneSE1Gen = 29,
iPadPro10Inch1Gen = 30,
iPhone7 = 31,
iPhone7Plus = 32,
iPodTouch6Gen = 33,
iPad5Gen = 34,
iPadPro2Gen = 35,
iPadPro10Inch2Gen = 36,
iPhone8 = 37,
iPhone8Plus = 38,
iPhoneX = 39,
iPhoneXS = 40,
iPhoneXSMax = 41,
iPhoneXR = 42,
iPadPro11Inch = 43,
iPadPro3Gen = 44,
iPad6Gen = 45,
iPadAir3Gen = 46,
iPadMini5Gen = 47,
iPhone11 = 48,
iPhone11Pro = 49,
iPhone11ProMax = 50,
iPodTouch7Gen = 51,
iPad7Gen = 52,
iPhoneSE2Gen = 53,
iPhoneUnknown = 10001,
iPadUnknown = 10002,
iPodTouchUnknown = 10003,
}
public enum ActivityIndicatorStyle
{
DontShow = -1, // Do not show ActivityIndicator
WhiteLarge = 0, // The large white style of indicator (UIActivityIndicatorViewStyleWhiteLarge).
White = 1, // The standard white style of indicator (UIActivityIndicatorViewStyleWhite).
Gray = 2, // The standard gray style of indicator (UIActivityIndicatorViewStyleGray).
}
[NativeHeader("PlatformDependent/iPhonePlayer/IOSScriptBindings.h")]
public sealed partial class Device
{
extern public static string systemVersion
{
[FreeFunction("systeminfo::GetDeviceSystemVersion")]
get;
}
extern public static DeviceGeneration generation
{
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("UnityDeviceGeneration")]
get;
}
extern public static string vendorIdentifier
{
[NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
[FreeFunction("UnityVendorIdentifier")]
get;
}
// please note that we check both advertisingIdentifier/advertisingTrackingEnabled
// usage in scripts to decide if we should enable UNITY_USES_IAD macro (i.e. code that uses iAD and related things)
// that's why it is VERY important that you use private extern functions instead of properties in internal/implementation code
// as another caveat, apple seems to grep app strings naively when checking for usages of this api
// poterntially finding UnityAdvertisingIdentifier/IsAdvertisingTrackingEnabled
// thats why we renamed these functions to be less like apple api
[NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
[FreeFunction("UnityAdIdentifier")]
extern private static string GetAdIdentifier();
public static string advertisingIdentifier
{
get
{
string advertisingId = GetAdIdentifier();
Application.InvokeOnAdvertisingIdentifierCallback(advertisingId, IsAdTrackingEnabled());
return advertisingId;
}
}
[NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
[FreeFunction("IOSScripting::IsAdTrackingEnabled")]
extern private static bool IsAdTrackingEnabled();
public static bool advertisingTrackingEnabled
{
get
{
return IsAdTrackingEnabled();
}
}
extern public static bool hideHomeButton
{
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::GetHideHomeButton")] get;
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::SetHideHomeButton")] set;
}
extern public static bool lowPowerModeEnabled
{
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::GetLowPowerModeEnabled")] get;
}
extern public static bool wantsSoftwareDimming
{
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::GetWantsSoftwareDimming")] get;
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::SetWantsSoftwareDimming")] set;
}
extern private static int deferSystemGesturesModeInternal
{
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::GetDeferSystemGesturesMode")] get;
[NativeConditional("PLATFORM_IOS")]
[FreeFunction("IOSScripting::SetDeferSystemGesturesMode")] set;
}
public static SystemGestureDeferMode deferSystemGesturesMode
{
get { return (SystemGestureDeferMode)deferSystemGesturesModeInternal; }
set { deferSystemGesturesModeInternal = (int)value; }
}
[NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
[NativeMethod(Name = "IOSScripting::SetNoBackupFlag", IsFreeFunction = true, IsThreadSafe = true)]
extern public static void SetNoBackupFlag(string path);
[NativeConditional("PLATFORM_IOS || PLATFORM_TVOS")]
[NativeMethod(Name = "IOSScripting::ResetNoBackupFlag", IsFreeFunction = true, IsThreadSafe = true)]
extern public static void ResetNoBackupFlag(string path);
[NativeConditional("PLATFORM_IOS")]
[NativeMethod(Name = "IOSScripting::RequestStoreReview", IsFreeFunction = true, IsThreadSafe = true)]
extern public static bool RequestStoreReview();
}
}