connectInstagram method

Future<bool> connectInstagram(
  1. BuildContext context
)

Connect to Instagram using native Opacity SDK

Implementation

Future<bool> connectInstagram(BuildContext context) async {
  try {
    // Initialize Opacity SDK first
    await initOpacity();

    // Get username from secure storage
    final username = await getFromSecure('username') ?? '';

    // Use native Opacity SDK connection
    return await _connectInstagramWithOpacitySDK(context, username);
  } catch (e) {
    print('Error with Opacity SDK, falling back to standard OAuth: $e');
    // Fallback to standard OAuth flow if Opacity fails
    return await connectStandardOAuth(context, 'instagram');
  }
}