Skip to content

Commit

Permalink
feat: Share app
Browse files Browse the repository at this point in the history
  • Loading branch information
Zied-Dahmani committed Nov 23, 2023
1 parent 7e1bbd6 commit 2ba43af
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,5 @@ app.*.symbols
key.properties
app/upload-keystore.jks

# Environment variables
.env
5 changes: 5 additions & 0 deletions lib/application/controllers/scan_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:qataa/application/services/connectivity_service.dart';
import 'package:qataa/application/usecases/scan_barcode_use_case.dart';
import 'package:qataa/presentation/widgets/bottom_sheet_content.dart';
import 'package:qataa/utils/screen_util.dart';
import 'package:share_plus/share_plus.dart';
import 'dart:developer' as developer;
import 'package:url_launcher/url_launcher.dart';

Expand Down Expand Up @@ -110,4 +111,8 @@ class ScanController extends GetxController {
throw 'Could not launch $uri';
}
}

Future<void> shareApp() async {
await Share.shareUri(Uri.parse('https://play.google.com/store/apps/details?id=com.rebounddev.qataa'));
}
}
4 changes: 2 additions & 2 deletions lib/config/locale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class Locale implements Translations {
'connectivityProblemTitle': 'إنترنت',
'connectivityProblemSubtitle': 'ثبت عندك إنترنت ولا',
'scanOnBoardingTitle': 'سكاني المنتج',
'scanOnBoardingBody': 'بش تعرفو ضمن قائمة المقاطعة ولا تنجم تشريه',
'scanOnBoardingBody': 'بش تعرفو موجود في قائمة المقاطعة ولا تنجم تشريه',
'emailOnBoardingTitle': 'استفسارات',
'emailOnBoardingBody': 'كان تحب تسأل على حاجة تنجم تبعثلنا بريد إلكتروني',
'alertTitle': 'تنبيه',
'alertSubtitle': 'كل مرة قعدين نزيدو في منتج إلى قائمة المقاطعة.',
'alertSubtitle': 'كل مرة قاعدين نزيدو في منتج إلى قائمة المقاطعة.',
'ok': 'مفهوم',
},
};
Expand Down
2 changes: 1 addition & 1 deletion lib/data/repositories/barcode_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BarcodeRepository implements IBarcodeRepository {
final boycottList = await _boycottDataSource.fetchBoycottList();
final result = await _barcodeDataProvider.fetchBarcodeData(barcode);

return ['brand', 'desciption','manufacturer','title'].any((attribute) {
return ['brand', 'description','manufacturer','title'].any((attribute) {
final attributeValue = result.data['product'][attribute];
if (attributeValue != null) {
final lowerCasedValue = attributeValue.toLowerCase();
Expand Down
38 changes: 25 additions & 13 deletions lib/presentation/views/scan_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart';
import 'package:onboarding_overlay/onboarding_overlay.dart';
import 'package:qataa/application/controllers/scan_controller.dart';
Expand Down Expand Up @@ -42,13 +43,6 @@ class _ScanScreenState extends State<ScanScreen> with WidgetsBindingObserver {
});
}

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
ScreenUtil.CustomSystemChrome(context);
}
}

void setVisible(){
setState(() {
isVisible = true;
Expand All @@ -58,18 +52,36 @@ class _ScanScreenState extends State<ScanScreen> with WidgetsBindingObserver {
}
}

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
ScreenUtil.CustomSystemChrome(context);
}
}

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child: Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(FontAwesomeIcons.solidEnvelope),
onPressed: () {
_scanController.sendEmail();
},
),
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
icon: const Icon(FontAwesomeIcons.solidEnvelope),
onPressed: () {
_scanController.sendEmail();
},
),
IconButton(
icon: const Icon(FontAwesomeIcons.share),
onPressed: () {
_scanController.shareApp();
},
),
],
)
),
body: GetX<ScanController>(builder: (_) {
if (_scanController.state is VerificationLoadInProgress) {
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies:
onboarding_overlay: ^3.2.1
shared_preferences: ^2.2.0
flutter_dotenv: ^5.1.0
share_plus: ^7.2.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
Expand Down

0 comments on commit 2ba43af

Please sign in to comment.