Skip to content

Commit bdc1ade

Browse files
committed
Added factory method to force 'https' app url
1 parent 05b928b commit bdc1ade

File tree

6 files changed

+174
-34
lines changed

6 files changed

+174
-34
lines changed

Assets/AppServices/client/MobileServiceClient.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
using RestSharp;
44
using System.Collections.Generic;
55
using System;
6+
using System.Text.RegularExpressions;
7+
8+
69
#if !NETFX_CORE || UNITY_ANDROID
710
using System.Net;
811
using System.Security.Cryptography.X509Certificates;
@@ -41,7 +44,8 @@ public MobileServiceClient(string appUrl, string appKey) : base(appUrl)
4144
/// </summary>
4245
public MobileServiceClient(string appUrl) : base(appUrl)
4346
{
44-
AppUrl = appUrl;
47+
AppUrl = appUrl;
48+
Debug.Log("AppUrl: " + AppUrl);
4549

4650
// required for running in Windows and Android
4751
#if !NETFX_CORE || UNITY_ANDROID
@@ -50,6 +54,14 @@ public MobileServiceClient(string appUrl) : base(appUrl)
5054
#endif
5155
}
5256

57+
/// <summary>
58+
/// Using factory method forces app url to be changed from 'http' to 'https' url
59+
/// </summary>
60+
public static MobileServiceClient Create(string appUrl)
61+
{
62+
return new MobileServiceClient (ForceHttps (appUrl));
63+
}
64+
5365
public override string ToString()
5466
{
5567
return this.BaseUrl;
@@ -94,6 +106,14 @@ public void Login(MobileServiceAuthenticationProvider provider)
94106
this.ExecuteAsync(request, callback);
95107
}
96108

109+
/// <summary>
110+
/// When you copy the URL is is 'http' by default, but its preferable to use 'https'
111+
/// </summary>
112+
private static string ForceHttps(string appUrl)
113+
{
114+
return Regex.Replace(appUrl, "(?m)http://", "https://");
115+
}
116+
97117
/// <summary>
98118
/// Mobile Service uses an AppKey, but App Service does not.
99119
/// </summary>

Assets/Scenes/AppServicesDemo.unity

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SceneSettings:
1313
--- !u!104 &2
1414
RenderSettings:
1515
m_ObjectHideFlags: 0
16-
serializedVersion: 6
16+
serializedVersion: 7
1717
m_Fog: 0
1818
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
1919
m_FogMode: 3
@@ -37,12 +37,12 @@ RenderSettings:
3737
m_ReflectionIntensity: 1
3838
m_CustomReflection: {fileID: 0}
3939
m_Sun: {fileID: 0}
40+
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
4041
--- !u!157 &4
4142
LightmapSettings:
4243
m_ObjectHideFlags: 0
43-
serializedVersion: 6
44+
serializedVersion: 7
4445
m_GIWorkflowMode: 0
45-
m_LightmapsMode: 1
4646
m_GISettings:
4747
serializedVersion: 2
4848
m_BounceScale: 1
@@ -53,17 +53,22 @@ LightmapSettings:
5353
m_EnableBakedLightmaps: 0
5454
m_EnableRealtimeLightmaps: 0
5555
m_LightmapEditorSettings:
56-
serializedVersion: 3
56+
serializedVersion: 4
5757
m_Resolution: 2
5858
m_BakeResolution: 40
5959
m_TextureWidth: 1024
6060
m_TextureHeight: 1024
61+
m_AO: 0
6162
m_AOMaxDistance: 1
62-
m_Padding: 2
6363
m_CompAOExponent: 0
64+
m_CompAOExponentDirect: 0
65+
m_Padding: 2
6466
m_LightmapParameters: {fileID: 0}
67+
m_LightmapsBakeMode: 1
6568
m_TextureCompression: 1
69+
m_DirectLightInLightProbes: 1
6670
m_FinalGather: 0
71+
m_FinalGatherFiltering: 1
6772
m_FinalGatherRayCount: 1024
6873
m_ReflectionCompression: 2
6974
m_LightingDataAsset: {fileID: 0}
@@ -168,6 +173,7 @@ Transform:
168173
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
169174
m_LocalPosition: {x: 0, y: 0, z: -10}
170175
m_LocalScale: {x: 1, y: 1, z: 1}
176+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
171177
m_Children: []
172178
m_Father: {fileID: 0}
173179
m_RootOrder: 0
@@ -196,6 +202,7 @@ Transform:
196202
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
197203
m_LocalPosition: {x: 0, y: 0, z: 0}
198204
m_LocalScale: {x: 1, y: 1, z: 1}
205+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
199206
m_Children: []
200207
m_Father: {fileID: 0}
201208
m_RootOrder: 1

Assets/Scripts/AppServicesDemo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ void Start ()
3838
{
3939
Debug.Log ("Azure App Service");
4040

41-
/// Create App Service client
42-
_client = new MobileServiceClient (_appUrl);
41+
/// Create App Service client (Using factory Create method to force 'https' url)
42+
_client = MobileServiceClient.Create(_appUrl); //new MobileServiceClient(_appUrl);
4343

4444
Debug.Log(_client);
4545

ProjectSettings/GraphicsSettings.asset

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,31 @@
33
--- !u!30 &1
44
GraphicsSettings:
55
m_ObjectHideFlags: 0
6-
serializedVersion: 5
6+
serializedVersion: 7
77
m_Deferred:
88
m_Mode: 1
99
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
1010
m_DeferredReflections:
1111
m_Mode: 1
1212
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13+
m_ScreenSpaceShadows:
14+
m_Mode: 1
15+
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
1316
m_LegacyDeferred:
1417
m_Mode: 1
1518
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
19+
m_DepthNormals:
20+
m_Mode: 1
21+
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
22+
m_MotionVectors:
23+
m_Mode: 1
24+
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
25+
m_LightHalo:
26+
m_Mode: 1
27+
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
28+
m_LensFlare:
29+
m_Mode: 1
30+
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
1631
m_AlwaysIncludedShaders:
1732
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
1833
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
@@ -21,8 +36,23 @@ GraphicsSettings:
2136
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
2237
- {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
2338
m_PreloadedShaders: []
24-
m_ShaderSettings:
25-
useScreenSpaceShadows: 0
39+
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
40+
type: 0}
41+
m_ShaderSettings_Tier1:
42+
useCascadedShadowMaps: 1
43+
standardShaderQuality: 2
44+
useReflectionProbeBoxProjection: 1
45+
useReflectionProbeBlending: 1
46+
m_ShaderSettings_Tier2:
47+
useCascadedShadowMaps: 1
48+
standardShaderQuality: 2
49+
useReflectionProbeBoxProjection: 1
50+
useReflectionProbeBlending: 1
51+
m_ShaderSettings_Tier3:
52+
useCascadedShadowMaps: 1
53+
standardShaderQuality: 2
54+
useReflectionProbeBoxProjection: 1
55+
useReflectionProbeBlending: 1
2656
m_BuildTargetShaderSettings: []
2757
m_LightmapStripping: 0
2858
m_FogStripping: 0

0 commit comments

Comments
 (0)