Skip to content

Commit 7e84839

Browse files
committed
Run setupDirs + writeResolv unconditionally on app open (#40)
Previously these only ran when the gateway was already running. After an app update, the gateway is not running but Android may have cleared the files directory. Moving setupDirs/writeResolv before the isGatewayRunning check ensures resolv.conf always exists before any terminal or gateway operation. Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>
1 parent 96ea66f commit 7e84839

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

flutter_app/lib/services/gateway_service.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class GatewayService {
3939
await prefs.init();
4040
final savedUrl = prefs.dashboardUrl;
4141

42+
// Always ensure directories and resolv.conf exist on app open.
43+
// Android may clear the files directory during an app update (#40).
44+
try { await NativeBridge.setupDirs(); } catch (_) {}
45+
try { await NativeBridge.writeResolv(); } catch (_) {}
46+
4247
final alreadyRunning = await NativeBridge.isGatewayRunning();
4348
if (alreadyRunning) {
44-
// Ensure directories exist — Android may have cleared them after
45-
// an upgrade or while the app was in the background (#40).
46-
try { await NativeBridge.setupDirs(); } catch (_) {}
47-
// Refresh resolv.conf so DNS keeps working.
48-
try { await NativeBridge.writeResolv(); } catch (_) {}
4949
// Write allowCommands config so the next gateway restart picks it up,
5050
// and in case the running gateway supports config hot-reload.
5151
await _writeNodeAllowConfig();

0 commit comments

Comments
 (0)