{"action":"created","comment":{"url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/comments/79424736","id":79424736,"diff_hunk":"@@ -34,9 +37,31 @@ private static void verifyExternalStorageForPlaintextImport() throws NoExternalS\n   }\n \n   private static File getPlaintextExportFile() {\n-    File backup    = PlaintextBackupExporter.getPlaintextExportFile();\n-    File oldBackup = new File(Environment.getExternalStorageDirectory(), \"TextSecurePlaintextBackup.xml\");\n+    File backup = PlaintextBackupExporter.getPlaintextExportFile();\n+    FilenameFilter backupFilesFilter = new FilenameFilter() {\n+      public boolean accept(File file, String name) {\n+        return name.startsWith(\"SignalPlaintextBackup_\");\n+      }\n+    };\n+\n+    File dir = Environment.getExternalStorageDirectory();\n+    File[] allBackupFiles;\n+    if (dir.exists()) {\n+      allBackupFiles = dir.listFiles(backupFilesFilter);\n+      Arrays.sort(allBackupFiles, Collections.reverseOrder());\n+    } else { \n+      allBackupFiles = new File[0];\n+    }\n \n+    File oldBackup;\n+    if (allBackupFiles.length > 0) {\n+      oldBackup = allBackupFiles[0];\n+    } else {\n+      oldBackup = new File(Environment.getExternalStorageDirectory(), \"SignalPlaintextBackup.xml\");\n+      if (!oldBackup.exists())\n+        oldBackup = new File(Environment.getExternalStorageDirectory(), \"TextSecurePlaintextBackup.xml\");\n+    }","path":"src/org/thoughtcrime/securesms/database/PlaintextBackupImporter.java","position":39,"original_position":39,"commit_id":"32916d9498622630368308bba9cab373cfadff76","original_commit_id":"32916d9498622630368308bba9cab373cfadff76","user":{"login":"FeuRenard","id":16167751,"avatar_url":"https://avatars.githubusercontent.com/u/16167751?v=3","gravatar_id":"","url":"https://api.github.com/users/FeuRenard","html_url":"https://github.com/FeuRenard","followers_url":"https://api.github.com/users/FeuRenard/followers","following_url":"https://api.github.com/users/FeuRenard/following{/other_user}","gists_url":"https://api.github.com/users/FeuRenard/gists{/gist_id}","starred_url":"https://api.github.com/users/FeuRenard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FeuRenard/subscriptions","organizations_url":"https://api.github.com/users/FeuRenard/orgs","repos_url":"https://api.github.com/users/FeuRenard/repos","events_url":"https://api.github.com/users/FeuRenard/events{/privacy}","received_events_url":"https://api.github.com/users/FeuRenard/received_events","type":"User","site_admin":false},"body":"I don't know about our convention. In `ConversationActivity.java` you find two versions, both of them multiple times:\r\n\r\n- https://github.com/WhisperSystems/Signal-Android/blob/master/src/org/thoughtcrime/securesms/ConversationActivity.java#L273\r\n- https://github.com/WhisperSystems/Signal-Android/blob/master/src/org/thoughtcrime/securesms/ConversationActivity.java#L302","created_at":"2016-09-19T15:59:03Z","updated_at":"2016-09-19T15:59:03Z","html_url":"https://github.com/WhisperSystems/Signal-Android/pull/5702#discussion_r79424736","pull_request_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702","_links":{"self":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/comments/79424736"},"html":{"href":"https://github.com/WhisperSystems/Signal-Android/pull/5702#discussion_r79424736"},"pull_request":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702"}}},"pull_request":{"url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702","id":85720636,"html_url":"https://github.com/WhisperSystems/Signal-Android/pull/5702","diff_url":"https://github.com/WhisperSystems/Signal-Android/pull/5702.diff","patch_url":"https://github.com/WhisperSystems/Signal-Android/pull/5702.patch","issue_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5702","number":5702,"state":"open","locked":false,"title":"Add Timestamp to PlainTextBackup","user":{"login":"char32","id":13737621,"avatar_url":"https://avatars.githubusercontent.com/u/13737621?v=3","gravatar_id":"","url":"https://api.github.com/users/char32","html_url":"https://github.com/char32","followers_url":"https://api.github.com/users/char32/followers","following_url":"https://api.github.com/users/char32/following{/other_user}","gists_url":"https://api.github.com/users/char32/gists{/gist_id}","starred_url":"https://api.github.com/users/char32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/char32/subscriptions","organizations_url":"https://api.github.com/users/char32/orgs","repos_url":"https://api.github.com/users/char32/repos","events_url":"https://api.github.com/users/char32/events{/privacy}","received_events_url":"https://api.github.com/users/char32/received_events","type":"User","site_admin":false},"body":"### Contributor checklist\r\n<!-- replace the empty checkboxes [ ] below with checked ones [x] accordingly -->\r\n- [x] I am following the [Code Style Guidelines](https://github.com/WhisperSystems/Signal-Android/wiki/Code-Style-Guidelines)\r\n- [x] I have tested my contribution on these devices:\r\n * Google Nexus 4 (Android 5.1.1)\r\n- [x] My contribution is fully baked and ready to be merged as is\r\n- [x] I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the `Fixes #1234` [syntax](https://help.github.com/articles/closing-issues-via-commit-messages/)\r\n- [x] I have made the choice whether I want the [BitHub reward](https://github.com/WhisperSystems/Signal-Android/wiki/BitHub-Rewards) or not by omitting or adding the word `FREEBIE` in the commit message of my first commit\r\n\r\n----------\r\n\r\nLike requested in #5364 this patch adds a timestamp to the backup.\r\nThe file will be named like SignalPlainTextBackup_20160620201010.xml.\r\nSo yyyyMMddHHmmss as format.\r\nTo test it is just necessary to do a simple PlainTextBackup.\r\n\r\nThe import was adjusted too.\r\nIt behaves like this:\r\n\r\n    take backup-filename stored in environment\r\n    if not, search dynamically for the latest timestamp (based on filename) and use that backup\r\n    if not, search for the old filenmae SignalPlainTextBackup.xml (for backwards compatibilit\r\n\r\nResolves #5364","created_at":"2016-09-18T19:49:00Z","updated_at":"2016-09-19T15:59:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"080936201709a065b0aa6d41f20bc1b804f9b817","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702/commits","review_comments_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702/comments","review_comment_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5702/comments","statuses_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/statuses/32916d9498622630368308bba9cab373cfadff76","head":{"label":"char32:add_backuptimestamp","ref":"add_backuptimestamp","sha":"32916d9498622630368308bba9cab373cfadff76","user":{"login":"char32","id":13737621,"avatar_url":"https://avatars.githubusercontent.com/u/13737621?v=3","gravatar_id":"","url":"https://api.github.com/users/char32","html_url":"https://github.com/char32","followers_url":"https://api.github.com/users/char32/followers","following_url":"https://api.github.com/users/char32/following{/other_user}","gists_url":"https://api.github.com/users/char32/gists{/gist_id}","starred_url":"https://api.github.com/users/char32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/char32/subscriptions","organizations_url":"https://api.github.com/users/char32/orgs","repos_url":"https://api.github.com/users/char32/repos","events_url":"https://api.github.com/users/char32/events{/privacy}","received_events_url":"https://api.github.com/users/char32/received_events","type":"User","site_admin":false},"repo":{"id":42782641,"name":"TextSecure","full_name":"char32/TextSecure","owner":{"login":"char32","id":13737621,"avatar_url":"https://avatars.githubusercontent.com/u/13737621?v=3","gravatar_id":"","url":"https://api.github.com/users/char32","html_url":"https://github.com/char32","followers_url":"https://api.github.com/users/char32/followers","following_url":"https://api.github.com/users/char32/following{/other_user}","gists_url":"https://api.github.com/users/char32/gists{/gist_id}","starred_url":"https://api.github.com/users/char32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/char32/subscriptions","organizations_url":"https://api.github.com/users/char32/orgs","repos_url":"https://api.github.com/users/char32/repos","events_url":"https://api.github.com/users/char32/events{/privacy}","received_events_url":"https://api.github.com/users/char32/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/char32/TextSecure","description":"A private messenger for Android.","fork":true,"url":"https://api.github.com/repos/char32/TextSecure","forks_url":"https://api.github.com/repos/char32/TextSecure/forks","keys_url":"https://api.github.com/repos/char32/TextSecure/keys{/key_id}","collaborators_url":"https://api.github.com/repos/char32/TextSecure/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/char32/TextSecure/teams","hooks_url":"https://api.github.com/repos/char32/TextSecure/hooks","issue_events_url":"https://api.github.com/repos/char32/TextSecure/issues/events{/number}","events_url":"https://api.github.com/repos/char32/TextSecure/events","assignees_url":"https://api.github.com/repos/char32/TextSecure/assignees{/user}","branches_url":"https://api.github.com/repos/char32/TextSecure/branches{/branch}","tags_url":"https://api.github.com/repos/char32/TextSecure/tags","blobs_url":"https://api.github.com/repos/char32/TextSecure/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/char32/TextSecure/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/char32/TextSecure/git/refs{/sha}","trees_url":"https://api.github.com/repos/char32/TextSecure/git/trees{/sha}","statuses_url":"https://api.github.com/repos/char32/TextSecure/statuses/{sha}","languages_url":"https://api.github.com/repos/char32/TextSecure/languages","stargazers_url":"https://api.github.com/repos/char32/TextSecure/stargazers","contributors_url":"https://api.github.com/repos/char32/TextSecure/contributors","subscribers_url":"https://api.github.com/repos/char32/TextSecure/subscribers","subscription_url":"https://api.github.com/repos/char32/TextSecure/subscription","commits_url":"https://api.github.com/repos/char32/TextSecure/commits{/sha}","git_commits_url":"https://api.github.com/repos/char32/TextSecure/git/commits{/sha}","comments_url":"https://api.github.com/repos/char32/TextSecure/comments{/number}","issue_comment_url":"https://api.github.com/repos/char32/TextSecure/issues/comments{/number}","contents_url":"https://api.github.com/repos/char32/TextSecure/contents/{+path}","compare_url":"https://api.github.com/repos/char32/TextSecure/compare/{base}...{head}","merges_url":"https://api.github.com/repos/char32/TextSecure/merges","archive_url":"https://api.github.com/repos/char32/TextSecure/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/char32/TextSecure/downloads","issues_url":"https://api.github.com/repos/char32/TextSecure/issues{/number}","pulls_url":"https://api.github.com/repos/char32/TextSecure/pulls{/number}","milestones_url":"https://api.github.com/repos/char32/TextSecure/milestones{/number}","notifications_url":"https://api.github.com/repos/char32/TextSecure/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/char32/TextSecure/labels{/name}","releases_url":"https://api.github.com/repos/char32/TextSecure/releases{/id}","deployments_url":"https://api.github.com/repos/char32/TextSecure/deployments","created_at":"2015-09-19T17:28:17Z","updated_at":"2016-06-22T18:58:32Z","pushed_at":"2016-09-18T21:30:07Z","git_url":"git://github.com/char32/TextSecure.git","ssh_url":"git@github.com:char32/TextSecure.git","clone_url":"https://github.com/char32/TextSecure.git","svn_url":"https://github.com/char32/TextSecure","homepage":"https://whispersystems.org","size":78450,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"WhisperSystems:master","ref":"master","sha":"3ede281e5e994c8ba5dcff96aecf215c8676f6e2","user":{"login":"WhisperSystems","id":702459,"avatar_url":"https://avatars.githubusercontent.com/u/702459?v=3","gravatar_id":"","url":"https://api.github.com/users/WhisperSystems","html_url":"https://github.com/WhisperSystems","followers_url":"https://api.github.com/users/WhisperSystems/followers","following_url":"https://api.github.com/users/WhisperSystems/following{/other_user}","gists_url":"https://api.github.com/users/WhisperSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/WhisperSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WhisperSystems/subscriptions","organizations_url":"https://api.github.com/users/WhisperSystems/orgs","repos_url":"https://api.github.com/users/WhisperSystems/repos","events_url":"https://api.github.com/users/WhisperSystems/events{/privacy}","received_events_url":"https://api.github.com/users/WhisperSystems/received_events","type":"Organization","site_admin":false},"repo":{"id":2990192,"name":"Signal-Android","full_name":"WhisperSystems/Signal-Android","owner":{"login":"WhisperSystems","id":702459,"avatar_url":"https://avatars.githubusercontent.com/u/702459?v=3","gravatar_id":"","url":"https://api.github.com/users/WhisperSystems","html_url":"https://github.com/WhisperSystems","followers_url":"https://api.github.com/users/WhisperSystems/followers","following_url":"https://api.github.com/users/WhisperSystems/following{/other_user}","gists_url":"https://api.github.com/users/WhisperSystems/gists{/gist_id}","starred_url":"https://api.github.com/users/WhisperSystems/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WhisperSystems/subscriptions","organizations_url":"https://api.github.com/users/WhisperSystems/orgs","repos_url":"https://api.github.com/users/WhisperSystems/repos","events_url":"https://api.github.com/users/WhisperSystems/events{/privacy}","received_events_url":"https://api.github.com/users/WhisperSystems/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WhisperSystems/Signal-Android","description":"A private messenger for Android.","fork":false,"url":"https://api.github.com/repos/WhisperSystems/Signal-Android","forks_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/forks","keys_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/teams","hooks_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/hooks","issue_events_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/events{/number}","events_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/events","assignees_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/assignees{/user}","branches_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/branches{/branch}","tags_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/tags","blobs_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/git/refs{/sha}","trees_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/statuses/{sha}","languages_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/languages","stargazers_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/stargazers","contributors_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/contributors","subscribers_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/subscribers","subscription_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/subscription","commits_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/commits{/sha}","git_commits_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/git/commits{/sha}","comments_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/comments{/number}","issue_comment_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/comments{/number}","contents_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/contents/{+path}","compare_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/merges","archive_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/downloads","issues_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues{/number}","pulls_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls{/number}","milestones_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/milestones{/number}","notifications_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/labels{/name}","releases_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/releases{/id}","deployments_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/deployments","created_at":"2011-12-15T20:01:12Z","updated_at":"2016-09-19T13:48:07Z","pushed_at":"2016-09-18T21:30:07Z","git_url":"git://github.com/WhisperSystems/Signal-Android.git","ssh_url":"git@github.com:WhisperSystems/Signal-Android.git","clone_url":"https://github.com/WhisperSystems/Signal-Android.git","svn_url":"https://github.com/WhisperSystems/Signal-Android","homepage":"https://whispersystems.org","size":110866,"stargazers_count":6595,"watchers_count":6595,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1786,"mirror_url":null,"open_issues_count":718,"forks":1786,"open_issues":718,"watchers":6595,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702"},"html":{"href":"https://github.com/WhisperSystems/Signal-Android/pull/5702"},"issue":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5702"},"comments":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5702/comments"},"review_comments":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702/comments"},"review_comment":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/pulls/5702/commits"},"statuses":{"href":"https://api.github.com/repos/WhisperSystems/Signal-Android/statuses/32916d9498622630368308bba9cab373cfadff76"}}}}
{"actor":{"display_login":"FeuRenard"}}