allow to store topic name in setting

This commit is contained in:
lxsang 2021-01-15 20:38:55 +01:00
parent d8f999749a
commit e45e8dd5b1
6 changed files with 21 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
"dependencies": [ "dependencies": [
"Antunnel@0.1.8-a" "Antunnel@0.1.8-a"
], ],
"version":"0.1.5-a", "version":"0.1.6-a",
"category":"Other", "category":"Other",
"iconclass":"fa fa-android", "iconclass":"fa fa-android",
"mimes":["none"], "mimes":["none"],

View File

@ -12,6 +12,9 @@ class SysmondService extends OS.application.BaseService
#] #]
@onmenuselect = (e) => @openApp() @onmenuselect = (e) => @openApp()
setting: () ->
return @systemsetting.applications["SystemControl"]
init: () -> init: () ->
checklib = () => checklib = () =>
if not Antunnel.tunnel if not Antunnel.tunnel
@ -21,8 +24,9 @@ class SysmondService extends OS.application.BaseService
@error e.toString(), e @error e.toString(), e
@quit() @quit()
else else
return unless @setting().topic
@tunnel = Antunnel.tunnel @tunnel = Antunnel.tunnel
@sub = new Antunnel.Subscriber("fbf070ddea3ea90d07f456540b405d302554ec82") @sub = new Antunnel.Subscriber(@setting().topic)
@sub.onopen = () => @sub.onopen = () =>
#@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello") #@sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode("Hello")
console.log("Subscribed to notification channel") console.log("Subscribed to notification channel")
@ -44,6 +48,16 @@ class SysmondService extends OS.application.BaseService
@quit() @quit()
Antunnel.tunnel.subscribe @sub Antunnel.tunnel.subscribe @sub
if not @setting().topic
console.log "Open dialog"
@_gui.openDialog("PromptDialog", {
title: __("Enter topic name"),
label: __("Please enter topic name")
})
.then (v) =>
@setting().topic = v
checklib()
else
checklib() checklib()

View File

@ -13,7 +13,7 @@
"dependencies": [ "dependencies": [
"Antunnel@0.1.8-a" "Antunnel@0.1.8-a"
], ],
"version":"0.1.5-a", "version":"0.1.6-a",
"category":"Other", "category":"Other",
"iconclass":"fa fa-android", "iconclass":"fa fa-android",
"mimes":["none"], "mimes":["none"],

View File

@ -235,8 +235,8 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/SystemControl/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/SystemControl/README.md",
"category": "Other", "category": "Other",
"author": "", "author": "",
"version": "0.1.5-a", "version": "0.1.6-a",
"dependencies": ["Antunnel@0.1.8-a"],"version":"0.1.5-a","category":"Other","iconclass":"fafa-android","mimes":["none"], "dependencies": ["Antunnel@0.1.8-a"],"version":"0.1.6-a","category":"Other","iconclass":"fafa-android","mimes":["none"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/SystemControl/build/release/SystemControl.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/SystemControl/build/release/SystemControl.zip"
}, },
{ {