123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- //
- // PrefsUtil.swift
- // AppBuilder
- //
- // Created by Kevin Maulana on 23/03/22.
- //
- import Foundation
- import NexilisLite
- class PrefsUtil {
- static let CPAAS_MODE_FLOATING = 0
- static let CPAAS_MODE_DOCKED = 1
- static let CPAAS_MODE_BURGER = 2
- static let CPAAS_MODE_MIX = 4
- static let DEFAULT_CPAAS_MODE = CPAAS_MODE_DOCKED
-
- static func getCpaasMode() -> Int {
- let mode: Int! = SecureUserDefaults.shared.value(forKey: "cpaas_mode") ?? 0
- if(mode != 0) {
- return mode - 1
- }
- return PrefsUtil.DEFAULT_CPAAS_MODE
- }
-
- static func setCpaasMode(mode: Int){
- SecureUserDefaults.shared.set(mode+1, forKey: "cpaas_mode")
- }
-
- static var CUSTOM_TAB = "1,2,3,4"
-
- static func getCustomTab() -> String {
- if let cust: String = SecureUserDefaults.shared.value(forKey: "custom_tab") {
- if(!cust.isEmpty){
- return cust
- }
- }
- return PrefsUtil.CUSTOM_TAB
- }
-
- static func getURLFirstTab() -> String? {
- let value: String? = SecureUserDefaults.shared.value(forKey: "app_builder_url_first_tab")
- return value
- }
-
- static func getURLThirdTab() -> String? {
- let value: String? = SecureUserDefaults.shared.value(forKey: "app_builder_url_third_tab")
- return value
- }
- static func getURLBase() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_url_base") ?? "https://nexilis.io/"
- return value
- }
- static func getURLQMS() -> String? {
- let value: String? = SecureUserDefaults.shared.value(forKey: "app_builder_url_qms")
- return value
- }
- static func getIconDock() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_icon_dock") ?? ""
- return value
- }
- static func getIconSS() -> String? {
- let value: String? = SecureUserDefaults.shared.value(forKey: "app_builder_icon_ss")
- return value
- }
- static func getBackground() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_background") ?? ""
- return value
- }
-
- static func getBackgroundLight() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_background_light") ?? ""
- return value
- }
- static func getBackgroundDark() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_background_dark") ?? ""
- return value
- }
-
- static func getUrlSS() -> String? {
- return PrefsUtil.getURLBase() + "get_file_from_path?img=" + PrefsUtil.getIconSS()!
- }
- static func getUrlDock() -> String? {
- return PrefsUtil.getURLBase() + "get_file_from_path?img=" + PrefsUtil.getIconDock()
- }
-
- static func getURLPrivacyPolicy() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_url_privacy_policy") ?? "https://nexilis.io/privacypolicy"
- return value
- }
-
- static func getEnablePrivacyPolicy() -> Bool {
- let value: Bool = SecureUserDefaults.shared.value(forKey: "app_builder_enable_privacy_policy") ?? false
- return value
- }
-
- static func getAgreePrivacyPolicy() -> Bool {
- let value: Bool = SecureUserDefaults.shared.value(forKey: "agree_privacy_policy") ?? false
- return value
- }
-
- static func setAgreePrivacyPolicy(value: Bool){
- SecureUserDefaults.shared.set(value, forKey: "agree_privacy_policy")
- }
- static func getTerms() -> Bool {
- let value: Bool = SecureUserDefaults.shared.value(forKey: "terms_app") ?? false
- return value
- }
-
- static func setTerms(value: Bool){
- SecureUserDefaults.shared.set(value, forKey: "terms_app")
- }
-
- static func getCustomButtons() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_custom_buttons") ?? ""
- return value
- }
-
- static func getCustomFBIcon() -> String {
- let value: String = SecureUserDefaults.shared.value(forKey: "app_builder_button_icon") ?? ""
- return value
- }
-
- static func getIconCenterAnim() -> String? {
- let value: String? = SecureUserDefaults.shared.value(forKey: "fb_icon_center_anim")
- return value
- }
-
- }
- //public static String getHeaderColorSetting(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // String header_color = sharedPref.getString("header_color", "#00000000");
- // return header_color;
- // }
- //
- // public static String getHeaderTextColorSetting(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // String header_text_color = sharedPref.getString("header_text_color", "#FF000000");
- // return header_text_color;
- // }
- //
- // public static void setContentFilter(Context pContext, String new_value) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // SharedPreferences.Editor edit = sharedPref.edit();
- // edit.putString("content_filter",new_value);
- // edit.apply();
- // }
- //
- // public static String getContentFilter(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // String header_text_color = sharedPref.getString("content_filter", "1,2,3,4,5");
- // return header_text_color;
- // }
- //
- // public static void setContentSort(Context pContext, int new_value) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // SharedPreferences.Editor edit = sharedPref.edit();
- // edit.putInt("content_sort",new_value);
- // edit.apply();
- // }
- //
- // public static int getContentSort(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // int header_text_color = sharedPref.getInt("content_sort", 1);
- // return header_text_color;
- // }
- //
- // public static void setContentClassification(Context pContext, String new_value) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // SharedPreferences.Editor edit = sharedPref.edit();
- // edit.putString("content_class",new_value);
- // edit.apply();
- // }
- //
- // public static String getContentClassification(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // String header_text_color = sharedPref.getString("content_class", "1,2,3,4");
- // return header_text_color;
- // }
- //
- // public static final int CPAAS_MODE_FLOATING = 0;
- // public static final int CPAAS_MODE_DOCKED = 1;
- // public static final int CPAAS_MODE_BURGER = 2;
- // public static final int CPAAS_MODE_MIX = 4;
- // public static final int DEFAULT_CPAAS_MODE = CPAAS_MODE_DOCKED;
- // public static int getCpaasMode(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // int mode_index = sharedPref.getInt("cpaas_mode", DEFAULT_CPAAS_MODE);
- // return mode_index;
- // }
- //
- // public static void setCpaasMode(Context pContext, int new_value) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // SharedPreferences.Editor edit = sharedPref.edit();
- // edit.putInt("cpaas_mode",new_value);
- // edit.apply();
- // }
- //
- // public static final int CPAAS_FLOAT_MODE_IN_APP = 3;
- // public static final int CPAAS_FLOAT_MODE_OUT_APP = 4;
- // public static int getCpaasFloatMode(Context pContext) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // int mode_index = sharedPref.getInt("cpaas_float_mode", CPAAS_FLOAT_MODE_IN_APP);
- // return mode_index;
- // }
- // public static void setCpaasFloatMode(Context pContext, int new_value) {
- // final SharedPreferences sharedPref = pContext.getSharedPreferences("PREF_SYS", Context.MODE_PRIVATE);
- // SharedPreferences.Editor edit = sharedPref.edit();
- // edit.putInt("cpaas_float_mode",new_value);
- // edit.apply();
- // }
- //
- // public static String getURLFirstTab() {
- // return CoreDataSqlite_PrefsDB.get("app_builder_url_first_tab", "");
- // }
- //
- // public static String getURLThirdTab() {
- // return CoreDataSqlite_PrefsDB.get("app_builder_url_third_tab", "");
- // }
- //
- // public static String getURLBase() {
- // return CoreDataSqlite_PrefsDB.get("app_builder_url_base", Util_RandomCrypt.decrypt("3<rl;duhpt<<=vswwk"));
- // }
- //
- // public static void setURLFirstTab(String new_value) {
- // CoreDataSqlite_PrefsDB.put("app_builder_url_first_tab", new_value);
- // }
- //
- // public static void setURLThirdTab(String new_value) {
- // CoreDataSqlite_PrefsDB.put("app_builder_url_third_tab", new_value);
- // }
- //
- // public static void setURLBase(String new_value) {
- // CoreDataSqlite_PrefsDB.put("app_builder_url_base", new_value);
- // }
- //
- // public static String DEFAULT_TAB_AMOUNT = "4";
- //
- // public static String getTabAmount(){
- // return CoreDataSqlite_PrefsDB.get("app_builder_tab_amount", DEFAULT_TAB_AMOUNT);
- // }
- //
- // public static void setTabAmount(Context pContext, String new_value){
- // CoreDataSqlite_PrefsDB.put("app_builder_tab_amount", new_value);
- // }
|