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

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