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

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