mvan231 / Scriptable

MIT License
115 stars 39 forks source link

Made it work with iOS 17.2 #23

Open hendrikwedhorn opened 6 months ago

hendrikwedhorn commented 6 months ago

This script just doesn't want to work for me under iOS 17.2. Some debugging showed me that filling the array with one simple line (81) simply does not work. Also some JS Playgrounds where not able to parse that JSON into the array.

Using the for loop worked instandly.

Also: Thanks you for your work!!!

This is the JSON im getting from amazon.de (Germany):

{
   "4607ef3d-d654-4204-9ecb-ed8fd00373de":{
      "listInfo":{
         "listId":"4607ef3d-d654-4204-9ecb-ed8fd00373de",
         "listOfListIds":[
            "4607ef3d-d654-4204-9ecb-ed8fd00373de"
         ],
         "listName":"amazon einkaufen",
         "defaultList":false,
         "listType":"LIST",
         "archivedList":false,
         "customerId":"A4CLL7OD7LBPM",
         "customerName":null,
         "shareType":null,
         "version":1,
         "createAt":1594030831545,
         "updateAt":1594030831545
      },
      "listItems":[
         {
            "id":"970c343f-7140-4e48-b867-3925ce267372",
            "listId":"4607ef3d-d654-4204-9ecb-ed8fd00373de",
            "value":"pflaster",
            "encryptedValue":"AAAAAAAAAQASLtxxXs934xyNuPuYgyT7JAAAAAAAAACWddYmnyRFX/RV5+zRmblwL4TORMwaI+irPu8BdywIUlzL4h0=",
            "updatedDateTime":1594030831559,
            "createdDateTime":1594030831559,
            "categoryValue":"Other",
            "customerId":"A4CLL7OD7LBPM",
            "version":1,
            "completed":false,
            "itemType":"KEYWORD",
            "listItemMetadata":[
               {
                  "type":"com.amazon.alexashoppinglist.metadata.ItemCategory",
                  "createTime":1703709859380,
                  "createClientIdentity":"AMAZON_CATEGORIZATION_PROVIDER",
                  "categoryValue":"Other",
                  "categoryId":14,
                  "categoryType":"AMAZON_GROCERY_TYPE_LIST_CATEGORIES"
               }
            ]
         }
      ],
      "listMetadata":[
         {
            "type":"com.amazon.alexashoppinglist.metadata.ListCategories",
            "createTime":1703709859382,
            "createClientIdentity":"AMAZON_CATEGORIZATION_PROVIDER",
            "id":"4607ef3d-d654-4204-9ecb-ed8fd00373de",
            "version":0,
            "categoryType":"AMAZON_GROCERY_TYPE_LIST_CATEGORIES",
            "categories":[
               {
                  "id":0,
                  "value":"Produce",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":1,
                  "value":"Meat & Seafood",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":2,
                  "value":"Household",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":3,
                  "value":"Bakery",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":4,
                  "value":"Baking & Cooking",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":5,
                  "value":"Frozen",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":6,
                  "value":"Pasta & Noodles",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":7,
                  "value":"Snacks (Chips, Crackers, Cookies)",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":8,
                  "value":"Dairy",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":9,
                  "value":"Breakfast & Cereal",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":10,
                  "value":"Beverages",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":11,
                  "value":"Deli",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":12,
                  "value":"Beans & Grains",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":13,
                  "value":"Condiments",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":14,
                  "value":"Other",
                  "tags":[

                  ]
               }
            ]
         }
      ]
   },
   "YW16bjEuYWNjb3VudC5BR0hPQkJOVEgzSFdLQ1RVRjJaMzQyRkJZM1NRLVNIT1BQSU5HX0lURU0=":{
      "listInfo":{
         "listId":"YW16bjEuYWNjb3VudC5BR0hPQkJOVEgzSFdLQ1RVRjJaMzQyRkJZM1NRLVNIT1BQSU5HX0lURU0=",
         "listOfListIds":[
            "YW16bjEuYWNjb3VudC5BR0hPQkJOVEgzSFdLQ1RVRjJaMzQyRkJZM1NRLVNIT1BQSU5HX0lURU0="
         ],
         "listName":"",
         "defaultList":true,
         "listType":"SHOPPING_LIST",
         "archivedList":false,
         "customerId":"A4CLL7OD7LBPM",
         "customerName":null,
         "shareType":null,
         "version":1,
         "createAt":1594030831545,
         "updateAt":1594030831545
      },
      "listItems":[
         {
            "id":"9e7fb8d1-2dd5-41a5-b428-91ac9f5756b0",
            "listId":"YW16bjEuYWNjb3VudC5BR0hPQkJOVEgzSFdLQ1RVRjJaMzQyRkJZM1NRLVNIT1BQSU5HX0lURU0=",
            "value":"NichtsXX",
            "encryptedValue":"AAAAAAAAAQCOK5E4sQJsCjyzf2bBzVRrJAAAAAAAAABYEFLN4D+AZLPR/7qUx5/kp4udXyjp3ac6tbyXldlMedE1Wlw=",
            "updatedDateTime":1703701505382,
            "createdDateTime":1703701266302,
            "categoryValue":"Other",
            "customerId":"A4CLL7OD7LBPM",
            "version":2,
            "completed":false,
            "itemType":"KEYWORD",
            "listItemMetadata":[
               {
                  "type":"com.amazon.alexashoppinglist.metadata.ItemCategory",
                  "createTime":1703709859383,
                  "createClientIdentity":"AMAZON_CATEGORIZATION_PROVIDER",
                  "categoryValue":"Other",
                  "categoryId":14,
                  "categoryType":"AMAZON_GROCERY_TYPE_LIST_CATEGORIES"
               }
            ]
         }
      ],
      "listMetadata":[
         {
            "type":"com.amazon.alexashoppinglist.metadata.ListCategories",
            "createTime":1703709859384,
            "createClientIdentity":"AMAZON_CATEGORIZATION_PROVIDER",
            "id":"A4CLL7OD7LBPM-SHOP",
            "version":0,
            "categoryType":"AMAZON_GROCERY_TYPE_LIST_CATEGORIES",
            "categories":[
               {
                  "id":0,
                  "value":"Produce",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":1,
                  "value":"Meat & Seafood",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":2,
                  "value":"Household",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":3,
                  "value":"Bakery",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":4,
                  "value":"Baking & Cooking",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":5,
                  "value":"Frozen",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":6,
                  "value":"Pasta & Noodles",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":7,
                  "value":"Snacks (Chips, Crackers, Cookies)",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":8,
                  "value":"Dairy",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":9,
                  "value":"Breakfast & Cereal",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":10,
                  "value":"Beverages",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":11,
                  "value":"Deli",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":12,
                  "value":"Beans & Grains",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":13,
                  "value":"Condiments",
                  "tags":[
                     "GROCERY_TYPE"
                  ]
               },
               {
                  "id":14,
                  "value":"Other",
                  "tags":[

                  ]
               }
            ]
         }
      ]
   }
}
mvan231 commented 4 months ago

Sorry for just seeing this. Strange that it wasn't working for you. Scriptable has some of its own little intricacies that make it unique to vanilla JS but I'm glad you got it working.

For me, the original script is still working on 17.3