{"action":"created","comment":{"url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/comments/61527879","id":61527879,"diff_hunk":"@@ -0,0 +1,176 @@\n+/**\n+ * Created by aleckim on 2016. 4. 20..\n+ */\n+\n+angular.module('service.twads', [])\n+    .factory('TwAds', function($rootScope, Util) {\n+        var obj = {};\n+        obj.enableAds;\n+        obj.showAds;\n+        obj.requestEnable;\n+        obj.requestShow;\n+        obj.loaded = false;\n+        obj.ready = false;\n+\n+        obj.loadTwAdsInfo = function () {\n+            var twAdsInfo = JSON.parse(localStorage.getItem(\"twAdsInfo\"));\n+            console.log('load TwAdsInfo='+JSON.stringify(twAdsInfo)+\n+                        ' request enable='+obj.requestEnable+' show='+obj.requestShow);\n+\n+            obj.ready = true;\n+\n+            if (obj.requestEnable != undefined) {\n+                obj.setEnableAds(obj.requestEnable);\n+            }\n+            else {\n+                if (twAdsInfo == undefined || twAdsInfo.enable == undefined) {\n+                    obj.setEnableAds(true);\n+                }\n+                else {\n+                    obj.setEnableAds(twAdsInfo.enable);\n+                }\n+            }\n+\n+            if (obj.requestShow != undefined) {\n+                obj.setShowAds(obj.requestShow);\n+            }\n+            else {\n+                obj.setShowAds(obj.enableAds);\n+            }\n+        };\n+\n+        obj.saveTwAdsInfo = function (enable) {\n+            var twAdsInfo = {enable: enable};\n+            localStorage.setItem(\"twAdsInfo\", JSON.stringify(twAdsInfo));\n+        };\n+\n+        obj.setEnableAds = function (enable) {\n+            console.log('set enable ads enable='+enable);\n+            if (enable == obj.enableAds)  {\n+                console.log('already TwAds is enable='+enable);\n+                return;\n+            }\n+\n+            if (obj.ready != true) {\n+                console.log('set enable ads called before ready');\n+                obj.requestEnable = enable;\n+                return;\n+            }\n+\n+            if (enable === false) {\n+                obj.setShowAds(false);\n+            }\n+            obj.enableAds = enable;\n+\n+            //close bottom box\n+            $rootScope.viewAdsBanner = obj.enableAds;\n+            $rootScope.contentBottom = obj.enableAds?100:50;\n+            angular.element(document.getElementsByClassName('tabs')).css('margin-bottom', obj.enableAds?'50px':'0px');\n+        };\n+\n+        obj.setShowAds = function(show) {\n+            console.log('set show ads show='+show);\n+            if(obj.showAds === show) {\n+                console.log('already TwAds is show='+show);\n+                return;\n+            }\n+            if (obj.ready != true) {\n+                console.log('set show ads called before ready');\n+                obj.requestShow = show;\n+                return;\n+            }\n+\n+            if (obj.enableAds === false && show === true) {\n+               console.log('TwAds is not enabled');\n+                return;\n+            }\n+\n+            obj.showAds = show;\n+\n+            angular.element(document.getElementsByClassName('tabs')).css('margin-bottom', show?'50px':'0px');\n+            obj._setAdMobShowAd(show);\n+        };\n+\n+        obj._setAdMobShowAd = function(show) {\n+            console.log('set ad mob show ='+show);\n+\n+            if ( !(admob) ) {\n+                console.log('admob plugin not ready : set Enable Ads');\n+                return;\n+            }\n+\n+            if (show) {\n+                var admobParam = new admob.Params();\n+                admobParam.isTesting = Util.isDebug();\n+\n+                admob.showBanner(admob.BannerSize.BANNER, admob.Position.BOTTOM_CENTER, admobParam, function () {\n+\n+                }, function (e) {\n+                    console.log('fail to show ad mob');\n+                    console.log(JSON.stringify(e));\n+                });\n+            }\n+            else {\n+                admob.hideBanner(function () {\n+\n+                }, function (e) {\n+                    console.log('fail to hide ad mob');\n+                    console.log(JSON.stringify(e));\n+                });\n+            }\n+        };\n+\n+        return obj;\n+    })\n+    .run(function($ionicPlatform, TwAds) {\n+\n+        $ionicPlatform.ready(function() {\n+            //Purchase.setAccountLevel('lover');\n+            //#367\n+            //todo: height 기준으로 layout 재계산\n+            //todo: header hide상태를 해제하여 bannerAd가 overlap되도록 변경\n+            var runAdmob = true;\n+\n+            if (!runAdmob) {\n+                console.log('admob is unused');\n+                return;\n+            }\n+\n+            if ( !(admob) ) {\n+                console.log('ad mob plugin not ready');\n+                return;\n+            }\n+\n+            if (TwAds.loaded == true) {\n+                console.log('TwAds is already loaded');\n+                return;\n+            }\n+            TwAds.loaded = true;\n+\n+            var bannerAdUnit;\n+            var interstitialAdUnit;\n+            if (ionic.Platform.isIOS()) {\n+                bannerAdUnit = 'ca-app-pub-3300619349648096/7636193363';\n+                interstitialAdUnit = 'ca-app-pub-3300619349648096/3066392962';\n+            }","path":"client/www/js/service.twads.js","position":155,"original_position":155,"commit_id":"ed7b0704832cd8abc52c668a1abcdcdea421a126","original_commit_id":"ed7b0704832cd8abc52c668a1abcdcdea421a126","user":{"login":"kimalec","id":6895272,"avatar_url":"https://avatars.githubusercontent.com/u/6895272?v=3","gravatar_id":"","url":"https://api.github.com/users/kimalec","html_url":"https://github.com/kimalec","followers_url":"https://api.github.com/users/kimalec/followers","following_url":"https://api.github.com/users/kimalec/following{/other_user}","gists_url":"https://api.github.com/users/kimalec/gists{/gist_id}","starred_url":"https://api.github.com/users/kimalec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimalec/subscriptions","organizations_url":"https://api.github.com/users/kimalec/orgs","repos_url":"https://api.github.com/users/kimalec/repos","events_url":"https://api.github.com/users/kimalec/events{/privacy}","received_events_url":"https://api.github.com/users/kimalec/received_events","type":"User","site_admin":false},"body":"흐흐 빼야 합니다. ","created_at":"2016-04-29T01:54:02Z","updated_at":"2016-04-29T01:54:02Z","html_url":"https://github.com/WizardFactory/TodayWeather/pull/807#discussion_r61527879","pull_request_url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807","_links":{"self":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/comments/61527879"},"html":{"href":"https://github.com/WizardFactory/TodayWeather/pull/807#discussion_r61527879"},"pull_request":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807"}}},"pull_request":{"url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807","id":68082198,"html_url":"https://github.com/WizardFactory/TodayWeather/pull/807","diff_url":"https://github.com/WizardFactory/TodayWeather/pull/807.diff","patch_url":"https://github.com/WizardFactory/TodayWeather/pull/807.patch","issue_url":"https://api.github.com/repos/WizardFactory/TodayWeather/issues/807","number":807,"state":"open","locked":false,"title":"add cordova-plugin-inapppurchase, com.admob.plugin","user":{"login":"kimalec","id":6895272,"avatar_url":"https://avatars.githubusercontent.com/u/6895272?v=3","gravatar_id":"","url":"https://api.github.com/users/kimalec","html_url":"https://github.com/kimalec","followers_url":"https://api.github.com/users/kimalec/followers","following_url":"https://api.github.com/users/kimalec/following{/other_user}","gists_url":"https://api.github.com/users/kimalec/gists{/gist_id}","starred_url":"https://api.github.com/users/kimalec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimalec/subscriptions","organizations_url":"https://api.github.com/users/kimalec/orgs","repos_url":"https://api.github.com/users/kimalec/repos","events_url":"https://api.github.com/users/kimalec/events{/privacy}","received_events_url":"https://api.github.com/users/kimalec/received_events","type":"User","site_admin":false},"body":"#524 #791\r\nYou have to update cordova to 6.1.1\r\nnew modules - controller.purchase, service.twads","created_at":"2016-04-27T16:18:28Z","updated_at":"2016-04-29T01:54:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"414112ddfebb5e534670c6c7e80a622823dcaada","assignee":{"login":"skywlrl","id":8368939,"avatar_url":"https://avatars.githubusercontent.com/u/8368939?v=3","gravatar_id":"","url":"https://api.github.com/users/skywlrl","html_url":"https://github.com/skywlrl","followers_url":"https://api.github.com/users/skywlrl/followers","following_url":"https://api.github.com/users/skywlrl/following{/other_user}","gists_url":"https://api.github.com/users/skywlrl/gists{/gist_id}","starred_url":"https://api.github.com/users/skywlrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skywlrl/subscriptions","organizations_url":"https://api.github.com/users/skywlrl/orgs","repos_url":"https://api.github.com/users/skywlrl/repos","events_url":"https://api.github.com/users/skywlrl/events{/privacy}","received_events_url":"https://api.github.com/users/skywlrl/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807/commits","review_comments_url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807/comments","review_comment_url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WizardFactory/TodayWeather/issues/807/comments","statuses_url":"https://api.github.com/repos/WizardFactory/TodayWeather/statuses/ed7b0704832cd8abc52c668a1abcdcdea421a126","head":{"label":"kimalec:524-in-app-purchase","ref":"524-in-app-purchase","sha":"ed7b0704832cd8abc52c668a1abcdcdea421a126","user":{"login":"kimalec","id":6895272,"avatar_url":"https://avatars.githubusercontent.com/u/6895272?v=3","gravatar_id":"","url":"https://api.github.com/users/kimalec","html_url":"https://github.com/kimalec","followers_url":"https://api.github.com/users/kimalec/followers","following_url":"https://api.github.com/users/kimalec/following{/other_user}","gists_url":"https://api.github.com/users/kimalec/gists{/gist_id}","starred_url":"https://api.github.com/users/kimalec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimalec/subscriptions","organizations_url":"https://api.github.com/users/kimalec/orgs","repos_url":"https://api.github.com/users/kimalec/repos","events_url":"https://api.github.com/users/kimalec/events{/privacy}","received_events_url":"https://api.github.com/users/kimalec/received_events","type":"User","site_admin":false},"repo":{"id":39199577,"name":"TodayWeather","full_name":"kimalec/TodayWeather","owner":{"login":"kimalec","id":6895272,"avatar_url":"https://avatars.githubusercontent.com/u/6895272?v=3","gravatar_id":"","url":"https://api.github.com/users/kimalec","html_url":"https://github.com/kimalec","followers_url":"https://api.github.com/users/kimalec/followers","following_url":"https://api.github.com/users/kimalec/following{/other_user}","gists_url":"https://api.github.com/users/kimalec/gists{/gist_id}","starred_url":"https://api.github.com/users/kimalec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimalec/subscriptions","organizations_url":"https://api.github.com/users/kimalec/orgs","repos_url":"https://api.github.com/users/kimalec/repos","events_url":"https://api.github.com/users/kimalec/events{/privacy}","received_events_url":"https://api.github.com/users/kimalec/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kimalec/TodayWeather","description":"Inform how warm or cold it is today than yesterday.","fork":true,"url":"https://api.github.com/repos/kimalec/TodayWeather","forks_url":"https://api.github.com/repos/kimalec/TodayWeather/forks","keys_url":"https://api.github.com/repos/kimalec/TodayWeather/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kimalec/TodayWeather/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kimalec/TodayWeather/teams","hooks_url":"https://api.github.com/repos/kimalec/TodayWeather/hooks","issue_events_url":"https://api.github.com/repos/kimalec/TodayWeather/issues/events{/number}","events_url":"https://api.github.com/repos/kimalec/TodayWeather/events","assignees_url":"https://api.github.com/repos/kimalec/TodayWeather/assignees{/user}","branches_url":"https://api.github.com/repos/kimalec/TodayWeather/branches{/branch}","tags_url":"https://api.github.com/repos/kimalec/TodayWeather/tags","blobs_url":"https://api.github.com/repos/kimalec/TodayWeather/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kimalec/TodayWeather/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kimalec/TodayWeather/git/refs{/sha}","trees_url":"https://api.github.com/repos/kimalec/TodayWeather/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kimalec/TodayWeather/statuses/{sha}","languages_url":"https://api.github.com/repos/kimalec/TodayWeather/languages","stargazers_url":"https://api.github.com/repos/kimalec/TodayWeather/stargazers","contributors_url":"https://api.github.com/repos/kimalec/TodayWeather/contributors","subscribers_url":"https://api.github.com/repos/kimalec/TodayWeather/subscribers","subscription_url":"https://api.github.com/repos/kimalec/TodayWeather/subscription","commits_url":"https://api.github.com/repos/kimalec/TodayWeather/commits{/sha}","git_commits_url":"https://api.github.com/repos/kimalec/TodayWeather/git/commits{/sha}","comments_url":"https://api.github.com/repos/kimalec/TodayWeather/comments{/number}","issue_comment_url":"https://api.github.com/repos/kimalec/TodayWeather/issues/comments{/number}","contents_url":"https://api.github.com/repos/kimalec/TodayWeather/contents/{+path}","compare_url":"https://api.github.com/repos/kimalec/TodayWeather/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kimalec/TodayWeather/merges","archive_url":"https://api.github.com/repos/kimalec/TodayWeather/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kimalec/TodayWeather/downloads","issues_url":"https://api.github.com/repos/kimalec/TodayWeather/issues{/number}","pulls_url":"https://api.github.com/repos/kimalec/TodayWeather/pulls{/number}","milestones_url":"https://api.github.com/repos/kimalec/TodayWeather/milestones{/number}","notifications_url":"https://api.github.com/repos/kimalec/TodayWeather/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kimalec/TodayWeather/labels{/name}","releases_url":"https://api.github.com/repos/kimalec/TodayWeather/releases{/id}","deployments_url":"https://api.github.com/repos/kimalec/TodayWeather/deployments","created_at":"2015-07-16T13:51:30Z","updated_at":"2016-01-15T07:45:06Z","pushed_at":"2016-04-29T00:34:05Z","git_url":"git://github.com/kimalec/TodayWeather.git","ssh_url":"git@github.com:kimalec/TodayWeather.git","clone_url":"https://github.com/kimalec/TodayWeather.git","svn_url":"https://github.com/kimalec/TodayWeather","homepage":null,"size":19581,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"master"}},"base":{"label":"WizardFactory:master","ref":"master","sha":"d8748e873b0d6874cb60f502279c3b8b7769e45c","user":{"login":"WizardFactory","id":6895302,"avatar_url":"https://avatars.githubusercontent.com/u/6895302?v=3","gravatar_id":"","url":"https://api.github.com/users/WizardFactory","html_url":"https://github.com/WizardFactory","followers_url":"https://api.github.com/users/WizardFactory/followers","following_url":"https://api.github.com/users/WizardFactory/following{/other_user}","gists_url":"https://api.github.com/users/WizardFactory/gists{/gist_id}","starred_url":"https://api.github.com/users/WizardFactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WizardFactory/subscriptions","organizations_url":"https://api.github.com/users/WizardFactory/orgs","repos_url":"https://api.github.com/users/WizardFactory/repos","events_url":"https://api.github.com/users/WizardFactory/events{/privacy}","received_events_url":"https://api.github.com/users/WizardFactory/received_events","type":"Organization","site_admin":false},"repo":{"id":35748347,"name":"TodayWeather","full_name":"WizardFactory/TodayWeather","owner":{"login":"WizardFactory","id":6895302,"avatar_url":"https://avatars.githubusercontent.com/u/6895302?v=3","gravatar_id":"","url":"https://api.github.com/users/WizardFactory","html_url":"https://github.com/WizardFactory","followers_url":"https://api.github.com/users/WizardFactory/followers","following_url":"https://api.github.com/users/WizardFactory/following{/other_user}","gists_url":"https://api.github.com/users/WizardFactory/gists{/gist_id}","starred_url":"https://api.github.com/users/WizardFactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WizardFactory/subscriptions","organizations_url":"https://api.github.com/users/WizardFactory/orgs","repos_url":"https://api.github.com/users/WizardFactory/repos","events_url":"https://api.github.com/users/WizardFactory/events{/privacy}","received_events_url":"https://api.github.com/users/WizardFactory/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WizardFactory/TodayWeather","description":"Inform how warm or cold it is today than yesterday.","fork":false,"url":"https://api.github.com/repos/WizardFactory/TodayWeather","forks_url":"https://api.github.com/repos/WizardFactory/TodayWeather/forks","keys_url":"https://api.github.com/repos/WizardFactory/TodayWeather/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WizardFactory/TodayWeather/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WizardFactory/TodayWeather/teams","hooks_url":"https://api.github.com/repos/WizardFactory/TodayWeather/hooks","issue_events_url":"https://api.github.com/repos/WizardFactory/TodayWeather/issues/events{/number}","events_url":"https://api.github.com/repos/WizardFactory/TodayWeather/events","assignees_url":"https://api.github.com/repos/WizardFactory/TodayWeather/assignees{/user}","branches_url":"https://api.github.com/repos/WizardFactory/TodayWeather/branches{/branch}","tags_url":"https://api.github.com/repos/WizardFactory/TodayWeather/tags","blobs_url":"https://api.github.com/repos/WizardFactory/TodayWeather/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WizardFactory/TodayWeather/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WizardFactory/TodayWeather/git/refs{/sha}","trees_url":"https://api.github.com/repos/WizardFactory/TodayWeather/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WizardFactory/TodayWeather/statuses/{sha}","languages_url":"https://api.github.com/repos/WizardFactory/TodayWeather/languages","stargazers_url":"https://api.github.com/repos/WizardFactory/TodayWeather/stargazers","contributors_url":"https://api.github.com/repos/WizardFactory/TodayWeather/contributors","subscribers_url":"https://api.github.com/repos/WizardFactory/TodayWeather/subscribers","subscription_url":"https://api.github.com/repos/WizardFactory/TodayWeather/subscription","commits_url":"https://api.github.com/repos/WizardFactory/TodayWeather/commits{/sha}","git_commits_url":"https://api.github.com/repos/WizardFactory/TodayWeather/git/commits{/sha}","comments_url":"https://api.github.com/repos/WizardFactory/TodayWeather/comments{/number}","issue_comment_url":"https://api.github.com/repos/WizardFactory/TodayWeather/issues/comments{/number}","contents_url":"https://api.github.com/repos/WizardFactory/TodayWeather/contents/{+path}","compare_url":"https://api.github.com/repos/WizardFactory/TodayWeather/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WizardFactory/TodayWeather/merges","archive_url":"https://api.github.com/repos/WizardFactory/TodayWeather/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WizardFactory/TodayWeather/downloads","issues_url":"https://api.github.com/repos/WizardFactory/TodayWeather/issues{/number}","pulls_url":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls{/number}","milestones_url":"https://api.github.com/repos/WizardFactory/TodayWeather/milestones{/number}","notifications_url":"https://api.github.com/repos/WizardFactory/TodayWeather/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WizardFactory/TodayWeather/labels{/name}","releases_url":"https://api.github.com/repos/WizardFactory/TodayWeather/releases{/id}","deployments_url":"https://api.github.com/repos/WizardFactory/TodayWeather/deployments","created_at":"2015-05-17T02:17:17Z","updated_at":"2016-04-17T03:58:05Z","pushed_at":"2016-04-29T00:34:46Z","git_url":"git://github.com/WizardFactory/TodayWeather.git","ssh_url":"git@github.com:WizardFactory/TodayWeather.git","clone_url":"https://github.com/WizardFactory/TodayWeather.git","svn_url":"https://github.com/WizardFactory/TodayWeather","homepage":null,"size":19936,"stargazers_count":16,"watchers_count":16,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":120,"forks":9,"open_issues":120,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807"},"html":{"href":"https://github.com/WizardFactory/TodayWeather/pull/807"},"issue":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/issues/807"},"comments":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/issues/807/comments"},"review_comments":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807/comments"},"review_comment":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/pulls/807/commits"},"statuses":{"href":"https://api.github.com/repos/WizardFactory/TodayWeather/statuses/ed7b0704832cd8abc52c668a1abcdcdea421a126"}}}}