Skip to content

Commit

Permalink
Update Ember, filer.js and idb.filesystem.js
Browse files Browse the repository at this point in the history
Still need to update Ember code to fix all deprecations...
  • Loading branch information
szimek committed Jul 19, 2020
1 parent 90df380 commit 48a08f3
Show file tree
Hide file tree
Showing 51 changed files with 5,091 additions and 2,009 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]
end_of_line = lf
charset = utf-8
Expand Down
26 changes: 22 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
const eslintPluginNode = require('eslint-plugin-node');

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember', 'prettier'],
extends: ['airbnb-base', 'plugin:ember/recommended', 'prettier'],
Expand All @@ -14,12 +20,15 @@ module.exports = {
'no-console': 'off',
'no-underscore-dangle': 'off',

strict: 'off',

'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',

'prettier/prettier': 'error',

// TODO: Enable these
'ember/no-jquery': 'off',
'ember/no-observers': 'off',
'ember/no-get': 'off',
},
overrides: [
// node files
Expand All @@ -32,15 +41,24 @@ module.exports = {
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'server/**/*.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
rules: {
...eslintPluginNode.configs.recommended.rules,
// add your custom rules and overrides for node files here

// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off',
},
},
],
};
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/.env
/.env*
/.pnp*
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log
/newrelic_agent.log

# ember-try
/.node_modules.ember-try/
Expand Down
11 changes: 0 additions & 11 deletions .prettierrc.json

This file was deleted.

17 changes: 6 additions & 11 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
'use strict';

module.exports = {
extends: 'recommended',
extends: 'octane',

// TODO: enable these
rules: {
'no-html-comments': false,
'no-action': false,
'no-curly-component-invocation': false,
'no-implicit-this': false,
'no-partial': false,
},
ignore: [
'./node_modules/**',
'./vendor/**',
'./tmp/**',
'./dist/**',
'./tests/**',
],
};
5 changes: 4 additions & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"ignore_dirs": ["tmp", "dist"]
"ignore_dirs": [
"tmp",
"dist"
]
}
17 changes: 9 additions & 8 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import Resolver from './resolver';
// eslint-disable-next-line import/extensions
import config from './config/environment';

const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver,
});
export default class App extends Application {
modulePrefix = config.modulePrefix;

loadInitializers(App, config.modulePrefix);
podModulePrefix = config.podModulePrefix;

Resolver = Resolver;
}

export default App;
loadInitializers(App, config.modulePrefix);
3 changes: 2 additions & 1 deletion app/components/file-field.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import TextField from '@ember/component/text-field';
import $ from 'jquery';

export default TextField.extend({
type: 'file',
Expand All @@ -21,7 +22,7 @@ export default TextField.extend({
// so if sender wants later to send the same file again,
// the 'change' event is triggered correctly.
reset() {
const field = this.$();
const field = $(this.element);
field
.wrap('<form>')
.closest('form')
Expand Down
22 changes: 11 additions & 11 deletions app/components/peer-avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default Component.extend({
later(
this,
function toggleClass() {
this.$()
$(this.element)
.parent('.avatar')
.addClass(className)
.delay(2000)
Expand All @@ -36,29 +36,29 @@ export default Component.extend({
.dequeue();
});
},
250
250,
);
},

init(...args) {
this._super(args);

this.toggleTransferCompletedClass = this.toggleTransferCompletedClass.bind(
this
this,
);
},

didInsertElement(...args) {
this._super(args);
const peer = this.get('peer');
const { peer } = this;

peer.on('didReceiveFile', this.toggleTransferCompletedClass);
peer.on('didSendFile', this.toggleTransferCompletedClass);
},

willDestroyElement(...args) {
this._super(args);
const peer = this.get('peer');
const { peer } = this;

peer.off('didReceiveFile', this.toggleTransferCompletedClass);
peer.off('didSendFile', this.toggleTransferCompletedClass);
Expand All @@ -67,7 +67,7 @@ export default Component.extend({
// Delegate click to hidden file field in peer template
click() {
if (this.canSendFile()) {
this.$()
$(this.element)
.closest('.peer')
.find('input[type=file]')
.click();
Expand All @@ -78,7 +78,7 @@ export default Component.extend({
dragEnter(event) {
this.cancelEvent(event);

this.$()
$(this.element)
.parent('.avatar')
.addClass('hover');
},
Expand All @@ -88,18 +88,18 @@ export default Component.extend({
},

dragLeave() {
this.$()
$(this.element)
.parent('.avatar')
.removeClass('hover');
},

drop(event) {
this.cancelEvent(event);
this.$()
$(this.element)
.parent('.avatar')
.removeClass('hover');

const peer = this.get('peer');
const { peer } = this;
const dt = event.originalEvent.dataTransfer;
const { files } = dt;
const file = files[0];
Expand All @@ -124,7 +124,7 @@ export default Component.extend({
},

canSendFile() {
const peer = this.get('peer');
const { peer } = this;

// Can't send files if another file transfer is already in progress
return !(peer.get('transfer.file') || peer.get('transfer.info'));
Expand Down
18 changes: 9 additions & 9 deletions app/components/peer-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default Component.extend({
actions: {
// TODO: rename to something more meaningful (e.g. askIfWantToSendFile)
uploadFile(data) {
const peer = this.get('peer');
const { peer } = this;
const { file } = data;

// Cache the file, so that it's available
Expand All @@ -48,8 +48,8 @@ export default Component.extend({
},

sendFileTransferInquiry() {
const webrtc = this.get('webrtc');
const peer = this.get('peer');
const { webrtc } = this;
const { peer } = this;

webrtc.connect(peer.get('peer.id'));
peer.set('state', 'establishing_connection');
Expand All @@ -62,14 +62,14 @@ export default Component.extend({
abortFileTransfer() {
this._cancelFileTransfer();

const webrtc = this.get('webrtc');
const { webrtc } = this;
const connection = this.get('peer.peer.connection');

webrtc.sendCancelRequest(connection);
},

acceptFileTransfer() {
const peer = this.get('peer');
const { peer } = this;

this._sendFileTransferResponse(true);

Expand All @@ -80,7 +80,7 @@ export default Component.extend({
},

rejectFileTransfer() {
const peer = this.get('peer');
const { peer } = this;

this._sendFileTransferResponse(false);
peer.set('transfer.info', null);
Expand All @@ -89,7 +89,7 @@ export default Component.extend({
},

_cancelFileTransfer() {
const peer = this.get('peer');
const { peer } = this;

peer.setProperties({
'transfer.file': null,
Expand All @@ -98,8 +98,8 @@ export default Component.extend({
},

_sendFileTransferResponse(response) {
const webrtc = this.get('webrtc');
const peer = this.get('peer');
const { webrtc } = this;
const { peer } = this;
const connection = peer.get('peer.connection');

webrtc.sendFileResponse(connection, response);
Expand Down
3 changes: 1 addition & 2 deletions app/components/popover-confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { computed } from '@ember/object';

export default Component.extend({
classNames: ['popover-confirm'],
isVisible: false,
iconClass: computed('filename', function() {
const filename = this.get('filename');
const { filename } = this;

if (filename) {
const regex = /\.([0-9a-z]+)$/i;
Expand Down
11 changes: 6 additions & 5 deletions app/components/progress-bar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Component from '@ember/component';
import { observer } from '@ember/object';
import $ from 'jquery';

export default Component.extend({
tagName: 'svg',
Expand All @@ -12,13 +13,13 @@ export default Component.extend({
transfer: null,

didInsertElement() {
this.set('path', this.$().find('path'));
this.set('path', $(this.element).find('path'));
},

sendingProgressDidChange: observer('transfer.sendingProgress', function() {
const progress = this.get('transfer.sendingProgress');

if (this.get('path')) {
if (this.path) {
this._calculateSVGAnim(progress);
}
}),
Expand All @@ -28,14 +29,14 @@ export default Component.extend({
function() {
const progress = this.get('transfer.receivingProgress');

if (this.get('path')) {
if (this.path) {
this._calculateSVGAnim(progress);
}
}
},
),

_calculateSVGAnim(progress) {
const path = this.get('path');
const { path } = this;
if (!path) {
return;
}
Expand Down
Loading

0 comments on commit 48a08f3

Please sign in to comment.