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.3KB

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