From c652309678ba08bb704d8c7457e719b1647d0249 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 09:08:46 +0000 Subject: [PATCH 1/9] =?UTF-8?q?=F0=9F=94=A7=20Add=20api=20key=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Config/config-template.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/Config/config-template.json b/Assets/Config/config-template.json index f166819d..87d2bfd1 100644 --- a/Assets/Config/config-template.json +++ b/Assets/Config/config-template.json @@ -41,7 +41,8 @@ "repeatRate":10, "repeatTime":"hours", "plannerBackgroundColour":"#FFFFFF", - "plannerTextColour": "#000000" + "plannerTextColour": "#000000", + "apiKey": "" }, "someone@gmail.com": { "title": "Tom's Calendar", @@ -79,7 +80,8 @@ "titleColour": "#FFFFFF", "repeatRate": 2, "repeatTime": "hours", - "groupId": "groupId" + "groupId": "groupId", + "apiKey": "" }, "trains": { "title": "Trains", @@ -89,7 +91,8 @@ "repeatRate": 1, "repeatTime": "minutes", "apiKey": "key", - "stationCode": "HRS" + "stationCode": "HRS", + "apiKey": "" }, "weather": { "title": "Weather", From 9af08f202f4c44013b0ade1268af300b97c84fba Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 09:10:26 +0000 Subject: [PATCH 2/9] =?UTF-8?q?=F0=9F=94=A7=20Remove=20duplicate=20key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Config/config-template.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Assets/Config/config-template.json b/Assets/Config/config-template.json index 87d2bfd1..21f48126 100644 --- a/Assets/Config/config-template.json +++ b/Assets/Config/config-template.json @@ -91,8 +91,7 @@ "repeatRate": 1, "repeatTime": "minutes", "apiKey": "key", - "stationCode": "HRS", - "apiKey": "" + "stationCode": "HRS" }, "weather": { "title": "Weather", From 9ae81589f0d5d7d6e654f1ea0512ea443f00b738 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 09:27:19 +0000 Subject: [PATCH 3/9] =?UTF-8?q?=F0=9F=92=BB=20Add=20api=20key=20to=20the?= =?UTF-8?q?=20request=20body=20for=20the=20recipe=20manager=20service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Widgets/Food Planner/FoodPlanner.cs | 5 ++++- .../Widgets/Food Planner/Planner Entry/PlannerEntry.cs | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Assets/Widgets/Food Planner/FoodPlanner.cs b/Assets/Widgets/Food Planner/FoodPlanner.cs index db124383..6dd47eae 100644 --- a/Assets/Widgets/Food Planner/FoodPlanner.cs +++ b/Assets/Widgets/Food Planner/FoodPlanner.cs @@ -75,8 +75,11 @@ private IEnumerator AddToShoppingListRoutine() PlannerEntry[] plannerEntries = FindObjectsOfType(); foreach (PlannerEntry entry in plannerEntries) { + JSONObject body = new JSONObject(); + body.Add("apiKey", Config.instance.GetWidgetConfig()[GetWidgetConfigKey()]["apiKey"]); + // Get the ingredients by recipe - UnityWebRequest request = Postman.CreateGetRequest(Endpoints.RECIPES + "?name=" + entry.GetRecipeName()); + UnityWebRequest request = Postman.CreateGetRequest(Endpoints.RECIPES + "?name=" + entry.GetRecipeName(), body); yield return request.SendWebRequest(); JSONNode json = JSON.Parse(request.downloadHandler.text); diff --git a/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs b/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs index 6cd73437..d86bb89d 100644 --- a/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs +++ b/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs @@ -16,8 +16,12 @@ public class PlannerEntry : MonoBehaviour [SerializeField] private Image recipeBackground; [SerializeField] private Image dayBackground; + private string configKey; + private IEnumerator Start() { + configKey = FindObjectOfType().GetWidgetConfigKey(); + string label = ""; foreach (char c in day.ToString().Substring(0, 3).ToUpper()) { @@ -26,9 +30,9 @@ private IEnumerator Start() dayText.text = label; JSONObject json = new JSONObject(); - json.Add("day", day.ToString()); + json.Add("apiKey", Config.instance.GetWidgetConfig()[configKey]["apiKey"]); - UnityWebRequest request = Postman.CreateGetRequest(Endpoints.PLANNER + "?day=" + day.ToString()); + UnityWebRequest request = Postman.CreateGetRequest(Endpoints.PLANNER + "?day=" + day.ToString(), json); yield return request.SendWebRequest(); recipe.text = JSON.Parse(request.downloadHandler.text)["planner"]["recipe"]; @@ -62,6 +66,7 @@ public IEnumerator SelectRecipeRoutine() JSONObject json = new JSONObject(); json.Add("recipe", string.IsNullOrEmpty(recipe.text) ? " " : recipe.text); json.Add("day", day.ToString()); + json.Add("apiKey", Config.instance.GetWidgetConfig()[configKey]["apiKey"]); UnityWebRequest request = Postman.CreatePostRequest(Endpoints.PLANNER_ADD, json); yield return request.SendWebRequest(); From b10b7db046536de362184dcce395e729a52aefff Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 13:52:22 +0000 Subject: [PATCH 4/9] =?UTF-8?q?=F0=9F=92=BB=20Refactor=20the=20recipe=20ma?= =?UTF-8?q?nager=20api=20requests=20to=20include=20api=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Dialog/Popup Dialog/AddNewRecipeDialog.cs | 1 + .../Scripts/Dialog/Popup Dialog/RecipeSelectionDialog.cs | 2 +- Assets/Scripts/Requests/Endpoints.cs | 7 ++++++- Assets/Widgets/Food Planner/FoodPlanner.cs | 5 +---- Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs | 5 +---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/Dialog/Popup Dialog/AddNewRecipeDialog.cs b/Assets/Scripts/Dialog/Popup Dialog/AddNewRecipeDialog.cs index cfc3df62..0654839d 100644 --- a/Assets/Scripts/Dialog/Popup Dialog/AddNewRecipeDialog.cs +++ b/Assets/Scripts/Dialog/Popup Dialog/AddNewRecipeDialog.cs @@ -55,6 +55,7 @@ private IEnumerator UploadNewRecipeRoutine() json.Add("name", recipeName.text); json.Add("ingredients", ingredientsArray); + json.Add("apiKey", Config.instance.GetWidgetConfig()[FindObjectOfType().GetWidgetConfigKey()]["apiKey"]); UnityWebRequest request = Postman.CreatePostRequest(Endpoints.RECIPES_ADD, json); yield return request.SendWebRequest(); diff --git a/Assets/Scripts/Dialog/Popup Dialog/RecipeSelectionDialog.cs b/Assets/Scripts/Dialog/Popup Dialog/RecipeSelectionDialog.cs index dc53e056..e0261058 100644 --- a/Assets/Scripts/Dialog/Popup Dialog/RecipeSelectionDialog.cs +++ b/Assets/Scripts/Dialog/Popup Dialog/RecipeSelectionDialog.cs @@ -37,7 +37,7 @@ private IEnumerator PopulateRecipesRoutine() { ClearExistingRecipes(); - UnityWebRequest request = Postman.CreateGetRequest(Endpoints.RECIPES); + UnityWebRequest request = Postman.CreateGetRequest(Endpoints.RECIPES(Config.instance.GetWidgetConfig()[FindObjectOfType().GetWidgetConfigKey()]["apiKey"])); yield return request.SendWebRequest(); string response = request.downloadHandler.text; diff --git a/Assets/Scripts/Requests/Endpoints.cs b/Assets/Scripts/Requests/Endpoints.cs index 2ea06695..b3266cac 100644 --- a/Assets/Scripts/Requests/Endpoints.cs +++ b/Assets/Scripts/Requests/Endpoints.cs @@ -3,12 +3,17 @@ public class Endpoints { private static readonly string RECIPE_MANAGER = "https://home-dashboard-recipe-manager.herokuapp.com"; + public static readonly string TODOIST_TASKS = "https://api.todoist.com/rest/v1/tasks"; - public static readonly string RECIPES = RECIPE_MANAGER + "/recipes"; public static readonly string RECIPES_ADD = RECIPE_MANAGER + "/recipes/add"; public static readonly string PLANNER = RECIPE_MANAGER + "/planner"; public static readonly string PLANNER_ADD = RECIPE_MANAGER + "/planner/add"; + public static string RECIPES(string apiKey) + { + return RECIPE_MANAGER + "/recipes?apiKey=" + apiKey; + } + public static string TRAIN_DEPARTURES(string stationCode, int numberOfResults, string apiKey) { return "https://home-dashboard-train-manager.herokuapp.com/departures?stationCode=" + stationCode + "&numberOfResults=" + numberOfResults + "&apiKey=" + apiKey; diff --git a/Assets/Widgets/Food Planner/FoodPlanner.cs b/Assets/Widgets/Food Planner/FoodPlanner.cs index 6dd47eae..cde27171 100644 --- a/Assets/Widgets/Food Planner/FoodPlanner.cs +++ b/Assets/Widgets/Food Planner/FoodPlanner.cs @@ -75,11 +75,8 @@ private IEnumerator AddToShoppingListRoutine() PlannerEntry[] plannerEntries = FindObjectsOfType(); foreach (PlannerEntry entry in plannerEntries) { - JSONObject body = new JSONObject(); - body.Add("apiKey", Config.instance.GetWidgetConfig()[GetWidgetConfigKey()]["apiKey"]); - // Get the ingredients by recipe - UnityWebRequest request = Postman.CreateGetRequest(Endpoints.RECIPES + "?name=" + entry.GetRecipeName(), body); + UnityWebRequest request = Postman.CreateGetRequest(Endpoints.RECIPES(Config.instance.GetWidgetConfig()[GetWidgetConfigKey()]["apiKey"]) + "&name=" + entry.GetRecipeName()); yield return request.SendWebRequest(); JSONNode json = JSON.Parse(request.downloadHandler.text); diff --git a/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs b/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs index d86bb89d..a296384c 100644 --- a/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs +++ b/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs @@ -29,10 +29,7 @@ private IEnumerator Start() } dayText.text = label; - JSONObject json = new JSONObject(); - json.Add("apiKey", Config.instance.GetWidgetConfig()[configKey]["apiKey"]); - - UnityWebRequest request = Postman.CreateGetRequest(Endpoints.PLANNER + "?day=" + day.ToString(), json); + UnityWebRequest request = Postman.CreateGetRequest(Endpoints.PLANNER + "?day=" + day.ToString() + "&apiKey=" + Config.instance.GetWidgetConfig()[configKey]["apiKey"]); yield return request.SendWebRequest(); recipe.text = JSON.Parse(request.downloadHandler.text)["planner"]["recipe"]; From 80cb76eba489ff132d269f2aff4b2b6e2afc58a1 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 14:22:25 +0000 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=92=BB=20Add=20api=20key=20to=20split?= =?UTF-8?q?wise=20widget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Requests/Endpoints.cs | 4 ++-- Assets/Widgets/Splitwise/Splitwise.cs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Requests/Endpoints.cs b/Assets/Scripts/Requests/Endpoints.cs index b3266cac..72d93d00 100644 --- a/Assets/Scripts/Requests/Endpoints.cs +++ b/Assets/Scripts/Requests/Endpoints.cs @@ -39,9 +39,9 @@ public static string WEATHER(string apiKey, string latitude, string longitude) return "https://api.darksky.net/forecast/" + apiKey + "/" + latitude + "," + longitude + "?units=uk"; } - public static string SPLITWISE(string groupId) + public static string SPLITWISE(string groupId, string apiKey) { - return "https://home-dashboard-splitwise-mngr.herokuapp.com/group?groupId=" + groupId; + return "https://home-dashboard-splitwise-mngr.herokuapp.com/group?groupId=" + groupId + "&apiKey=" + apiKey; } } } \ No newline at end of file diff --git a/Assets/Widgets/Splitwise/Splitwise.cs b/Assets/Widgets/Splitwise/Splitwise.cs index bffb6a34..f8586cf2 100644 --- a/Assets/Widgets/Splitwise/Splitwise.cs +++ b/Assets/Widgets/Splitwise/Splitwise.cs @@ -15,11 +15,13 @@ public class Splitwise : Widget [SerializeField] private Text allSettledUp; private string groupId; + private string apiKey; public override void ReloadConfig() { JSONNode config = Config.instance.GetWidgetConfig()[this.GetWidgetConfigKey()]; groupId = config["groupId"]; + apiKey = config["apiKey"]; } public override void Run() @@ -31,7 +33,7 @@ public override void Run() private IEnumerator RunRoutine() { - UnityWebRequest request = Postman.CreateGetRequest(Endpoints.SPLITWISE(groupId)); + UnityWebRequest request = Postman.CreateGetRequest(Endpoints.SPLITWISE(groupId, apiKey)); yield return request.SendWebRequest(); bool ok = request.error == null ? true : false; From 9660c22b392aaf28371488e7275802f385caac51 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 14:43:40 +0000 Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=94=A7=20Update=20to=20Unity=202019.3?= =?UTF-8?q?.1f1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectSettings/ProjectVersion.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 798259ba..e1506f9f 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.3.0f6 -m_EditorVersionWithRevision: 2019.3.0f6 (27ab2135bccf) +m_EditorVersion: 2019.3.1f1 +m_EditorVersionWithRevision: 2019.3.1f1 (89d6087839c2) From 142bc29399e0bab867b8ee48781f4b87f256d754 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 15:58:05 +0000 Subject: [PATCH 7/9] =?UTF-8?q?=F0=9F=92=BB=20Update=20the=20planner=20wid?= =?UTF-8?q?get=20entry=20to=20add=20a=20clear=20button=20in=20the=20top=20?= =?UTF-8?q?right=20corner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Planner Entry/Planner Entry.prefab | 178 ++++++++++++++++++ 1 file changed, 178 insertions(+) diff --git a/Assets/Widgets/Food Planner/Planner Entry/Planner Entry.prefab b/Assets/Widgets/Food Planner/Planner Entry/Planner Entry.prefab index e47df6ce..6e2a7d73 100644 --- a/Assets/Widgets/Food Planner/Planner Entry/Planner Entry.prefab +++ b/Assets/Widgets/Food Planner/Planner Entry/Planner Entry.prefab @@ -1,5 +1,105 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &1010729676822046605 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5339644471310249574} + - component: {fileID: 2001669543973521186} + - component: {fileID: 6129861246054940873} + m_Layer: 5 + m_Name: Clear + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5339644471310249574 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1010729676822046605} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5691326883058657595} + m_Father: {fileID: 1013217550476370056} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 1.0588, y: 0.2427} + m_SizeDelta: {x: -2.1178, y: -0.4853} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2001669543973521186 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1010729676822046605} + m_CullTransparentMesh: 0 +--- !u!114 &6129861246054940873 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1010729676822046605} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 0} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1013217550476370057} + m_MethodName: ClearRecipe + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &1013217548956904210 GameObject: m_ObjectHideFlags: 0 @@ -364,6 +464,7 @@ RectTransform: m_Children: - {fileID: 1013217549811931801} - {fileID: 1013217548956904211} + - {fileID: 5339644471310249574} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -425,3 +526,80 @@ MonoBehaviour: recipe: {fileID: 1013217549817886997} recipeBackground: {fileID: 1013217550476370058} dayBackground: {fileID: 1013217549811931802} +--- !u!1 &5526285332960553496 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5691326883058657595} + - component: {fileID: 3123804056909923364} + - component: {fileID: 3125227728032329774} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5691326883058657595 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5526285332960553496} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.075, z: 0.1} + m_Children: [] + m_Father: {fileID: 5339644471310249574} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -0.0000020861626, y: -0.000003889203} + m_SizeDelta: {x: 3.2728, y: 3.9257} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3123804056909923364 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5526285332960553496} + m_CullTransparentMesh: 0 +--- !u!114 &3125227728032329774 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5526285332960553496} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 12800000, guid: d9f34d8218de7804b9cbc0e3167c9854, type: 3} + m_FontSize: 2 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 282 + m_Alignment: 4 + m_AlignByGeometry: 1 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: X From 54bbb9ddab466c5a709b19dc1089733e4263e521 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Thu, 13 Feb 2020 15:59:23 +0000 Subject: [PATCH 8/9] =?UTF-8?q?=F0=9F=92=BB=20Add=20a=20clear=20method=20t?= =?UTF-8?q?o=20the=20planner=20entry=20routine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Planner Entry/PlannerEntry.cs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs b/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs index a296384c..901d6b0b 100644 --- a/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs +++ b/Assets/Widgets/Food Planner/Planner Entry/PlannerEntry.cs @@ -17,10 +17,12 @@ public class PlannerEntry : MonoBehaviour [SerializeField] private Image dayBackground; private string configKey; + private string apiKey; private IEnumerator Start() { configKey = FindObjectOfType().GetWidgetConfigKey(); + apiKey = Config.instance.GetWidgetConfig()[configKey]["apiKey"]; string label = ""; foreach (char c in day.ToString().Substring(0, 3).ToUpper()) @@ -63,7 +65,7 @@ public IEnumerator SelectRecipeRoutine() JSONObject json = new JSONObject(); json.Add("recipe", string.IsNullOrEmpty(recipe.text) ? " " : recipe.text); json.Add("day", day.ToString()); - json.Add("apiKey", Config.instance.GetWidgetConfig()[configKey]["apiKey"]); + json.Add("apiKey", apiKey); UnityWebRequest request = Postman.CreatePostRequest(Endpoints.PLANNER_ADD, json); yield return request.SendWebRequest(); @@ -72,6 +74,35 @@ public IEnumerator SelectRecipeRoutine() } } + /// + /// Quick method to clear the entry + /// + public void ClearRecipe() + { + StartCoroutine(ClearRecipeRoutine()); + } + + private IEnumerator ClearRecipeRoutine() + { + JSONObject json = new JSONObject(); + json.Add("recipe", " "); + json.Add("day", day.ToString()); + json.Add("apiKey", apiKey); + + UnityWebRequest request = Postman.CreatePostRequest(Endpoints.PLANNER_ADD, json); + yield return request.SendWebRequest(); + + JSONNode response = JSON.Parse(request.downloadHandler.text); + if(response["status"] == 200) + { + recipe.text = ""; + } + else + { + WidgetLogger.instance.Log("Could not clear recipe: " + response["message"]); + } + } + public string GetRecipeName() { return recipe.text; From fdbb00e163301dcdb10fdef3f0494a01ec7faf98 Mon Sep 17 00:00:00 2001 From: Tom Hewitt Date: Fri, 14 Feb 2020 09:28:59 +0000 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=94=A7=20Update=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectSettings/ProjectSettings.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index b5a1dfa7..8bf8f273 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -118,7 +118,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 5.0.2 + bundleVersion: 5.1.0 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0