aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2019-04-02 09:03:54 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2019-04-02 09:03:54 +0800
commita46ec83c9b258a3aed65e1ef08769300c01ca13b (patch)
treea48f7ddb8635ffbb024ff755d1865686c8a0ab27
parent4055dc3475cb743e540766a8a8c704bb2b807502 (diff)
downloadtangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.tar
tangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.tar.gz
tangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.tar.bz2
tangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.tar.lz
tangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.tar.xz
tangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.tar.zst
tangerine-wallet-browser-a46ec83c9b258a3aed65e1ef08769300c01ca13b.zip
Remove NoticeController (#6382)
-rw-r--r--app/scripts/background.js1
-rw-r--r--app/scripts/metamask-controller.js16
-rw-r--r--app/scripts/migrations/033.js32
-rw-r--r--app/scripts/migrations/index.js2
-rw-r--r--app/scripts/notice-controller.js112
-rw-r--r--notices/README.md5
-rw-r--r--notices/archive/notice_0.md179
-rw-r--r--notices/archive/notice_2.md6
-rw-r--r--notices/archive/notice_3.md11
-rw-r--r--notices/archive/notice_4.md5
-rw-r--r--notices/notices.js35
-rw-r--r--test/unit/app/controllers/notice-controller-test.js92
-rw-r--r--test/unit/migrations/033-test.js40
-rw-r--r--test/unit/ui/app/actions.spec.js54
-rw-r--r--test/unit/ui/app/reducers/app.spec.js9
-rw-r--r--test/unit/ui/app/reducers/metamask.spec.js43
-rw-r--r--ui/app/components/app/notice.js138
-rw-r--r--ui/app/components/app/send/tests/send-selectors-test-data.js1
-rw-r--r--ui/app/ducks/app/app.js6
-rw-r--r--ui/app/ducks/metamask/metamask.js14
-rw-r--r--ui/app/helpers/constants/routes.js4
-rw-r--r--ui/app/pages/home/home.container.js2
-rw-r--r--ui/app/pages/notice/notice.js203
-rw-r--r--ui/app/pages/routes/index.js10
-rw-r--r--ui/app/store/actions.js57
25 files changed, 77 insertions, 1000 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 7fea3c8c6..cca0d4709 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -106,7 +106,6 @@ setupMetamaskMeshMetrics()
* @property {string} rpcTarget - DEPRECATED - The URL of the current RPC provider.
* @property {Object} identities - An object matching lower-case hex addresses to Identity objects with "address" and "name" (nickname) keys.
* @property {Object} unapprovedTxs - An object mapping transaction hashes to unapproved transactions.
- * @property {boolean} noActiveNotices - False if there are notices the user should confirm before using the application.
* @property {Array} frequentRpcList - A list of frequently used RPCs, including custom user-provided ones.
* @property {Array} addressBook - A list of previously sent to addresses.
* @property {address} selectedTokenAddress - Used to indicate if a token is globally selected. Should be deprecated in favor of UI-centric token selection.
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 058d527c0..4108ed4c0 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -24,7 +24,6 @@ const KeyringController = require('eth-keyring-controller')
const NetworkController = require('./controllers/network')
const PreferencesController = require('./controllers/preferences')
const CurrencyController = require('./controllers/currency')
-const NoticeController = require('./notice-controller')
const ShapeShiftController = require('./controllers/shapeshift')
const InfuraController = require('./controllers/infura')
const BlacklistController = require('./controllers/blacklist')
@@ -211,13 +210,6 @@ module.exports = class MetamaskController extends EventEmitter {
})
this.balancesController.updateAllBalances()
- // notices
- this.noticeController = new NoticeController({
- initState: initState.NoticeController,
- version,
- firstVersion: initState.firstTimeInfo.version,
- })
-
this.shapeshiftController = new ShapeShiftController({
initState: initState.ShapeShiftController,
})
@@ -243,7 +235,6 @@ module.exports = class MetamaskController extends EventEmitter {
PreferencesController: this.preferencesController.store,
AddressBookController: this.addressBookController,
CurrencyController: this.currencyController.store,
- NoticeController: this.noticeController.store,
ShapeShiftController: this.shapeshiftController.store,
NetworkController: this.networkController.store,
InfuraController: this.infuraController.store,
@@ -265,7 +256,6 @@ module.exports = class MetamaskController extends EventEmitter {
RecentBlocksController: this.recentBlocksController.store,
AddressBookController: this.addressBookController,
CurrencyController: this.currencyController.store,
- NoticeController: this.noticeController.memStore,
ShapeshiftController: this.shapeshiftController.store,
InfuraController: this.infuraController.store,
ProviderApprovalController: this.providerApprovalController.store,
@@ -371,7 +361,6 @@ module.exports = class MetamaskController extends EventEmitter {
const keyringController = this.keyringController
const preferencesController = this.preferencesController
const txController = this.txController
- const noticeController = this.noticeController
const networkController = this.networkController
const providerApprovalController = this.providerApprovalController
@@ -470,11 +459,6 @@ module.exports = class MetamaskController extends EventEmitter {
signTypedMessage: nodeify(this.signTypedMessage, this),
cancelTypedMessage: this.cancelTypedMessage.bind(this),
- // notices
- checkNotices: noticeController.updateNoticesList.bind(noticeController),
- markNoticeRead: noticeController.markNoticeRead.bind(noticeController),
- markAllNoticesRead: nodeify(noticeController.markAllNoticesRead, noticeController),
-
approveProviderRequest: providerApprovalController.approveProviderRequest.bind(providerApprovalController),
clearApprovedOrigins: providerApprovalController.clearApprovedOrigins.bind(providerApprovalController),
rejectProviderRequest: providerApprovalController.rejectProviderRequest.bind(providerApprovalController),
diff --git a/app/scripts/migrations/033.js b/app/scripts/migrations/033.js
new file mode 100644
index 000000000..3abb2593e
--- /dev/null
+++ b/app/scripts/migrations/033.js
@@ -0,0 +1,32 @@
+// next version number
+const version = 33
+
+/*
+
+Cleans up notices and assocated notice controller code
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: async function (originalVersionedData) {
+ const versionedData = clone(originalVersionedData)
+ versionedData.meta.version = version
+ const state = versionedData.data
+ const newState = transformState(state)
+ versionedData.data = newState
+ return versionedData
+ },
+}
+
+function transformState (state) {
+ const newState = state
+ // transform state here
+ if (state.NoticeController) {
+ delete newState.NoticeController
+ }
+ return newState
+}
diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js
index eb1b51685..be3328bad 100644
--- a/app/scripts/migrations/index.js
+++ b/app/scripts/migrations/index.js
@@ -42,4 +42,6 @@ module.exports = [
require('./029'),
require('./030'),
require('./031'),
+ require('./032'),
+ require('./033'),
]
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js
deleted file mode 100644
index 63b422c5b..000000000
--- a/app/scripts/notice-controller.js
+++ /dev/null
@@ -1,112 +0,0 @@
-const {EventEmitter} = require('events')
-const semver = require('semver')
-const extend = require('xtend')
-const ObservableStore = require('obs-store')
-const hardCodedNotices = require('../../notices/notices.js')
-const uniqBy = require('lodash.uniqby')
-
-module.exports = class NoticeController extends EventEmitter {
-
- constructor (opts = {}) {
- super()
- this.noticePoller = null
- this.firstVersion = opts.firstVersion
- this.version = opts.version
- const initState = extend({
- noticesList: [],
- }, opts.initState)
- this.store = new ObservableStore(initState)
- // setup memStore
- this.memStore = new ObservableStore({})
- this.store.subscribe(() => this._updateMemstore())
- this._updateMemstore()
- // pull in latest notices
- this.updateNoticesList()
- }
-
- getNoticesList () {
- return this.store.getState().noticesList
- }
-
- getUnreadNotices () {
- const notices = this.getNoticesList()
- return notices.filter((notice) => notice.read === false)
- }
-
- getNextUnreadNotice () {
- const unreadNotices = this.getUnreadNotices()
- return unreadNotices[0]
- }
-
- async setNoticesList (noticesList) {
- this.store.updateState({ noticesList })
- return true
- }
-
- markNoticeRead (noticeToMark, cb) {
- cb = cb || function (err) { if (err) throw err }
- try {
- const notices = this.getNoticesList()
- const index = notices.findIndex((currentNotice) => currentNotice.id === noticeToMark.id)
- notices[index].read = true
- notices[index].body = ''
- this.setNoticesList(notices)
- const latestNotice = this.getNextUnreadNotice()
- cb(null, latestNotice)
- } catch (err) {
- cb(err)
- }
- }
-
- markAllNoticesRead () {
- const noticeList = this.getNoticesList()
- noticeList.forEach(notice => {
- notice.read = true
- notice.body = ''
- })
- this.setNoticesList(noticeList)
- const latestNotice = this.getNextUnreadNotice()
- return latestNotice
- }
-
-
- async updateNoticesList () {
- const newNotices = await this._retrieveNoticeData()
- const oldNotices = this.getNoticesList()
- const combinedNotices = this._mergeNotices(oldNotices, newNotices)
- const filteredNotices = this._filterNotices(combinedNotices)
- const result = this.setNoticesList(filteredNotices)
- this._updateMemstore()
- return result
- }
-
- _mergeNotices (oldNotices, newNotices) {
- return uniqBy(oldNotices.concat(newNotices), 'id')
- }
-
- _filterNotices (notices) {
- return notices.filter((newNotice) => {
- if ('version' in newNotice) {
- const satisfied = semver.satisfies(this.version, newNotice.version)
- return satisfied
- }
- if ('firstVersion' in newNotice) {
- const satisfied = semver.satisfies(this.firstVersion, newNotice.firstVersion)
- return satisfied
- }
- return true
- })
- }
-
- async _retrieveNoticeData () {
- // Placeholder for remote notice API.
- return hardCodedNotices
- }
-
- _updateMemstore () {
- const nextUnreadNotice = this.getNextUnreadNotice()
- const noActiveNotices = !nextUnreadNotice
- this.memStore.updateState({ nextUnreadNotice, noActiveNotices })
- }
-
-}
diff --git a/notices/README.md b/notices/README.md
deleted file mode 100644
index 9362769c2..000000000
--- a/notices/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Notices
-
-Those notices are of legal nature. They are displayed to the users of MetaMask.
-
-Any changes or additions must be reviewed by the product management. \ No newline at end of file
diff --git a/notices/archive/notice_0.md b/notices/archive/notice_0.md
deleted file mode 100644
index c485edd1d..000000000
--- a/notices/archive/notice_0.md
+++ /dev/null
@@ -1,179 +0,0 @@
-# Terms of Use #
-
-**THIS AGREEMENT IS SUBJECT TO BINDING ARBITRATION AND A WAIVER OF CLASS ACTION RIGHTS AS DETAILED IN SECTION 13. PLEASE READ THE AGREEMENT CAREFULLY.**
-
-_Our Terms of Use have been updated as of September 5, 2016_
-
-## 1. Acceptance of Terms ##
-
-MetaMask provides a platform for managing Ethereum (or "ETH") accounts, and allowing ordinary websites to interact with the Ethereum blockchain, while keeping the user in control over what transactions they approve, through our website located at[ ](http://metamask.io)[https://metamask.io/](https://metamask.io/) and browser plugin (the "Site") — which includes text, images, audio, code and other materials (collectively, the “Content”) and all of the features, and services provided. The Site, and any other features, tools, materials, or other services offered from time to time by MetaMask are referred to here as the “Service.” Please read these Terms of Use (the “Terms” or “Terms of Use”) carefully before using the Service. By using or otherwise accessing the Services, or clicking to accept or agree to these Terms where that option is made available, you (1) accept and agree to these Terms (2) consent to the collection, use, disclosure and other handling of information as described in our Privacy Policy and (3) any additional terms, rules and conditions of participation issued by MetaMask from time to time. If you do not agree to the Terms, then you may not access or use the Content or Services.
-
-## 2. Modification of Terms of Use ##
-
-Except for Section 13, providing for binding arbitration and waiver of class action rights, MetaMask reserves the right, at its sole discretion, to modify or replace the Terms of Use at any time. The most current version of these Terms will be posted on our Site. You shall be responsible for reviewing and becoming familiar with any such modifications. Use of the Services by you after any modification to the Terms constitutes your acceptance of the Terms of Use as modified.
-
-
-
-## 3. Eligibility ##
-
-You hereby represent and warrant that you are fully able and competent to enter into the terms, conditions, obligations, affirmations, representations and warranties set forth in these Terms and to abide by and comply with these Terms.
-
-MetaMask is a global platform and by accessing the Content or Services, you are representing and warranting that, you are of the legal age of majority in your jurisdiction as is required to access such Services and Content and enter into arrangements as provided by the Service. You further represent that you are otherwise legally permitted to use the service in your jurisdiction including owning cryptographic tokens of value, and interacting with the Services or Content in any way. You further represent you are responsible for ensuring compliance with the laws of your jurisdiction and acknowledge that MetaMask is not liable for your compliance with such laws.
-
-## 4 Account Password and Security ##
-
-When setting up an account within MetaMask, you will be responsible for keeping your own account secrets, which may be a twelve-word seed phrase, an account file, or other locally stored secret information. MetaMask encrypts this information locally with a password you provide, that we never send to our servers. You agree to (a) never use the same password for MetaMask that you have ever used outside of this service; (b) keep your secret information and password confidential and do not share them with anyone else; (c) immediately notify MetaMask of any unauthorized use of your account or breach of security. MetaMask cannot and will not be liable for any loss or damage arising from your failure to comply with this section.
-
-## 5. Representations, Warranties, and Risks ##
-
-### 5.1. Warranty Disclaimer ###
-
-You expressly understand and agree that your use of the Service is at your sole risk. The Service (including the Service and the Content) are provided on an "AS IS" and "as available" basis, without warranties of any kind, either express or implied, including, without limitation, implied warranties of merchantability, fitness for a particular purpose or non-infringement. You acknowledge that MetaMask has no control over, and no duty to take any action regarding: which users gain access to or use the Service; what effects the Content may have on you; how you may interpret or use the Content; or what actions you may take as a result of having been exposed to the Content. You release MetaMask from all liability for you having acquired or not acquired Content through the Service. MetaMask makes no representations concerning any Content contained in or accessed through the Service, and MetaMask will not be responsible or liable for the accuracy, copyright compliance, legality or decency of material contained in or accessed through the Service.
-
-### 5.2 Sophistication and Risk of Cryptographic Systems ###
-
-By utilizing the Service or interacting with the Content or platform in any way, you represent that you understand the inherent risks associated with cryptographic systems; and warrant that you have an understanding of the usage and intricacies of native cryptographic tokens, like Ether (ETH) and Bitcoin (BTC), smart contract based tokens such as those that follow the Ethereum Token Standard (https://github.com/ethereum/EIPs/issues/20), and blockchain-based software systems.
-
-### 5.3 Risk of Regulatory Actions in One or More Jurisdictions ###
-
-MetaMask and ETH could be impacted by one or more regulatory inquiries or regulatory action, which could impede or limit the ability of MetaMask to continue to develop, or which could impede or limit your ability to access or use the Service or Ethereum blockchain.
-
-### 5.4 Risk of Weaknesses or Exploits in the Field of Cryptography ###
-
-You acknowledge and understand that Cryptography is a progressing field. Advances in code cracking or technical advances such as the development of quantum computers may present risks to cryptocurrencies and Services of Content, which could result in the theft or loss of your cryptographic tokens or property. To the extent possible, MetaMask intends to update the protocol underlying Services to account for any advances in cryptography and to incorporate additional security measures, but does not guarantee or otherwise represent full security of the system. By using the Service or accessing Content, you acknowledge these inherent risks.
-
-### 5.5 Volatility of Crypto Currencies ###
-
-You understand that Ethereum and other blockchain technologies and associated currencies or tokens are highly volatile due to many factors including but not limited to adoption, speculation, technology and security risks. You also acknowledge that the cost of transacting on such technologies is variable and may increase at any time causing impact to any activities taking place on the Ethereum blockchain. You acknowledge these risks and represent that MetaMask cannot be held liable for such fluctuations or increased costs.
-
-### 5.6 Application Security ###
-
-You acknowledge that Ethereum applications are code subject to flaws and acknowledge that you are solely responsible for evaluating any code provided by the Services or Content and the trustworthiness of any third-party websites, products, smart-contracts, or Content you access or use through the Service. You further expressly acknowledge and represent that Ethereum applications can be written maliciously or negligently, that MetaMask cannot be held liable for your interaction with such applications and that such applications may cause the loss of property or even identity. This warning and others later provided by MetaMask in no way evidence or represent an on-going duty to alert you to all of the potential risks of utilizing the Service or Content.
-
-## 6. Indemnity ##
-
-You agree to release and to indemnify, defend and hold harmless MetaMask and its parents, subsidiaries, affiliates and agencies, as well as the officers, directors, employees, shareholders and representatives of any of the foregoing entities, from and against any and all losses, liabilities, expenses, damages, costs (including attorneys’ fees and court costs) claims or actions of any kind whatsoever arising or resulting from your use of the Service, your violation of these Terms of Use, and any of your acts or omissions that implicate publicity rights, defamation or invasion of privacy. MetaMask reserves the right, at its own expense, to assume exclusive defense and control of any matter otherwise subject to indemnification by you and, in such case, you agree to cooperate with MetaMask in the defense of such matter.
-
-## 7. Limitation on liability ##
-
-YOU ACKNOWLEDGE AND AGREE THAT YOU ASSUME FULL RESPONSIBILITY FOR YOUR USE OF THE SITE AND SERVICE. YOU ACKNOWLEDGE AND AGREE THAT ANY INFORMATION YOU SEND OR RECEIVE DURING YOUR USE OF THE SITE AND SERVICE MAY NOT BE SECURE AND MAY BE INTERCEPTED OR LATER ACQUIRED BY UNAUTHORIZED PARTIES. YOU ACKNOWLEDGE AND AGREE THAT YOUR USE OF THE SITE AND SERVICE IS AT YOUR OWN RISK. RECOGNIZING SUCH, YOU UNDERSTAND AND AGREE THAT, TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, NEITHER METAMASK NOR ITS SUPPLIERS OR LICENSORS WILL BE LIABLE TO YOU FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY OR OTHER DAMAGES OF ANY KIND, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER TANGIBLE OR INTANGIBLE LOSSES OR ANY OTHER DAMAGES BASED ON CONTRACT, TORT, STRICT LIABILITY OR ANY OTHER THEORY (EVEN IF METAMASK HAD BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES), RESULTING FROM THE SITE OR SERVICE; THE USE OR THE INABILITY TO USE THE SITE OR SERVICE; UNAUTHORIZED ACCESS TO OR ALTERATION OF YOUR TRANSMISSIONS OR DATA; STATEMENTS OR CONDUCT OF ANY THIRD PARTY ON THE SITE OR SERVICE; ANY ACTIONS WE TAKE OR FAIL TO TAKE AS A RESULT OF COMMUNICATIONS YOU SEND TO US; HUMAN ERRORS; TECHNICAL MALFUNCTIONS; FAILURES, INCLUDING PUBLIC UTILITY OR TELEPHONE OUTAGES; OMISSIONS, INTERRUPTIONS, LATENCY, DELETIONS OR DEFECTS OF ANY DEVICE OR NETWORK, PROVIDERS, OR SOFTWARE (INCLUDING, BUT NOT LIMITED TO, THOSE THAT DO NOT PERMIT PARTICIPATION IN THE SERVICE); ANY INJURY OR DAMAGE TO COMPUTER EQUIPMENT; INABILITY TO FULLY ACCESS THE SITE OR SERVICE OR ANY OTHER WEBSITE; THEFT, TAMPERING, DESTRUCTION, OR UNAUTHORIZED ACCESS TO, IMAGES OR OTHER CONTENT OF ANY KIND; DATA THAT IS PROCESSED LATE OR INCORRECTLY OR IS INCOMPLETE OR LOST; TYPOGRAPHICAL, PRINTING OR OTHER ERRORS, OR ANY COMBINATION THEREOF; OR ANY OTHER MATTER RELATING TO THE SITE OR SERVICE.
-
-SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES. ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
-
-## 8. Our Proprietary Rights ##
-
-All title, ownership and intellectual property rights in and to the Service are owned by MetaMask or its licensors. You acknowledge and agree that the Service contains proprietary and confidential information that is protected by applicable intellectual property and other laws. Except as expressly authorized by MetaMask, you agree not to copy, modify, rent, lease, loan, sell, distribute, perform, display or create derivative works based on the Service, in whole or in part. MetaMask issues a license for MetaMask, found [here](https://github.com/MetaMask/metamask-plugin/blob/master/LICENSE). For information on other licenses utilized in the development of MetaMask, please see our attribution page at: [https://metamask.io/attributions.html](https://metamask.io/attributions.html)
-
-## 9. Links ##
-
-The Service provides, or third parties may provide, links to other World Wide Web or accessible sites, applications or resources. Because MetaMask has no control over such sites, applications and resources, you acknowledge and agree that MetaMask is not responsible for the availability of such external sites, applications or resources, and does not endorse and is not responsible or liable for any content, advertising, products or other materials on or available from such sites or resources. You further acknowledge and agree that MetaMask shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.
-
-## 10. Termination and Suspension ##
-
-MetaMask may terminate or suspend all or part of the Service and your MetaMask access immediately, without prior notice or liability, if you breach any of the terms or conditions of the Terms. Upon termination of your access, your right to use the Service will immediately cease.
-
-The following provisions of the Terms survive any termination of these Terms: INDEMNITY; WARRANTY DISCLAIMERS; LIMITATION ON LIABILITY; OUR PROPRIETARY RIGHTS; LINKS; TERMINATION; NO THIRD PARTY BENEFICIARIES; BINDING ARBITRATION AND CLASS ACTION WAIVER; GENERAL INFORMATION.
-
-## 11. No Third Party Beneficiaries ##
-
-You agree that, except as otherwise expressly provided in these Terms, there shall be no third party beneficiaries to the Terms.
-
-## 12. Notice and Procedure For Making Claims of Copyright Infringement ##
-
-If you believe that your copyright or the copyright of a person on whose behalf you are authorized to act has been infringed, please provide MetaMask’s Copyright Agent a written Notice containing the following information:
-
-· an electronic or physical signature of the person authorized to act on behalf of the owner of the copyright or other intellectual property interest;
-
-· a description of the copyrighted work or other intellectual property that you claim has been infringed;
-
-· a description of where the material that you claim is infringing is located on the Service;
-
-· your address, telephone number, and email address;
-
-· a statement by you that you have a good faith belief that the disputed use is not authorized by the copyright owner, its agent, or the law;
-
-· a statement by you, made under penalty of perjury, that the above information in your Notice is accurate and that you are the copyright or intellectual property owner or authorized to act on the copyright or intellectual property owner's behalf.
-
-MetaMask’s Copyright Agent can be reached at:
-
-Email: copyright [at] metamask [dot] io
-
-Mail:
-
-Attention:
-
-MetaMask Copyright ℅ ConsenSys
-
-49 Bogart Street
-
-Brooklyn, NY 11206
-
-## 13. Binding Arbitration and Class Action Waiver ##
-
-PLEASE READ THIS SECTION CAREFULLY – IT MAY SIGNIFICANTLY AFFECT YOUR LEGAL RIGHTS, INCLUDING YOUR RIGHT TO FILE A LAWSUIT IN COURT
-
-### 13.1 Initial Dispute Resolution ###
-
-The parties shall use their best efforts to engage directly to settle any dispute, claim, question, or disagreement and engage in good faith negotiations which shall be a condition to either party initiating a lawsuit or arbitration.
-
-### 13.2 Binding Arbitration ###
-
-If the parties do not reach an agreed upon solution within a period of 30 days from the time informal dispute resolution under the Initial Dispute Resolution provision begins, then either party may initiate binding arbitration as the sole means to resolve claims, subject to the terms set forth below. Specifically, all claims arising out of or relating to these Terms (including their formation, performance and breach), the parties’ relationship with each other and/or your use of the Service shall be finally settled by binding arbitration administered by the American Arbitration Association in accordance with the provisions of its Commercial Arbitration Rules and the supplementary procedures for consumer related disputes of the American Arbitration Association (the "AAA"), excluding any rules or procedures governing or permitting class actions.
-
-The arbitrator, and not any federal, state or local court or agency, shall have exclusive authority to resolve all disputes arising out of or relating to the interpretation, applicability, enforceability or formation of these Terms, including, but not limited to any claim that all or any part of these Terms are void or voidable, or whether a claim is subject to arbitration. The arbitrator shall be empowered to grant whatever relief would be available in a court under law or in equity. The arbitrator’s award shall be written, and binding on the parties and may be entered as a judgment in any court of competent jurisdiction.
-
-The parties understand that, absent this mandatory provision, they would have the right to sue in court and have a jury trial. They further understand that, in some instances, the costs of arbitration could exceed the costs of litigation and the right to discovery may be more limited in arbitration than in court.
-
-### 13.3 Location ###
-
-Binding arbitration shall take place in New York. You agree to submit to the personal jurisdiction of any federal or state court in New York County, New York, in order to compel arbitration, to stay proceedings pending arbitration, or to confirm, modify, vacate or enter judgment on the award entered by the arbitrator.
-
-### 13.4 Class Action Waiver ###
-
-The parties further agree that any arbitration shall be conducted in their individual capacities only and not as a class action or other representative action, and the parties expressly waive their right to file a class action or seek relief on a class basis. YOU AND METAMASK AGREE THAT EACH MAY BRING CLAIMS AGAINST THE OTHER ONLY IN YOUR OR ITS INDIVIDUAL CAPACITY, AND NOT AS A PLAINTIFF OR CLASS MEMBER IN ANY PURPORTED CLASS OR REPRESENTATIVE PROCEEDING. If any court or arbitrator determines that the class action waiver set forth in this paragraph is void or unenforceable for any reason or that an arbitration can proceed on a class basis, then the arbitration provision set forth above shall be deemed null and void in its entirety and the parties shall be deemed to have not agreed to arbitrate disputes.
-
-### 13.5 Exception - Litigation of Intellectual Property and Small Claims Court Claims ###
-
-Notwithstanding the parties' decision to resolve all disputes through arbitration, either party may bring an action in state or federal court to protect its intellectual property rights ("intellectual property rights" means patents, copyrights, moral rights, trademarks, and trade secrets, but not privacy or publicity rights). Either party may also seek relief in a small claims court for disputes or claims within the scope of that court’s jurisdiction.
-
-### 13.6 30-Day Right to Opt Out ###
-
-You have the right to opt-out and not be bound by the arbitration and class action waiver provisions set forth above by sending written notice of your decision to opt-out to the following address: MetaMask ℅ ConsenSys, 49 Bogart Street, Brooklyn NY 11206 and via email at support@metamask.io. The notice must be sent within 30 days of September 6, 2016 or your first use of the Service, whichever is later, otherwise you shall be bound to arbitrate disputes in accordance with the terms of those paragraphs. If you opt-out of these arbitration provisions, MetaMask also will not be bound by them.
-
-### 13.7 Changes to This Section ###
-
-MetaMask will provide 60-days’ notice of any changes to this section. Changes will become effective on the 60th day, and will apply prospectively only to any claims arising after the 60th day.
-
-For any dispute not subject to arbitration you and MetaMask agree to submit to the personal and exclusive jurisdiction of and venue in the federal and state courts located in New York, New York. You further agree to accept service of process by mail, and hereby waive any and all jurisdictional and venue defenses otherwise available.
-
-The Terms and the relationship between you and MetaMask shall be governed by the laws of the State of New York without regard to conflict of law provisions.
-
-## 14. General Information ##
-
-### 14.1 Entire Agreement ###
-
-These Terms (and any additional terms, rules and conditions of participation that MetaMask may post on the Service) constitute the entire agreement between you and MetaMask with respect to the Service and supersedes any prior agreements, oral or written, between you and MetaMask. In the event of a conflict between these Terms and the additional terms, rules and conditions of participation, the latter will prevail over the Terms to the extent of the conflict.
-
-### 14.2 Waiver and Severability of Terms ###
-
-The failure of MetaMask to exercise or enforce any right or provision of the Terms shall not constitute a waiver of such right or provision. If any provision of the Terms is found by an arbitrator or court of competent jurisdiction to be invalid, the parties nevertheless agree that the arbitrator or court should endeavor to give effect to the parties' intentions as reflected in the provision, and the other provisions of the Terms remain in full force and effect.
-
-### 14.3 Statute of Limitations ###
-
-You agree that regardless of any statute or law to the contrary, any claim or cause of action arising out of or related to the use of the Service or the Terms must be filed within one (1) year after such claim or cause of action arose or be forever barred.
-
-### 14.4 Section Titles ###
-
-The section titles in the Terms are for convenience only and have no legal or contractual effect.
-
-### 14.5 Communications ###
-
-Users with questions, complaints or claims with respect to the Service may contact us using the relevant contact information set forth above and at communications@metamask.io.
-
-## 15 Related Links ##
-
-**[Terms of Use](https://metamask.io/terms.html)**
-
-**[Privacy](https://metamask.io/privacy.html)**
-
-**[Attributions](https://metamask.io/attributions.html)**
diff --git a/notices/archive/notice_2.md b/notices/archive/notice_2.md
deleted file mode 100644
index 8370f2ce2..000000000
--- a/notices/archive/notice_2.md
+++ /dev/null
@@ -1,6 +0,0 @@
-MetaMask is beta software.
-
-When you log in to MetaMask and approve account access, your current account's address is visible to the site you're currently viewing. This can be used to look up your account balances of Ether and other tokens.
-
-For your privacy, take caution when approving account access and sign out of MetaMask when you're done using a site.
-
diff --git a/notices/archive/notice_3.md b/notices/archive/notice_3.md
deleted file mode 100644
index 59dd0f5c7..000000000
--- a/notices/archive/notice_3.md
+++ /dev/null
@@ -1,11 +0,0 @@
-Please take a moment to [back up your seed phrase again](https://support.metamask.io/kb/article/28-abbu-always-be-backed-up-how-to-make-sure-your-12-word-metamask-seed-phrase-is-backed-up).
-
-MetaMask has become aware of a previous issue where a very small number of users were shown the wrong seed phrase to back up. The only way to protect yourself from this issue, is to back up your seed phrase again now.
-
-You can follow the guide at this link:
-
-[https://support.metamask.io/kb/article/28-abbu-always-be-backed-up-how-to-make-sure-your-12-word-metamask-seed-phrase-is-backed-up](https://support.metamask.io/kb/article/28-abbu-always-be-backed-up-how-to-make-sure-your-12-word-metamask-seed-phrase-is-backed-up)
-
-We have fixed the known issue, but will be issuing ongoing bug bounties to help prevent this kind of problem in the future.
-
-For more information on this issue, [see this blog post](https://medium.com/metamask/seed-phrase-issue-bounty-awarded-e1986e811021)
diff --git a/notices/archive/notice_4.md b/notices/archive/notice_4.md
deleted file mode 100644
index 6493237cf..000000000
--- a/notices/archive/notice_4.md
+++ /dev/null
@@ -1,5 +0,0 @@
-Dear MetaMask Users,
-
-There have been several instances of high-profile legitimate websites such as BTC Manager and Games Workshop that have had their websites temporarily compromised. This involves showing a fake MetaMask window on the page asking for user's seed phrases. MetaMask will never open itself to ask you for your seed phrase, and users are encouraged to report these instances immediately to either [our phishing blacklist](https://github.com/MetaMask/eth-phishing-detect/issues) or our support email at [support@metamask.io](mailto:support@metamask.io).
-
-[Please read our full article on this ongoing issue over at Medium.](https://medium.com/metamask/new-phishing-strategy-becoming-common-1b1123837168)
diff --git a/notices/notices.js b/notices/notices.js
deleted file mode 100644
index 6392b6381..000000000
--- a/notices/notices.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// fs.readFileSync is inlined by browserify transform "brfs"
-const fs = require('fs')
-const path = require('path')
-
-module.exports = [
- {
- id: 0,
- read: false,
- date: 'Thu Feb 09 2017',
- title: 'Terms of Use',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_0.md'), 'utf8'),
- },
- {
- id: 2,
- read: false,
- date: 'Mon May 08 2017',
- title: 'Privacy Notice',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_2.md'), 'utf8'),
- },
- {
- id: 3,
- read: false,
- date: 'Tue Nov 28 2017',
- title: 'Seed Phrase Alert',
- firstVersion: '<=3.12.0',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_3.md'), 'utf8'),
- },
- {
- id: 4,
- read: false,
- date: 'Wed Jun 13 2018',
- title: 'Phishing Warning',
- body: fs.readFileSync(path.join(__dirname, '/archive', 'notice_4.md'), 'utf8'),
- },
-]
diff --git a/test/unit/app/controllers/notice-controller-test.js b/test/unit/app/controllers/notice-controller-test.js
deleted file mode 100644
index caa50a03e..000000000
--- a/test/unit/app/controllers/notice-controller-test.js
+++ /dev/null
@@ -1,92 +0,0 @@
-const assert = require('assert')
-const NoticeController = require('../../../../app/scripts/notice-controller')
-
-describe('notice-controller', function () {
- var noticeController
-
- beforeEach(function () {
- noticeController = new NoticeController()
- })
-
- describe('notices', function () {
-
- describe('#setNoticesList', function () {
- it('should set data appropriately', function (done) {
- var testList = [{
- id: 0,
- read: false,
- title: 'Futuristic Notice',
- }]
- noticeController.setNoticesList(testList)
- var testListId = noticeController.getNoticesList()[0].id
- assert.equal(testListId, 0)
- done()
- })
- })
-
- describe('#markNoticeRead', function () {
- it('should mark a notice as read', function (done) {
- var testList = [{
- id: 0,
- read: false,
- title: 'Futuristic Notice',
- }]
- noticeController.setNoticesList(testList)
- noticeController.markNoticeRead(testList[0])
- var newList = noticeController.getNoticesList()
- assert.ok(newList[0].read)
- done()
- })
- })
-
- describe('#markAllNoticesRead', () => {
- it('marks all notices read', async () => {
- const testList = [{
- id: 0,
- read: false,
- title: 'Notice 1',
- }, {
- id: 1,
- read: false,
- title: 'Notice 2',
- }, {
- id: 2,
- read: false,
- title: 'Notice 3',
- }]
-
- noticeController.setNoticesList(testList)
-
- noticeController.markAllNoticesRead()
-
- const unreadNotices = noticeController.getUnreadNotices()
- assert.equal(unreadNotices.length, 0)
- })
- })
-
- describe('#getNextUnreadNotice', function () {
- it('should retrieve the latest unread notice', function (done) {
- var testList = [
- {id: 0, read: true, title: 'Past Notice'},
- {id: 1, read: false, title: 'Current Notice'},
- {id: 2, read: false, title: 'Future Notice'},
- ]
- noticeController.setNoticesList(testList)
- var latestUnread = noticeController.getNextUnreadNotice()
- assert.equal(latestUnread.id, 1)
- done()
- })
- it('should return undefined if no unread notices exist.', function (done) {
- var testList = [
- {id: 0, read: true, title: 'Past Notice'},
- {id: 1, read: true, title: 'Current Notice'},
- {id: 2, read: true, title: 'Future Notice'},
- ]
- noticeController.setNoticesList(testList)
- var latestUnread = noticeController.getNextUnreadNotice()
- assert.ok(!latestUnread)
- done()
- })
- })
- })
-})
diff --git a/test/unit/migrations/033-test.js b/test/unit/migrations/033-test.js
new file mode 100644
index 000000000..b111198fd
--- /dev/null
+++ b/test/unit/migrations/033-test.js
@@ -0,0 +1,40 @@
+const assert = require('assert')
+const migration33 = require('../../../app/scripts/migrations/033')
+
+describe('Migration to delete notice controller', () => {
+ const oldStorage = {
+ 'meta': {},
+ 'data': {
+ 'NoticeController': {
+ 'noticesList': [
+ {
+ id: 0,
+ read: false,
+ date: 'Thu Feb 09 2017',
+ title: 'Terms of Use',
+ body: 'notice body',
+ },
+ {
+ id: 2,
+ read: false,
+ title: 'Privacy Notice',
+ body: 'notice body',
+ },
+ {
+ id: 4,
+ read: false,
+ title: 'Phishing Warning',
+ body: 'notice body',
+ },
+ ],
+ },
+ },
+ }
+
+ it('removes notice controller from state', () => {
+ migration33.migrate(oldStorage)
+ .then(newStorage => {
+ assert.equal(newStorage.data.NoticeController, undefined)
+ })
+ })
+})
diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js
index a578ec89c..86c3f8aff 100644
--- a/test/unit/ui/app/actions.spec.js
+++ b/test/unit/ui/app/actions.spec.js
@@ -1031,52 +1031,6 @@ describe('Actions', () => {
})
})
- describe('#markNoticeRead', () => {
- let markNoticeReadSpy
- const notice = {
- id: 0,
- read: false,
- date: 'test date',
- title: 'test title',
- body: 'test body',
- }
-
- beforeEach(() => {
- markNoticeReadSpy = sinon.stub(background, 'markNoticeRead')
- })
-
- afterEach(() => {
- markNoticeReadSpy.restore()
- })
-
- it('calls markNoticeRead in background', () => {
- const store = mockStore()
-
- store.dispatch(actions.markNoticeRead(notice))
- .then(() => {
- assert(markNoticeReadSpy.calledOnce)
- })
-
- })
-
- it('errors when markNoticeRead in background throws', () => {
- const store = mockStore()
- const expectedActions = [
- { type: 'SHOW_LOADING_INDICATION', value: undefined },
- { type: 'HIDE_LOADING_INDICATION' },
- { type: 'DISPLAY_WARNING', value: 'error' },
- ]
- markNoticeReadSpy.callsFake((notice, callback) => {
- callback(new Error('error'))
- })
-
- store.dispatch(actions.markNoticeRead())
- .catch(() => {
- assert.deepEqual(store.getActions(), expectedActions)
- })
- })
- })
-
describe('#setProviderType', () => {
let setProviderTypeSpy
let store
@@ -1309,24 +1263,20 @@ describe('Actions', () => {
})
describe('#setCompletedOnboarding', () => {
- let markAllNoticesReadSpy, completeOnboardingSpy
+ let completeOnboardingSpy
beforeEach(() => {
- markAllNoticesReadSpy = sinon.stub(background, 'markAllNoticesRead')
- markAllNoticesReadSpy.callsFake(cb => cb())
completeOnboardingSpy = sinon.stub(background, 'completeOnboarding')
completeOnboardingSpy.callsFake(cb => cb())
})
after(() => {
- markAllNoticesReadSpy.restore()
completeOnboardingSpy.restore()
})
- it('completing onboarding marks all notices as read', async () => {
+ it('completes onboarding', async () => {
const store = mockStore()
await store.dispatch(actions.setCompletedOnboarding())
- assert.equal(markAllNoticesReadSpy.callCount, 1)
assert.equal(completeOnboardingSpy.callCount, 1)
})
})
diff --git a/test/unit/ui/app/reducers/app.spec.js b/test/unit/ui/app/reducers/app.spec.js
index 6c77e0ef9..09cf3dbf0 100644
--- a/test/unit/ui/app/reducers/app.spec.js
+++ b/test/unit/ui/app/reducers/app.spec.js
@@ -445,15 +445,6 @@ describe('App State', () => {
assert.equal(state.forgottenPassword, false)
})
- it('shows notice', () => {
- const state = reduceApp(metamaskState, {
- type: actions.SHOW_NOTICE,
- })
-
- assert.equal(state.transForward, true)
- assert.equal(state.isLoading, false)
- })
-
it('reveals account', () => {
const state = reduceApp(metamaskState, {
type: actions.REVEAL_ACCOUNT,
diff --git a/test/unit/ui/app/reducers/metamask.spec.js b/test/unit/ui/app/reducers/metamask.spec.js
index 388c67c76..d7876bf39 100644
--- a/test/unit/ui/app/reducers/metamask.spec.js
+++ b/test/unit/ui/app/reducers/metamask.spec.js
@@ -35,49 +35,6 @@ describe('MetaMask Reducers', () => {
assert.equal(state.isRevealingSeedWords, false)
})
- it('shows notice', () => {
- const notice = {
- id: 0,
- read: false,
- date: 'Date',
- title: 'Title',
- body: 'Body',
- }
-
- const state = reduceMetamask({}, {
- type: actions.SHOW_NOTICE,
- value: notice,
- })
-
- assert.equal(state.noActiveNotices, false)
- assert.equal(state.nextUnreadNotice, notice)
- })
-
- it('clears notice', () => {
-
- const notice = {
- id: 0,
- read: false,
- date: 'Date',
- title: 'Title',
- body: 'Body',
- }
-
- const noticesState = {
- metamask: {
- noActiveNotices: false,
- nextUnreadNotice: notice,
- },
- }
-
- const state = reduceMetamask(noticesState, {
- type: actions.CLEAR_NOTICES,
- })
-
- assert.equal(state.noActiveNotices, true)
- assert.equal(state.nextUnreadNotice, null)
- })
-
it('unlocks MetaMask', () => {
const state = reduceMetamask({}, {
type: actions.UNLOCK_METAMASK,
diff --git a/ui/app/components/app/notice.js b/ui/app/components/app/notice.js
deleted file mode 100644
index bb7e0814c..000000000
--- a/ui/app/components/app/notice.js
+++ /dev/null
@@ -1,138 +0,0 @@
-const inherits = require('util').inherits
-const Component = require('react').Component
-const PropTypes = require('prop-types')
-const h = require('react-hyperscript')
-const ReactMarkdown = require('react-markdown')
-const linker = require('extension-link-enabler')
-const findDOMNode = require('react-dom').findDOMNode
-const connect = require('react-redux').connect
-
-Notice.contextTypes = {
- t: PropTypes.func,
-}
-
-module.exports = connect()(Notice)
-
-
-inherits(Notice, Component)
-function Notice () {
- Component.call(this)
-}
-
-Notice.prototype.render = function () {
- const { notice, onConfirm } = this.props
- const { title, date, body } = notice
- const state = this.state || { disclaimerDisabled: true }
- const disabled = state.disclaimerDisabled
-
- return (
- h('.flex-column.flex-center.flex-grow', {
- style: {
- width: '100%',
- },
- }, [
- h('h3.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- title,
- ]),
-
- h('h5.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- date,
- ]),
-
- h('style', `
-
- .markdown {
- overflow-x: hidden;
- }
-
- .markdown h1, .markdown h2, .markdown h3 {
- margin: 10px 0;
- font-weight: bold;
- }
-
- .markdown strong {
- font-weight: bold;
- }
- .markdown em {
- font-style: italic;
- }
-
- .markdown p {
- margin: 10px 0;
- }
-
- .markdown a {
- color: #df6b0e;
- }
-
- `),
-
- h('div.markdown', {
- onScroll: (e) => {
- var object = e.currentTarget
- if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) {
- this.setState({disclaimerDisabled: false})
- }
- },
- style: {
- background: 'rgb(235, 235, 235)',
- height: '310px',
- padding: '6px',
- width: '90%',
- overflowY: 'scroll',
- scroll: 'auto',
- },
- }, [
- h(ReactMarkdown, {
- className: 'notice-box',
- source: body,
- skipHtml: true,
- }),
- ]),
-
- h('button.primary', {
- disabled,
- onClick: () => {
- this.setState({disclaimerDisabled: true}, () => onConfirm())
- },
- style: {
- marginTop: '18px',
- },
- }, this.context.t('accept')),
- ])
- )
-}
-
-Notice.prototype.componentDidMount = function () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.setupListener(node)
- if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
- this.setState({disclaimerDisabled: false})
- }
-}
-
-Notice.prototype.componentWillUnmount = function () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.teardownListener(node)
-}
diff --git a/ui/app/components/app/send/tests/send-selectors-test-data.js b/ui/app/components/app/send/tests/send-selectors-test-data.js
index d43d7c650..cff26a191 100644
--- a/ui/app/components/app/send/tests/send-selectors-test-data.js
+++ b/ui/app/components/app/send/tests/send-selectors-test-data.js
@@ -28,7 +28,6 @@ module.exports = {
'conversionRate': 1200.88200327,
'conversionDate': 1489013762,
'nativeCurrency': 'ETH',
- 'noActiveNotices': true,
'frequentRpcList': [],
'network': '3',
'accounts': {
diff --git a/ui/app/ducks/app/app.js b/ui/app/ducks/app/app.js
index acbb5c989..295507d70 100644
--- a/ui/app/ducks/app/app.js
+++ b/ui/app/ducks/app/app.js
@@ -435,12 +435,6 @@ function reduceApp (state, action) {
forgottenPassword: false,
})
- case actions.SHOW_NOTICE:
- return extend(appState, {
- transForward: true,
- isLoading: false,
- })
-
case actions.REVEAL_ACCOUNT:
return extend(appState, {
scrollToBottom: true,
diff --git a/ui/app/ducks/metamask/metamask.js b/ui/app/ducks/metamask/metamask.js
index 864229e83..47c767d68 100644
--- a/ui/app/ducks/metamask/metamask.js
+++ b/ui/app/ducks/metamask/metamask.js
@@ -18,8 +18,6 @@ function reduceMetamask (state, action) {
rpcTarget: 'https://rawtestrpc.metamask.io/',
identities: {},
unapprovedTxs: {},
- noActiveNotices: true,
- nextUnreadNotice: undefined,
frequentRpcList: [],
addressBook: [],
selectedTokenAddress: null,
@@ -69,18 +67,6 @@ function reduceMetamask (state, action) {
delete newState.seedWords
return newState
- case actions.SHOW_NOTICE:
- return extend(metamaskState, {
- noActiveNotices: false,
- nextUnreadNotice: action.value,
- })
-
- case actions.CLEAR_NOTICES:
- return extend(metamaskState, {
- noActiveNotices: true,
- nextUnreadNotice: undefined,
- })
-
case actions.UPDATE_METAMASK_STATE:
return extend(metamaskState, action.value)
diff --git a/ui/app/helpers/constants/routes.js b/ui/app/helpers/constants/routes.js
index c15027ff4..df35112d1 100644
--- a/ui/app/helpers/constants/routes.js
+++ b/ui/app/helpers/constants/routes.js
@@ -19,7 +19,6 @@ const NEW_ACCOUNT_ROUTE = '/new-account'
const IMPORT_ACCOUNT_ROUTE = '/new-account/import'
const CONNECT_HARDWARE_ROUTE = '/new-account/connect'
const SEND_ROUTE = '/send'
-const NOTICE_ROUTE = '/notice'
const WELCOME_ROUTE = '/welcome'
const INITIALIZE_ROUTE = '/initialize'
@@ -29,7 +28,6 @@ const INITIALIZE_CREATE_PASSWORD_ROUTE = '/initialize/create-password'
const INITIALIZE_IMPORT_ACCOUNT_ROUTE = '/initialize/create-password/import-account'
const INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE = '/initialize/create-password/import-with-seed-phrase'
const INITIALIZE_UNIQUE_IMAGE_ROUTE = '/initialize/create-password/unique-image'
-const INITIALIZE_NOTICE_ROUTE = '/initialize/notice'
const INITIALIZE_SELECT_ACTION_ROUTE = '/initialize/select-action'
const INITIALIZE_SEED_PHRASE_ROUTE = '/initialize/seed-phrase'
const INITIALIZE_END_OF_FLOW_ROUTE = '/initialize/end-of-flow'
@@ -62,7 +60,6 @@ module.exports = {
IMPORT_ACCOUNT_ROUTE,
CONNECT_HARDWARE_ROUTE,
SEND_ROUTE,
- NOTICE_ROUTE,
WELCOME_ROUTE,
INITIALIZE_ROUTE,
INITIALIZE_WELCOME_ROUTE,
@@ -71,7 +68,6 @@ module.exports = {
INITIALIZE_IMPORT_ACCOUNT_ROUTE,
INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE,
INITIALIZE_UNIQUE_IMAGE_ROUTE,
- INITIALIZE_NOTICE_ROUTE,
INITIALIZE_SELECT_ACTION_ROUTE,
INITIALIZE_SEED_PHRASE_ROUTE,
INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE,
diff --git a/ui/app/pages/home/home.container.js b/ui/app/pages/home/home.container.js
index 02ec4b9c6..7508654dc 100644
--- a/ui/app/pages/home/home.container.js
+++ b/ui/app/pages/home/home.container.js
@@ -7,7 +7,6 @@ import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-tr
const mapStateToProps = state => {
const { metamask, appState } = state
const {
- noActiveNotices,
lostAccounts,
seedWords,
suggestedTokens,
@@ -16,7 +15,6 @@ const mapStateToProps = state => {
const { forgottenPassword } = appState
return {
- noActiveNotices,
lostAccounts,
forgottenPassword,
seedWords,
diff --git a/ui/app/pages/notice/notice.js b/ui/app/pages/notice/notice.js
deleted file mode 100644
index d8274dfcb..000000000
--- a/ui/app/pages/notice/notice.js
+++ /dev/null
@@ -1,203 +0,0 @@
-const { Component } = require('react')
-const h = require('react-hyperscript')
-const { connect } = require('react-redux')
-const PropTypes = require('prop-types')
-const ReactMarkdown = require('react-markdown')
-const linker = require('extension-link-enabler')
-const generateLostAccountsNotice = require('../../../lib/lost-accounts-notice')
-const findDOMNode = require('react-dom').findDOMNode
-const actions = require('../../store/actions')
-const { DEFAULT_ROUTE } = require('../../helpers/constants/routes')
-
-class Notice extends Component {
- constructor (props) {
- super(props)
-
- this.state = {
- disclaimerDisabled: true,
- }
- }
-
- componentWillMount () {
- if (!this.props.notice) {
- this.props.history.push(DEFAULT_ROUTE)
- }
- }
-
- componentDidMount () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.setupListener(node)
- if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
- this.setState({ disclaimerDisabled: false })
- }
- }
-
- componentWillReceiveProps (nextProps) {
- if (!nextProps.notice) {
- this.props.history.push(DEFAULT_ROUTE)
- }
- }
-
- componentWillUnmount () {
- // eslint-disable-next-line react/no-find-dom-node
- var node = findDOMNode(this)
- linker.teardownListener(node)
- }
-
- handleAccept () {
- this.setState({ disclaimerDisabled: true })
- this.props.onConfirm()
- }
-
- render () {
- const { notice = {} } = this.props
- const { title, date, body } = notice
- const { disclaimerDisabled } = this.state
-
- return (
- h('.flex-column.flex-center.flex-grow', {
- style: {
- width: '100%',
- },
- }, [
- h('h3.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- title,
- ]),
-
- h('h5.flex-center.text-transform-uppercase.terms-header', {
- style: {
- background: '#EBEBEB',
- color: '#AEAEAE',
- marginBottom: 24,
- width: '100%',
- fontSize: '20px',
- textAlign: 'center',
- padding: 6,
- },
- }, [
- date,
- ]),
-
- h('style', `
-
- .markdown {
- overflow-x: hidden;
- }
-
- .markdown h1, .markdown h2, .markdown h3 {
- margin: 10px 0;
- font-weight: bold;
- }
-
- .markdown strong {
- font-weight: bold;
- }
- .markdown em {
- font-style: italic;
- }
-
- .markdown p {
- margin: 10px 0;
- }
-
- .markdown a {
- color: #df6b0e;
- }
-
- `),
-
- h('div.markdown', {
- onScroll: (e) => {
- var object = e.currentTarget
- if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) {
- this.setState({ disclaimerDisabled: false })
- }
- },
- style: {
- background: 'rgb(235, 235, 235)',
- height: '310px',
- padding: '6px',
- width: '90%',
- overflowY: 'scroll',
- scroll: 'auto',
- },
- }, [
- h(ReactMarkdown, {
- className: 'notice-box',
- source: body,
- skipHtml: true,
- }),
- ]),
-
- h('button.primary', {
- disabled: disclaimerDisabled,
- onClick: () => this.handleAccept(),
- style: {
- marginTop: '18px',
- },
- }, 'Accept'),
- ])
- )
- }
-
-}
-
-const mapStateToProps = state => {
- const { metamask } = state
- const { noActiveNotices, nextUnreadNotice, lostAccounts } = metamask
-
- return {
- noActiveNotices,
- nextUnreadNotice,
- lostAccounts,
- }
-}
-
-Notice.propTypes = {
- notice: PropTypes.object,
- onConfirm: PropTypes.func,
- history: PropTypes.object,
-}
-
-const mapDispatchToProps = dispatch => {
- return {
- markNoticeRead: nextUnreadNotice => dispatch(actions.markNoticeRead(nextUnreadNotice)),
- markAccountsFound: () => dispatch(actions.markAccountsFound()),
- }
-}
-
-const mergeProps = (stateProps, dispatchProps, ownProps) => {
- const { noActiveNotices, nextUnreadNotice, lostAccounts } = stateProps
- const { markNoticeRead, markAccountsFound } = dispatchProps
-
- let notice
- let onConfirm
-
- if (!noActiveNotices) {
- notice = nextUnreadNotice
- onConfirm = () => markNoticeRead(nextUnreadNotice)
- } else if (lostAccounts && lostAccounts.length > 0) {
- notice = generateLostAccountsNotice(lostAccounts)
- onConfirm = () => markAccountsFound()
- }
-
- return {
- ...stateProps,
- ...dispatchProps,
- ...ownProps,
- notice,
- onConfirm,
- }
-}
-
-module.exports = connect(mapStateToProps, mapDispatchToProps, mergeProps)(Notice)
diff --git a/ui/app/pages/routes/index.js b/ui/app/pages/routes/index.js
index 460cec958..e06d88c90 100644
--- a/ui/app/pages/routes/index.js
+++ b/ui/app/pages/routes/index.js
@@ -31,7 +31,6 @@ const AddTokenPage = require('../add-token')
const ConfirmAddTokenPage = require('../confirm-add-token')
const ConfirmAddSuggestedTokenPage = require('../confirm-add-suggested-token')
const CreateAccountPage = require('../create-account')
-const NoticeScreen = require('../notice/notice')
const Loading = require('../../components/ui/loading-screen')
const LoadingNetwork = require('../../components/app/loading-network-screen').default
@@ -67,7 +66,6 @@ import {
CONFIRM_TRANSACTION_ROUTE,
INITIALIZE_ROUTE,
INITIALIZE_UNLOCK_ROUTE,
- NOTICE_ROUTE,
} from '../../helpers/constants/routes'
// enums
@@ -109,7 +107,6 @@ class Routes extends Component {
<Authenticated path={REVEAL_SEED_ROUTE} component={RevealSeedConfirmation} exact />
<Authenticated path={MOBILE_SYNC_ROUTE} component={MobileSyncPage} exact />
<Authenticated path={SETTINGS_ROUTE} component={Settings} />
- <Authenticated path={NOTICE_ROUTE} component={NoticeScreen} exact />
<Authenticated path={`${CONFIRM_TRANSACTION_ROUTE}/:id?`} component={ConfirmTransaction} />
<Authenticated path={SEND_ROUTE} component={SendTransactionScreen} exact />
<Authenticated path={ADD_TOKEN_ROUTE} component={AddTokenPage} exact />
@@ -322,7 +319,6 @@ Routes.propTypes = {
dispatch: PropTypes.func,
toggleAccountMenu: PropTypes.func,
selectedAddress: PropTypes.string,
- noActiveNotices: PropTypes.bool,
lostAccounts: PropTypes.array,
isInitialized: PropTypes.bool,
forgottenPassword: PropTypes.bool,
@@ -360,10 +356,8 @@ function mapStateToProps (state) {
address,
keyrings,
isInitialized,
- noActiveNotices,
seedWords,
unapprovedTxs,
- nextUnreadNotice,
lostAccounts,
unapprovedMsgCount,
unapprovedPersonalMsgCount,
@@ -380,14 +374,13 @@ function mapStateToProps (state) {
alertMessage,
isLoading,
loadingMessage,
- noActiveNotices,
isInitialized,
isUnlocked: state.metamask.isUnlocked,
selectedAddress: state.metamask.selectedAddress,
currentView: state.appState.currentView,
activeAddress: state.appState.activeAddress,
transForward: state.appState.transForward,
- isOnboarding: Boolean(!noActiveNotices || seedWords || !isInitialized),
+ isOnboarding: Boolean(seedWords || !isInitialized),
isPopup: state.metamask.isPopup,
seedWords: state.metamask.seedWords,
submittedPendingTransactions: submittedPendingTransactionsSelector(state),
@@ -400,7 +393,6 @@ function mapStateToProps (state) {
network: state.metamask.network,
provider: state.metamask.provider,
forgottenPassword: state.appState.forgottenPassword,
- nextUnreadNotice,
lostAccounts,
frequentRpcListDetail: state.metamask.frequentRpcListDetail || [],
currentCurrency: state.metamask.currentCurrency,
diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js
index e5825b5f6..7d369fdb9 100644
--- a/ui/app/store/actions.js
+++ b/ui/app/store/actions.js
@@ -51,13 +51,6 @@ var actions = {
// remote state
UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE',
updateMetamaskState: updateMetamaskState,
- // notices
- MARK_NOTICE_READ: 'MARK_NOTICE_READ',
- markNoticeRead: markNoticeRead,
- SHOW_NOTICE: 'SHOW_NOTICE',
- showNotice: showNotice,
- CLEAR_NOTICES: 'CLEAR_NOTICES',
- clearNotices: clearNotices,
markAccountsFound,
// intialize screen
CREATE_NEW_VAULT_IN_PROGRESS: 'CREATE_NEW_VAULT_IN_PROGRESS',
@@ -1857,47 +1850,6 @@ function goBackToInitView () {
}
}
-//
-// notice
-//
-
-function markNoticeRead (notice) {
- return (dispatch) => {
- dispatch(actions.showLoadingIndication())
- log.debug(`background.markNoticeRead`)
- return new Promise((resolve, reject) => {
- background.markNoticeRead(notice, (err, notice) => {
- dispatch(actions.hideLoadingIndication())
- if (err) {
- dispatch(actions.displayWarning(err.message))
- return reject(err)
- }
-
- if (notice) {
- dispatch(actions.showNotice(notice))
- resolve(true)
- } else {
- dispatch(actions.clearNotices())
- resolve(false)
- }
- })
- })
- }
-}
-
-function showNotice (notice) {
- return {
- type: actions.SHOW_NOTICE,
- value: notice,
- }
-}
-
-function clearNotices () {
- return {
- type: actions.CLEAR_NOTICES,
- }
-}
-
function markAccountsFound () {
log.debug(`background.markAccountsFound`)
return callBackgroundThenUpdate(background.markAccountsFound)
@@ -2492,15 +2444,6 @@ function setCompletedOnboarding () {
dispatch(actions.showLoadingIndication())
try {
- await pify(background.markAllNoticesRead).call(background)
- } catch (err) {
- dispatch(actions.displayWarning(err.message))
- throw err
- }
-
- dispatch(actions.clearNotices())
-
- try {
await pify(background.completeOnboarding).call(background)
} catch (err) {
dispatch(actions.displayWarning(err.message))