Skip to content

Commit 687f3fb

Browse files
fb hotfix 2
1 parent 2d78484 commit 687f3fb

File tree

6 files changed

+98
-67
lines changed

6 files changed

+98
-67
lines changed

android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ 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 3
61+
versionCode 4
6262
versionName '1.2'
6363
}
6464

android/app/src/main/AndroidManifest.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
<intent>
55
<action android:name="android.intent.action.SENDTO" />
66
<data android:scheme="mailto" />
7-
</intent>
8-
<intent>
7+
</intent>
8+
<intent>
99
<action android:name="android.intent.action.VIEW" />
1010
<data android:scheme="tel" />
11+
</intent>
12+
<intent>
13+
<action android:name="android.intent.action.VIEW" />
14+
<data android:scheme="fb" />
15+
1116
</intent>
1217
</queries>
1318

lib/screens/loading_screen/loading_big_button_widget.dart

+7-5
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ class _LoadingBigButtonState extends State<LoadingBigButton>
7575
width: double.maxFinite,
7676
color: const Color.fromARGB(135, 255, 255, 255),
7777
child: const Center(
78-
child: Text('Click To Enter',
79-
style: TextStyle(
80-
color: Colors.black,
81-
fontSize: 17,
82-
fontWeight: FontWeight.w800)),
78+
child: FittedBox(
79+
child: Text('Click To Enter',
80+
style: TextStyle(
81+
color: Colors.black,
82+
fontSize: 17,
83+
fontWeight: FontWeight.w800)),
84+
),
8385
),
8486
),
8587
)

lib/screens/loading_screen/loading_screen.dart

+42-39
Original file line numberDiff line numberDiff line change
@@ -55,45 +55,48 @@ class _LoadingScreenState extends State<LoadingScreen> {
5555
Color.fromARGB(221, 0, 0, 0),
5656
Color.fromARGB(255, 246, 64, 51),
5757
])),
58-
child: Container(
59-
decoration: const BoxDecoration(color: Colors.black87),
60-
width: double.infinity,
61-
child: Column(
62-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
63-
crossAxisAlignment: CrossAxisAlignment.center,
64-
children: [
65-
Image.asset('assets/images/2x/logo.png'),
66-
_isLoading
67-
? Center(
68-
child: Column(
69-
mainAxisAlignment: MainAxisAlignment.center,
70-
children: [
71-
const CircularProgressIndicator(
72-
color: Colors.white,
73-
),
74-
const Padding(padding: EdgeInsets.only(bottom: 15)),
75-
const Text(
76-
"Loading catalog RCP",
77-
style: TextStyle(color: Colors.white, fontSize: 20),
78-
),
79-
const Text(
80-
'please wait a moment',
81-
style: TextStyle(
82-
color: Colors.white,
83-
decorationStyle: TextDecorationStyle.dashed),
84-
),
85-
Consumer<RcpData>(
86-
builder: (context, value, child) => Text(
87-
'Getting product ${value.count}/${value.numberProduct + 2}',
88-
style: const TextStyle(
89-
color: Colors.white,
90-
decorationStyle: TextDecorationStyle.dashed)),
91-
),
92-
],
93-
),
94-
)
95-
: const LoadingBigButton()
96-
],
58+
child: SafeArea(
59+
child: Container(
60+
decoration: const BoxDecoration(color: Colors.black87),
61+
width: double.infinity,
62+
child: Column(
63+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
64+
crossAxisAlignment: CrossAxisAlignment.center,
65+
children: [
66+
Image.asset('assets/images/2x/logo.png'),
67+
_isLoading
68+
? Center(
69+
child: Column(
70+
mainAxisAlignment: MainAxisAlignment.center,
71+
children: [
72+
const CircularProgressIndicator(
73+
color: Colors.white,
74+
),
75+
const Padding(padding: EdgeInsets.only(bottom: 15)),
76+
const Text(
77+
"Loading catalog RCP",
78+
style: TextStyle(color: Colors.white, fontSize: 20),
79+
),
80+
const Text(
81+
'please wait a moment',
82+
style: TextStyle(
83+
color: Colors.white,
84+
decorationStyle: TextDecorationStyle.dashed),
85+
),
86+
Consumer<RcpData>(
87+
builder: (context, value, child) => Text(
88+
'Getting product ${value.count}/${value.numberProduct + 2}',
89+
style: const TextStyle(
90+
color: Colors.white,
91+
decorationStyle:
92+
TextDecorationStyle.dashed)),
93+
),
94+
],
95+
),
96+
)
97+
: const LoadingBigButton()
98+
],
99+
),
97100
),
98101
),
99102
));

lib/screens/main_screen/main_screen.dart

+40-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// import 'dart:html';
1+
import 'dart:io';
22

33
import 'package:flutter/material.dart';
44
import 'package:flutter/services.dart';
@@ -25,11 +25,38 @@ class MainScreen extends StatefulWidget {
2525

2626
class _MainScreenState extends State<MainScreen> {
2727
final Uri _url = Uri.parse('https://racingcustomparts.com/');
28-
final facebookAppLink = 'fb://page/1422674971360874';
29-
final facebookHttpsLink = 'https://www.facebook.com/RacingCustomParts/';
28+
3029
final instaLink = 'https://www.instagram.com/racingcustomparts/';
3130
late bool switchThemeMode;
3231

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+
3360
Future<void> _launchUrlToBroswer() async {
3461
HapticFeedback.lightImpact();
3562
try {
@@ -46,18 +73,15 @@ class _MainScreenState extends State<MainScreen> {
4673
{required String appLink, String? alternative}) async {
4774
HapticFeedback.mediumImpact();
4875

49-
try {
50-
bool launched = await launchUrlString(
51-
appLink,
52-
mode: LaunchMode.externalApplication,
53-
);
54-
if (!launched) {
55-
await launchUrlString(
56-
alternative ?? appLink); // Launch web view if app is not installed!
57-
}
58-
} catch (error) {
59-
Provider.of<SettingAppProvider>(context, listen: false)
60-
.showErrorDialog(error, context);
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);
6185
}
6286
}
6387

@@ -159,10 +183,7 @@ class _MainScreenState extends State<MainScreen> {
159183
.withOpacity(0.4),
160184
blendColorl: const Color.fromARGB(209, 9, 37, 83),
161185
callback: () {
162-
_launchSocialMediaAppIfInstalled(
163-
alternative: facebookHttpsLink,
164-
appLink: facebookAppLink,
165-
);
186+
_openFacebook();
166187
},
167188
imageSrc: 'assets/images/tsunami.jpeg',
168189
icon: Icons.facebook,

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.1+1
19+
version: 1.2.2+1
2020

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

0 commit comments

Comments
 (0)