Skip to content

Commit

Permalink
Merge pull request #70 from cryptape/rename-neuron-to-cyton
Browse files Browse the repository at this point in the history
feat: rename neuron to cyton
  • Loading branch information
Keith-CY authored Jun 21, 2019
2 parents e303e64 + 805d7bc commit 632e5a3
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 32 deletions.
8 changes: 4 additions & 4 deletions app/javascript/src/pages/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderbyList, renderBlockbyList } from '../../template/home'
import jsontable from '../../utils/jsonApi'
import { htmlBannerImg } from '../../template/home'
import bindBanner from './bannerAction'
import neuronapi from '../../utils/neuron'
import cytonapi from '../../utils/cyton'
import { bindPulldownRefresh } from './pulldownRefresh'
import { titlebarNormal } from '../../utils/tablebar'
import { trackDapplist } from '../../utils/sensors'
Expand All @@ -25,7 +25,7 @@ const bindNavigationButton = () => {
const bindSearchBar = () => {
const bar = j('#id-button-search')
bar.click((e) => {
neuronapi.openSearchPage()
cytonapi.openSearchPage()
e.stopPropagation()
})
}
Expand All @@ -46,8 +46,8 @@ const bindTrackDapplist = (container) => {

const bindLinkButtons = () => {
const container = j('#id-container-jumpButtons')
container.children('.button.openCollection').on('click', neuronapi.openCollection)
container.children('.button.openMyDapp').on('click', neuronapi.openMyDapp)
container.children('.button.openCollection').on('click', cytonapi.openCollection)
container.children('.button.openMyDapp').on('click', cytonapi.openMyDapp)
}

const renderRecommand = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import platforminfo from './platform'
import { log } from './index'

const initAndroidApi = function() {
const openSearchPage = function() {
const initAndroidApi = function () {
const openSearchPage = function () {
window.appHybrid.startAddWebsitePage()
}

const setTitlebar = function(json) {
const setTitlebar = function (json) {
window.webTitleBar.getTitleBar(json)
}

const openMyDapp = function () {
window.appHybrid.toWebCollection()
}

const openCollection = function() {
const openCollection = function () {
window.appHybrid.toErc721()
}

Expand All @@ -27,20 +26,22 @@ const initAndroidApi = function() {
return table
}

const initIosApi = function() {
const openSearchPage = function() {
const initIosApi = function () {
const openSearchPage = function () {
window.touchSearchbar()
}

const setTitlebar = function(json) {
window.webkit.messageHandlers.getTitleBar.postMessage({ body: json })
const setTitlebar = function (json) {
window.webkit.messageHandlers.getTitleBar.postMessage({
body: json
})
}

const openMyDapp = function() {
const openMyDapp = function () {
clickMyDApp()
}

const openCollection = function() {
const openCollection = function () {
clickMyCollection()
}

Expand All @@ -62,9 +63,12 @@ const initWebApi = () => {
return table
}

const initNeuronTable = () => {
let { platform, notNeuron } = platforminfo
if (notNeuron) {
const initCytonTable = () => {
let {
platform,
notCyton
} = platforminfo
if (notCyton) {
platform = null
}
const initTable = {
Expand All @@ -76,4 +80,4 @@ const initNeuronTable = () => {
return methods
}

export default initNeuronTable()
export default initCytonTable()
4 changes: 2 additions & 2 deletions app/javascript/src/utils/jsonApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import platforminfo from './platform'
const log = console.log.bind(console, '>>>')

const parsedPlatformVersion = () => {
const { platform, version, notNeuron } = platforminfo
const s = notNeuron ? '' : `${platform}_version=${version}`
const { platform, version, notCyton } = platforminfo
const s = notCyton ? '' : `${platform}_version=${version}`
return s
}

Expand Down
6 changes: 3 additions & 3 deletions app/javascript/src/utils/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const parsedUserAgent = () => {
// let str = userAgent.split('Cyton(')[1]

let str = undefined
if (userAgent.includes('Neuron(')) {
str = userAgent.split('Neuron(')[1]
if (userAgent.includes('Cyton(')) {
str = userAgent.split('Cyton(')[1]
} else {
str = userAgent.split('Cyton(')[1]
}
Expand All @@ -18,7 +18,7 @@ const parsedUserAgent = () => {
return {
platform: 'ios',
version: '0.0.0.000000',
notNeuron: true,
notCyton: true,
}
} else {
str = str.split(')')[0]
Expand Down
15 changes: 10 additions & 5 deletions app/javascript/src/utils/tablebar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import neuronMethods from './neuron'
import { log } from './index'
import cytonMethods from './cyton'
import {
log
} from './index'

/*
{
Expand Down Expand Up @@ -30,7 +32,7 @@ const titlebarNormal = () => {
},
}
const json = JSON.stringify(config)
neuronMethods.setTitlebar(json)
cytonMethods.setTitlebar(json)
}

const titlebarShow = () => {
Expand All @@ -44,7 +46,10 @@ const titlebarShow = () => {
},
}
const json = JSON.stringify(config)
neuronMethods.setTitlebar(json)
cytonMethods.setTitlebar(json)
}

export { titlebarNormal, titlebarShow }
export {
titlebarNormal,
titlebarShow
}
2 changes: 1 addition & 1 deletion app/views/dapps/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@

<div id="id-container-other">
<a class="goto" href=<%= @dapp.url_address %>><%= t("visit") %></a>
<div class="warning"><%= t("not_neuron") %></div>
<div class="warning"><%= t("not_cyton") %></div>
</div>
</div>
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

en:
visit: "Visit"
not_neuron: "You will be redirected to a third party DApp, Please go through the User Agreement and Privacy Policy of the DApp carefully."
not_cyton: "You will be redirected to a third party DApp, Please go through the User Agreement and Privacy Policy of the DApp carefully."
submitted_at: "Submitted"
developer: "Authors"
my_collectibles: "My Collectibles"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
zh-CN:
visit: "立即前往"
not_neuron: "您即将进入第三方DApp平台,该服务不由Cyton提供"
not_cyton: "您即将进入第三方DApp平台,该服务不由Cyton提供"
submitted_at: "发布时间"
developer: "开发者"
my_collectibles: "我的藏品"
Expand Down

0 comments on commit 632e5a3

Please sign in to comment.