Skip to content

Commit 456f313

Browse files
committed
v6.7.0
1 parent f67f486 commit 456f313

File tree

13 files changed

+137
-50
lines changed

13 files changed

+137
-50
lines changed

LabelStoreMax/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ RAZORPAY_API_KEY=""
5151
PRODUCT_PLACEHOLDER_IMAGE="https://woosignal.com/images/woocommerce-placeholder.png"
5252
# Sets the default placeholder image for products with no image
5353

54-
AUTH_USER_KEY="AUTH_USER"
54+
AUTH_USER_KEY="AUTH_USER"
55+
FCM_ENABLED=false

LabelStoreMax/CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [6.7.0] - 2023-06-20
2+
3+
* Refactor project for Nylo 5.x.
4+
* New Firebase provider for FCM.
5+
* Pubspec.yaml dependency updates.
6+
17
## [6.6.2] - 2023-06-14
28

39
* Page bug fixes
@@ -33,7 +39,7 @@
3339
* Fix the ThemeColor.get helper method to support ColorStyles.
3440
* Pubspec.yaml dependency updates
3541

36-
* ## [6.4.0] - 2023-01-06
42+
## [6.4.0] - 2023-01-06
3743

3844
* Upgrade to Nylo v4.0.0
3945
* Update copyright

LabelStoreMax/lib/app/networking/dio/interceptors/bearer_auth_interceptor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BearerAuthInterceptor extends Interceptor {
1616
}
1717

1818
@override
19-
void onError(DioError err, ErrorInterceptorHandler handler) {
19+
void onError(DioException err, ErrorInterceptorHandler handler) {
2020
handler.next(err);
2121
}
2222
}

LabelStoreMax/lib/app/networking/dio/interceptors/logging_interceptor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LoggingInterceptor extends Interceptor {
1818
}
1919

2020
@override
21-
void onError(DioError err, ErrorInterceptorHandler handler) {
21+
void onError(DioException err, ErrorInterceptorHandler handler) {
2222
print(
2323
'ERROR[${err.response?.statusCode}] => PATH: ${err.requestOptions.path}');
2424
handler.next(err);

LabelStoreMax/lib/app/providers/app_provider.dart

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,6 @@ class AppProvider implements NyProvider {
2424
await WooSignal.instance
2525
.init(appKey: getEnv('APP_KEY'), debugMode: getEnv('APP_DEBUG'));
2626

27-
// Notifications
28-
/// await Firebase.initializeApp(
29-
/// options: DefaultFirebaseOptions.currentPlatform,
30-
/// );
31-
///
32-
/// FirebaseMessaging messaging = FirebaseMessaging.instance;
33-
///
34-
/// NotificationSettings settings = await messaging.requestPermission(
35-
/// alert: true,
36-
/// announcement: false,
37-
/// badge: true,
38-
/// carPlay: false,
39-
/// criticalAlert: false,
40-
/// provisional: false,
41-
/// sound: true,
42-
/// );
43-
///
44-
/// if (settings.authorizationStatus == AuthorizationStatus.authorized) {
45-
/// String? token = await messaging.getToken();
46-
/// if (token != null) {
47-
/// WooSignal.instance.setFcmToken(token);
48-
/// }
49-
/// }
50-
5127
AppHelper.instance.appConfig = WooSignalApp();
5228
AppHelper.instance.appConfig!.themeFont = "Poppins";
5329
AppHelper.instance.appConfig!.themeColors = {
@@ -124,4 +100,4 @@ class AppProvider implements NyProvider {
124100
afterBoot(Nylo nylo) async {
125101

126102
}
127-
}
103+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:firebase_core/firebase_core.dart';
2+
import 'package:firebase_messaging/firebase_messaging.dart';
3+
import 'package:flutter_app/firebase_options.dart';
4+
import 'package:nylo_framework/nylo_framework.dart';
5+
import 'package:woosignal/woosignal.dart';
6+
7+
class FirebaseProvider implements NyProvider {
8+
9+
boot(Nylo nylo) async {
10+
11+
return null;
12+
}
13+
14+
afterBoot(Nylo nylo) async {
15+
if (getEnv('FCM_ENABLED') != true) return;
16+
17+
await Firebase.initializeApp(
18+
options: DefaultFirebaseOptions.currentPlatform,
19+
);
20+
21+
FirebaseMessaging messaging = FirebaseMessaging.instance;
22+
NotificationSettings settings = await messaging.requestPermission(
23+
alert: true,
24+
announcement: false,
25+
badge: true,
26+
carPlay: false,
27+
criticalAlert: false,
28+
provisional: false,
29+
sound: true,
30+
);
31+
32+
if (settings.authorizationStatus != AuthorizationStatus.authorized) {
33+
return;
34+
}
35+
36+
String? token = await messaging.getToken();
37+
if (token != null) {
38+
WooSignal.instance.setFcmToken(token);
39+
}
40+
}
41+
}

LabelStoreMax/lib/config/providers.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '/app/providers/firebase_provider.dart';
12
import 'package:flutter_app/app/providers/app_provider.dart';
23
import 'package:flutter_app/app/providers/event_provider.dart';
34
import 'package:flutter_app/app/providers/route_provider.dart';
@@ -17,4 +18,7 @@ final Map<Type, NyProvider> providers = {
1718
AppProvider: AppProvider(),
1819
RouteProvider: RouteProvider(),
1920
EventProvider: EventProvider(),
21+
FirebaseProvider: FirebaseProvider(),
22+
2023
};
24+

LabelStoreMax/lib/config/validation_rules.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
|--------------------------------------------------------------------------
99
*/
1010

11-
final Map<Type, dynamic> validationRules = {
11+
final Map<String, dynamic> validationRules = {
1212
/// Example
13-
// SimplePassword: (attribute) => SimplePassword(attribute)
13+
// "simple_password": (attribute) => SimplePassword(attribute)
1414
};
1515

1616
/// Example validation class
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
2+
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
3+
import 'package:flutter/foundation.dart'
4+
show defaultTargetPlatform, kIsWeb, TargetPlatform;
5+
6+
/// Default [FirebaseOptions] for use with your Firebase apps.
7+
class DefaultFirebaseOptions {
8+
static FirebaseOptions get currentPlatform {
9+
if (kIsWeb) {
10+
throw UnsupportedError(
11+
'DefaultFirebaseOptions have not been configured for web - '
12+
'you can reconfigure this by running the FlutterFire CLI again.',
13+
);
14+
}
15+
switch (defaultTargetPlatform) {
16+
case TargetPlatform.android:
17+
return android;
18+
case TargetPlatform.iOS:
19+
return ios;
20+
case TargetPlatform.macOS:
21+
throw UnsupportedError(
22+
'DefaultFirebaseOptions have not been configured for macos - '
23+
'you can reconfigure this by running the FlutterFire CLI again.',
24+
);
25+
case TargetPlatform.windows:
26+
throw UnsupportedError(
27+
'DefaultFirebaseOptions have not been configured for windows - '
28+
'you can reconfigure this by running the FlutterFire CLI again.',
29+
);
30+
case TargetPlatform.linux:
31+
throw UnsupportedError(
32+
'DefaultFirebaseOptions have not been configured for linux - '
33+
'you can reconfigure this by running the FlutterFire CLI again.',
34+
);
35+
default:
36+
throw UnsupportedError(
37+
'DefaultFirebaseOptions are not supported for this platform.',
38+
);
39+
}
40+
}
41+
42+
static const FirebaseOptions android = FirebaseOptions(
43+
apiKey: '',
44+
appId: '',
45+
messagingSenderId: '',
46+
projectId: '',
47+
storageBucket: '',
48+
);
49+
50+
static const FirebaseOptions ios = FirebaseOptions(
51+
apiKey: '',
52+
appId: '',
53+
messagingSenderId: '',
54+
projectId: '',
55+
storageBucket: '',
56+
iosClientId: '',
57+
iosBundleId: '',
58+
);
59+
}

LabelStoreMax/lib/resources/pages/account_delete_page.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class _AccountDeletePageState extends NyState<AccountDeletePage> {
6767
PrimaryButton(
6868
title: trans("Yes, delete my account"),
6969
isLoading: isLocked('delete_account'),
70-
action: _deleteAccount),
70+
action: _deleteAccount,
71+
),
7172
LinkButton(title: trans("Back"), action: pop)
7273
],
7374
)

0 commit comments

Comments
 (0)