| @@ -0,0 +1,71 @@ | ||
| declare global { | ||
| export interface Window { | ||
| browser: any | ||
| } | ||
| } | ||
|
|
||
| declare type SendMessageEvent = (request: any, responseCallback?: (response: any) => void) => void; | ||
|
|
||
| interface RuntimeInterface { | ||
| onMessage: chrome.runtime.ExtensionMessageEvent; | ||
| sendMessage: SendMessageEvent; | ||
| onInstalled: chrome.runtime.ExtensionMessageEvent; | ||
|
|
||
| /** | ||
| * Create port and connect it | ||
| * | ||
| * @param {chrome.runtime.ConnectInfo} connectInfo | ||
| * @returns {chrome.runtime.Port} | ||
| */ | ||
| connect(connectInfo?: chrome.runtime.ConnectInfo): chrome.runtime.Port; | ||
|
|
||
| /** | ||
| * Returning current extension manifest | ||
| * | ||
| * @returns {any} | ||
| */ | ||
| getManifest(): chrome.runtime.Manifest; | ||
|
|
||
| tabs: TabsInterface; | ||
|
|
||
| reload(): void; | ||
| } | ||
|
|
||
| interface TabsInterface { | ||
| create(props?: chrome.tabs.CreateProperties): void; | ||
| } | ||
|
|
||
| interface ExtensionInterface { | ||
| alarms?: any; | ||
| bookmarks?: any; | ||
| browserAction?: any; | ||
| commands?: any; | ||
| contextMenus?: any; | ||
| cookies?: any; | ||
| downloads?: any; | ||
| events?: any; | ||
| extension?: any; | ||
| extensionTypes?: string[]; | ||
| history?: any; | ||
| i18n?: any; | ||
| idle?: any; | ||
| notifications?: any; | ||
| pageAction?: any; | ||
| runtime?: RuntimeInterface | any; | ||
| storage?: any; | ||
| tabs?: TabsInterface; | ||
| webNavigation?: any; | ||
| webRequest?: any; | ||
| windows?: any; | ||
| api?: any; | ||
|
|
||
| initBaseApi(): void; | ||
| } | ||
|
|
||
|
|
||
| export { | ||
| SendMessageEvent, | ||
| RuntimeInterface, | ||
| ExtensionInterface, | ||
| TabsInterface | ||
| } |
| @@ -0,0 +1,52 @@ | ||
| import * as Declarations from './Declarations'; | ||
| import {ExtensionProxy} from './ExtensionProxy'; | ||
| import CreateProperties = chrome.tabs.CreateProperties; | ||
| import Manifest = chrome.runtime.Manifest; | ||
|
|
||
|
|
||
| class Platform { | ||
|
|
||
| protected extension: ExtensionProxy; | ||
|
|
||
| constructor() { | ||
| this.extension = new ExtensionProxy(); | ||
| } | ||
|
|
||
| getExtension(): ExtensionProxy { | ||
| return this.extension; | ||
| } | ||
|
|
||
| /** | ||
| * extract Runtime object function | ||
| */ | ||
| getRuntime(): Declarations.RuntimeInterface { | ||
| return this.getExtension().runtime; | ||
| } | ||
|
|
||
| /** | ||
| * Extract Tabs function | ||
| */ | ||
| getTabs(): Declarations.TabsInterface { | ||
| return this.getExtension().tabs; | ||
| } | ||
|
|
||
| reload() { | ||
| this.getRuntime().reload(); | ||
| } | ||
|
|
||
| openWindow(createProperties: CreateProperties, callback: Function = null) { | ||
| this.getExtension().tabs.create(createProperties, callback); | ||
| } | ||
|
|
||
| getManifest(): Manifest { | ||
| return this.getRuntime().getManifest(); | ||
| } | ||
|
|
||
| getNotifications(): any { | ||
| return this.getExtension().notifications; | ||
| } | ||
| } | ||
|
|
||
| export { | ||
| Platform | ||
| } |
| @@ -0,0 +1,13 @@ | ||
| import * as Declarations from './Declarations'; | ||
| import {ExtensionProxy} from "./ExtensionProxy"; | ||
| import {Platform} from './Platform'; | ||
|
|
||
| const extensionInstance: Platform = new Platform(); | ||
|
|
||
| export { | ||
| Declarations, | ||
| Platform, | ||
| ExtensionProxy, | ||
|
|
||
| extensionInstance | ||
| } |
| @@ -1,5 +1,5 @@ | ||
| import LocalStorageStore from 'obs-store/lib/localStorage'; | ||
| import {STATE_STORAGE_KEY} from 'Core/Constant'; | ||
|
|
||
| const stateStorage = new LocalStorageStore({ | ||
| storageKey: STATE_STORAGE_KEY | ||
| @@ -62,7 +62,7 @@ export default class WalletsScreen extends React.Component { | ||
| }; | ||
| } | ||
|
|
||
| Background.sendRequest(type, {coin: toTriggerCoin}).then(callback); | ||
| }; | ||
|
|
||
| renderCoinRow = (coin) => { | ||