Force Checking of libCwtch.so Loading Status in Tests
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Sarah Jamie Lewis 2024-01-03 11:44:55 -08:00
parent a98068749e
commit f50242d664
5 changed files with 22 additions and 2 deletions

View File

@ -156,4 +156,6 @@ abstract class Cwtch {
void DeleteServerInfo(String profile, String handle);
void PublishServerUpdate(String onion);
Future<void> ConfigureConnections(String onion, bool listen, bool peers, bool servers);
bool IsLoaded();
}

View File

@ -268,6 +268,8 @@ class CwtchFfi implements Cwtch {
// Called on object being disposed to (presumably on app close) to close the isolate that's listening to libcwtch-go events
@override
void dispose() {
EnvironmentConfig.debugLog("tearing down cwtch FFI isolate");
library.close();
cwtchIsolate.kill(priority: Isolate.immediate);
}
@ -1121,4 +1123,11 @@ class CwtchFfi implements Cwtch {
PublishServerUpdate(utf8profile, utf8profile.length);
malloc.free(utf8profile);
}
@override
bool IsLoaded() {
bool check = library.providesSymbol("c_UpdateSettings");
EnvironmentConfig.debugLog("Checking that the FFI Interface is Correctly Loaded... $check");
return check;
}
}

View File

@ -469,4 +469,9 @@ class CwtchGomobile implements Cwtch {
void PublishServerUpdate(String profile) {
cwtchPlatform.invokeMethod("PublishServerUpdate", {"ProfileOnion": profile});
}
@override
bool IsLoaded() {
return true;
}
}

View File

@ -173,6 +173,10 @@ class FlwtchState extends State<Flwtch> with WindowListener {
getServerListStateProvider(),
],
builder: (context, widget) {
// in test mode...rebuild everything every second...if cwtch isn't loaded...
if (EnvironmentConfig.TEST_MODE && cwtch.IsLoaded() == false) {
Timer t = new Timer.periodic(Duration(seconds: 1), (Timer t) => setState(() {}));
}
return Consumer2<Settings, AppState>(
builder: (context, settings, appState, child) => MaterialApp(
key: Key('app'),
@ -190,7 +194,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
title: 'Cwtch',
showSemanticsDebugger: settings.useSemanticDebugger,
theme: mkThemeData(settings),
home: (!appState.cwtchInit || appState.modalState != ModalState.none) ? SplashView() : ProfileMgrView(),
home: (!appState.cwtchInit || appState.modalState != ModalState.none) || !cwtch.IsLoaded() ? SplashView() : ProfileMgrView(),
),
);
},

View File

@ -83,7 +83,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
}
Widget _buildSettingsList() {
return Consumer<Settings>(builder: (context, settings, child) {
return Consumer<Settings>(builder: (ccontext, settings, child) {
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
var appIcon = Icon(Icons.info, color: settings.current().mainTextColor);
return Scrollbar(