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 10KB

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