{"action":"created","issue":{"url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/issues/30","repository_url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck","labels_url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/issues/30/comments","events_url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/issues/30/events","html_url":"https://github.com/stefan-niedermann/nextcloud-deck/pull/30","id":394883867,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxNDk4NDcw","number":30,"title":"[WIP] Add basic support for annotations","user":{"login":"David-Development","id":4489723,"node_id":"MDQ6VXNlcjQ0ODk3MjM=","avatar_url":"https://avatars1.githubusercontent.com/u/4489723?v=4","gravatar_id":"","url":"https://api.github.com/users/David-Development","html_url":"https://github.com/David-Development","followers_url":"https://api.github.com/users/David-Development/followers","following_url":"https://api.github.com/users/David-Development/following{/other_user}","gists_url":"https://api.github.com/users/David-Development/gists{/gist_id}","starred_url":"https://api.github.com/users/David-Development/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/David-Development/subscriptions","organizations_url":"https://api.github.com/users/David-Development/orgs","repos_url":"https://api.github.com/users/David-Development/repos","events_url":"https://api.github.com/users/David-Development/events{/privacy}","received_events_url":"https://api.github.com/users/David-Development/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-12-30T16:20:06Z","updated_at":"2018-12-31T13:47:23Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/pulls/30","html_url":"https://github.com/stefan-niedermann/nextcloud-deck/pull/30","diff_url":"https://github.com/stefan-niedermann/nextcloud-deck/pull/30.diff","patch_url":"https://github.com/stefan-niedermann/nextcloud-deck/pull/30.patch"},"body":"This PR adds support for the new annotations introduced in the current SSO dev version. (Pull-Request: https://github.com/nextcloud/Android-SingleSignOn/pull/40).\r\n\r\nI managed to reduce the amount of code in the ApiProvider to: \r\n```java\r\nvoid initSsoApi(final NextcloudAPI.ApiConnectedListener callback) {\r\n    try {\r\n        SingleSignOnAccount ssoAccount = SingleAccountHelper.getCurrentSingleSignOnAccount(context);\r\n        NextcloudAPI nextcloudAPI = new NextcloudAPI(context, ssoAccount, GsonConfig.GetGson(), callback);\r\n        mApi = new NextcloudRetrofitApiBuilder(nextcloudAPI, API_ENDPOINT).create(DeckAPI.class);\r\n    } catch (SSOException e) {\r\n        callback.onError(e);\r\n    }\r\n}\r\n```\r\n\r\nThe class `DeckAPI_SSO` is safe to delete now. \r\n\r\nTo test this, clone the `add-annotations` branch from the `Android-SingleSignOn` repo in your project folder. I modified the `build.gradle` so that it'll pick it up automatically.\r\n\r\n```\r\n// Expected folder structure\r\n./StudioProjects/nextcloud-deck/\r\n                                app/\r\n                                Android-SingleSignOn/\r\n                                ...\r\n```\r\n\r\nI didn't manage to test all methods as I didn't manage to get deck running on my nextcloud yet. However most of the calls should work as expected (I wrote Unit Tests for all of them). \r\n\r\nIn case you need to enable FollowRedirects, you should use the `@NextcloudAPI.FollowRedirects` annotation as seen in my tests: https://github.com/nextcloud/Android-SingleSignOn/blob/bda2ad5a5107bed395381daec625d1b62b2f2a5d/src/test/java/com/nextcloud/android/sso/api/API.java#L91\r\n\r\nDue to the rewrite part of the `lastModifiedDate` ([here](https://github.com/stefan-niedermann/nextcloud-deck/blob/master/app/src/main/java/it/niedermann/nextcloud/deck/api/DeckAPI_SSO.java#L45)), I changed the signature of the endpoints from `Date` to `String` and passed in the date as the correctly formatted `String`. On my Server I'm still getting the following error message `{\"status\":500,\"message\":\"Invalid If-Modified-Since header provided.\"}`. Not sure why this happens. The header field contains the correct information (as seen in the screenshot below).\r\n\r\n<img width=\"504\" alt=\"bildschirmfoto 2018-12-30 um 17 13 57\" src=\"https://user-images.githubusercontent.com/4489723/50549037-73247280-0c56-11e9-8b44-1faa8fb39698.png\">\r\n\r\n\r\nLet me know what you guys think! :)"},"comment":{"url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/issues/comments/450647686","html_url":"https://github.com/stefan-niedermann/nextcloud-deck/pull/30#issuecomment-450647686","issue_url":"https://api.github.com/repos/stefan-niedermann/nextcloud-deck/issues/30","id":450647686,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDY0NzY4Ng==","user":{"login":"desperateCoder","id":6911132,"node_id":"MDQ6VXNlcjY5MTExMzI=","avatar_url":"https://avatars1.githubusercontent.com/u/6911132?v=4","gravatar_id":"","url":"https://api.github.com/users/desperateCoder","html_url":"https://github.com/desperateCoder","followers_url":"https://api.github.com/users/desperateCoder/followers","following_url":"https://api.github.com/users/desperateCoder/following{/other_user}","gists_url":"https://api.github.com/users/desperateCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/desperateCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/desperateCoder/subscriptions","organizations_url":"https://api.github.com/users/desperateCoder/orgs","repos_url":"https://api.github.com/users/desperateCoder/repos","events_url":"https://api.github.com/users/desperateCoder/events{/privacy}","received_events_url":"https://api.github.com/users/desperateCoder/received_events","type":"User","site_admin":false},"created_at":"2018-12-31T13:47:23Z","updated_at":"2018-12-31T13:47:23Z","author_association":"COLLABORATOR","body":"@David-Development Awesome! \r\nI most likely won't have time to test this the next few days, but i will as soon as possible.\r\nLooks promising though, thanks!\r\n\r\nOne more thing: have you seen the following?\r\n``` Java\r\n\r\n private DateFormat API_FORMAT = new SimpleDateFormat(\"E, d MMM yyyy hh:mm:ss z\");\r\n[...]\r\n if (lastSync != null) {\r\n            String lastSyncHeader = API_FORMAT.format(lastSync);\r\n            // omit Offset of timezone (e.g.: +01:00)\r\n            if (lastSyncHeader.matches(\"^.*\\\\+[0-9]{2}:[0-9]{2}$\")) {\r\n                lastSyncHeader = lastSyncHeader.substring(0, lastSyncHeader.length() - 6);\r\n            }\r\n            Log.d(\"deck lastSync\", lastSyncHeader);\r\n\r\n            Map<String, List<String>> header = new HashMap<>(); //concurrency, new one is needed!\r\n            List<String> hdr = new ArrayList<>();\r\n            hdr.add(lastSyncHeader);\r\n            header.put(\"If-Modified-Since\", hdr);\r\n            builder.setHeader(header);\r\n        }\r\n```\r\nIn theory, this is exactly what @juliushaertl told me it should look like.\r\n\r\nMaybe you could include this into your code to accept Dates as well?"}}
{"actor":{"display_login":"desperateCoder"}}