feat(移动端优化): 实现安卓原生应用的全屏布局和安全区域处理

添加安全区域插件和样式处理,优化移动端视图布局
重构路由和导航结构,改进底部导航栏
增强原生功能集成,包括状态栏和导航栏控制
优化位置服务和后台任务处理
更新语言包和样式以适应移动端体验
This commit is contained in:
sudomarcma
2025-07-08 14:15:25 +08:00
parent 8428d03051
commit 2b4a7b2c50
26 changed files with 1215 additions and 209 deletions
@@ -0,0 +1,54 @@
-- OPTIMIZATION: Simplify location_updates table schema
-- Remove redundant and unnecessary fields for better performance
-- Step 1: Create new optimized table structure
CREATE TABLE `location_updates_new` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`longitude` decimal(11,8) NOT NULL COMMENT 'Longitude first for geographic convention',
`latitude` decimal(10,8) NOT NULL COMMENT 'Latitude second for geographic convention',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Single timestamp field',
PRIMARY KEY (`id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_created_at` (`created_at`),
KEY `idx_user_created` (`user_id`, `created_at`) COMMENT 'Composite index for user location history'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Optimized location updates - essential fields only';
-- Step 2: Migrate existing data (longitude, latitude order)
INSERT INTO `location_updates_new` (`user_id`, `longitude`, `latitude`, `created_at`)
SELECT `user_id`, `longitude`, `latitude`, `created_at`
FROM `location_updates`
ORDER BY `created_at` ASC;
-- Step 3: Backup old table and replace with new one
RENAME TABLE `location_updates` TO `location_updates_backup`;
RENAME TABLE `location_updates_new` TO `location_updates`;
-- Step 4: Update the view to work with new schema
DROP VIEW IF EXISTS `recent_location_updates`;
CREATE VIEW `recent_location_updates` AS
SELECT
`lu`.`id` AS `id`,
`lu`.`user_id` AS `user_id`,
`lu`.`longitude` AS `longitude`,
`lu`.`latitude` AS `latitude`,
`lu`.`created_at` AS `created_at`,
`w`.`username` AS `username`,
`w`.`full_name` AS `full_name`,
TIMESTAMPDIFF(MINUTE, `lu`.`created_at`, NOW()) AS `minutes_ago`
FROM (`location_updates` `lu`
JOIN `workers` `w` ON((`lu`.`user_id` = `w`.`id`)))
WHERE (`lu`.`created_at` > (NOW() - INTERVAL 24 HOUR))
ORDER BY `lu`.`created_at` DESC;
-- Step 5: Add comment about optimization
ALTER TABLE `location_updates` COMMENT = 'Optimized for 30-minute updates - essential fields only (longitude, latitude, created_at)';
-- Verification queries (run these to verify the migration)
-- SELECT COUNT(*) as old_count FROM location_updates_backup;
-- SELECT COUNT(*) as new_count FROM location_updates;
-- SELECT * FROM location_updates ORDER BY created_at DESC LIMIT 5;
-- SELECT * FROM recent_location_updates LIMIT 5;
-- Note: After verifying the migration is successful, you can drop the backup table:
-- DROP TABLE `location_updates_backup`;