{"action":"opened","issue":{"url":"https://api.github.com/repos/dweinstein/node-google-play/issues/9","labels_url":"https://api.github.com/repos/dweinstein/node-google-play/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/dweinstein/node-google-play/issues/9/comments","events_url":"https://api.github.com/repos/dweinstein/node-google-play/issues/9/events","html_url":"https://github.com/dweinstein/node-google-play/issues/9","id":76578123,"number":9,"title":"decode availability restrictions properly","user":{"login":"dweinstein","id":794478,"avatar_url":"https://avatars.githubusercontent.com/u/794478?v=3","gravatar_id":"","url":"https://api.github.com/users/dweinstein","html_url":"https://github.com/dweinstein","followers_url":"https://api.github.com/users/dweinstein/followers","following_url":"https://api.github.com/users/dweinstein/following{/other_user}","gists_url":"https://api.github.com/users/dweinstein/gists{/gist_id}","starred_url":"https://api.github.com/users/dweinstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dweinstein/subscriptions","organizations_url":"https://api.github.com/users/dweinstein/orgs","repos_url":"https://api.github.com/users/dweinstein/repos","events_url":"https://api.github.com/users/dweinstein/events{/privacy}","received_events_url":"https://api.github.com/users/dweinstein/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"dweinstein","id":794478,"avatar_url":"https://avatars.githubusercontent.com/u/794478?v=3","gravatar_id":"","url":"https://api.github.com/users/dweinstein","html_url":"https://github.com/dweinstein","followers_url":"https://api.github.com/users/dweinstein/followers","following_url":"https://api.github.com/users/dweinstein/following{/other_user}","gists_url":"https://api.github.com/users/dweinstein/gists{/gist_id}","starred_url":"https://api.github.com/users/dweinstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dweinstein/subscriptions","organizations_url":"https://api.github.com/users/dweinstein/orgs","repos_url":"https://api.github.com/users/dweinstein/repos","events_url":"https://api.github.com/users/dweinstein/events{/privacy}","received_events_url":"https://api.github.com/users/dweinstein/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-05-15T03:36:37Z","updated_at":"2015-05-15T03:36:37Z","closed_at":null,"body":"\r\n```python\r\nIn [36]: ids\r\nOut[36]:\r\n[[0, 2131428078],\r\n [2, 2131428079],\r\n [8, 2131428085],\r\n [9, 2131428082],\r\n [9, 2131428083],\r\n [10, 2131428080],\r\n [11, 2131428081],\r\n [12, 2131428084]]\r\nIn [37]: for ccase, id in ids: zz = yy.get_id('com.android.vending', id); print ccase, hex(id), zz, yy.get_string('com.android.vending', zz[1])\r\n0 0x7f0b02ee (u'string', u'availability_restriction_generic', 2131428078) [u'availability_restriction_generic', u\"This item isn't available.\"]\r\n2 0x7f0b02ef (u'string', u'availability_restriction_country', 2131428079) [u'availability_restriction_country', u\"This item isn't available in your country.\"]\r\n8 0x7f0b02f5 (u'string', u'availability_restriction_not_in_group', 2131428085) [u'availability_restriction_not_in_group', u\"You're not in the targeted group for this item.\"]\r\n9 0x7f0b02f2 (u'string', u'availability_restriction_hardware_app', 2131428082) [u'availability_restriction_hardware_app', u\"Your device isn't compatible with this version.\"]\r\n9 0x7f0b02f3 (u'string', u'availability_restriction_hardware', 2131428083) [u'availability_restriction_hardware', u\"Your device isn't compatible with this item.\"]\r\n10 0x7f0b02f0 (u'string', u'availability_restriction_carrier', 2131428080) [u'availability_restriction_carrier', u\"This item isn't available on your carrier.\"]\r\n11 0x7f0b02f1 (u'string', u'availability_restriction_country_or_carrier', 2131428081) [u'availability_restriction_country_or_carrier', u\"This item isn't available in your country or on your carrier.\"]\r\n12 0x7f0b02f4 (u'string', u'availability_restriction_search_level', 2131428084) [u'availability_restriction_search_level', u\"Your content filtering level doesn't allow you to download this item.\"]```\r\n\r\nthe first column is the case from the client:\r\n\r\n```\r\npublic static int getAvailabilityRestrictionResourceId(Document document) {\r\n        int restriction = document.getAvailabilityRestriction();\r\n        int resourceId = 0x7F0B02EE;\r\n        switch(restriction) {\r\n            case 2: {\r\n                resourceId = 0x7F0B02EF;\r\n                break;\r\n            }\r\n            case 8: {\r\n                resourceId = 0x7F0B02F5;\r\n                break;\r\n            }\r\n            case 9: {\r\n                if(document.getDocumentType() == 1) {\r\n                    resourceId = 0x7F0B02F2;\r\n                    goto label_3;\r\n                }\r\n\r\n                resourceId = 0x7F0B02F3;\r\n                break;\r\n            }\r\n            case 10: {\r\n                resourceId = 0x7F0B02F0;\r\n                break;\r\n            }\r\n            case 11: {\r\n                resourceId = 0x7F0B02F1;\r\n                break;\r\n            }\r\n            case 12: {\r\n                resourceId = 0x7F0B02F4;\r\n                break;\r\n            }\r\n        }\r\n\r\n    label_3:\r\n        FinskyLog.d(\"Item is not available. Reason: \" + restriction, new Object[0]);\r\n        return resourceId;\r\n    }\r\n```\r\n\r\nso use the case to match up the resriction enum value to the string."}}