ini_set("rom_name",	"NanoDroid SetupWizard");
ini_set("rom_version",	"22.7");
ini_set("rom_author",	"Nanolx");
ini_set("rom_device",	"Generic (LOS/AOSP)");
ini_set("rom_date",	"20200829");

ini_set("force_colorspace","rgba");
splash(2000, "nanolx");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" );
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" );
theme("touchwiz");

viewbox(
	"Welcome",
	"Relevant information of the Package:\n\n"+
	"	Rom\t		<b><#selectbg_g>"+ini_get("rom_name")+"</#></b>\n"+
	"	Version\t	<b><#selectbg_g>"+ini_get("rom_version")+"</#></b>\n"+
	"	Date\t		<b><#selectbg_g>"+ini_get("rom_date")+"</#></b>\n\n"+
	"	Device\t	<b><#f00>"+ini_get("rom_device")+"</#></b>\n\n\n",
	"@welcome"
);

agreebox(
	"Terms Of Use",
	"<@center>Please read the NanoDroid terms of use</@>",
	"@license",
	"<@center>" + readfile_aroma("license.txt") + "</@>",
	"I agree with these terms of use",
	"<@center>You must accept the terms</@>"
);

selectbox(
	"Configuration Location",
	"Configuration Location",
	"@customize",
	"location.prop",

	"Where to store configuration", "", 2, #-- Group 1. key = "selected.1"
	"/data/media/0",	"Internal Storage (wipe-safe)",		1,	#-- selected.1 = 1
	"/external_sd",	"External SD Card (if any)",		0,	#-- selected.1 = 2
	"/data",	"Data Storage (not wipe-safe) ",	0	#-- selected.1 = 3
);

checkbox(
	"Generic Setup",
	"Generic Setup",
	"@customize",
	"setup.prop",

	"Adjust the basic settings", "", 2, #-- Group 1
	"Apps",		"Install Apps (customized later)",			1,
	"Overlay",	"Debloat Apps (customized later)",			1,
	"Maps API v1",	"Install Google Maps API version 1",			1,
	"Force System",	"Force System Mode Installation",			0,
	"GNU Bash",	"Install GNU Bash Shell",				1
);

selectbox(
	"microG",
	"microG",
	"@customize",
	"ug.prop",

	"Select whether to install microG", "", 2, #-- Group 1. key = "selected.1"
	"None",		"Don't install microG (does not effect NanoDroid-microG)",		0,	#-- selected.1 = 1
	"Full",		"Install microG [GmsCore, GsfProxy, DroidGuard Helper, Nominatim]",	1,	#-- selected.1 = 2
	"Minimal",	"Install microG [GmsCore, Nominatim]",					0	#-- selected.1 = 3
);

checkbox(
	"nlpBackends",
	"nlpBackends",
	"@customize",
	"nlp.prop",

	"Select the location backends for microG", "", 2, #-- Group 1
	"Déjà Vu",	"Install Déjà Vu backend",		1,
	"Ichnaea",	"Install Mozilla backend",		0,
	"Apple",	"Install Apple backend",		0,
	"Radiocell",	"Install Radiocells.org backend",	0
);

selectbox(
	"F-Droid",
	"F-Droid",
	"@customize",
	"fd.prop",

	"Select whether to install F-Droid", "", 2, #-- Group 1. key = "selected.1"
	"None",		"Don't install F-Droid (does not effect NanoDroid-FDroid)",	0,	#-- selected.1 = 1
	"Official",	"Install official F-Droid client",				0,	#-- selected.1 = 2
	"Aurora Droid",	"Install unofficial Aurora Droid client",			1,	#-- selected.1 = 3
	"Both",		"Install both official and Aurora F-Droid client",		0	#-- selected.1 = 4
);

selectbox(
	"Google App Store",
	"Google App Store",
	"@customize",
	"store.prop",

	"Select the Google App Store you want", "", 2, #-- Group 1. key = "selected.1"
	"None",			"Install no Google App Store",				0,	#-- selected.1 = 1
	"Play Store (patched)",	"Install patched Play Store with microG (in-)app-purchase support", 0,	#-- selected.1 = 2
	"Aurora Store",		"Install alternative Aurora Store",			0,	#-- selected.1 = 3
	"Fake Store",		"Install Fake Store only",				0,	#-- selected.1 = 4
	"Aurora + Fake Store",	"Install alternative Aurora Store (and Fake Store)",	1,	#-- selected.1 = 5
	"PLay + Aurora Store", "Install both Play Store and Aurora Store",		0,	#-- selected.1 = 6

);

checkbox(
	"Google Sync/Swipe",
	"Google Sync/Swipe",
	"@customize",
	"gsync.prop",

	"Select the Google Addons you want", "", 2, #-- Group 1
	"Google Sync",	"Install Google Contacts & Calendar Sync",		0,
	"Swipe",	"Install Swipe libraries",				0
);

checkbox(
	"Init Scripts",
	"Init Scripts",
	"@customize",
	"initd.prop",

	"Select the Init Scripts you want", "", 2, #-- Group 1
	"sqlite",	"cleanup and compress sqlite databases on boot",	1,
	"fstrim",	"optmize/trim file systems on boot",			1,
	"logcat",	"auto record logcats in /data/adb/logcats",		1,
	"external_sd",	"link sdcard to /external_sd for easy adb access",	1,
	"logscleaner",	"cleanup log files on boot",				0
);

checkbox(
	"Shell Utilities",
	"Shell Utilities",
	"@customize",
	"shellutil.prop",

	"Select the Shell utilities you want", "", 2, #-- #-- Group 1
	"findfs",	"---",							1,
	"findmnt",	"---",							1,
	"hexdump",	"---",							1,
	"lessecho",	"---",							1,
	"lesskey",	"---",							1,
	"lsblk",	"---",							1,
	"lscpu",	"---",							1,
	"lsipc",	"---",							1,
	"lslocks",	"---",							1,
	"lsns",		"---",							1,
	"ncal",		"---",							1,
	"whereis",	"---",							1
);

checkbox(
	"App Setup",
	"App Setup",
	"@customize",
	"apps.prop",

	"Select which Apps to install (if enabled)", "", 2, #-- Group 1
	"Alarmio",			"Alarm Clock without pre-alerts",	1,
	"Amaze",			"Amazing File Manager",			1,
	"AnysoftKeyboard",		"Powerful Keyboard",			1,
	"Blokada",			"Powerful ad blocker (rootless)",	1,
	"Frost",			"Facebook client",			1,
	"HackersKeyboard",		"Powerful developer Keyboard",		1,
	"K9Mail",			"Powerful Mail client",			1,
	"KeePassDX",			"Password Safe",			1,
	"MPV",				"Video Player",				1,
	"NewPipe",			"YouTube frontend and downloader",	1,
	"OAndBackupX",			"Backup and Restore Apps",		1,
	"Odyssey",			"Feature-Rich Music Player",		1,
	"OpenCamera",			"Feature-Rich Camera",			1,
	"OpenKeyChain",			"Encrypt or Sign E-Mails",		1,
	"OpenLauncher",			"Customizable Launcher",		1,
	"OpenVPN",			"Connect to VPNs",			1,
	"Tor Browser",			"Modified Firefox for TOR",		1,
	"Privacy Browser",		"Secure, Open Source Browser",		1,
	"QKSMS",			"Great SMS / MMS messenger",		1,
	"SimpleCalendar",		"Easy to use Calendar",			1,
	"SimpleGallery",		"Easy to use Gallery",			1,
	"SmartPack-Kernel-Manager",	"Customize Kernel Settings",		1,
	"Termux",			"Powerful Terminal Emulator",		1,
	"Twidere",			"Customizable Twitter Client",		1,
	"XDALabs",			"XDA at the palm of your hands",	1
);

checkbox(
	"Debloat Setup",
	"Debloat Setup",
	"@customize",
	"debloat.prop",

	"Select which Apps to Debloat (if enabled)", "", 2, #-- Group 1
	"BasicDreams",			"Screensaver",			1,
	"Browser",			"Standard Browser",		1,
	"Calendar",			"Standard Calendar",		1,
	"Camera2",			"Standard Camera",		1,
	"CMFileManager",		"Cyanogen File Manager",	1,
	"DeskClock",			"Stock Clock app",		1,
	"Eleven",			"Standard Music Player",	1,
	"Email",			"Standard Mail Program",	1,
	"Exchange2",			"Exchange Services (Email)",	1,
	"FMRadio",			"FM Radio/Tuner",		1,
	"Gallery2",			"Standard Gallery",		1,
	"Gello",			"Cyanogen Browser",		1,
	"Jelly",			"LineAge Browser",		1,
	"messaging",			"Standard SMS/MMS Program",	1,
	"mGerrit",			"Bug Tracker",			1,
	"OmniSwitch",			"OmniROM App Switcher",		1,
	"Phonograph",			"Music Player",			1,
	"PhotoTable",			"Screensaver",			1,
	"Recorder",			"Sound Recorder",		1,
	"ResurrectionStats",		"RR Statistics",		1,
	"Screencast",			"Screen Recorder",		1,
	"Slimperience",			"Web Browser",			1,
	"Snap",				"Camera",			1,
	"SnapdragonCamera",		"Snapdragon optmized Camera",	1,
	"SoundRecorder",		"Sound Recorder",		1,
	"Stk",				"SIM Card ToolKit",		1,
	"ViaBrowser",			"Web Browser",			1,
	"Wallpaper",			"Wallpaper App (Google)",	1,
	"WallpaperBackup",		"Wallpaper Backup (Google)",	1,
	"WallpaperPickerGoogle",	"Wallpaper App (Google)",	1
);

menubox(
	"NanoDroid SetupWizard",
	"<@center>Ready to create configuration.</@>",
	"@update",
	"menu.prop",
	"Create Configuration", "", "@install",
	"Abort SetupWizard", "", "@exit"
);

if prop("menu.prop","selected")=="2"
then
  exit("");
endif;

setvar("retstatus",
  install(
	"Creating Configuration...",
	"<@center><b>"+ini_get("rom_name")+"</b></@>",
	"");
);

ini_set("text_next", "Finish");

if getvar("retstatus")=="0" then
	viewbox(
	"Installation Completed",
	"<@center>\nCongratulations!\n\n"+
	"NanoDroid Configuration successfully created.</@>",
	"");
else
	viewbox("Installation Failed",
	"\n\SetupWizard Status: "+ getvar("retstatus"),
	"@alert");
endif;
