Show React icon to hosted web users
This commit is contained in:
parent
5b2e3af1ba
commit
2fb7945f23
|
|
@ -10,10 +10,12 @@ const String kMinServerVersion = '5.0.4';
|
|||
const String kAppName = 'Invoice Ninja';
|
||||
const String kSiteUrl = 'https://invoiceninja.com';
|
||||
const String kAppProductionUrl = 'https://invoicing.co';
|
||||
const String kAppReactUrl = 'https://app.invoicing.co';
|
||||
const String kAppStagingUrl = 'https://staging.invoicing.co';
|
||||
const String kAppStagingNetUrl = 'https://invoiceninja.net';
|
||||
const String kAppLargeTestUrl = 'https://testv5.invoicing.co';
|
||||
const String kAppDemoUrl = 'https://demo.invoiceninja.com';
|
||||
const String kFlutterDemoUrl = 'https://demo.invoiceninja.com';
|
||||
const String kReactDemoUrl = 'https://react.invoicing.co/demo';
|
||||
const String kWhiteLabelUrl =
|
||||
'https://app.invoiceninja.com/buy_now/?account_key=AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT&product_id=3';
|
||||
const String kPrivacyPolicyURL = 'https://www.invoiceninja.com/privacy-policy';
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ Middleware<AppState> _createLoadState(
|
|||
String? token;
|
||||
|
||||
if (Config.DEMO_MODE ||
|
||||
cleanApiUrl(store.state.authState.url) == kAppDemoUrl) {
|
||||
cleanApiUrl(store.state.authState.url) == kFlutterDemoUrl) {
|
||||
token = 'TOKEN';
|
||||
} else {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
|
|
|||
|
|
@ -833,7 +833,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
|
||||
bool get isSelfHosted => !isHosted;
|
||||
|
||||
bool get isDemo => cleanApiUrl(authState.url) == kAppDemoUrl;
|
||||
bool get isDemo => cleanApiUrl(authState.url) == kFlutterDemoUrl;
|
||||
|
||||
bool get isStaging => cleanApiUrl(authState.url) == kAppStagingUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ abstract class AuthState implements Built<AuthState, AuthStateBuilder> {
|
|||
|
||||
if ([
|
||||
kAppProductionUrl,
|
||||
kAppDemoUrl,
|
||||
kFlutterDemoUrl,
|
||||
kAppStagingUrl,
|
||||
kAppStagingNetUrl,
|
||||
].contains(cleanUrl)) {
|
||||
|
|
|
|||
|
|
@ -259,14 +259,18 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||
),
|
||||
if (!kReleaseMode ||
|
||||
(kIsWeb &&
|
||||
state.isSelfHosted &&
|
||||
state.userCompany.isAdmin &&
|
||||
!state.isDemo))
|
||||
(state.isHosted ||
|
||||
(state.isSelfHosted && state.userCompany.isAdmin))))
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10),
|
||||
child: IconButton(
|
||||
tooltip: localization!.enableReactApp,
|
||||
onPressed: () async {
|
||||
if (state.isDemo) {
|
||||
launchUrl(Uri.parse(kReactDemoUrl));
|
||||
} else if (state.isHosted) {
|
||||
launchUrl(Uri.parse(kAppReactUrl));
|
||||
} else {
|
||||
confirmCallback(
|
||||
context: context,
|
||||
message: localization.enableReactApp,
|
||||
|
|
@ -274,7 +278,8 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||
final credentials = state.credentials;
|
||||
final account = state.account
|
||||
.rebuild((b) => b..setReactAsDefaultAP = true);
|
||||
final url = '${credentials.url}/accounts/${account.id}';
|
||||
final url =
|
||||
'${credentials.url}/accounts/${account.id}';
|
||||
final data = serializers.serializeWith(
|
||||
AccountEntity.serializer, account);
|
||||
|
||||
|
|
@ -293,6 +298,7 @@ class _DashboardScreenState extends State<DashboardScreen>
|
|||
showErrorDialog(message: error as String?);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
icon: Icon(MdiIcons.react),
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in New Issue