{"action":"created","issue":{"url":"https://api.github.com/repos/haiwen/seadroid/issues/444","labels_url":"https://api.github.com/repos/haiwen/seadroid/issues/444/labels{/name}","comments_url":"https://api.github.com/repos/haiwen/seadroid/issues/444/comments","events_url":"https://api.github.com/repos/haiwen/seadroid/issues/444/events","html_url":"https://github.com/haiwen/seadroid/pull/444","id":117003071,"number":444,"title":"Refactor account storage and camera upload","user":{"login":"forouher","id":676900,"avatar_url":"https://avatars.githubusercontent.com/u/676900?v=3","gravatar_id":"","url":"https://api.github.com/users/forouher","html_url":"https://github.com/forouher","followers_url":"https://api.github.com/users/forouher/followers","following_url":"https://api.github.com/users/forouher/following{/other_user}","gists_url":"https://api.github.com/users/forouher/gists{/gist_id}","starred_url":"https://api.github.com/users/forouher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forouher/subscriptions","organizations_url":"https://api.github.com/users/forouher/orgs","repos_url":"https://api.github.com/users/forouher/repos","events_url":"https://api.github.com/users/forouher/events{/privacy}","received_events_url":"https://api.github.com/users/forouher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/haiwen/seadroid/milestones/13","html_url":"https://github.com/haiwen/seadroid/milestones/2.0","labels_url":"https://api.github.com/repos/haiwen/seadroid/milestones/13/labels","id":1241369,"number":13,"title":"2.0","description":"","creator":{"login":"Logan676","id":2975850,"avatar_url":"https://avatars.githubusercontent.com/u/2975850?v=3","gravatar_id":"","url":"https://api.github.com/users/Logan676","html_url":"https://github.com/Logan676","followers_url":"https://api.github.com/users/Logan676/followers","following_url":"https://api.github.com/users/Logan676/following{/other_user}","gists_url":"https://api.github.com/users/Logan676/gists{/gist_id}","starred_url":"https://api.github.com/users/Logan676/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Logan676/subscriptions","organizations_url":"https://api.github.com/users/Logan676/orgs","repos_url":"https://api.github.com/users/Logan676/repos","events_url":"https://api.github.com/users/Logan676/events{/privacy}","received_events_url":"https://api.github.com/users/Logan676/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":0,"state":"open","created_at":"2015-08-05T02:57:26Z","updated_at":"2015-12-19T02:38:58Z","due_on":"2016-02-04T16:00:00Z","closed_at":null},"comments":13,"created_at":"2015-11-15T16:42:32Z","updated_at":"2015-12-25T09:59:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/haiwen/seadroid/pulls/444","html_url":"https://github.com/haiwen/seadroid/pull/444","diff_url":"https://github.com/haiwen/seadroid/pull/444.diff","patch_url":"https://github.com/haiwen/seadroid/pull/444.patch"},"body":"This PR refactors camera upload and the account storage. To be more precise, it does two things:\r\n\r\n1. It refactors the account storage. Instead of storing accounts in an SQL table, they are now stored in an Android-provided storage API. This is only done to allow us to do thing number 2.\r\n\r\n2. refactor camera upload. this changes most of the internal structure of the camera upload procedure. I tried to keep the UI as unchanged as possible, though.\r\n\r\nThe patches have more detailed explanations in their individual commit messages.\r\n\r\nThey should hopefully address the following issues:\r\n\r\nissue #277 (Camera upload function dumps all subdir files into single dir)\r\nissue #301 (Inconsistency in camera upload sync)\r\nissue #311 (second suggestion: target repo sub directories)\r\nissue #336 (file duplication when doing a full resync)\r\nissue #375 (Picture upload not acting as service?)\r\nissue #423 (Pictures never upload) [maybe. not sure what's going on there]\r\n\r\nSome further notes:\r\n* This patch set includes the patches from PR #422 as the same files are touched and thus to avoid merge conflicts.\r\n* Originally I also wanted to refactor the TransferService into a SyncAdapter. However this patchset took much longer than expected so I postponed the TransferService refactoring for a later time.\r\n* The Java 7 patch is not necessary, just a convenience. I can remove it, if you want to stay compatible with Java 6.\r\n* Due to the large number of changes, there might well be bugs remaining. ;) I've tested this patchset for some days in the emulator and on an Android 5.1 phone and will amend commits if I find more issues.\r\n* Please be especially aware  of Shibboleth accounts and SeafilePro features. I had to touch code for both, but was not able to test the changes.\r\n* To the best of my (and AndroidStudio's) knowledge this should all be compatible with API level 8. However I didn't do any tests on an API 8 device.\r\n\r\nWhile this PR adds a feature or two, the main reason for its existence is to bring more stability to camera upload mechanism. So, to avoid replacing 5 old bugs with 10 new ones, this PR will need some thorough testing. Especially on\r\n\r\n* phones with Android 4.x or 2.x\r\n* non-standard camera apps\r\n\r\n[_EDIT_: I realized maybe I should write a couple of lines on the user-visible changes of this PR. Here it goes:]\r\n\r\nAccounts\r\n* Accounts can now be created/removed via Android Settings -> Account. It uses the same activities and should behave pretty much the same.\r\n* The \"Pick type of Seafile server\" dialog had to be refactored into an Activity with a list. Actually I'm not quite happy with that and I think the old Dialog looked slightly better (building Android UIs is still new to me). Unfortunately I couldn't figure out a way to get the old Dialog working reliably, as I had to move it out of AccountsManager into the SeafileAuthenticatorActivity.\r\n* Accounts are now stored seperately from all other SQL tables. This means that they will survive the cleaning of all app data (which is probably more useful to developers than anyone else ;)\r\n\r\nCamera upload\r\n* In Android Settings -> Account -> Seafile one can now see the timestamp of the last successfull camera upload sync. Also the user can manually trigger a sync there.\r\n* The directory chooser for picking local directories to upload is gone. It has been replaced with a list of media albums (basically the same list the Android gallery shows). If people had previously configured manually a list directories, after this patch the settings will revert back to the \"Auto sync\" setting.\r\n* The sync will now skip files that are already on the server and have the same file name and size.\r\n* The sync will now place image properly in subfolders on the server. The folders are named after the gallery albums (internally called \"buckets\").\r\n* As a target, subdirectories of repositories are now also possible.\r\n* Monitoring of the media store will now start at phone boot and after an APK upgrade.\r\n* Resyncs will happen regularily (about every 24h, scheduled by the Android OS)\r\n* In case of network errors, Android does an automatic retry with exponential backoff\r\n* Hard errors during sync (remote repo gone, auth error) are now made visible to the user as a notification.\r\n\r\nMigration\r\n* Accounts are migrated.\r\n* Default account is not migrated (due to settings refactoring). So the user has to select her preferred account once after upgrade.\r\n* Camera settings are migrated, except the \"custom local folder\" setting. That one will revert back to \"auto select folders\".\r\n* Camera sync will resync everything after upgrade. As the target folders are now different (in most cases \"Camera\" instead of \"Camera Uploads\") this will cause a full reupload of all local images.\r\n\r\nI'll be happy to address any upcoming bugs, issues and questions."},"comment":{"url":"https://api.github.com/repos/haiwen/seadroid/issues/comments/167218021","html_url":"https://github.com/haiwen/seadroid/pull/444#issuecomment-167218021","issue_url":"https://api.github.com/repos/haiwen/seadroid/issues/444","id":167218021,"user":{"login":"forouher","id":676900,"avatar_url":"https://avatars.githubusercontent.com/u/676900?v=3","gravatar_id":"","url":"https://api.github.com/users/forouher","html_url":"https://github.com/forouher","followers_url":"https://api.github.com/users/forouher/followers","following_url":"https://api.github.com/users/forouher/following{/other_user}","gists_url":"https://api.github.com/users/forouher/gists{/gist_id}","starred_url":"https://api.github.com/users/forouher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forouher/subscriptions","organizations_url":"https://api.github.com/users/forouher/orgs","repos_url":"https://api.github.com/users/forouher/repos","events_url":"https://api.github.com/users/forouher/events{/privacy}","received_events_url":"https://api.github.com/users/forouher/received_events","type":"User","site_admin":false},"created_at":"2015-12-25T09:59:35Z","updated_at":"2015-12-25T09:59:35Z","body":"These patches should address all the issues you've noticed up to now.\r\n\r\nPlease be aware that merging commit bc5a2df will remove your existing accounts on your development phone as that patch renames the account type."}}