Skip to content

Commit d6ffacb

Browse files
try ver
1 parent 687f3fb commit d6ffacb

File tree

7 files changed

+42
-67
lines changed

7 files changed

+42
-67
lines changed

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ android {
5858
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
5959
minSdkVersion 27
6060
targetSdkVersion 33
61-
versionCode 4
62-
versionName '1.2'
61+
versionCode 8
62+
versionName '1.3'
6363
}
6464

6565
signingConfigs {

android/app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
</intent>
1717
</queries>
18-
18+
1919

2020
<application
2121
android:label="Racing Custom Parts"

ios/Runner/Info.plist

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleURLTypes</key>
6+
<key>LSApplicationQueriesSchemes</key>
7+
<array>
8+
<string>fb</string>
9+
</array>
610
<array>
711
<dict>
812
<key>CFBundleURLSchemes</key>

lib/main.dart

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Future<void> main() async {
2525
},
2626
appRunner: () => runApp(const RCP()),
2727
);
28+
// // runApp(const RCP());
2829
}
2930

3031
class RCP extends StatelessWidget {

lib/screens/main_screen/main_screen.dart

+17-47
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:io';
2-
31
import 'package:flutter/material.dart';
42
import 'package:flutter/services.dart';
53
import 'package:provider/provider.dart';
@@ -11,7 +9,6 @@ import 'package:rcp/screens/main_screen/section_tittle_widget.dart';
119
import 'package:rcp/screens/main_screen/silver_appbar_widget.dart';
1210
import 'package:rcp/screens/main_screen/single_cat_grid_widget.dart';
1311
import 'package:url_launcher/url_launcher.dart';
14-
import 'package:url_launcher/url_launcher_string.dart';
1512

1613
import 'carusel_widget.dart';
1714
import 'main_bottombar_screen.dart';
@@ -26,37 +23,10 @@ class MainScreen extends StatefulWidget {
2623
class _MainScreenState extends State<MainScreen> {
2724
final Uri _url = Uri.parse('https://racingcustomparts.com/');
2825

29-
final instaLink = 'https://www.instagram.com/racingcustomparts/';
26+
final instaLink = Uri.parse('https://www.instagram.com/racingcustomparts/');
27+
final fbLink = Uri.parse('https://www.facebook.com/RacingCustomParts/');
3028
late bool switchThemeMode;
3129

32-
Future<void> _openFacebook() async {
33-
HapticFeedback.mediumImpact();
34-
35-
String fbProtocolUrl;
36-
if (Platform.isIOS) {
37-
fbProtocolUrl = 'fb://profile/1422674971360874';
38-
} else {
39-
fbProtocolUrl = 'fb://page/1422674971360874';
40-
}
41-
42-
String fallbackUrl = 'https://www.facebook.com/RacingCustomParts';
43-
44-
try {
45-
Uri fbBundleUri = Uri.parse(fbProtocolUrl);
46-
var canLaunchNatively = await canLaunchUrl(fbBundleUri);
47-
48-
if (canLaunchNatively) {
49-
launchUrl(fbBundleUri);
50-
} else {
51-
await launchUrl(Uri.parse(fallbackUrl),
52-
mode: LaunchMode.externalApplication);
53-
}
54-
} catch (error) {
55-
Provider.of<SettingAppProvider>(context, listen: false)
56-
.showErrorDialog(error, context);
57-
}
58-
}
59-
6030
Future<void> _launchUrlToBroswer() async {
6131
HapticFeedback.lightImpact();
6232
try {
@@ -69,19 +39,20 @@ class _MainScreenState extends State<MainScreen> {
6939
}
7040
}
7141

72-
Future<void> _launchSocialMediaAppIfInstalled(
73-
{required String appLink, String? alternative}) async {
74-
HapticFeedback.mediumImpact();
42+
Future<void> _launchSocialMediaAppIfInstalled({
43+
required Uri url,
44+
}) async {
45+
HapticFeedback.lightImpact();
46+
47+
try {
48+
bool launched = await launchUrl(url,
49+
mode: LaunchMode.externalApplication); // Launch the app if installed!
7550

76-
bool launched = await launchUrlString(
77-
appLink,
78-
mode: LaunchMode.externalApplication,
79-
);
80-
if (!launched) {
81-
await launchUrlString(
82-
alternative as String); // Launch web view if app is not installed!
83-
} else {
84-
launchUrlString(appLink);
51+
if (!launched) {
52+
launchUrl(url); // Launch web view if app is not installed!
53+
}
54+
} catch (e) {
55+
launchUrl(url); // Launch web view if app is not installed!
8556
}
8657
}
8758

@@ -183,7 +154,7 @@ class _MainScreenState extends State<MainScreen> {
183154
.withOpacity(0.4),
184155
blendColorl: const Color.fromARGB(209, 9, 37, 83),
185156
callback: () {
186-
_openFacebook();
157+
_launchSocialMediaAppIfInstalled(url: fbLink);
187158
},
188159
imageSrc: 'assets/images/tsunami.jpeg',
189160
icon: Icons.facebook,
@@ -194,8 +165,7 @@ class _MainScreenState extends State<MainScreen> {
194165
.withOpacity(0.4),
195166
blendColorl: const Color.fromARGB(190, 73, 6, 62),
196167
callback: () {
197-
_launchSocialMediaAppIfInstalled(
198-
appLink: instaLink);
168+
_launchSocialMediaAppIfInstalled(url: instaLink);
199169
},
200170
imageSrc: 'assets/images/drag.jpeg',
201171
icon: Icons.photo_camera,

pubspec.lock

+16-16
Original file line numberDiff line numberDiff line change
@@ -604,18 +604,18 @@ packages:
604604
dependency: transitive
605605
description:
606606
name: path_provider_android
607-
sha256: "019f18c9c10ae370b08dce1f3e3b73bc9f58e7f087bb5e921f06529438ac0ae7"
607+
sha256: da97262be945a72270513700a92b39dd2f4a54dad55d061687e2e37a6390366a
608608
url: "https://pub.dev"
609609
source: hosted
610-
version: "2.0.24"
610+
version: "2.0.25"
611611
path_provider_foundation:
612612
dependency: transitive
613613
description:
614614
name: path_provider_foundation
615-
sha256: "818b2dc38b0f178e0ea3f7cf3b28146faab11375985d815942a68eee11c2d0f7"
615+
sha256: ad4c4d011830462633f03eb34445a45345673dfd4faf1ab0b4735fbd93b19183
616616
url: "https://pub.dev"
617617
source: hosted
618-
version: "2.2.1"
618+
version: "2.2.2"
619619
path_provider_linux:
620620
dependency: transitive
621621
description:
@@ -676,10 +676,10 @@ packages:
676676
dependency: transitive
677677
description:
678678
name: pointycastle
679-
sha256: c3120a968135aead39699267f4c74bc9a08e4e909e86bc1b0af5bfd78691123c
679+
sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c"
680680
url: "https://pub.dev"
681681
source: hosted
682-
version: "3.7.2"
682+
version: "3.7.3"
683683
pool:
684684
dependency: transitive
685685
description:
@@ -756,18 +756,18 @@ packages:
756756
dependency: "direct main"
757757
description:
758758
name: share_plus
759-
sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625"
759+
sha256: "692261968a494e47323dcc8bc66d8d52e81bc27cb4b808e4e8d7e8079d4cc01a"
760760
url: "https://pub.dev"
761761
source: hosted
762-
version: "6.3.1"
762+
version: "6.3.2"
763763
share_plus_platform_interface:
764764
dependency: transitive
765765
description:
766766
name: share_plus_platform_interface
767-
sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1"
767+
sha256: "0c6e61471bd71b04a138b8b588fa388e66d8b005e6f2deda63371c5c505a0981"
768768
url: "https://pub.dev"
769769
source: hosted
770-
version: "3.2.0"
770+
version: "3.2.1"
771771
shelf:
772772
dependency: transitive
773773
description:
@@ -913,10 +913,10 @@ packages:
913913
dependency: transitive
914914
description:
915915
name: url_launcher_android
916-
sha256: dd729390aa936bf1bdf5cd1bc7468ff340263f80a2c4f569416507667de8e3c8
916+
sha256: a52628068d282d01a07cd86e6ba99e497aa45ce8c91159015b2416907d78e411
917917
url: "https://pub.dev"
918918
source: hosted
919-
version: "6.0.26"
919+
version: "6.0.27"
920920
url_launcher_ios:
921921
dependency: transitive
922922
description:
@@ -937,10 +937,10 @@ packages:
937937
dependency: transitive
938938
description:
939939
name: url_launcher_macos
940-
sha256: "0ef2b4f97942a16523e51256b799e9aa1843da6c60c55eefbfa9dbc2dcb8331a"
940+
sha256: "91ee3e75ea9dadf38036200c5d3743518f4a5eb77a8d13fda1ee5764373f185e"
941941
url: "https://pub.dev"
942942
source: hosted
943-
version: "3.0.4"
943+
version: "3.0.5"
944944
url_launcher_platform_interface:
945945
dependency: transitive
946946
description:
@@ -993,10 +993,10 @@ packages:
993993
dependency: transitive
994994
description:
995995
name: web_socket_channel
996-
sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b
996+
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
997997
url: "https://pub.dev"
998998
source: hosted
999-
version: "2.3.0"
999+
version: "2.4.0"
10001000
win32:
10011001
dependency: transitive
10021002
description:

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 1.2.2+1
19+
version: 1.3.0+1
2020

2121
environment:
2222
sdk: ">=2.19.3 <3.0.0"

0 commit comments

Comments
 (0)