Skip to content

Commit b4cb23f

Browse files
committed
feat: use SSOAuth object
1 parent add21b1 commit b4cb23f

6 files changed

Lines changed: 32 additions & 22 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ When launching the feedback page you will need to provide an authoration token (
4343
```dart
4444
openFeedbackPage(
4545
//...
46-
ssoAuthToken: "Bearer mytoken123",
47-
ssoTokenUrl: "https://api.example.com/v1/auth/featurebase/token",
46+
auth: SSOAuth(
47+
token: 'Bearer mytoken123',
48+
tokenUrl: 'https://api.example.com/v1/auth/featurebase/token',
49+
),
4850
//...
4951
);
5052
```

example/lib/main.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ class _MyHomePageState extends State<MyHomePage> {
9393
BlendMode.srcIn,
9494
),
9595
),
96-
ssoAuthToken: 'Bearer ae1fbdemo2025',
97-
ssoTokenUrl:
98-
'https://fb-sdk-api.xn--1-3fa.com/v1/sso/featurebase/token',
96+
auth: SSOAuth(
97+
token: 'Bearer ae1fbdemo2025',
98+
tokenUrl:
99+
'https://fb-sdk-api.xn--1-3fa.com/v1/sso/featurebase/token',
100+
),
99101
appName: 'Featurebase',
100102
organizationName:
101103
'featurebaseflutter', //Development Org for the SDK

lib/actions.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ void openFeedbackPage({
1111
/// App name (example: Featurebase)
1212
required String appName,
1313

14-
/// SSO Auth Token (See README.md for more information)
15-
required String ssoAuthToken,
16-
17-
/// SSO Token URL (See README.md for more information)
18-
required String ssoTokenUrl,
14+
/// SSO Auth (See README.md for more information)
15+
required SSOAuth auth,
1916

2017
/// Primary color used
2118
required Color primaryColor,
@@ -44,8 +41,7 @@ void openFeedbackPage({
4441
child: FeedbackView(
4542
logo: logo,
4643
organizationName: organizationName,
47-
ssoAuthToken: ssoAuthToken,
48-
ssoTokenUrl: ssoTokenUrl,
44+
auth: auth,
4945
primaryColor: primaryColor,
5046
appName: appName,
5147
textColor: textColor,

lib/featurebase.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ part 'providers/comment.dart';
7070
//Other
7171
part 'actions.dart';
7272
part 'utils.dart';
73-
73+
part 'models/sso_auth.dart';
7474
part 'featurebase.g.dart';

lib/models/sso_auth.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
part of featurebase;
2+
3+
class SSOAuth {
4+
/// SSO Auth Token (See README.md for more information)
5+
final String token;
6+
7+
/// SSO Token URL (See README.md for more information)
8+
final String tokenUrl;
9+
10+
SSOAuth({
11+
required this.token,
12+
required this.tokenUrl,
13+
});
14+
}

lib/ui/feedback/feedback.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ class FeedbackView extends ConsumerStatefulWidget {
77
/// Featurebase organization name (example: featurebase)
88
final String organizationName;
99

10-
/// SSO Token URL (See README.md for more information)
11-
final String ssoTokenUrl;
12-
13-
/// SSO Auth Token (See README.md for more information)
14-
final String ssoAuthToken;
10+
/// SSO Auth (See README.md for more information)
11+
final SSOAuth auth;
1512

1613
/// App name (example: Featurebase)
1714
final String appName;
@@ -38,8 +35,7 @@ class FeedbackView extends ConsumerStatefulWidget {
3835
super.key,
3936
required this.logo,
4037
required this.organizationName,
41-
required this.ssoTokenUrl,
42-
required this.ssoAuthToken,
38+
required this.auth,
4339
required this.appName,
4440
required this.primaryColor,
4541
this.textColor = Colors.black,
@@ -84,8 +80,8 @@ class _FeedbackViewState extends ConsumerState<FeedbackView> {
8480
_fbService.setup(
8581
widget.organizationName,
8682
widget.enableHapticFeedback,
87-
ssoTokenUrl: widget.ssoTokenUrl,
88-
ssoAuthToken: widget.ssoAuthToken,
83+
ssoTokenUrl: widget.auth.tokenUrl,
84+
ssoAuthToken: widget.auth.token,
8985
);
9086
init();
9187
super.initState();

0 commit comments

Comments
 (0)