Support for geochats

This commit is contained in:
Global Server 2022-01-01 12:28:21 +01:00
parent 91aa80bb64
commit b4dfdea7c2
59 changed files with 254 additions and 101 deletions

50
package-lock.json generated
View File

@ -7540,7 +7540,7 @@
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
"integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
"dev": true,
"devOptional": true,
"dependencies": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
@ -7561,7 +7561,7 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"dev": true,
"devOptional": true,
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
@ -7574,7 +7574,7 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true,
"devOptional": true,
"engines": {
"node": ">=8"
}
@ -7583,7 +7583,7 @@
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"devOptional": true,
"dependencies": {
"fill-range": "^7.0.1"
},
@ -7595,7 +7595,7 @@
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"devOptional": true,
"dependencies": {
"to-regex-range": "^5.0.1"
},
@ -7607,7 +7607,6 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
@ -7621,7 +7620,7 @@
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true,
"devOptional": true,
"dependencies": {
"is-glob": "^4.0.1"
},
@ -7633,7 +7632,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"devOptional": true,
"dependencies": {
"binary-extensions": "^2.0.0"
},
@ -7645,7 +7644,7 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"devOptional": true,
"engines": {
"node": ">=0.12.0"
}
@ -7654,7 +7653,7 @@
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
"integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
"dev": true,
"devOptional": true,
"dependencies": {
"picomatch": "^2.2.1"
},
@ -7666,7 +7665,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"devOptional": true,
"dependencies": {
"is-number": "^7.0.0"
},
@ -19361,7 +19360,7 @@
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true,
"devOptional": true,
"engines": {
"node": ">=8.6"
},
@ -25658,7 +25657,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
"integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
"dev": true,
"optional": true,
"dependencies": {
"chokidar": "^2.1.8"
@ -25669,7 +25667,6 @@
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
"deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.",
"dev": true,
"optional": true,
"dependencies": {
"anymatch": "^2.0.0",
@ -33044,7 +33041,7 @@
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
"integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
"dev": true,
"devOptional": true,
"requires": {
"anymatch": "~3.1.1",
"braces": "~3.0.2",
@ -33060,7 +33057,7 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"dev": true,
"devOptional": true,
"requires": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
@ -33070,13 +33067,13 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true
"devOptional": true
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"devOptional": true,
"requires": {
"fill-range": "^7.0.1"
}
@ -33085,7 +33082,7 @@
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"devOptional": true,
"requires": {
"to-regex-range": "^5.0.1"
}
@ -33094,14 +33091,13 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true
},
"glob-parent": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true,
"devOptional": true,
"requires": {
"is-glob": "^4.0.1"
}
@ -33110,7 +33106,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"devOptional": true,
"requires": {
"binary-extensions": "^2.0.0"
}
@ -33119,13 +33115,13 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true
"devOptional": true
},
"readdirp": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
"integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
"dev": true,
"devOptional": true,
"requires": {
"picomatch": "^2.2.1"
}
@ -33134,7 +33130,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"devOptional": true,
"requires": {
"is-number": "^7.0.0"
}
@ -42059,7 +42055,7 @@
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true
"devOptional": true
},
"pify": {
"version": "4.0.1",
@ -46911,7 +46907,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
"integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
"dev": true,
"optional": true,
"requires": {
"chokidar": "^2.1.8"
@ -46921,7 +46916,6 @@
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
"dev": true,
"optional": true,
"requires": {
"anymatch": "^2.0.0",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
(this.webpackJsonp=this.webpackJsonp||[]).push([[20],{15:function(e,t,s){"use strict";s.r(t),s.d(t,"RootScope",(function(){return r}));var i=s(45),n=s(54),o=s(29);class r extends n.a{constructor(){super(),this.overlaysActive=0,this.idle={isIDLE:!0,deactivated:!1,focusPromise:Promise.resolve(),focusResolve:()=>{}},this.connectionStatus={},this.filterId=0,this.config={forwarded_count_max:100,edit_time_limit:172800,pinned_dialogs_count_max:5,pinned_infolder_count_max:100,message_length_max:4096,caption_length_max:1024},this.addEventListener("peer_changed",e=>{this.peerId=e,document.body.classList.toggle("has-chat",!!e)}),this.addEventListener("user_auth",({id:e})=>{this.myId="number"==typeof i.b?+e:""+e}),this.addEventListener("connection_status_change",e=>{this.connectionStatus[e.name]=e}),this.addEventListener("idle",e=>{e?this.idle.focusPromise=new Promise(e=>{this.idle.focusResolve=e}):this.idle.focusResolve()})}get themeColorElem(){return void 0!==this._themeColorElem?this._themeColorElem:this._themeColorElem=document.head.querySelector('[name="theme-color"]')||null}setThemeColor(e=this.themeColor){e||(e=this.isNight()?"#212121":"#ffffff");const t=this.themeColorElem;t&&t.setAttribute("content",e)}setThemeListener(){try{const e=window.matchMedia("(prefers-color-scheme: dark)"),t=()=>{this.systemTheme=e.matches?"night":"day",this.myId?this.dispatchEvent("theme_change"):this.setTheme()};"addEventListener"in e?e.addEventListener("change",t):"addListener"in e&&e.addListener(t),t()}catch(e){}}setTheme(){const e=this.isNight(),t=document.head.querySelector('[name="color-scheme"]');t&&t.setAttribute("content",e?"dark":"light"),document.documentElement.classList.toggle("night",e),this.setThemeColor()}get isOverlayActive(){return this.overlaysActive>0}set isOverlayActive(e){this.overlaysActive+=e?1:-1,this.dispatchEvent("overlay_toggle",this.isOverlayActive)}isNight(){return"night"===this.getTheme().name}getTheme(e=("system"===this.settings.theme?this.systemTheme:this.settings.theme)){return this.settings.themes.find(t=>t.name===e)}}const c=new r;o.a.rootScope=c,t.default=c},29:function(e,t,s){"use strict";s.d(t,"a",(function(){return n}));const i=s(77).a.debug,n="undefined"!=typeof window?window:self;t.b=i},45:function(e,t,s){"use strict";s.d(t,"b",(function(){return i})),s.d(t,"c",(function(){return n})),s.d(t,"d",(function(){return o})),s.d(t,"a",(function(){return r}));const i=0,n=1271266957,o=777e3,r=2147483647},54:function(e,t,s){"use strict";s.d(t,"a",(function(){return i}));class i{constructor(e){this._constructor(e)}_constructor(e=!1){this.reuseResults=e,this.listeners={},this.listenerResults={}}addEventListener(e,t,s){var i,n;(null!==(i=this.listeners[e])&&void 0!==i?i:this.listeners[e]=[]).push({callback:t,options:s}),this.listenerResults.hasOwnProperty(e)&&(t(...this.listenerResults[e]),null===(n=s)||void 0===n?void 0:n.once)&&this.listeners[e].pop()}addMultipleEventsListeners(e){for(const t in e)this.addEventListener(t,e[t])}removeEventListener(e,t,s){this.listeners[e]&&this.listeners[e].findAndSplice(e=>e.callback===t)}_dispatchEvent(e,t,...s){this.reuseResults&&(this.listenerResults[e]=s);const i=t&&[],n=this.listeners[e];if(n){n.slice().forEach(t=>{var o;if(-1===n.findIndex(e=>e.callback===t.callback))return;let r;try{r=t.callback(...s)}catch(e){}i&&i.push(r),(null===(o=t.options)||void 0===o?void 0:o.once)&&this.removeEventListener(e,t.callback)})}return i}dispatchResultableEvent(e,...t){return this._dispatchEvent(e,!0,...t)}dispatchEvent(e,...t){this._dispatchEvent(e,!1,...t)}cleanup(){this.listeners={},this.listenerResults={}}}},77:function(e,t,s){"use strict";const i={test:location.search.indexOf("test=1")>0,debug:location.search.indexOf("debug=1")>0,http:!1,ssl:!0,multipleConnections:!0,asServiceWorker:!1,transport:"websocket"};i.http=location.search.indexOf("http=1")>0,i.http&&(i.transport="https"),t.a=i}}]);
//# sourceMappingURL=20.ff9370bab866f803df41.chunk.js.map
//# sourceMappingURL=20.4071ee7060202bc4308a.chunk.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"sources":["webpack:///26.27b86f0f8f80f7f420ab.chunk.js"],"names":["this","push","28","module","__webpack_exports__","__webpack_require__","r","String","prototype","toUserId","toChatId","toPeerId","isChat","isPeerId","test","toString","Number","Math","abs","undefined"],"mappings":"CAACA,KAAmB,aAAIA,KAAmB,cAAK,IAAIC,KAAK,CAAC,CAAC,IAAI,CAEzDC,GACA,SAAUC,EAAQC,EAAqBC,GAE7C,aACAA,EAAoBC,EAAEF,GAMtBG,OAAOC,UAAUC,SAAW,WACxB,QAAST,MAAMS,YAEnBF,OAAOC,UAAUE,SAAW,WACxB,QAASV,MAAMU,YAEnBH,OAAOC,UAAUG,SAAW,SAAUC,GAClC,QAASZ,MAAMW,SAASC,IAE5BL,OAAOC,UAAUK,SAAW,WACxB,MAAO,SAASC,KAAKd,KAAKe,aAE9BC,OAAOR,UAAUC,SAAW,WACxB,OAAOT,MAEXgB,OAAOR,UAAUE,SAAW,WACxB,OAAOO,KAAKC,IAAIlB,OAEpBgB,OAAOR,UAAUG,SAAW,SAAUC,GAClC,YAAkBO,IAAXP,EAAuBZ,KAAQY,GAAUK,KAAKC,IAAIlB,MAAQA,MAErEgB,OAAOR,UAAUK,SAAW,WACxB,OAAO","file":"26.3728922ed59faa39207a.chunk.js","sourceRoot":""}
{"version":3,"sources":["webpack:///./src/helpers/peerIdPolyfill.ts"],"names":["String","prototype","toUserId","this","toChatId","toPeerId","isChat","isPeerId","test","toString","Number","Math","abs","undefined"],"mappings":"sFAAA,OAMAA,OAAOC,UAAUC,SAAW,WAC1B,QAASC,MAAMD,YAGjBF,OAAOC,UAAUG,SAAW,WAC1B,QAASD,MAAMC,YAGjBJ,OAAOC,UAAUI,SAAW,SAASC,GACnC,QAASH,MAAME,SAASC,IAG1BN,OAAOC,UAAUM,SAAW,WAC1B,MAAO,SAASC,KAAKL,KAAKM,aAG5BC,OAAOT,UAAUC,SAAW,WAC1B,OAAOC,MAGTO,OAAOT,UAAUG,SAAW,WAC1B,OAAOO,KAAKC,IAAIT,OAGlBO,OAAOT,UAAUI,SAAW,SAASC,GACnC,YAAkBO,IAAXP,EAAuBH,KAAkBG,GAAUK,KAAKC,IAAIT,MAAkBA,MAGvFO,OAAOT,UAAUM,SAAW,WAC1B,OAAO","file":"26.3728922ed59faa39207a.chunk.js","sourcesContent":["/*\n * https://github.com/morethanwords/tweb\n * Copyright (C) 2019-2021 Eduard Kuzmenko\n * https://github.com/morethanwords/tweb/blob/master/LICENSE\n */\n\nString.prototype.toUserId = function() {\n return (+this).toUserId();\n};\n\nString.prototype.toChatId = function() {\n return (+this).toChatId();\n};\n\nString.prototype.toPeerId = function(isChat?: boolean) {\n return (+this).toPeerId(isChat);\n};\n\nString.prototype.isPeerId = function() {\n return /^[\\d-]/.test(this.toString());\n};\n\nNumber.prototype.toUserId = function() {\n return this as any;\n};\n\nNumber.prototype.toChatId = function() {\n return Math.abs(this as any);\n};\n\nNumber.prototype.toPeerId = function(isChat?: boolean) {\n return isChat === undefined ? this as number : (isChat ? -Math.abs(this as number) : this as number);\n};\n\nNumber.prototype.isPeerId = function() {\n return true;\n};\n\ndeclare global {\n interface String {\n toUserId(): UserId;\n toChatId(): ChatId;\n toPeerId(isChat?: boolean): PeerId;\n isPeerId(): this is string;\n }\n\n interface Number {\n toUserId(): UserId;\n toChatId(): ChatId;\n toPeerId(isChat?: boolean): PeerId;\n isPeerId(): this is PeerId;\n }\n}\n\nexport {};\n"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,8 +77,9 @@ export type InputFieldOptions = {
maxLength?: number,
showLengthOn?: number,
plainText?: true,
animate?: true,
animate?: boolean,
required?: boolean,
canBeEdited?: boolean,
validate?: () => boolean
};
@ -108,7 +109,7 @@ class InputField {
options.showLengthOn = Math.min(40, Math.round(options.maxLength / 3));
}
const {placeholder, maxLength, showLengthOn, name, plainText} = options;
const {placeholder, maxLength, showLengthOn, name, plainText, canBeEdited} = options;
let label = options.label || options.labelText;
@ -119,7 +120,7 @@ class InputField {
}
this.container.innerHTML = `
<div contenteditable="true" class="input-field-input"></div>
<div contenteditable="${String(!!canBeEdited)}" class="input-field-input"></div>
`;
input = this.container.firstElementChild as HTMLElement;

View File

@ -47,9 +47,10 @@ export default class PeerProfile {
private username: Row;
private phone: Row;
private notifications: Row;
private location: Row;
private cleaned: boolean;
private setBioTimeout: number;
private setMoreDetailsTimeout: number;
private setPeerStatusInterval: number;
private peerId: PeerId;
@ -64,6 +65,7 @@ export default class PeerProfile {
public init() {
this.init = null;
this.element = document.createElement('div');
this.element.classList.add('profile-content');
@ -122,13 +124,25 @@ export default class PeerProfile {
}
});
this.location = new Row({
title: ' ',
subtitleLangKey: 'AttachLocation',
icon: 'location'
});
this.notifications = new Row({
checkboxField: new CheckboxField({toggle: true}),
titleLangKey: 'Notifications',
icon: 'unmute'
});
this.section.content.append(this.phone.container, this.username.container, this.bio.container, this.notifications.container);
this.section.content.append(
this.phone.container,
this.username.container,
this.location.container,
this.bio.container,
this.notifications.container
);
this.element.append(this.section.container, generateDelimiter());
@ -156,7 +170,7 @@ export default class PeerProfile {
rootScope.addEventListener('peer_bio_edit', (peerId) => {
if(peerId === this.peerId) {
this.setBio(true);
this.setMoreDetails(true);
}
});
@ -193,11 +207,12 @@ export default class PeerProfile {
this.bio.container.style.display = 'none';
this.phone.container.style.display = 'none';
this.username.container.style.display = 'none';
this.location.container.style.display = 'none';
this.notifications.container.style.display = '';
this.notifications.checkboxField.checked = true;
if(this.setBioTimeout) {
window.clearTimeout(this.setBioTimeout);
this.setBioTimeout = 0;
if(this.setMoreDetailsTimeout) {
window.clearTimeout(this.setMoreDetailsTimeout);
this.setMoreDetailsTimeout = 0;
}
}
@ -275,7 +290,7 @@ export default class PeerProfile {
//membersLi.style.display = appPeersManager.isBroadcast(peerId) ? 'none' : '';
} */
this.setBio();
this.setMoreDetails();
replaceContent(this.name, new PeerTitle({
peerId,
@ -290,10 +305,10 @@ export default class PeerProfile {
this.setPeerStatus(true);
}
public setBio(override?: true) {
if(this.setBioTimeout) {
window.clearTimeout(this.setBioTimeout);
this.setBioTimeout = 0;
public setMoreDetails(override?: true) {
if(this.setMoreDetailsTimeout) {
window.clearTimeout(this.setMoreDetailsTimeout);
this.setMoreDetailsTimeout = 0;
}
const peerId = this.peerId;
@ -314,6 +329,8 @@ export default class PeerProfile {
if(userFull.rAbout && peerId !== rootScope.myId) {
setText(userFull.rAbout, this.bio);
}
this.location.container.style.display = 'none';
//this.log('userFull', userFull);
return true;
@ -331,13 +348,21 @@ export default class PeerProfile {
setText(RichTextProcessor.wrapRichText(chatFull.about), this.bio);
}
// @ts-ignore
if(chatFull?.location?._ == 'channelLocation') {
// @ts-ignore
setText(RichTextProcessor.wrapRichText(chatFull.location.address), this.location);
}else{
this.location.container.style.display = 'none';
}
return true;
});
}
promise.then((canSetNext) => {
if(canSetNext) {
this.setBioTimeout = window.setTimeout(() => this.setBio(true), 60e3);
this.setMoreDetailsTimeout = window.setTimeout(() => this.setMoreDetails(true), 60e3);
}
});
}

View File

@ -42,6 +42,7 @@ import { closeBtnMenu } from "../misc";
import { indexOfAndSplice } from "../../helpers/array";
import ButtonIcon from "../buttonIcon";
import confirmationPopup from "../confirmationPopup";
import { InputFile } from "../../layer";
export const LEFT_COLUMN_ACTIVE_CLASSNAME = 'is-left-column-shown';
@ -84,6 +85,18 @@ export class AppSidebarLeft extends SidebarSlider {
});
};
const onNewGeoGroupClick = () => {
new AppAddMembersTab(this).open({
type: 'chat',
skippable: true, // you can create geogroups without members
takeOut: (peerIds) => {
new AppNewGroupTab(this).open(peerIds, true);
},
title: 'GroupAddMembers',
placeholder: 'SendMessageTo'
});
};
const onContactsClick = () => {
new AppContactsTab(this).open();
};
@ -235,6 +248,10 @@ export class AppSidebarLeft extends SidebarSlider {
icon: 'newgroup',
text: 'NewGroup',
onClick: onNewGroupClick
},{
icon: 'newgroup',
text: 'NewGeoGroup',
onClick: onNewGeoGroupClick
}, {
icon: 'newprivate',
text: 'NewPrivateChat',

View File

@ -16,13 +16,29 @@ import AvatarEdit from "../../avatarEdit";
import { i18n } from "../../../lib/langPack";
import ButtonCorner from "../../buttonCorner";
interface OpenStreetMapInterface {
place_id?: number;
license?: string;
osm_type?: string;
osm_id?: number;
lat?: string;
lon?: string;
display_name: string;
address?: object;
boundingbox?: object;
}
export default class AppNewGroupTab extends SliderSuperTab {
private searchGroup = new SearchGroup(true, 'contacts', true, 'new-group-members disable-hover', false);
private avatarEdit: AvatarEdit;
private uploadAvatar: () => Promise<InputFile> = null;
private peerIds: PeerId[];
private isGeoChat: boolean = false;
private nextBtn: HTMLButtonElement;
private groupNameInputField: InputField;
private groupLocationInputField: InputField;
private userLocationCoords: { lat: number, long: number };
private userLocationAddress: string;
protected init() {
this.container.classList.add('new-group-container');
@ -40,11 +56,22 @@ export default class AppNewGroupTab extends SliderSuperTab {
maxLength: 128
});
inputWrapper.append(this.groupNameInputField.container);
this.groupLocationInputField = new InputField({
label: 'ChannelGeoGroupLocation',
name: 'location',
canBeEdited: false
});
inputWrapper.append(
this.groupNameInputField.container,
this.groupLocationInputField.container
);
this.groupNameInputField.input.addEventListener('input', () => {
const value = this.groupNameInputField.value;
this.nextBtn.classList.toggle('is-visible', !!value.length && !this.groupNameInputField.input.classList.contains('error'));
let valueCheck = !!value.length && !this.groupNameInputField.input.classList.contains('error');
if(this.isGeoChat) valueCheck = valueCheck && !!this.userLocationCoords && !!this.userLocationAddress;
this.nextBtn.classList.toggle('is-visible', !!valueCheck);
});
this.nextBtn = ButtonCorner({icon: 'arrow_next'});
@ -52,17 +79,35 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.nextBtn.addEventListener('click', () => {
const title = this.groupNameInputField.value;
this.nextBtn.disabled = true;
appChatsManager.createChat(title, this.peerIds.map(peerId => peerId.toUserId())).then((chatId) => {
if(this.uploadAvatar) {
this.uploadAvatar().then((inputFile) => {
appChatsManager.editPhoto(chatId, inputFile);
});
}
appSidebarLeft.removeTabFromHistory(this);
appSidebarLeft.selectTab(0);
});
if(this.isGeoChat){
if(!this.userLocationAddress || !this.userLocationCoords) return;
appChatsManager.createGeoChat(title, '', this.userLocationCoords, this.userLocationAddress).then((chatId) => {
if(this.uploadAvatar) {
this.uploadAvatar().then((inputFile) => {
appChatsManager.editPhoto(chatId, inputFile);
});
}
if(this.peerIds.length){
appChatsManager.inviteToChannel(chatId, this.peerIds);
}
appSidebarLeft.removeTabFromHistory(this);
appSidebarLeft.selectTab(0);
});
}else{
this.nextBtn.disabled = true;
appChatsManager.createChat(title, this.peerIds.map(peerId => peerId.toUserId())).then((chatId) => {
if(this.uploadAvatar) {
this.uploadAvatar().then((inputFile) => {
appChatsManager.editPhoto(chatId, inputFile);
});
}
appSidebarLeft.removeTabFromHistory(this);
appSidebarLeft.selectTab(0);
});
}
});
const chatsContainer = document.createElement('div');
@ -78,14 +123,25 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.avatarEdit.clear();
this.uploadAvatar = null;
this.groupNameInputField.value = '';
this.groupLocationInputField.container.classList.add('hide');
this.nextBtn.disabled = false;
}
public open(peerIds: PeerId[]) {
public open(peerIds: PeerId[], isGeoChat: boolean = false) {
const result = super.open();
result.then(() => {
this.isGeoChat = isGeoChat;
this.peerIds = peerIds;
if(isGeoChat){
this.setTitle('NewGeoGroup');
this.groupLocationInputField.container.classList.remove('hide');
this.groupLocationInputField.setValueSilently('Locating...');
this.startLocating();
}else{
this.groupLocationInputField.container.classList.add('hide');
}
this.peerIds.forEach(userId => {
let {dom} = appDialogsManager.addDialogNew({
dialog: userId,
@ -105,4 +161,29 @@ export default class AppNewGroupTab extends SliderSuperTab {
return result;
}
private startLocating(){
navigator.geolocation.getCurrentPosition(location => {
this.userLocationCoords = {
lat: location.coords.latitude,
long: location.coords.longitude
};
let uri = "https://nominatim.openstreetmap.org/reverse";
uri += "?lat="+location.coords.latitude;
uri += "&lon="+location.coords.longitude;
uri += "&format=json";
uri += "&addressdetails=1";
uri += "&accept-language=en";
fetch(uri)
// @ts-ignore
.then((response) => response.json() as OpenStreetMapInterface)
.then(
(response: OpenStreetMapInterface) => {
this.userLocationAddress = response.display_name;
this.groupLocationInputField.setValueSilently(response.display_name);
}
);
});
}
}

View File

@ -6,7 +6,7 @@
import { copyTextToClipboard } from "../../../helpers/clipboard";
import { randomLong } from "../../../helpers/random";
import { Chat, ChatFull, ExportedChatInvite } from "../../../layer";
import { Chat, ChatFull, ExportedChatInvite, ChannelLocation } from "../../../layer";
import appChatsManager from "../../../lib/appManagers/appChatsManager";
import appProfileManager from "../../../lib/appManagers/appProfileManager";
import Button from "../../button";
@ -81,6 +81,8 @@ export default class AppChatTypeTab extends SliderSuperTabEventable {
}
});
let uri = '';
const btnRevoke = Button('btn-primary btn-transparent danger', {icon: 'delete', text: 'RevokeLink'});
attachClickEvent(btnRevoke, () => {

View File

@ -1,4 +1,5 @@
const lang = {
"GrantPermissions":"Grant me permissions",
"Animations": "Animations",
"AttachAlbum": "Album",
"Appearance.Color.Hex": "HEX",
@ -231,6 +232,7 @@ const lang = {
"UsernameHelpLink": "This link opens a chat with you:\n%1$s",
"NewChannel": "New Channel",
"NewGroup": "New Group",
"NewGeoGroup": "New Geo-Group",
"Contacts": "Contacts",
"SavedMessages": "Saved Messages",
"Settings": "Settings",
@ -399,6 +401,7 @@ const lang = {
"MegaPrivateInfo": "Private groups can only be joined if you were invited or have an invite link.",
"ChannelPrivateLinkHelp": "People can join your channel by following this link. You can revoke the link any time.",
"MegaPrivateLinkHelp": "People can join your group by following this link. You can revoke the link any time.",
"ChannelGeoGroupLocation":"Group location",
"RevokeButton": "Revoke",
"RevokeLink": "Revoke Link",
"RevokeAlert": "Are you sure you want to revoke this link? Once the link is revoked, no one will be able to join using it.",

View File

@ -11,7 +11,7 @@
import DEBUG, { MOUNT_CLASS_TO } from "../../config/debug";
import { isObject, safeReplaceObject, copy, deepEqual } from "../../helpers/object";
import { ChannelParticipant, Chat, ChatAdminRights, ChatBannedRights, ChatParticipant, ChatPhoto, InputChannel, InputChatPhoto, InputFile, InputPeer, Update, Updates } from "../../layer";
import { InputGeoPoint, ChannelParticipant, Chat, ChatAdminRights, ChatBannedRights, ChatParticipant, ChatPhoto, InputChannel, InputChatPhoto, InputFile, InputPeer, Update, Updates } from "../../layer";
import apiManagerProxy from "../mtproto/mtprotoworker";
import apiManager from '../mtproto/mtprotoworker';
import { RichTextProcessor } from "../richtextprocessor";
@ -498,6 +498,33 @@ export class AppChatsManager {
});
}
public createGeoChat(title: string, about: string, gpoint: {
lat: number,
long: number
}, address: string): Promise<ChatId> {
let geo_point = {
_: 'inputGeoPoint',
lat: gpoint['lat'],
long: gpoint['long']
} as InputGeoPoint;
// NON TOCCARE STO PEZZO MAI PIù NELLA VITA
return apiManager.invokeApi('channels.createChannel', {
megagroup: true,
title,
about,
geo_point,
address
}).then((updates) => {
apiUpdatesManager.processUpdateMessage(updates);
const channelId = (updates as any).chats[0].id;
rootScope.dispatchEvent('history_focus', {peerId: channelId.toPeerId(true)});
return channelId;
});
}
public inviteToChannel(id: ChatId, userIds: UserId[]) {
const input = this.getChannelInput(id);
const usersInputs = userIds.map(u => appUsersManager.getUserInput(u));

View File

@ -36,4 +36,4 @@ export default {"MTProto":{"constructors":[{"id":481674261,"predicate":"vector",
constructorsIndex?: {[id: number]: number}
},
layer: number,
};
};

View File

@ -829,4 +829,4 @@ class TLDeserialization<FetchLongAs extends Long> {
MOUNT_CLASS_TO.TLDeserialization = TLDeserialization;
MOUNT_CLASS_TO.TLSerialization = TLSerialization;
export { TLDeserialization, TLSerialization };
export { TLDeserialization, TLSerialization };

View File

@ -1,3 +1,6 @@
"GrantPermissions" = "Grant permissions"
"NewGeoGroup" = "New GeoGroup"
"ChannelGeoGroupLocation" = "Group location"
"Animations" = "Animations";
"AttachAlbum" = "Album";
"BlockModal.Search.Placeholder" = "Block user...";