Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6: migrated "connect" #1030

Merged
merged 2 commits into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ globals:
_: true
$: true
amplify: true
CryptoJS: true
ko: true
LRUCache: true
moment: true
Expand Down
2 changes: 1 addition & 1 deletion app/script/announce/AnnounceRepository.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/announce/AnnounceService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/announce/UpdateSource.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/Asset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetCrypto.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetMetaDataBuilder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetRemoteData.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetRetentionPolicy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
10 changes: 5 additions & 5 deletions app/script/assets/AssetService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -219,7 +219,7 @@ z.assets.AssetService = class AssetService {
const url = this.client.create_url(`/assets/${asset_id}`);
let asset_url = `${url}?access_token=${this.client.access_token}&conv_id=${conversation_id}`;
if (force_caching) {
asset_url = `${asset_url}&forceCaching=true`;
asset_url = `${asset_url}&forceCaching=true`;
}
return asset_url;
}
Expand All @@ -237,7 +237,7 @@ z.assets.AssetService = class AssetService {
const url = this.client.create_url(`/conversations/${conversation_id}/otr/assets/${asset_id}`);
let asset_url = `${url}?access_token=${this.client.access_token}`;
if (force_caching) {
asset_url = `${asset_url}&forceCaching=true`;
asset_url = `${asset_url}&forceCaching=true`;
}
return asset_url;
}
Expand All @@ -254,10 +254,10 @@ z.assets.AssetService = class AssetService {
const url = this.client.create_url(`/assets/v3/${asset_key}/`);
let asset_url = `${url}?access_token=${this.client.access_token}`;
if (asset_token) {
asset_url = `${asset_url}&asset_token=${asset_token}`;
asset_url = `${asset_url}&asset_token=${asset_token}`;
}
if (force_caching) {
asset_url = `${asset_url}&forceCaching=true`;
asset_url = `${asset_url}&forceCaching=true`;
}
return asset_url;
}
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetTransferState.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetURLCache.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/assets/AssetUploadFailedReason.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
35 changes: 18 additions & 17 deletions app/script/assets/ImageSizeType.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
//
// Wire
// Copyright (C) 2016 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
/*
* Wire
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

Expand Down
2 changes: 1 addition & 1 deletion app/script/audio/AudioError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/audio/AudioPlayingType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/audio/AudioPreference.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/audio/AudioRepository.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/audio/AudioType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/AccessTokenError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/AuthRepository.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/AuthService.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/AuthView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/SignOutReason.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/URLParameter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion app/script/auth/ValidationError.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
47 changes: 0 additions & 47 deletions app/script/connect/ConnectError.coffee

This file was deleted.

60 changes: 60 additions & 0 deletions app/script/connect/ConnectError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Wire
* Copyright (C) 2017 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

'use strict';

window.z = window.z || {};
window.z.connect = z.connect = {};

z.connect.ConnectError = class ConnectError extends Error {
constructor(type) {
super();

this.name = this.constructor.name;
this.stack = (new Error()).stack;
this.type = type || z.connect.ConnectError.prototype.TYPE.UNKNOWN;

switch (this.type) {
case z.connect.ConnectError.prototype.TYPE.GOOGLE_CLIENT:
this.message = 'Google Auth Client for JavaScript not loaded';
break;
case z.connect.ConnectError.prototype.TYPE.GOOGLE_DOWNLOAD:
this.message = 'Failed to download contacts from Google';
break;
case z.connect.ConnectError.prototype.TYPE.NO_CONTACTS:
this.message = 'No contacts found for matching';
break;
case z.connect.ConnectError.prototype.TYPE.UPLOAD:
this.message = 'Address book upload failed';
break;
default:
this.message = 'Unknown ConnectError';
}
}

static get TYPE() {
return {
GOOGLE_CLIENT: 'z.connect.ConnectError::TYPE.GOOGLE_CLIENT',
GOOGLE_DOWNLOAD: 'z.connect.ConnectError::TYPE.GOOGLE_DOWNLOAD',
NO_CONTACTS: 'z.connect.ConnectError::TYPE.NO_CONTACTS',
UNKNOWN: 'z.connect.ConnectError::TYPE.UNKNOWN',
UPLOAD: 'z.connect.ConnectError::TYPE.UPLOAD',
};
}
};
Loading