1
0
forked from x/icebergs

opt island

This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-12 23:37:26 +08:00
parent a12a4836b9
commit ef97bf61ca
3 changed files with 6 additions and 1 deletions

View File

@ -128,6 +128,9 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title
var Icons = map[string]string{ice.PROCESS: "🕑", ice.FAILURE: "❌", ice.SUCCESS: "✅"}
func toastContent(m *ice.Message, state string, arg ...ice.Any) string {
if len(arg) > 0 {
return kit.JoinWord(kit.Simple(Icons[state], arg)...)
}
return kit.JoinWord(kit.Simple(Icons[state], m.ActionKey(), state, arg)...)
}
func ToastSuccess(m *ice.Message, arg ...ice.Any) {
@ -137,7 +140,7 @@ func ToastFailure(m *ice.Message, arg ...ice.Any) {
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "3s")).Sleep(m.OptionDefault(ice.TOAST_DURATION, "3s"))
}
func ToastProcess(m *ice.Message, arg ...ice.Any) func() {
Toast(m, toastContent(m, ice.PROCESS, arg...), "", "30s")
Toast(m, toastContent(m, ice.PROCESS, arg...), "", "180s")
return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s") }
}
func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message {

View File

@ -119,6 +119,7 @@ func _space_fork(m *ice.Message) {
m.Cmd(SPACE, value[mdb.NAME], gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
}
})
m.Cmd(gdb.EVENT, gdb.HAPPEN, gdb.EVENT, OPS_SERVER_OPEN, args)
})
}
_space_handle(m, false, name, c)

View File

@ -80,6 +80,7 @@ func (m *Message) PushDetail(value Any, arg ...string) *Message {
case string:
value = kit.UnMarshal(v)
}
m.OptionFields("detail")
return m.Push(FIELDS_DETAIL, value, kit.Split(kit.Join(arg)))
}
func (m *Message) RenameOption(from, to string) *Message {