#51 Adding Tweets from Twitter with popular Hashtags
Opened 2 years ago by twishi. Modified 2 years ago
twishi/Fedora-app master  into  master

file modified
+1 -1

@@ -56,11 +56,11 @@ 

      <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />

      <plugin name="cordova-plugin-statusbar" spec="~2.1.3" />

      <plugin name="cordova-plugin-whitelist" spec="~1.2.2" />

-     <plugin name="cordova-plugin-x-socialsharing" spec="^5.1.8" />

      <plugin name="cordova-plugin-calendar" spec="^4.5.5" />

      <plugin name="cordova-plugin-inappbrowser" spec="^1.4.0" />

      <plugin name="cordova-plugin-native-spinner" spec="^1.1.3" />

      <plugin name="cordova-plugin-x-toast" spec="^2.5.2" />

      <engine name="browser" spec="5.0.3" />

      <engine name="android" spec="7.0.0" />

+     <plugin name="cordova-plugin-x-socialsharing" spec="^5.3.2" />

  </widget>

file modified
+3 -2

@@ -48,14 +48,14 @@ 

      "cordova-plugin-splashscreen": "^3.2.2",

      "cordova-plugin-statusbar": "^2.1.3",

      "cordova-plugin-whitelist": "^1.2.2",

-     "cordova-plugin-x-socialsharing": "^5.1.8",

+     "cordova-plugin-x-socialsharing": "^5.3.2",

      "cordova-plugin-x-toast": "^2.5.2",

      "es6-promise-plugin": "^4.2.2",

      "fb": "^1.1.1",

      "ionic-angular": "3.9.2",

      "ionic-plugin-keyboard": "^2.2.1",

      "ionicons": "^3.0.0",

-     "lodash": "^4.14.0",

+     "lodash": "^4.17.5",

      "moment": "^2.14.1",

      "moment-timezone": "^0.5.5",

      "query-string": "^4.2.2",

@@ -66,6 +66,7 @@ 

    },

    "devDependencies": {

      "@ionic/app-scripts": "3.1.8",

+     "@types/lodash": "4.14.105",

      "typescript": "2.4.2"

    },

    "cordova": {

@@ -0,0 +1,401 @@ 

+ {

+   "name": "cron",

+   "version": "1.0.0",

+   "lockfileVersion": 1,

+   "requires": true,

+   "dependencies": {

+     "ajv": {

+       "version": "5.5.2",

+       "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",

+       "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",

+       "requires": {

+         "co": "4.6.0",

+         "fast-deep-equal": "1.1.0",

+         "fast-json-stable-stringify": "2.0.0",

+         "json-schema-traverse": "0.3.1"

+       }

+     },

+     "asn1": {

+       "version": "0.2.3",

+       "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",

+       "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y="

+     },

+     "assert-plus": {

+       "version": "1.0.0",

+       "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",

+       "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="

+     },

+     "asynckit": {

+       "version": "0.4.0",

+       "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",

+       "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="

+     },

+     "aws-sign2": {

+       "version": "0.7.0",

+       "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",

+       "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="

+     },

+     "aws4": {

+       "version": "1.7.0",

+       "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz",

+       "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w=="

+     },

+     "bcrypt-pbkdf": {

+       "version": "1.0.1",

+       "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",

+       "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",

+       "optional": true,

+       "requires": {

+         "tweetnacl": "0.14.5"

+       }

+     },

+     "bluebird": {

+       "version": "3.5.1",

+       "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",

+       "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="

+     },

+     "boom": {

+       "version": "4.3.1",

+       "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",

+       "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",

+       "requires": {

+         "hoek": "4.2.1"

+       }

+     },

+     "caseless": {

+       "version": "0.12.0",

+       "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",

+       "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="

+     },

+     "co": {

+       "version": "4.6.0",

+       "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",

+       "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="

+     },

+     "combined-stream": {

+       "version": "1.0.6",

+       "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",

+       "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",

+       "requires": {

+         "delayed-stream": "1.0.0"

+       }

+     },

+     "core-util-is": {

+       "version": "1.0.2",

+       "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",

+       "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="

+     },

+     "cryptiles": {

+       "version": "3.1.2",

+       "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",

+       "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",

+       "requires": {

+         "boom": "5.2.0"

+       },

+       "dependencies": {

+         "boom": {

+           "version": "5.2.0",

+           "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",

+           "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==",

+           "requires": {

+             "hoek": "4.2.1"

+           }

+         }

+       }

+     },

+     "dashdash": {

+       "version": "1.14.1",

+       "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",

+       "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",

+       "requires": {

+         "assert-plus": "1.0.0"

+       }

+     },

+     "delayed-stream": {

+       "version": "1.0.0",

+       "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",

+       "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="

+     },

+     "ecc-jsbn": {

+       "version": "0.1.1",

+       "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",

+       "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",

+       "optional": true,

+       "requires": {

+         "jsbn": "0.1.1"

+       }

+     },

+     "extend": {

+       "version": "3.0.1",

+       "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",

+       "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="

+     },

+     "extsprintf": {

+       "version": "1.3.0",

+       "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",

+       "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="

+     },

+     "fast-deep-equal": {

+       "version": "1.1.0",

+       "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",

+       "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="

+     },

+     "fast-json-stable-stringify": {

+       "version": "2.0.0",

+       "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",

+       "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="

+     },

+     "forever-agent": {

+       "version": "0.6.1",

+       "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",

+       "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="

+     },

+     "form-data": {

+       "version": "2.3.2",

+       "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",

+       "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",

+       "requires": {

+         "asynckit": "0.4.0",

+         "combined-stream": "1.0.6",

+         "mime-types": "2.1.18"

+       }

+     },

+     "getpass": {

+       "version": "0.1.7",

+       "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",

+       "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",

+       "requires": {

+         "assert-plus": "1.0.0"

+       }

+     },

+     "har-schema": {

+       "version": "2.0.0",

+       "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",

+       "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="

+     },

+     "har-validator": {

+       "version": "5.0.3",

+       "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",

+       "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",

+       "requires": {

+         "ajv": "5.5.2",

+         "har-schema": "2.0.0"

+       }

+     },

+     "hawk": {

+       "version": "6.0.2",

+       "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",

+       "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==",

+       "requires": {

+         "boom": "4.3.1",

+         "cryptiles": "3.1.2",

+         "hoek": "4.2.1",

+         "sntp": "2.1.0"

+       }

+     },

+     "hoek": {

+       "version": "4.2.1",

+       "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",

+       "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="

+     },

+     "http-signature": {

+       "version": "1.2.0",

+       "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",

+       "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",

+       "requires": {

+         "assert-plus": "1.0.0",

+         "jsprim": "1.4.1",

+         "sshpk": "1.14.1"

+       }

+     },

+     "is-typedarray": {

+       "version": "1.0.0",

+       "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",

+       "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="

+     },

+     "isstream": {

+       "version": "0.1.2",

+       "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",

+       "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="

+     },

+     "jsbn": {

+       "version": "0.1.1",

+       "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",

+       "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",

+       "optional": true

+     },

+     "json-schema": {

+       "version": "0.2.3",

+       "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",

+       "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="

+     },

+     "json-schema-traverse": {

+       "version": "0.3.1",

+       "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",

+       "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="

+     },

+     "json-stringify-safe": {

+       "version": "5.0.1",

+       "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",

+       "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="

+     },

+     "jsprim": {

+       "version": "1.4.1",

+       "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",

+       "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",

+       "requires": {

+         "assert-plus": "1.0.0",

+         "extsprintf": "1.3.0",

+         "json-schema": "0.2.3",

+         "verror": "1.10.0"

+       }

+     },

+     "mime": {

+       "version": "1.6.0",

+       "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",

+       "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="

+     },

+     "mime-db": {

+       "version": "1.33.0",

+       "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",

+       "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="

+     },

+     "mime-types": {

+       "version": "2.1.18",

+       "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",

+       "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",

+       "requires": {

+         "mime-db": "1.33.0"

+       }

+     },

+     "oauth-sign": {

+       "version": "0.8.2",

+       "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",

+       "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM="

+     },

+     "performance-now": {

+       "version": "2.1.0",

+       "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",

+       "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="

+     },

+     "punycode": {

+       "version": "1.4.1",

+       "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",

+       "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="

+     },

+     "qs": {

+       "version": "6.5.1",

+       "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",

+       "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="

+     },

+     "request": {

+       "version": "2.85.0",

+       "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz",

+       "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==",

+       "requires": {

+         "aws-sign2": "0.7.0",

+         "aws4": "1.7.0",

+         "caseless": "0.12.0",

+         "combined-stream": "1.0.6",

+         "extend": "3.0.1",

+         "forever-agent": "0.6.1",

+         "form-data": "2.3.2",

+         "har-validator": "5.0.3",

+         "hawk": "6.0.2",

+         "http-signature": "1.2.0",

+         "is-typedarray": "1.0.0",

+         "isstream": "0.1.2",

+         "json-stringify-safe": "5.0.1",

+         "mime-types": "2.1.18",

+         "oauth-sign": "0.8.2",

+         "performance-now": "2.1.0",

+         "qs": "6.5.1",

+         "safe-buffer": "5.1.1",

+         "stringstream": "0.0.5",

+         "tough-cookie": "2.3.4",

+         "tunnel-agent": "0.6.0",

+         "uuid": "3.2.1"

+       }

+     },

+     "safe-buffer": {

+       "version": "5.1.1",

+       "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",

+       "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="

+     },

+     "sntp": {

+       "version": "2.1.0",

+       "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",

+       "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",

+       "requires": {

+         "hoek": "4.2.1"

+       }

+     },

+     "sshpk": {

+       "version": "1.14.1",

+       "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz",

+       "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=",

+       "requires": {

+         "asn1": "0.2.3",

+         "assert-plus": "1.0.0",

+         "bcrypt-pbkdf": "1.0.1",

+         "dashdash": "1.14.1",

+         "ecc-jsbn": "0.1.1",

+         "getpass": "0.1.7",

+         "jsbn": "0.1.1",

+         "tweetnacl": "0.14.5"

+       }

+     },

+     "stringstream": {

+       "version": "0.0.5",

+       "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",

+       "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg="

+     },

+     "tough-cookie": {

+       "version": "2.3.4",

+       "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",

+       "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",

+       "requires": {

+         "punycode": "1.4.1"

+       }

+     },

+     "tunnel-agent": {

+       "version": "0.6.0",

+       "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",

+       "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",

+       "requires": {

+         "safe-buffer": "5.1.1"

+       }

+     },

+     "tweetnacl": {

+       "version": "0.14.5",

+       "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",

+       "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",

+       "optional": true

+     },

+     "twit": {

+       "version": "2.2.9",

+       "resolved": "https://registry.npmjs.org/twit/-/twit-2.2.9.tgz",

+       "integrity": "sha1-ZxBXT4FkHaoDeWobS457eNPXVnY=",

+       "requires": {

+         "bluebird": "3.5.1",

+         "mime": "1.6.0",

+         "request": "2.85.0"

+       }

+     },

+     "uuid": {

+       "version": "3.2.1",

+       "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",

+       "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA=="

+     },

+     "verror": {

+       "version": "1.10.0",

+       "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",

+       "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",

+       "requires": {

+         "assert-plus": "1.0.0",

+         "core-util-is": "1.0.2",

+         "extsprintf": "1.3.0"

+       }

+     }

+   }

+ }

@@ -0,0 +1,14 @@ 

+ {

+   "name": "cron",

+   "version": "1.0.0",

+   "description": "",

+   "main": "twitter.js",

+   "scripts": {

+     "test": "echo \"Error: no test specified\" && exit 1"

+   },

+   "author": "",

+   "license": "ISC",

+   "dependencies": {

+     "twit": "^2.2.9"

+   }

+ }

file added
+74

@@ -0,0 +1,74 @@ 

+ var Twit = require('twit');

+ 

+ var T = new Twit({

+     consumer_key:         'cuLxLMfC5jOoEcMnH2qvUL83j'

+   , consumer_secret:      'WLAWlJ4KUQ2lQ7W5BPDZWFQTB0KuHfSoBX8hUPBBUlI9Mif2sa'

+   , access_token:         '716300138340192256-jDYaMzu8nKtOpNBX69nVMxIR2j2dNWX'

+   , access_token_secret:  'X2kQlFaTIsl8oLLXf99PADO5SeXdodED58zGm8Jy3aLkq'

+ })

+ 

+ var options = { screen_name: 'fedora',

+                 count: 200 };

+ 

+                 function popular(array) { 

+    if (array.length == 0) return [null, 0];

+    var n = max = 1, maxNum = array[0], pv, cv;

+ 

+    for(var i = 0; i < array.length; i++, pv = array[i-1], cv = array[i]) {

+       if (pv == cv) { 

+         if (++n >= max) {

+            max = n; maxNum = cv;

+         }

+       } else n = 1;

+    }

+ 

+    return [maxNum, max];

+ };

+ 

+ 

+ 

+ 

+ 

+ 

+ 

+ var hashtags = [];

+ var hashtags_count = [];

+ T.get('statuses/user_timeline', options , function(err, data) {

+   for (var i = 0; i < data.length ; i++) {

+     t = data[i].text;

+     n = t.match(/#[A-Za-z0-9]+/mg);

+     

+     

+      if(n != null){

+         for(a in n){

+             if(data.hasOwnProperty(a)) {

+                 var value = n[a];

+                 var c = hashtags.indexOf(value);

+                 if(c != -1){

+                     hashtags_count[c] += 1;

+                 }else{

+                     hashtags.push(value);

+                     hashtags_count.push(1);

+                 }

+             }

+         }

+      }

+   }

+   

+ }).then(function(){ 

+     //console.log(hashtags);

+     //console.log(hashtags_count);

+     var hashtags_count_2 = hashtags_count.concat();

+     hashtags_count_2.sort(function(a, b){return b-a});

+ 

+     max_p = [];

+     max_pi = [];

+     for(i=0;i<10;i++){

+         //console.log(hashtags_count.indexOf(hashtags_count_2[i]));

+         item_index = hashtags_count.indexOf(hashtags_count_2[i]);

+         max_pi.push(item_index)

+         max_p.push(hashtags[item_index]);

+     }

+     console.log(max_p);

+ });

+ 

file modified
+13 -2

@@ -20,18 +20,22 @@ 

    // TODO: Refactor, we are not supposed to use `any`, rather, ww should define an

    // interface Post { content:string, date:Date }

    private posts:Array<any>;

+   private tagged_updates:Array<any>;

    private tweets:Array<any>;

    private updates:Array<any>;

    private USER:any;

- 

+   

    constructor(private browser:Browser, private fb:FB, private tw:Tw,

                private socialSharing:SocialSharing) {

      this.posts = [];

+     this.tagged_updates = [];

      this.tweets = [];

      this.updates = [];

+     

  

      this.USER = {

        FB: 'fedoraqa',

+       FB2: 'TheFedoraProject',

        TW: 'fedora_qa',

      };

    }

@@ -48,6 +52,13 @@ 

          this.mergeUpdates();

        }).catch((err) => console.log(err + "kanika"));

  

+     this.fb

+       .getTaggedPosts(this.USER.FB2)

+       .then((posts:Array<any>) => {

+         this.tagged_updates = posts;

+         this.mergeUpdates();

+       }).catch((err) => console.log(err + "twishi"));

+ 

      this.tw

        .getTimelineTweets(this.USER.TW)

        .then((tweets:Array<any>) => {

@@ -58,7 +69,7 @@ 

  

    mergeUpdates() {

      // TODO: Merge as per ascending order of timestamps?

-     this.updates = [ ...this.posts, ...this.tweets ];

+     this.updates = [ ...this.posts, ...this.tagged_updates, ...this.tweets ];

    }

  

    openUpdate(event) {

file modified
+44

@@ -10,6 +10,12 @@ 

    version: 'v2.6'

  };

  

+ const FB_CONFIG2 = {

+   accessToken: 'ACCESS_TOKEN_FOR_PAGE_THEFEDORAPROJECT',

+   xfbml: true,

+   version: 'v2.6'

+ };

+ 

  /*

    Generated class for the Fb provider.

  

@@ -19,8 +25,11 @@ 

  @Injectable()

  export class FB {

    private fb:Facebook;

+   private fb2:Facebook;

+   

    constructor() {

      this.fb = new Facebook(FB_CONFIG);

+     this.fb2 = new Facebook(FB_CONFIG2);

    }

  

    api(urlParts) {

@@ -34,6 +43,18 @@ 

        });

      });

    }

+   

+   api2(urlParts) {

+     return new Promise((resolve, reject) => {

+       this.fb.api(urlParts.join('/'), res => {

+         if (!res || res.error) {

+           return reject(res);

+         } else {

+           return resolve(res);

+         }

+       });

+     });

+   }

  

    getPagePosts(page) {

      return new Promise((resolve, reject) => {

@@ -57,4 +78,27 @@ 

        }).catch(reject);

      });

    }

+ 

+   getTaggedPosts(page) {

+     return new Promise((resolve, reject) => {

+       this.api([page, 'tagged']).then((res:any) => {

+         var posts = _.compact(_.map(res.data, p => {

+           var post = {

+             id: p.id,

+             link: 'https://facebook.com/' + p.id,

+             content: p.message,

+             origin: 'facebook',

+           };

+ 

+           if (_.isEmpty(post.content)) {

+             return null;

+           } else {

+             return post;

+           }

+         }));

+ 

+         return resolve(posts);

+       }).catch(reject);

+     });

+   }

  }

So the discussion was going on which popular tags should we show in the social section of the application.
What I have thought is that there will be a cron job (located in src/cron/twitter.js) which will fetch first 100 or 1000 tweets from @fedora twitter handle and then we will search for the hashtags which are occuring maximum number of times in all the posts.

The top 3 to 4 hashtags with maximum count could be shown in the social section.
I have implemented the logic with my own twitter credentials here (for demo purpose) which will show the most used hashtags.

The reason for cron job is that it takes a plenty of time and there is API request limit on twitter so we should run the cron job in every hour or every 30 minutes which will store the maximum used hashtag in a file and then we can build an API endpoint which will read content from that file and serve on the app side.

I am designing the UI for this on a seperate PR if you all think this would be the best approach for this.

I have implemented the logic with my own twitter credentials here

Posting the credentials on a public platform is highly insecure. Your twitter account may be easily compromised. Usually people grant wider scope to the application while generating the token, which might have access to even post through your account (POST statuses/update
).

  • Make sure that the key does not have write access to your account.
  • Posting Key publically on the internet means that anyone can use that key and exhaust your limit.

Cheers :-)

I understand posting such information is highly insecure. I posted it here with only Read Access so everyone can test easily.

I was waiting for review from someone then I had planned to refresh the tokens.