From fa559a2a28b24666ec0dd10f18356f4401dfac5c Mon Sep 17 00:00:00 2001 From: Artsiom Trubchyk Date: Thu, 11 Feb 2021 12:33:32 +0300 Subject: [PATCH] Add sys info consts --- druid/const.lua | 4 ++++ druid/helper.lua | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/druid/const.lua b/druid/const.lua index c50cf8e..9f1fc0d 100644 --- a/druid/const.lua +++ b/druid/const.lua @@ -51,6 +51,10 @@ M.PIVOTS = { } +M.SYS_INFO = sys.get_sys_info() +M.CURRENT_SYSTEM_NAME = M.SYS_INFO.system_name + + M.OS = { ANDROID = "Android", IOS = "iPhone OS", diff --git a/druid/helper.lua b/druid/helper.lua index 71233ef..cc83abc 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -183,14 +183,14 @@ end --- Check if device is mobile (Android or iOS) -- @function helper..is_mobile function M.is_mobile() - return system_name == const.OS.IOS or SYSTEM_NAME == const.OS.ANDROID + return const.CURRENT_SYSTEM_NAME == const.OS.IOS or const.CURRENT_SYSTEM_NAME == const.OS.ANDROID end --- Check if device is HTML5 -- @function helper.is_web function M.is_web() - return system_name == const.OS.BROWSER + return const.CURRENT_SYSTEM_NAME == const.OS.BROWSER end