{"action":"created","comment":{"url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/comments/54430040","id":54430040,"diff_hunk":"@@ -0,0 +1,117 @@\n+'use strict';\n+\n+import React, {\n+  Component,\n+  View,\n+  StyleSheet,\n+  TouchableHighlight,\n+  Text\n+} from 'react-native';\n+import s from './report-problem.style';\n+const styles = StyleSheet.create(s);\n+\n+var Camera = require('react-native-camera');\n+\n+var RNFS = require('react-native-fs');\n+\n+export default class ReportProblem extends Component {\n+\n+\n+  constructor(props) {\n+    super(props);\n+  }\n+  componentDidMount(){\n+    this.trackLocation();\n+    this.state = {\n+      cameraType: Camera.constants.Type.back,\n+    };\n+  }\n+\n+  /**\n+   * Store geolocation in state variable so we can save it in annotation.\n+   */\n+  trackLocation = () => {\n+      navigator.geolocation.getCurrentPosition(\n+        (position) => {\n+          var lat = position.coords.latitude;\n+          var lng = position.coords.longitude;\n+          this.setState({'lat':lat, 'lng':lng});\n+        },\n+        (error) => console.log(error.message),\n+        {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000}\n+      );\n+      this.watchID = navigator.geolocation.watchPosition((position) => {\n+        var lat = position.coords.latitude;\n+        var lng = position.coords.longitude;\n+        this.setState({'lat':lat, 'lng':lng});\n+      });\n+  }\n+\n+  /**\n+   * Capture a photo with the camera, add in the geolocation, save to disk, send to firebase\n+   * Note: This function is passed as a callback to the menu component.  When the report button is clicked,\n+   * this function is executed.  We store a reference to the camera when the component is\n+   * rendered with:  ref={(c) => this.cam = c\n+   */\n+  capturePhoto = () => {\n+    console.log('Capture photo');\n+    var obj = this;\n+    this.cam.capture({\n+      metadata: {\n+        location: this.props.location\n+      },\n+      target: Camera.constants.CaptureTarget.disk,\n+    },\n+    function(err, filePath) {\n+       console.log('Save photo');\n+      RNFS.readFile(filePath, 'base64').then((fileData) => {\n+         \n+         // TODO: do these need to be chained promises? I works OK\n+         // now, but e.g. save annotation should finish before fetchAnnotations runs\n+         // (but pan and tab switch could happen async)  \n+         console.log('Begin save annotation and photo.');\n+         obj.props.saveAnnotation({'lat':obj.state.lat, 'lng': obj.state.lng,'photo':fileData});\n+         console.log('Begin fetch annotations.');\n+         obj.props.fetchAnnotations();\n+         console.log('Begin pan map.');\n+         obj.props.panMapActionCreator(obj.state.lat, obj.state.lng);\n+         console.log('Begin switch tab.');\n+         obj.props.switchTabActionCreator('location');\n+         \n+         console.log('Photo captured.');","path":"src/components/report-problem.component.js","position":81,"original_position":81,"commit_id":"3bc7e68e4e956a3d8e49e4b26d2658cf2d03e585","original_commit_id":"3bc7e68e4e956a3d8e49e4b26d2658cf2d03e585","user":{"login":"ericmasiello","id":3525886,"avatar_url":"https://avatars.githubusercontent.com/u/3525886?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmasiello","html_url":"https://github.com/ericmasiello","followers_url":"https://api.github.com/users/ericmasiello/followers","following_url":"https://api.github.com/users/ericmasiello/following{/other_user}","gists_url":"https://api.github.com/users/ericmasiello/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmasiello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmasiello/subscriptions","organizations_url":"https://api.github.com/users/ericmasiello/orgs","repos_url":"https://api.github.com/users/ericmasiello/repos","events_url":"https://api.github.com/users/ericmasiello/events{/privacy}","received_events_url":"https://api.github.com/users/ericmasiello/received_events","type":"User","site_admin":false},"body":"just an FYI - \r\nI heard a developer mention that having massive number of console.logs can actually slow down the app. I think if all we ever log are simple strings it shouldn't be a problem. But we should be mindful of that if u ever wanna start logged big JSON objects","created_at":"2016-02-29T15:59:32Z","updated_at":"2016-02-29T15:59:32Z","html_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile/pull/6#discussion_r54430040","pull_request_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/comments/54430040"},"html":{"href":"https://github.com/ericmasiello/Trail-Conservancy-Mobile/pull/6#discussion_r54430040"},"pull_request":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6","id":61093892,"html_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile/pull/6","diff_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile/pull/6.diff","patch_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile/pull/6.patch","issue_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/6","number":6,"state":"open","locked":false,"title":"- Restructure application so main page was the menu (instead of menu as a subcomponent).  This allows the navigator to work properly","user":{"login":"cmann50","id":2318067,"avatar_url":"https://avatars.githubusercontent.com/u/2318067?v=3","gravatar_id":"","url":"https://api.github.com/users/cmann50","html_url":"https://github.com/cmann50","followers_url":"https://api.github.com/users/cmann50/followers","following_url":"https://api.github.com/users/cmann50/following{/other_user}","gists_url":"https://api.github.com/users/cmann50/gists{/gist_id}","starred_url":"https://api.github.com/users/cmann50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmann50/subscriptions","organizations_url":"https://api.github.com/users/cmann50/orgs","repos_url":"https://api.github.com/users/cmann50/repos","events_url":"https://api.github.com/users/cmann50/events{/privacy}","received_events_url":"https://api.github.com/users/cmann50/received_events","type":"User","site_admin":false},"body":"- Added page for reporting problem, and split map and report problem into separate pages, making the code cleaner\n- Added ability to take a photo on the report problem page.  Photo is sent to server, and async calls update the annotations, switch to the main tab, pan to the annotation on the map (need to optimize photo fetching)","created_at":"2016-02-29T15:25:00Z","updated_at":"2016-02-29T15:59:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6/commits","review_comments_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6/comments","review_comment_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/6/comments","statuses_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/statuses/3bc7e68e4e956a3d8e49e4b26d2658cf2d03e585","head":{"label":"ericmasiello:feature/merge-camera","ref":"feature/merge-camera","sha":"3bc7e68e4e956a3d8e49e4b26d2658cf2d03e585","user":{"login":"ericmasiello","id":3525886,"avatar_url":"https://avatars.githubusercontent.com/u/3525886?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmasiello","html_url":"https://github.com/ericmasiello","followers_url":"https://api.github.com/users/ericmasiello/followers","following_url":"https://api.github.com/users/ericmasiello/following{/other_user}","gists_url":"https://api.github.com/users/ericmasiello/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmasiello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmasiello/subscriptions","organizations_url":"https://api.github.com/users/ericmasiello/orgs","repos_url":"https://api.github.com/users/ericmasiello/repos","events_url":"https://api.github.com/users/ericmasiello/events{/privacy}","received_events_url":"https://api.github.com/users/ericmasiello/received_events","type":"User","site_admin":false},"repo":{"id":49844313,"name":"Trail-Conservancy-Mobile","full_name":"ericmasiello/Trail-Conservancy-Mobile","owner":{"login":"ericmasiello","id":3525886,"avatar_url":"https://avatars.githubusercontent.com/u/3525886?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmasiello","html_url":"https://github.com/ericmasiello","followers_url":"https://api.github.com/users/ericmasiello/followers","following_url":"https://api.github.com/users/ericmasiello/following{/other_user}","gists_url":"https://api.github.com/users/ericmasiello/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmasiello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmasiello/subscriptions","organizations_url":"https://api.github.com/users/ericmasiello/orgs","repos_url":"https://api.github.com/users/ericmasiello/repos","events_url":"https://api.github.com/users/ericmasiello/events{/privacy}","received_events_url":"https://api.github.com/users/ericmasiello/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile","description":"","fork":false,"url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile","forks_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/forks","keys_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/teams","hooks_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/hooks","issue_events_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/events{/number}","events_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/events","assignees_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/assignees{/user}","branches_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/branches{/branch}","tags_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/tags","blobs_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/languages","stargazers_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/stargazers","contributors_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/contributors","subscribers_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/subscribers","subscription_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/subscription","commits_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/contents/{+path}","compare_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/merges","archive_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/downloads","issues_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues{/number}","pulls_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/labels{/name}","releases_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/releases{/id}","deployments_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/deployments","created_at":"2016-01-18T01:26:51Z","updated_at":"2016-02-14T13:27:20Z","pushed_at":"2016-02-29T15:25:00Z","git_url":"git://github.com/ericmasiello/Trail-Conservancy-Mobile.git","ssh_url":"git@github.com:ericmasiello/Trail-Conservancy-Mobile.git","clone_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile.git","svn_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile","homepage":null,"size":22029,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"ericmasiello:develop","ref":"develop","sha":"493c5474eee16cf8e4a12d4230eaf7154d2791a5","user":{"login":"ericmasiello","id":3525886,"avatar_url":"https://avatars.githubusercontent.com/u/3525886?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmasiello","html_url":"https://github.com/ericmasiello","followers_url":"https://api.github.com/users/ericmasiello/followers","following_url":"https://api.github.com/users/ericmasiello/following{/other_user}","gists_url":"https://api.github.com/users/ericmasiello/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmasiello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmasiello/subscriptions","organizations_url":"https://api.github.com/users/ericmasiello/orgs","repos_url":"https://api.github.com/users/ericmasiello/repos","events_url":"https://api.github.com/users/ericmasiello/events{/privacy}","received_events_url":"https://api.github.com/users/ericmasiello/received_events","type":"User","site_admin":false},"repo":{"id":49844313,"name":"Trail-Conservancy-Mobile","full_name":"ericmasiello/Trail-Conservancy-Mobile","owner":{"login":"ericmasiello","id":3525886,"avatar_url":"https://avatars.githubusercontent.com/u/3525886?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmasiello","html_url":"https://github.com/ericmasiello","followers_url":"https://api.github.com/users/ericmasiello/followers","following_url":"https://api.github.com/users/ericmasiello/following{/other_user}","gists_url":"https://api.github.com/users/ericmasiello/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmasiello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmasiello/subscriptions","organizations_url":"https://api.github.com/users/ericmasiello/orgs","repos_url":"https://api.github.com/users/ericmasiello/repos","events_url":"https://api.github.com/users/ericmasiello/events{/privacy}","received_events_url":"https://api.github.com/users/ericmasiello/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile","description":"","fork":false,"url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile","forks_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/forks","keys_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/teams","hooks_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/hooks","issue_events_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/events{/number}","events_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/events","assignees_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/assignees{/user}","branches_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/branches{/branch}","tags_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/tags","blobs_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/statuses/{sha}","languages_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/languages","stargazers_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/stargazers","contributors_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/contributors","subscribers_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/subscribers","subscription_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/subscription","commits_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/contents/{+path}","compare_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/merges","archive_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/downloads","issues_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues{/number}","pulls_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls{/number}","milestones_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/milestones{/number}","notifications_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/labels{/name}","releases_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/releases{/id}","deployments_url":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/deployments","created_at":"2016-01-18T01:26:51Z","updated_at":"2016-02-14T13:27:20Z","pushed_at":"2016-02-29T15:25:00Z","git_url":"git://github.com/ericmasiello/Trail-Conservancy-Mobile.git","ssh_url":"git@github.com:ericmasiello/Trail-Conservancy-Mobile.git","clone_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile.git","svn_url":"https://github.com/ericmasiello/Trail-Conservancy-Mobile","homepage":null,"size":22029,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6"},"html":{"href":"https://github.com/ericmasiello/Trail-Conservancy-Mobile/pull/6"},"issue":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/6"},"comments":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/ericmasiello/Trail-Conservancy-Mobile/statuses/3bc7e68e4e956a3d8e49e4b26d2658cf2d03e585"}}}}