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

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