Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Satellite-im/Satellite-Absolute
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroPronghorn committed Oct 3, 2021
2 parents 1bf5202 + 03e2df0 commit 73d81e3
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/tailored/messaging/message/reply/Reply.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div v-if="!showReplies" class="reply-preview" @click="toggleReplies">
<font-awesome-icon :icon="['far', 'plus-square']" />
&nbsp;
{{message.replies.length}} {{$tc('conversation.reply', message.replies.length)}}
{{ makeReplyText }}
</div>
<div class="reply-container" v-if="showReplies" v-for="reply in message.replies">
<div class="is-reply" @mouseenter="mouseOver(reply.id)" @mouseleave="mouseOver('')">
Expand Down
22 changes: 22 additions & 0 deletions components/tailored/messaging/message/reply/Reply.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ export default Vue.extend({
data() {
return { showReplies: false, replyHover: '' }
},
computed: {
/**
* makeReplyText: generates the "Replies from _____" text in a chat
* depending on the number of users in the reply thread, it will generate a different replyText
*/
makeReplyText() {
const replyLength = Object.keys(this.$props.message.replies).length
let baseReply = replyLength > 1 ? "Replies from " : "Reply from "
const firstName = this.$mock.users.filter((u: any) => u.address === this.$props.message.replies[0].from)[0].name
const secondName = replyLength > 1 ? this.$mock.users.filter((u: any) => u.address === this.$props.message.replies[1].from)[0].name : ""
if (replyLength === 1) {
baseReply += firstName
} else if (replyLength === 2) {
baseReply += firstName + " and " + secondName
} else {
baseReply += firstName + ", " + secondName + ", and " + (replyLength - 2) + " more ..."
}
return baseReply
}
},
methods: {
mouseOver(replyId: string) {
this.$data.replyHover = replyId
Expand Down
6 changes: 4 additions & 2 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const Config = {
// Keep in sync with Sounds enum in SoundManager.ts
sounds: {
doesLoop: ['call'],
newMessage: 'QmSkZGMEJGDgsq1X3p72Rp9QScjHa2AoWRkMcSve4CmQS4/Notification.ogg',
newMessage:
'QmSkZGMEJGDgsq1X3p72Rp9QScjHa2AoWRkMcSve4CmQS4/Notification.ogg',
call: 'QmSSLAFWdneYGBfX2JK7bJNhgpcLbeCABZXLHp1rEsAdaF',
hangup: 'QmSkZGMEJGDgsq1X3p72Rp9QScjHa2AoWRkMcSve4CmQS4/Unused.ogg',
mute: 'QmSkZGMEJGDgsq1X3p72Rp9QScjHa2AoWRkMcSve4CmQS4/Mute.ogg',
Expand All @@ -35,6 +36,7 @@ export const Config = {
],
},
solana: {
customFaucet: 'http://faucet.satellite.one:3000',
network: 'devnet',
serverProgramId: 'FGdpP9RSN3ZE8d1PXxiBXS8ThCsXdi342KmDwqSQ3ZBz',
friendsProgramId: 'BxX6o2HG5DWrJt2v8GMSWNG2V2NtxNbAUF3wdE5Ao5gS',
Expand Down Expand Up @@ -62,7 +64,7 @@ export const Config = {
id: 'algorand',
nickname: 'Penumbra',
disabled: true,
}
},
],
badges: {
verified: {
Expand Down
31 changes: 27 additions & 4 deletions libraries/Solana/SolanaManager/SolanaManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,33 @@ export default class SolanaManager {
*/
async requestAirdrop() {
if (this.payerAccount) {
const signature = await this.connection.requestAirdrop(
this.payerAccount?.publicKey,
1000000000
)
let signature

if (Config.solana.customFaucet !== '') {
const result = await fetch(Config.solana.customFaucet, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
address: this.payerAccount?.publicKey.toBase58(),
}),
})

const jsonResult = await result.json()

if (jsonResult.status === 'success') {
signature = jsonResult.transactionSignature
} else {
return null
}
} else {
signature = await this.connection.requestAirdrop(
this.payerAccount?.publicKey,
1000000000
)
}

return this.connection.confirmTransaction(
signature,
Config.solana.defaultCommitment
Expand Down
17 changes: 17 additions & 0 deletions mock/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,23 @@ export const Messages = [
payload: 'This is a message reply',
reactions: [],
},
{
id: '02-432-338',
from: '0xdc76cd25977e0a5ae17155770273ad58648913d3',
to: '00-00-03',
type: 'text',
at: 1620515563000,
payload: 'This is a message reply 3',
reactions: [],
}, {
id: '02-432-338',
from: '0x9bf4001d307dfd62b26a2f1307ee0c0307632d59',
to: '00-00-03',
type: 'text',
at: 1620515563000,
payload: 'This is a message reply 4',
reactions: [],
},
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default Vue.extend({
right: 0;
bottom: 0;
overflow: hidden;
.loader-container {
min-width: 250px;
align-self: center;
Expand Down

0 comments on commit 73d81e3

Please sign in to comment.