Преглед изворни кода

Merge branch 'msg-fact' of fyindr/siimee into dev

tags/0.0.1^2
maeda пре 3 година
родитељ
комит
0a3bdd9002
2 измењених фајлова са 34 додато и 11 уклоњено
  1. 9
    9
      frontend/src/services/chat.service.js
  2. 25
    2
      frontend/src/views/HomeView.vue

+ 9
- 9
frontend/src/services/chat.service.js Прегледај датотеку

13
     subscribe: () => console.error('no provider subscribe method set'),
13
     subscribe: () => console.error('no provider subscribe method set'),
14
     listen: () => console.error('no provider listen method set'),
14
     listen: () => console.error('no provider listen method set'),
15
 }
15
 }
16
-
17
 /**
16
 /**
17
+ * 
18
+ * 
18
  * Breaking out as much pubnub specific flavor
19
  * Breaking out as much pubnub specific flavor
19
  */
20
  */
20
 const setupPubnub = async uuid => {
21
 const setupPubnub = async uuid => {
37
 }
38
 }
38
 
39
 
39
 class ChatMessage {
40
 class ChatMessage {
40
-    constructor({ title, description }) {
41
-        ;(this.title = title), (this.description = description)
41
+    constructor(message) {
42
+        this.description = message
42
     }
43
     }
43
 }
44
 }
44
-
45
-const testMessage = new ChatMessage({
46
-    title: 'testing',
47
-    description: 'hello world!',
48
-})
49
 const MAIN_CHANNEL = 'Channel-Siimee'
45
 const MAIN_CHANNEL = 'Channel-Siimee'
50
 
46
 
51
 /** Singleton that holds all our chat information */
47
 /** Singleton that holds all our chat information */
101
      */
97
      */
102
     async publish(channel, message) {
98
     async publish(channel, message) {
103
         // console.log('publishing message to channel:', channel)
99
         // console.log('publishing message to channel:', channel)
104
-        return providerMethods.publish({ channel, message })
100
+        return providerMethods.publish({ 
101
+            channel,
102
+            message: new ChatMessage(message)
103
+        })
105
     }
104
     }
106
     /**
105
     /**
107
      * Subscribe to a channels
106
      * Subscribe to a channels
129
         this.subscriptions = [MAIN_CHANNEL]
128
         this.subscriptions = [MAIN_CHANNEL]
130
         console.warn('chatter stop no implemented')
129
         console.warn('chatter stop no implemented')
131
     }
130
     }
131
+
132
 }
132
 }
133
 
133
 
134
 export { Chatter }
134
 export { Chatter }

+ 25
- 2
frontend/src/views/HomeView.vue Прегледај датотеку

12
     
12
     
13
     p(v-else-if="matches.length===0") No matches.
13
     p(v-else-if="matches.length===0") No matches.
14
     p(v-else) Loading...
14
     p(v-else) Loading...
15
-
16
 </template>
15
 </template>
17
 
16
 
18
 <script>
17
 <script>
18
+    import 'wave-ui/dist/wave-ui.css'
19
 import ProfileCardList from '../components/ProfileCardList.vue'
19
 import ProfileCardList from '../components/ProfileCardList.vue'
20
 
20
 
21
 import { Card } from '../entities'
21
 import { Card } from '../entities'
22
-import { fetchQueueByProfileId, fetchMembershipsByProfileId } from '../services'
22
+import { fetchQueueByProfileId, fetchMembershipsByProfileId, currentProfile } from '../services'
23
 import { mixins } from '../utils'
23
 import { mixins } from '../utils'
24
 
24
 
25
 /** Callback used to format incoming into card */
25
 /** Callback used to format incoming into card */
69
             }
69
             }
70
             this.loading = false
70
             this.loading = false
71
         },
71
         },
72
+        // this can be placed in utils/notification.js
73
+        notify(payload) {
74
+            this.$waveui.notify({
75
+            message: payload.timetoken,
76
+            timeout: 6000,
77
+            bgColor: 'white',
78
+            color: 'success',
79
+            dismiss: false,
80
+            shadow: true,
81
+            round: true,
82
+            sm: true,
83
+            icon: 'wi-star'
84
+        })
85
+        },
86
+        //  a way to send a message to a user for development purposes and testing
87
+        async chat()  {
88
+           const chatter = currentProfile.chatter
89
+           const res = await chatter.publish(chatter.subscriptions[0],{
90
+            title: 'New Message',
91
+            description: 'This is a new message',
92
+           })
93
+           this.notify(res)
94
+        }
72
     },
95
     },
73
 }
96
 }
74
 </script>
97
 </script>

Loading…
Откажи
Сачувај