appinioGmbH / flutter_packages

Dart and Flutter plugins/packages used and maintained by @appinioGmbH

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ BUG ] : Share to Instagram Direct works on Android and iOS, but Stories do not on iOS

lisovyk opened this issue · comments

Plugin name
Appinio social share

Describe the bug
I encountered a bug where my test users on ios can't share to instagram stories while the share-to-direct is present.

To Reproduce
Steps to reproduce the behavior:
I don't have an iOS physical device and it's not possible to install apps on simulator - thanks apple - so no way to create a reproducable example for me.

Expected behavior
Instagram Story share works both on Android and iOS. I suspect facebook Stories might be broken too but no way to

Screenshots
android and ios screenshots, same app version:
Screenshot 2024-03-26 at 16 44 03
2024-03-26 16 44 07

Smartphone (please complete the following information):

  • Device: iphone 12
  • OS: 17.4
  • Version: unknown

Additional context
Here are parts of the code I am using, if it will be of any help. Thanks.

FutureBuilder(
                    future: AppinioSocialShare().getInstalledApps(),
                    builder: (context, snapshot) {
                      if (snapshot.connectionState == ConnectionState.waiting) {
                        return const Center(child: CircularProgressIndicator());
                      }
                      if (snapshot.hasError) {
                        return Center(
                          child: Text('Помилка: ${snapshot.error}'),
                        );
                      }

                      List<SharePlatform> sharePlatformsFiltered = [];
                      if (snapshot.data != null && snapshot.data!.isNotEmpty) {
                        print(snapshot.data!.entries);
                        // print all entries values
                        print(snapshot.data!.entries.map((e) => e.value).toList());
                        final installedShareApps = snapshot.data!.entries.where((e) => e.value).map((e) => e.key).toList();
                        sharePlatformsFiltered =
                            SharePlatform.defaults.where((e) => installedShareApps.contains(e.platform_name)).toList();
                      }

                      return _buildShareOptionsGrid(theme, sharePlatformsFiltered, context);
                    },
SingleChildScrollView _buildShareOptionsGrid(ThemeData theme, List<SharePlatform> sharePlatformsFiltered, BuildContext context) {
    return SingleChildScrollView(
      child: GridView.count(
        shrinkWrap: true,
        physics: NeverScrollableScrollPhysics(),
        crossAxisCount: 4,
        childAspectRatio: 1,
        children: [
          _buildCell(
            theme,
            Remix.links_line,
            'Скопіювати посилання',
            onTap: () {
              Clipboard.setData(ClipboardData(text: url));
              if (Platform.isIOS) {
                snackbarKey.currentState?.showSnackBar(const SnackBar(content: Text('Посилання скопійовано')));
              }
            },
          ),
          ...sharePlatformsFiltered
              .map(
                (SharePlatform e) => _buildCell(
                  theme,
                  e.icon,
                  e.name,
                  onTap: () async {
                    if (e.platform_name == SharePlatform.telegram.platform_name) {
                      File file = await generatePicture(context, theme, background: true);
                      AppinioSocialShare().shareToTelegram('Посилання: $url', filePaths: [file.path]);
                      // AppinioSocialShare().shareToTelegram(url);
                      // https://core.telegram.org/widgets/share
                    } else if (e.platform_name == SharePlatform.instagram_story.platform_name) {
                      File file = await generatePicture(context, theme);
                      await AppinioSocialShare().shareToInstagramStory(FACEBOOK_APP_ID,
                          stickerImage: file.path,
                          backgroundBottomColor: '#${backgroundBottomColor.value.toRadixString(16)}',
                          backgroundTopColor: '#${backgroundTopColor.value.toRadixString(16)}',
                          attributionURL: url);
                    } else if (e.platform_name == SharePlatform.instagram_direct.platform_name) {
                      await AppinioSocialShare().shareToInstagramDirect(url);
                    } else if (e.platform_name == SharePlatform.facebook_messenger.platform_name) {
                      await AppinioSocialShare().shareToMessenger(url);
                    } else if (e.platform_name == SharePlatform.facebook_story.platform_name) {
                      File file = await generatePicture(context, theme);
                      await AppinioSocialShare().shareToFacebookStory(
                        FACEBOOK_APP_ID,
                        backgroundBottomColor: '#${backgroundBottomColor.value.toRadixString(16)}',
                        backgroundTopColor: '#${backgroundTopColor.value.toRadixString(16)}',
                        stickerImage: file.path,
                        attributionURL: url,
                      );
                    } else if (e.platform_name == SharePlatform.twitter.platform_name) {
                      File file = await generatePicture(context, theme, background: true);
                      await AppinioSocialShare().shareToTwitter(
                        url,
                        filePaths: [file.path],
                      );
                    } else if (e.platform_name == SharePlatform.whatsapp.platform_name) {
                      File file = await generatePicture(context, theme, background: true);
                      await AppinioSocialShare().shareToWhatsapp(
                        url,
                        filePaths: [file.path],
                      );
                    }
                  },
                ),
              )
              .toList(),
          _buildCell(theme, Remix.more_line, 'Більше', onTap: () => Share.share(url)),
        ],
      ),

oopsie, my internet connection lagged...