refactor: removed sponsorship prompt

This commit is contained in:
Liyas Thomas
2021-01-16 17:00:03 +05:30
parent bf0bcf2f72
commit ed20b009a5

View File

@@ -222,69 +222,68 @@ export default {
}) })
} }
let showAd = localStorage.getItem("showAd") === "no" // let showAd = localStorage.getItem("showAd") === "no"
if (!showAd) { // if (!showAd) {
setTimeout(() => { // setTimeout(() => {
this.$toast.clear() // this.$toast.clear()
this.$toast.show( // this.$toast.show(
"<span><a href='https://github.com/sponsors/hoppscotch' target='_blank' rel='noopener'>Sponsor us to support Hoppscotch open source project 💖</a><br><sub>Whoosh this away to dismiss.</sub></span>", // "<span><a href='https://github.com/sponsors/hoppscotch' target='_blank' rel='noopener'>Sponsor us to support Hoppscotch open source project 💖</a><br><sub>Whoosh this away to dismiss.</sub></span>",
{ // {
icon: "", // icon: "",
duration: 0, // duration: 0,
theme: "toasted-ad", // theme: "toasted-ad",
action: [ // action: [
{ // {
text: "Sponsor", // text: "Sponsor",
icon: "chevron_right", // icon: "chevron_right",
onClick: (e, toastObject) => { // onClick: (e, toastObject) => {
localStorage.setItem("showAd", "no") // localStorage.setItem("showAd", "no")
toastObject.goAway(0) // toastObject.goAway(0)
window.open("https://github.com/sponsors/hoppscotch") // window.open("https://github.com/sponsors/hoppscotch")
}, // },
}, // },
], // ],
onComplete() { // onComplete() {
localStorage.setItem("showAd", "no") // localStorage.setItem("showAd", "no")
}, // },
} // }
) // )
}, 8000) // }, 8000)
} // }
let showExtensionsToast = localStorage.getItem("showExtensionsToast") === "yes" // let showExtensionsToast = localStorage.getItem("showExtensionsToast") === "yes"
// Just return if showExtensionsToast is "no" // if (!showExtensionsToast) {
if (!showExtensionsToast) return // setTimeout(() => {
// if (!hasExtensionInstalled()) {
setTimeout(() => { // this.$toast.show(this.$t("extensions_info2"), {
if (!hasExtensionInstalled()) { // icon: "extension",
this.$toast.show(this.$t("extensions_info2"), { // duration: 5000,
icon: "extension", // theme: "toasted-primary",
duration: 5000, // action: [
theme: "toasted-primary", // {
action: [ // text: this.$t("yes"),
{ // onClick: (e, toastObject) => {
text: this.$t("yes"), // this.showExtensions = true
onClick: (e, toastObject) => { // localStorage.setItem("showExtensionsToast", "yes")
this.showExtensions = true // toastObject.goAway(0)
localStorage.setItem("showExtensionsToast", "yes") // },
toastObject.goAway(0) // },
}, // {
}, // text: this.$t("no"),
{ // onClick: (e, toastObject) => {
text: this.$t("no"), // this.$store.commit("setMiscState", {
onClick: (e, toastObject) => { // value: false,
this.$store.commit("setMiscState", { // attribute: "showExtensionsToast",
value: false, // })
attribute: "showExtensionsToast", // localStorage.setItem("showExtensionsToast", "no")
}) // toastObject.goAway(0)
localStorage.setItem("showExtensionsToast", "no") // },
toastObject.goAway(0) // },
}, // ],
}, // })
], // }
}) // }, 5000)
} // }
}, 5000)
}, },
methods: { methods: {
nativeShare() { nativeShare() {