Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

wv0.native.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. import { WebView } from 'react-native-webview';
  2. import React, { PureComponent,Component,Button as Button_v0, } from 'react';
  3. // import { Button as Button_v0,} from 'react';
  4. import { Button } from 'react-native-paper';
  5. // Button as R_Button
  6. import { Button as Button_v2, useTheme } from 'react-native-paper';
  7. import {
  8. Animated,
  9. Keyboard,
  10. SafeAreaView,
  11. TextInput,
  12. TouchableHighlight,
  13. TouchableOpacity,
  14. View,
  15. Button as Button_v1,
  16. // Text,
  17. } from 'react-native';
  18. import * as rn from 'react-native';
  19. import * as rn_cam from './rn_cam';
  20. import * as rn_vshot from './rn_vshot';
  21. // rn_vshot.ExampleCaptureOnMountManually
  22. var Text2 = rn.Text
  23. import {AbstractButton} from '../react/features/base/toolbox/components';
  24. import { Header, LoadingIndicator, Text } from '../react/features/base/react';
  25. // clog("glob_vhook:",)
  26. glob_vhook.btns = {
  27. Button_v0,
  28. Button_v1,
  29. Button_v2,
  30. }
  31. function onMsg(event ){
  32. clog("OBMSG>>>>")
  33. var onMsg = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("onMsg",{that:this,event},{}) : {}
  34. }
  35. type Props = {}
  36. // class Wview_ui extends AbstractButton<Props> {
  37. class Wview_ui extends PureComponent<Props> {
  38. // class Wview_ui extends AbstractButton<Props, any> {
  39. // icon = "IconMessage";
  40. constructor(props) {
  41. super(props);
  42. this.v1="a"
  43. clog("Wview_v1 init")
  44. glob_vhook.nodes.wvui = this
  45. }
  46. render() {
  47. // return
  48. }
  49. }
  50. function dbg_vbx_onpress(event){
  51. clog("dbg_vbx_onpress:",event)
  52. clog("dbg_vbx_onpress:a",arguments)
  53. clog("dbg_vbx_onpress:this",this)
  54. clog("dbg_vbx_onpress:color",this.color)
  55. clog("dbg_vbx_onpress:currentTarget",event.currentTarget)
  56. clog("dbg_vbx_onpress:prop_id",this.prop_id)
  57. }
  58. function fncb_only_v2(fn_name,arg1){
  59. var that0 = this
  60. // var ret = function(arg2){
  61. return function(arg2){
  62. // return tglob_au.run_dev_cbs(fn_name,{arg1,arg2,argx:arguments})
  63. // clog("???2",fn_name)
  64. var ret2 = tglob_au.run_dev_cbs(fn_name,{arg1,arg2,argx:arguments,thats:{that0,that1:this}})
  65. return ret2.o.ret
  66. }
  67. // return ret
  68. }
  69. function fncb_only(fn_name){
  70. var ret
  71. if (window.glob_vhook.rcb[fn_name]){
  72. // ret = window.glob_vhook.rcb[fn_name](fn_name,o,dflt_ret)
  73. // (fn_name,o,dflt_ret)
  74. ret = {status:1,fn:window.glob_vhook.rcb[fn_name]}
  75. } else {
  76. ret = {status:0,fn:window.nop}
  77. }
  78. return ret
  79. }
  80. // class Wview_btns extends Component<Props> {
  81. class Wview_btns extends PureComponent<Props> {
  82. constructor(props) {
  83. super(props);
  84. }
  85. render(){
  86. // wview_btns = tglob_au.run_dev_cbs("wview_btns",{that:this})
  87. var x1 = tglob_au.run_dev_cbs("wview_btns",{that:this}) || {o:{}}
  88. var wview_btns = x1.o.ret || {}
  89. // clog("\n\n\n\nwview_btns",wview_btns)
  90. // wview_btns.style_b1 || {}
  91. // wview_btns.style_b2 || {}
  92. // wview_btns.style_v0 || {}
  93. // color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  94. // onPress = {fncb_only("vbx_press").fn.bind(this)}
  95. // style={wview_btns.style_v0 || {}}
  96. // prop_id = "b1"
  97. // prop_id = "b2"
  98. // <View style={wview_btns.style_v1 || {}}>
  99. // </View>
  100. // <View style={wview_btns.style_v2 || {}}>
  101. // </View>
  102. // style={ {} }
  103. // return (
  104. // NEED CONSTS DEFS
  105. var ret_con = {}
  106. var ret = (
  107. <View style={wview_btns.style_v0 || {}}>
  108. <Button_v2
  109. prop_id = "b1"
  110. style = { wview_btns.style_b1 || {}}
  111. labelStyle = { wview_btns.style_b2l || {}}
  112. color={wview_btns.color_b1}
  113. onPress = {fncb_only_v2("vbx_press",{wvt:this,ret_con,button_action:"wb_toggle"})}
  114. >
  115. {wview_btns.b1_txt || "udef1"}
  116. </Button_v2>
  117. <Button_v2
  118. prop_id = "b2"
  119. style = { wview_btns.style_b2 || {}}
  120. labelStyle = { wview_btns.style_b2l || {}}
  121. color={wview_btns.color_b2}
  122. onPress = {fncb_only_v2("vbx_press",{wvt:this,ret_con,button_action:"tbox_toggle"})}
  123. >
  124. {wview_btns.b2_txt || "udef2"}
  125. </Button_v2>
  126. {
  127. !!0 && <Text style={wview_btns.style_v2 || {}}>Wview_vx</Text>
  128. }
  129. { !!0 && <Text style={wview_btns.style_v2 || {}}>Wview_vx2</Text> }
  130. </View>
  131. )
  132. ret_con.ret= ret
  133. return ret
  134. }
  135. }
  136. class Wview_vx extends Component<Props> {
  137. constructor(props) {
  138. super(props);
  139. }
  140. render(){
  141. var wb_url
  142. // tglob_au.run_dev_cbs("render_vvx",{that:this,args:arguments,a:"z?"})
  143. if (glob_vhook?.fns?.gen_xcal_room3) {
  144. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  145. } else {
  146. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  147. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  148. }
  149. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  150. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  151. // <View
  152. // style = {wv0_styles.v1 || {}}
  153. // >
  154. var wv0_styles_dev = this.wv0_styles_dev || {}
  155. // window.postMessage("Your message");
  156. // console.log(">>>>>>>..?")
  157. var injectedJs = `(function(){
  158. console.log(">>>>>>>..")
  159. this.webView.postMessage("ZZ")
  160. return "Send me back!"}());
  161. `;
  162. injectedJs =`
  163. setTimeout(function () {
  164. window.ReactNativeWebView.postMessage("Hello!")
  165. console.log("QWETUI\n")
  166. window.top.postMessage('hello2', '*')
  167. }, 2000)
  168. `
  169. // clog("VVX:")
  170. return (
  171. <View style={wv0_styles_dev.vx_v}>
  172. <WebView source = {{uri:wb_url}}
  173. style = {wv0_styles_dev.webview_style || {}}
  174. injectedJavaScript={injectedJs}
  175. startInLoadingState
  176. javaScriptEnabledAndroid={true}
  177. javaScriptEnabled={true}
  178. onMessage={onMsg}
  179. ></WebView>
  180. </View>
  181. )
  182. return (
  183. <View style={this.props.vx_v}>
  184. <Text style={this.props.vx_tx} >Wview_vx</Text>
  185. </View>
  186. )
  187. }
  188. }
  189. // class Wview_vx
  190. class Wview_v1 extends PureComponent<Props> {
  191. // class Wview_v1 extends Component<Props> {
  192. constructor(props) {
  193. super(props);
  194. // const { palette } = useTheme();
  195. this.v1="a"
  196. // this.palette=palette
  197. tglob_au.reg_qxi_cb(this.rs_state.bind(this),"SET_TILE_VIEW_DIMENSIONS","RS_STATE")
  198. tglob_au.reg_dev_cb(this.rs_state2.bind(this),"rerender_Wview_v1","rerender")
  199. clog("Wview_v1 init")
  200. }
  201. rs_state2(a1,a2,a3,a4,a5){
  202. this.setState(() => {
  203. return { unseen3: Math.random() }
  204. });
  205. }
  206. rs_state(a1,a2,a3,a4,a5){
  207. // clog("RS_STATE",this,{a1,a2,a3,a4,a5})
  208. // clog("RS_STATE",{a1,a2,a3,a4,a5})
  209. this.setState(() => {
  210. // console.log('setting state');
  211. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  212. // return { unseen: "does not display" }
  213. return { unseen2: wv0_dev.ret }
  214. });
  215. /*
  216. try {
  217. // var s = this.props
  218. var s = this.state
  219. clog("::::",s)
  220. } catch (err){
  221. console.error("ERR:,")
  222. }
  223. */
  224. }
  225. /*
  226. componentDidMount() {
  227. setInterval(() => {
  228. this.setState(() => {
  229. // console.log('setting state');
  230. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  231. return { unseen: "does not display" }
  232. // return { unseen: wv0_dev.ret }
  233. });
  234. }, 1000);
  235. }
  236. */
  237. render() {
  238. var wb_url
  239. // clog("Wview_v1 render")
  240. // console.log("wview_v1 render.")
  241. if (glob_vhook?.fns?.gen_xcal_room3) {
  242. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  243. } else {
  244. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  245. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  246. }
  247. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  248. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  249. // <View
  250. // style = {wv0_styles.v1 || {}}
  251. // >
  252. var wv0_styles_dev = this.wv0_styles_dev || {}
  253. // window.postMessage("Your message");
  254. // console.log(">>>>>>>..?")
  255. var injectedJs = `(function(){
  256. console.log(">>>>>>>..")
  257. this.webView.postMessage("ZZ")
  258. return "Send me back!"}());
  259. `;
  260. injectedJs =`
  261. setTimeout(function () {
  262. window.ReactNativeWebView.postMessage("Hello!")
  263. console.log("QWETUI\n")
  264. window.top.postMessage('hello2', '*')
  265. }, 2000)
  266. `
  267. // <View style = { wv0_styles.v1 || {} }>
  268. // style = {webview_style}
  269. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  270. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  271. // {t('polls.create.create')}
  272. // <Wview_ui style = { wv0_styles_dev.vb1 || {}} />
  273. // vx_v
  274. // vx_tx
  275. return (
  276. <View style = { wv0_styles_dev.v1 || {} }>
  277. <Text style = { wv0_styles_dev.txt || {} }
  278. >
  279. Z??
  280. </Text>
  281. <Wview_vx
  282. vx_tx = { wv0_styles_dev.vx_tx || {} }
  283. vx_v = { wv0_styles_dev.vx_v || {} }
  284. ></Wview_vx>
  285. <Wview_btns
  286. pt0 = { wv0_styles_dev.wv_b0 || {}}
  287. style = { wv0_styles_dev.wv_b || {}}
  288. ></Wview_btns>
  289. <rn_vshot.ExampleCaptureOnMountManually></rn_vshot.ExampleCaptureOnMountManually>
  290. <Button_v2
  291. title = "Cheems"
  292. style = { wv0_styles_dev.vb1 || {}}
  293. color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  294. onPress = {fncb_only("vb1_press").fn.bind(this)}
  295. >
  296. {wv0_styles_dev.vb1_txt || "udef"}
  297. </Button_v2>
  298. <Text2 style = { wv0_styles_dev.txt2 || {} }
  299. >
  300. Z2
  301. </Text2>
  302. </View>
  303. )
  304. }
  305. }
  306. // <rn_cam.ExampleApp></rn_cam.ExampleApp>
  307. // <rn_cam.ExampleApp></rn_cam.ExampleApp>
  308. // color = { this.palette.screen01Header }
  309. export {Wview_v1}