📈 Simple log user share
This commit is contained in:
		@@ -1,5 +1,6 @@
 | 
				
			|||||||
import 'dart:math';
 | 
					import 'dart:math';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import 'package:firebase_analytics/firebase_analytics.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
import 'package:flutter_animate/flutter_animate.dart';
 | 
					import 'package:flutter_animate/flutter_animate.dart';
 | 
				
			||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
 | 
					import 'package:font_awesome_flutter/font_awesome_flutter.dart';
 | 
				
			||||||
@@ -40,9 +41,10 @@ class _PostActionState extends State<PostAction> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Future<void> _doShare({bool noUri = false}) async {
 | 
					  Future<void> _doShare({bool noUri = false}) async {
 | 
				
			||||||
 | 
					    ShareResult result;
 | 
				
			||||||
    final box = context.findRenderObject() as RenderBox?;
 | 
					    final box = context.findRenderObject() as RenderBox?;
 | 
				
			||||||
    if ((PlatformInfo.isAndroid || PlatformInfo.isIOS) && !noUri) {
 | 
					    if ((PlatformInfo.isAndroid || PlatformInfo.isIOS) && !noUri) {
 | 
				
			||||||
      await Share.shareUri(
 | 
					      result = await Share.shareUri(
 | 
				
			||||||
        Uri.parse('https://solsynth.dev/posts/${widget.item.id}'),
 | 
					        Uri.parse('https://solsynth.dev/posts/${widget.item.id}'),
 | 
				
			||||||
        sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
 | 
					        sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
@@ -52,7 +54,7 @@ class _PostActionState extends State<PostAction> {
 | 
				
			|||||||
        widget.item.body['description'],
 | 
					        widget.item.body['description'],
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
      final isExtraNotEmpty = extraContent.any((x) => x != null);
 | 
					      final isExtraNotEmpty = extraContent.any((x) => x != null);
 | 
				
			||||||
      await Share.share(
 | 
					      result = await Share.share(
 | 
				
			||||||
        'postShareContent'.trParams({
 | 
					        'postShareContent'.trParams({
 | 
				
			||||||
          'username': widget.item.author.nick,
 | 
					          'username': widget.item.author.nick,
 | 
				
			||||||
          'content':
 | 
					          'content':
 | 
				
			||||||
@@ -65,6 +67,14 @@ class _PostActionState extends State<PostAction> {
 | 
				
			|||||||
        sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
 | 
					        sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (result.status != ShareResultStatus.dismissed) {
 | 
				
			||||||
 | 
					      await FirebaseAnalytics.instance.logShare(
 | 
				
			||||||
 | 
					        contentType: 'Post',
 | 
				
			||||||
 | 
					        itemId: widget.item.id.toString(),
 | 
				
			||||||
 | 
					        method: result.raw,
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user