isMainReady method

Future<bool> isMainReady()

to check if ChatScreen is loaded on the page

Implementation

Future<bool> isMainReady() async {
  try {
    final result = await wpClient.evaluateJs(
      '''typeof window.WPP !== 'undefined' && window.WPP.conn.isMainReady();''',
      tryPromise: false,
    );
    return result == true || result?.toString() == "true";
  } catch (e) {
    WhatsappLogger.log(e.toString());
    return false;
  }
}