pass himan UI language to tinode-sdk

This commit is contained in:
or-else
2020-02-23 10:57:04 +03:00
parent e7840b05a6
commit e27c106c33
7 changed files with 37 additions and 16 deletions
+11 -7
View File
@@ -192,7 +192,8 @@ class TinodeWeb extends React.Component {
viewportHeight: document.documentElement.clientHeight viewportHeight: document.documentElement.clientHeight
}); });
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport); const {locale} = this.props.intl;
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
this.tinode.onDisconnect = this.handleDisconnect; this.tinode.onDisconnect = this.handleDisconnect;
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration; this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
@@ -257,8 +258,9 @@ class TinodeWeb extends React.Component {
} }
// Setup transport (usually websocket) and server address. This will terminate connection with the server. // Setup transport (usually websocket) and server address. This will terminate connection with the server.
static tnSetup(serverAddress, transport) { static tnSetup(serverAddress, transport, locale) {
let tinode = new Tinode(APP_NAME, serverAddress, API_KEY, transport, isSecureConnection()); const tinode = new Tinode(APP_NAME, serverAddress, API_KEY, transport, isSecureConnection());
tinode.setHumanLanguage(locale);
tinode.enableLogging(LOGGING_ENABLED, true); tinode.enableLogging(LOGGING_ENABLED, true);
return tinode; return tinode;
} }
@@ -856,13 +858,14 @@ class TinodeWeb extends React.Component {
// User updated global parameters. // User updated global parameters.
handleGlobalSettings(settings) { handleGlobalSettings(settings) {
let serverAddress = settings.serverAddress || this.state.serverAddress; const serverAddress = settings.serverAddress || this.state.serverAddress;
let transport = settings.transport || this.state.transport; const transport = settings.transport || this.state.transport;
if (this.tinode) { if (this.tinode) {
this.tinode.onDisconnect = undefined; this.tinode.onDisconnect = undefined;
this.tinode.disconnect(); this.tinode.disconnect();
} }
this.tinode = TinodeWeb.tnSetup(serverAddress, transport); const {locale} = this.props.intl;
this.tinode = TinodeWeb.tnSetup(serverAddress, transport, locale);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
this.tinode.onDisconnect = this.handleDisconnect; this.tinode.onDisconnect = this.handleDisconnect;
@@ -1077,7 +1080,8 @@ class TinodeWeb extends React.Component {
this.tinode.disconnect(); this.tinode.disconnect();
} }
this.setState(this.getBlankState()); this.setState(this.getBlankState());
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport); const {locale} = this.props.intl;
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
this.tinode.onDisconnect = this.handleDisconnect; this.tinode.onDisconnect = this.handleDisconnect;
HashNavigation.navigateTo(''); HashNavigation.navigateTo('');
+8 -4
View File
@@ -4784,7 +4784,8 @@ var TinodeWeb = function (_React$Component) {
viewportWidth: document.documentElement.clientWidth, viewportWidth: document.documentElement.clientWidth,
viewportHeight: document.documentElement.clientHeight viewportHeight: document.documentElement.clientHeight
}); });
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport); var locale = this.props.intl.locale;
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
this.tinode.onDisconnect = this.handleDisconnect; this.tinode.onDisconnect = this.handleDisconnect;
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration; this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
@@ -5501,7 +5502,8 @@ var TinodeWeb = function (_React$Component) {
this.tinode.disconnect(); this.tinode.disconnect();
} }
this.tinode = TinodeWeb.tnSetup(serverAddress, transport); var locale = this.props.intl.locale;
this.tinode = TinodeWeb.tnSetup(serverAddress, transport, locale);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
this.tinode.onDisconnect = this.handleDisconnect; this.tinode.onDisconnect = this.handleDisconnect;
this.setState({ this.setState({
@@ -5812,7 +5814,8 @@ var TinodeWeb = function (_React$Component) {
} }
this.setState(this.getBlankState()); this.setState(this.getBlankState());
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport); var locale = this.props.intl.locale;
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
this.tinode.onDisconnect = this.handleDisconnect; this.tinode.onDisconnect = this.handleDisconnect;
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__["default"].navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__["default"].navigateTo('');
@@ -6224,8 +6227,9 @@ var TinodeWeb = function (_React$Component) {
} }
}], [{ }], [{
key: "tnSetup", key: "tnSetup",
value: function tnSetup(serverAddress, transport) { value: function tnSetup(serverAddress, transport, locale) {
var tinode = new tinode_sdk__WEBPACK_IMPORTED_MODULE_5___default.a(_config_js__WEBPACK_IMPORTED_MODULE_11__["APP_NAME"], serverAddress, _config_js__WEBPACK_IMPORTED_MODULE_11__["API_KEY"], transport, Object(_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__["isSecureConnection"])()); var tinode = new tinode_sdk__WEBPACK_IMPORTED_MODULE_5___default.a(_config_js__WEBPACK_IMPORTED_MODULE_11__["APP_NAME"], serverAddress, _config_js__WEBPACK_IMPORTED_MODULE_11__["API_KEY"], transport, Object(_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__["isSecureConnection"])());
tinode.setHumanLanguage(locale);
tinode.enableLogging(_config_js__WEBPACK_IMPORTED_MODULE_11__["LOGGING_ENABLED"], true); tinode.enableLogging(_config_js__WEBPACK_IMPORTED_MODULE_11__["LOGGING_ENABLED"], true);
return tinode; return tinode;
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+14 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long