From 4e1c5bc0b823436d9be006b2aae25c5dcb42740f Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Wed, 25 Jun 2025 13:51:53 +0200 Subject: [PATCH] dymanic platform detection --- Frontend/lib/mih_config/mih_env.dart | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/Frontend/lib/mih_config/mih_env.dart b/Frontend/lib/mih_config/mih_env.dart index 450074ad..0cfe35b8 100644 --- a/Frontend/lib/mih_config/mih_env.dart +++ b/Frontend/lib/mih_config/mih_env.dart @@ -19,17 +19,27 @@ abstract class AppEnviroment { switch (env) { case Enviroment.dev: { - //================= Android Dev Urls ================= - // baseApiUrl = "http://10.0.2.2:8080"; - // baseFileUrl = "http://10.0.2.2:9000"; - // baseAiUrl = "http://10.0.2.2:11434"; - // bannerAdUnitId = 'ca-app-pub-3940256099942544/9214589741'; - //================= Web & iOS Dev Urls ================= - baseApiUrl = "http://localhost:8080"; - baseFileUrl = "http://localhost:9000"; - baseAiUrl = "http://localhost:11434"; - bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174'; - break; + if (kIsWeb) { + //================= Web Dev Urls ================= + baseApiUrl = "http://localhost:8080"; + baseFileUrl = "http://localhost:9000"; + baseAiUrl = "http://localhost:11434"; + bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174'; + break; + } else if (Platform.isAndroid) { + //================= Android Dev Urls ================= + baseApiUrl = "http://10.0.2.2:8080"; + baseFileUrl = "http://10.0.2.2:9000"; + baseAiUrl = "http://10.0.2.2:11434"; + bannerAdUnitId = 'ca-app-pub-3940256099942544/9214589741'; + } else { + //================= Web & iOS Dev Urls ================= + baseApiUrl = "http://localhost:8080"; + baseFileUrl = "http://localhost:9000"; + baseAiUrl = "http://localhost:11434"; + bannerAdUnitId = 'ca-app-pub-3940256099942544/2435281174'; + break; + } } case Enviroment.prod: {