Skip to content

Commit

Permalink
Changed swipe right message to reference kittie name rather than ID
Browse files Browse the repository at this point in the history
  • Loading branch information
vince0656 committed Nov 28, 2019
1 parent c4edc0d commit 4115a7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/Firebase/CryptoKitties/KittiesService.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ export default new class KittiesService {
});
}

async swipeRight(network, kittieId, studId, studImg, message, from) {
const payload = {msg: message, from, stud: studId, studImg, status: 'PENDING'};
async swipeRight(network, kittieId, stud, msg, from) {
const payload = {msg, from, stud, status: 'PENDING'};
return db.collection('kitties')
.doc('network')
.collection(network)
.doc(kittieId)
.collection('swipeRight')
.doc(studId)
.doc(stud.id)
.set(payload, {
merge: true
});
Expand Down
18 changes: 11 additions & 7 deletions src/components/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@
console.log(`poke [[${pokeId}]] to kittie ${kittieId}`);
},
swipeRight: async function (kittieId) {
const stud = this.kitties.userSelected;
const studImg = this.kitties.user.filter(kittie => kittie.id.toString() === stud)[0].image_url_png;
console.log('studImg', studImg);
const msg = `Hello treakle, want to breed with ${stud}?`;
await KittiesService.swipeRight('mainnet', kittieId, stud, studImg, msg, '0x401cBf2194D35D078c0BcdAe4BeA42275483ab5F'.toLowerCase());
console.log(`swipe right from ${stud} to ${kittieId}`);
const studId = this.kitties.userSelected;
const {image_url_png, name} = this.kitties.user.filter(kittie => kittie.id.toString() === studId)[0];
const studPayload = {
id: studId,
studImg: image_url_png,
name
};
const msg = `Want to breed with ${studPayload.name}?`;
await KittiesService.swipeRight('mainnet', kittieId, studPayload, msg, '0x401cBf2194D35D078c0BcdAe4BeA42275483ab5F'.toLowerCase());
console.log(`swipe right from ${studPayload.id} to ${kittieId}`);
},
acceptRight: async function (kittieId, studId) {
await KittiesService.matchKitties('mainnet', studId, kittieId);
Expand Down

0 comments on commit 4115a7e

Please sign in to comment.