You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wv0.native.js 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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';
  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. var Text2 = rn.Text
  20. import {AbstractButton} from '../react/features/base/toolbox/components';
  21. import { Header, LoadingIndicator, Text } from '../react/features/base/react';
  22. // clog("glob_vhook:",)
  23. glob_vhook.btns = {
  24. Button_v0,
  25. Button_v1,
  26. Button_v2,
  27. }
  28. function onMsg(event ){
  29. clog("OBMSG>>>>")
  30. var onMsg = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("onMsg",{that:this,event},{}) : {}
  31. }
  32. type Props = {}
  33. // class Wview_ui extends AbstractButton<Props> {
  34. class Wview_ui extends PureComponent<Props> {
  35. // class Wview_ui extends AbstractButton<Props, any> {
  36. // icon = "IconMessage";
  37. constructor(props) {
  38. super(props);
  39. this.v1="a"
  40. clog("Wview_v1 init")
  41. glob_vhook.nodes.wvui = this
  42. }
  43. render() {
  44. // return
  45. }
  46. }
  47. function fncb_only_v2(fn_name){
  48. }
  49. function fncb_only(fn_name){
  50. var ret
  51. if (window.glob_vhook.rcb[fn_name]){
  52. // ret = window.glob_vhook.rcb[fn_name](fn_name,o,dflt_ret)
  53. // (fn_name,o,dflt_ret)
  54. ret = {status:1,fn:window.glob_vhook.rcb[fn_name]}
  55. } else {
  56. ret = {status:0,fn:window.nop}
  57. }
  58. return ret
  59. }
  60. class Wview_btns extends Component<Props> {
  61. constructor(props) {
  62. super(props);
  63. }
  64. render(){
  65. // wview_btns = tglob_au.run_dev_cbs("wview_btns",{that:this})
  66. var x1 = tglob_au.run_dev_cbs("wview_btns",{that:this}) || {o:{}}
  67. var wview_btns = x1.o.ret || {}
  68. clog("\n\n\n\nwview_btns",wview_btns)
  69. // wview_btns.style_b1 || {}
  70. // wview_btns.style_b2 || {}
  71. // wview_btns.style_v0 || {}
  72. // color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  73. // onPress = {fncb_only("vbx_press").fn.bind(this)}
  74. // style={wview_btns.style_v0 || {}}
  75. // prop_id = "b1"
  76. // prop_id = "b2"
  77. // style={ {} }
  78. return (
  79. <View >
  80. <Button_v0
  81. style = { wview_btns.style_b1 || {}}
  82. >
  83. {"wview_btns.b1_txt" || "udef"}
  84. </Button_v0>
  85. </View>
  86. )
  87. }
  88. }
  89. class Wview_vx extends Component<Props> {
  90. constructor(props) {
  91. super(props);
  92. }
  93. render(){
  94. var wb_url
  95. tglob_au.run_dev_cbs("render_vvx",{that:this,args:arguments,a:"z?"})
  96. if (glob_vhook?.fns?.gen_xcal_room3) {
  97. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  98. } else {
  99. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  100. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  101. }
  102. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  103. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  104. // <View
  105. // style = {wv0_styles.v1 || {}}
  106. // >
  107. var wv0_styles_dev = this.wv0_styles_dev || {}
  108. // window.postMessage("Your message");
  109. // console.log(">>>>>>>..?")
  110. var injectedJs = `(function(){
  111. console.log(">>>>>>>..")
  112. this.webView.postMessage("ZZ")
  113. return "Send me back!"}());
  114. `;
  115. injectedJs =`
  116. setTimeout(function () {
  117. window.ReactNativeWebView.postMessage("Hello!")
  118. console.log("QWETUI\n")
  119. window.top.postMessage('hello2', '*')
  120. }, 2000)
  121. `
  122. // clog("VVX:")
  123. return (
  124. <View style={wv0_styles_dev.vx_v}>
  125. <WebView source = {{uri:wb_url}}
  126. style = {wv0_styles_dev.webview_style || {}}
  127. injectedJavaScript={injectedJs}
  128. startInLoadingState
  129. javaScriptEnabledAndroid={true}
  130. javaScriptEnabled={true}
  131. onMessage={onMsg}
  132. ></WebView>
  133. </View>
  134. )
  135. return (
  136. <View style={this.props.vx_v}>
  137. <Text style={this.props.vx_tx} >Wview_vx</Text>
  138. </View>
  139. )
  140. }
  141. }
  142. // class Wview_vx
  143. // class Wview_v1 extends PureComponent<Props> {
  144. class Wview_v1 extends Component<Props> {
  145. constructor(props) {
  146. super(props);
  147. // const { palette } = useTheme();
  148. this.v1="a"
  149. // this.palette=palette
  150. tglob_au.reg_qxi_cb(this.rs_state.bind(this),"SET_TILE_VIEW_DIMENSIONS","RS_STATE")
  151. tglob_au.reg_dev_cb(this.rs_state2.bind(this),"rerender_Wview_v1","rerender")
  152. clog("Wview_v1 init")
  153. }
  154. rs_state2(a1,a2,a3,a4,a5){
  155. this.setState(() => {
  156. return { unseen3: Math.random() }
  157. });
  158. }
  159. rs_state(a1,a2,a3,a4,a5){
  160. // clog("RS_STATE",this,{a1,a2,a3,a4,a5})
  161. // clog("RS_STATE",{a1,a2,a3,a4,a5})
  162. this.setState(() => {
  163. // console.log('setting state');
  164. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  165. // return { unseen: "does not display" }
  166. return { unseen2: wv0_dev.ret }
  167. });
  168. /*
  169. try {
  170. // var s = this.props
  171. var s = this.state
  172. clog("::::",s)
  173. } catch (err){
  174. console.error("ERR:,")
  175. }
  176. */
  177. }
  178. /*
  179. componentDidMount() {
  180. setInterval(() => {
  181. this.setState(() => {
  182. // console.log('setting state');
  183. var wv0_dev = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_dev",{that:this},{}) : {}
  184. return { unseen: "does not display" }
  185. // return { unseen: wv0_dev.ret }
  186. });
  187. }, 1000);
  188. }
  189. */
  190. render() {
  191. var wb_url
  192. clog("Wview_v1 render")
  193. // console.log("wview_v1 render.")
  194. if (glob_vhook?.fns?.gen_xcal_room3) {
  195. wb_url = glob_vhook.fns.gen_xcal_room3().room_url
  196. } else {
  197. // wb_url = "https://excalidraw.videocorners.com/#room=4zmaf7d5jtcx4pqgruba,4zmaf7BMXbI6tCEiW7rbgy"
  198. wb_url = "https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"
  199. }
  200. var webview_style = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("webview_style",{that:this},{}) : {}
  201. var wv0_styles = window.glob_vhook.fns.glob_dev_fncb ? window.glob_vhook.fns.glob_dev_fncb("wv0_styles",{that:this},{}) : {}
  202. // <View
  203. // style = {wv0_styles.v1 || {}}
  204. // >
  205. var wv0_styles_dev = this.wv0_styles_dev || {}
  206. // window.postMessage("Your message");
  207. // console.log(">>>>>>>..?")
  208. var injectedJs = `(function(){
  209. console.log(">>>>>>>..")
  210. this.webView.postMessage("ZZ")
  211. return "Send me back!"}());
  212. `;
  213. injectedJs =`
  214. setTimeout(function () {
  215. window.ReactNativeWebView.postMessage("Hello!")
  216. console.log("QWETUI\n")
  217. window.top.postMessage('hello2', '*')
  218. }, 2000)
  219. `
  220. // <View style = { wv0_styles.v1 || {} }>
  221. // style = {webview_style}
  222. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  223. // <WebView source = {{uri:"https://excalidraw.videocorners.com/#room=4zxcald5jtcx4pqgruba,4zxcalBMXbI6tCEiW7rbgy"}}
  224. // {t('polls.create.create')}
  225. // <Wview_ui style = { wv0_styles_dev.vb1 || {}} />
  226. // vx_v
  227. // vx_tx
  228. return (
  229. <View style = { wv0_styles_dev.v1 || {} }>
  230. <Text style = { wv0_styles_dev.txt || {} }
  231. >
  232. Z??
  233. </Text>
  234. <Wview_vx
  235. vx_tx = { wv0_styles_dev.vx_tx || {} }
  236. vx_v = { wv0_styles_dev.vx_v || {} }
  237. ></Wview_vx>
  238. <Wview_btns
  239. pt0 = { wv0_styles_dev.wv_b || {}}
  240. ></Wview_btns>
  241. <Button_v2
  242. title = "Cheems"
  243. style = { wv0_styles_dev.vb1 || {}}
  244. color = { wv0_styles_dev.vb1_color || "#00ffffff" }
  245. onPress = {fncb_only("vb1_press").fn.bind(this)}
  246. >
  247. {wv0_styles_dev.vb1_txt || "udef"}
  248. </Button_v2>
  249. <Text2 style = { wv0_styles_dev.txt2 || {} }
  250. >
  251. Z2
  252. </Text2>
  253. </View>
  254. )
  255. }
  256. }
  257. // color = { this.palette.screen01Header }
  258. export {Wview_v1}