Browse Source

setting up new firebase and twitter account

rohit.gowda 4 years ago
parent
commit
1286853727

+ 2 - 2
app/config.xml

@@ -78,8 +78,8 @@
         <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
     </platform>
     <universal-links>
-        <host name="hybridosn.page.link" scheme="https" />
-        <host name="hybridosn.firebaseapp.com" scheme="https">
+        <host name="twitterhosn.page.link" scheme="https" />
+        <host name="twitter-hosn.firebaseapp.com" scheme="https">
             <path url="/__/auth/callback" />
         </host>
     </universal-links>

+ 10 - 5
app/src/providers/auth/auth.ts

@@ -14,17 +14,22 @@ export class AuthProvider {
     private twitter: TwitterApiProvider
   ) {
     const config = {
-      apiKey: "AIzaSyCMYjjtPPZak7wBBnh9sy8Yr3Fz1145MuM",
-      authDomain: "hybridosn.firebaseapp.com",
-      databaseURL: "https://hybridosn.firebaseio.com",
-      storageBucket: "hybridosn.appspot.com"
+      apiKey: "AIzaSyDRb5IVPCjdKld_5ubsGuP9tEPTRG0kgQ4",
+      authDomain: "twitter-hosn.firebaseapp.com",
+      databaseURL: "https://twitter-hosn.firebaseio.com",
+      projectId: "twitter-hosn",
+      storageBucket: "twitter-hosn.appspot.com",
+      messagingSenderId: "502393136960",
+      appId: "1:502393136960:web:886faa1155c38a37087ca5",
+      measurementId: "G-XPXJQF3LWV"
     };
     firebase.initializeApp(config);
-
     this.authProvider = new firebase.auth.TwitterAuthProvider();
     this.authProvider.setCustomParameters({
       lang: "de"
     });
+    console.log('this.authProvider',this.authProvider);
+
   }
 
   /**

+ 18 - 12
app/src/providers/twitter-api/twitter-api.ts

@@ -15,16 +15,20 @@ export class TwitterApiProvider {
    * initialize Twitter API provider
    */
   public async initApi() {
+    console.log('initAPi iis initting');
     const access_token_key = await this.storage.get("accessTokenKey");
     const access_token_secret = await this.storage.get("accessTokenSecret");
-    if (access_token_key && access_token_secret) {
+    console.log('inside twitter initapi access_token_key:', access_token_key, 'access_token_secret', access_token_secret);
+    // if (access_token_key && access_token_secret) {
+    if (1) {
       this.client = new Twit({
-        consumer_key: "UxZkbKotkr8Uc6seupnaZ1kDE",
-        consumer_secret: "fEAas8iugR60FOEXsFG0iajq6oyfIIXRBVMlTgWxBd1stWIKHq",
-        access_token: access_token_key,
-        access_token_secret: access_token_secret,
+        consumer_key: "ewAyFOepelB1Dgczl7LReD3pN",
+        consumer_secret: "xblu59EZCTrNnW5waDvPjkpaiothQBjDCaJlLaxuezfIdol9Ot",
+        access_token: "1205934370546241541-Ma5zbQIMPTVnbRIYTCaUGgpQnqwApu",
+        access_token_secret: "mnCbVPV0IuQ8UeRCzZSfM6qnn29m41tkAjXVHTBpySP5i",
         timeout_ms: 60 * 1000 // optional HTTP request timeout to apply to all requests.
       });
+      console.log('new twit client created successfully');
     } else {
       console.error(
         "Access Token Key and Secret not set. Creating Twit-client not possible."
@@ -37,13 +41,15 @@ export class TwitterApiProvider {
    * fetch home feed in batches of 20 tweets starting at maxId
    * @param maxId tweet id
    */
-  public async fetchHomeFeed(maxId?) {
+  public async fetchHomeFeed(maxId ? ) {
+    console.log('fetchine home feed', this.client);
     const res = await this.client.get("statuses/home_timeline", {
       count: 20,
       include_entities: true,
       tweet_mode: "extended",
       max_id: maxId
-    });
+    })
+    console.log('res is:', res);
     return res.data;
   }
 
@@ -71,7 +77,7 @@ export class TwitterApiProvider {
    * @param userId user id
    * @param maxId max tweet id
    */
-  public async fetchUserTimeline(userId, maxId?) {
+  public async fetchUserTimeline(userId, maxId ? ) {
     try {
       const res = await this.client.get("statuses/user_timeline", {
         user_id: userId,
@@ -141,7 +147,7 @@ export class TwitterApiProvider {
    * @param retweet tweet object to retweet
    * @param replyToStatusId tweet id to reply to
    */
-  public async tweet(status, retweet?, replyToStatusId?) {
+  public async tweet(status, retweet ? , replyToStatusId ? ) {
     if (status.length === 0 && retweet) {
       // Simple retweet
       return await this.client.post("statuses/retweet", {
@@ -225,7 +231,7 @@ export class TwitterApiProvider {
    * @param keyword keyword
    * @param maxId max tweet id
    */
-  public async searchRecentTweets(keyword: string, maxId?: string) {
+  public async searchRecentTweets(keyword: string, maxId ? : string) {
     const res = await this.client.get("search/tweets", {
       q: keyword,
       result_type: "recent",
@@ -243,7 +249,7 @@ export class TwitterApiProvider {
    * @param keyword keyword
    * @param maxId max tweet id
    */
-  public async searchPopularTweets(keyword: string, maxId?: string) {
+  public async searchPopularTweets(keyword: string, maxId ? : string) {
     const res = await this.client.get("search/tweets", {
       q: keyword,
       result_type: "popular",
@@ -261,7 +267,7 @@ export class TwitterApiProvider {
    * @param keyword keyword
    * @param page page number
    */
-  public async searchUsers(keyword: string, page?: number) {
+  public async searchUsers(keyword: string, page ? : number) {
     const res = await this.client.get("users/search", {
       q: keyword,
       count: 10,

+ 2 - 2
app/ul_web_hooks/android/android_web_hook.html

@@ -15,8 +15,8 @@ You can just copy-paste them in the <header> section of the appropriate pages of
 -->
 
 <head>
-<link rel="alternate" href="android-app://de.porth.hybridosn/https/hybridosn.page.link" />
-<link rel="alternate" href="android-app://de.porth.hybridosn/https/hybridosn.firebaseapp.com/__/auth/callback" />
+<link rel="alternate" href="android-app://de.porth.hybridosn/https/twitterhosn.page.link" />
+<link rel="alternate" href="android-app://de.porth.hybridosn/https/twitter-hosn.firebaseapp.com/__/auth/callback" />
 
 <!-- Your other stuff from the head tag -->
 </head>