mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-09-07 19:46:06 +00:00
Compare commits
4 commits
ad45cc1d78
...
5afc1ef692
Author | SHA1 | Date | |
---|---|---|---|
|
5afc1ef692 | ||
|
21d8265f42 | ||
|
382e2bbbf7 | ||
|
b41054920a |
11 changed files with 172 additions and 28 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -45,6 +45,7 @@ lib/generated_plugin_registrant.dart
|
||||||
/env.sh
|
/env.sh
|
||||||
/lib/gen.versions.dart
|
/lib/gen.versions.dart
|
||||||
/lib/.gen.versions.dart
|
/lib/.gen.versions.dart
|
||||||
|
/lib/oss_licenses.dart
|
||||||
/ios/Flutter/.last_build_id
|
/ios/Flutter/.last_build_id
|
||||||
/local.properties
|
/local.properties
|
||||||
/.gradle/
|
/.gradle/
|
||||||
|
|
|
@ -50,3 +50,6 @@ cd ..
|
||||||
# Try and avoid issues with building by moving into place after we are complete
|
# Try and avoid issues with building by moving into place after we are complete
|
||||||
#TODO: this might be a parallel build of deps issue in kotlin, might need to solve there
|
#TODO: this might be a parallel build of deps issue in kotlin, might need to solve there
|
||||||
mv lib/.gen.versions.dart lib/gen.versions.dart
|
mv lib/.gen.versions.dart lib/gen.versions.dart
|
||||||
|
|
||||||
|
# Generate licenses library
|
||||||
|
flutter pub run flutter_oss_licenses:generate.dart
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
import 'package:mobile_nebula/services/utils.dart';
|
|
||||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
|
|
||||||
enum SimpleScrollable {
|
enum SimpleScrollable {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ConfigPageItem extends StatelessWidget {
|
||||||
onPressed: this.disabled ? null : onPressed,
|
onPressed: this.disabled ? null : onPressed,
|
||||||
color: Utils.configItemBackground(context),
|
color: Utils.configItemBackground(context),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 15, right: 15),
|
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||||
constraints: BoxConstraints(minHeight: Utils.minInteractiveSize, minWidth: double.infinity),
|
constraints: BoxConstraints(minHeight: Utils.minInteractiveSize, minWidth: double.infinity),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: crossAxisAlignment,
|
crossAxisAlignment: crossAxisAlignment,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:mobile_nebula/components/config/ConfigItem.dart';
|
||||||
import 'package:mobile_nebula/components/config/ConfigPageItem.dart';
|
import 'package:mobile_nebula/components/config/ConfigPageItem.dart';
|
||||||
import 'package:mobile_nebula/components/config/ConfigSection.dart';
|
import 'package:mobile_nebula/components/config/ConfigSection.dart';
|
||||||
import 'package:mobile_nebula/gen.versions.dart';
|
import 'package:mobile_nebula/gen.versions.dart';
|
||||||
|
import 'package:mobile_nebula/screens/LicensesScreen.dart';
|
||||||
import 'package:mobile_nebula/services/utils.dart';
|
import 'package:mobile_nebula/services/utils.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
|
@ -68,7 +69,12 @@ class _AboutScreenState extends State<AboutScreen> {
|
||||||
label: Text('Privacy policy'),
|
label: Text('Privacy policy'),
|
||||||
labelWidth: 300,
|
labelWidth: 300,
|
||||||
onPressed: () => Utils.launchUrl('https://www.defined.net/privacy/', context)),
|
onPressed: () => Utils.launchUrl('https://www.defined.net/privacy/', context)),
|
||||||
// ConfigPageItem(label: Text('Licenses'), labelWidth: 300, onPressed: () => Utils.launchUrl('https://defined.net/mobile/license', context)),
|
ConfigPageItem(
|
||||||
|
label: Text('Licenses'),
|
||||||
|
labelWidth: 300,
|
||||||
|
onPressed: () => Utils.openPage(context, (context) {
|
||||||
|
return LicensesScreen();
|
||||||
|
})),
|
||||||
]),
|
]),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 20),
|
padding: EdgeInsets.only(top: 20),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -6,8 +7,12 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
|
|
||||||
import 'package:mobile_nebula/components/SimplePage.dart';
|
import 'package:mobile_nebula/components/SimplePage.dart';
|
||||||
|
import 'package:mobile_nebula/components/buttons/PrimaryButton.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
import '../components/config/ConfigItem.dart';
|
||||||
|
import '../components/config/ConfigSection.dart';
|
||||||
|
|
||||||
class EnrollmentScreen extends StatefulWidget {
|
class EnrollmentScreen extends StatefulWidget {
|
||||||
final String? code;
|
final String? code;
|
||||||
final StreamController? stream;
|
final StreamController? stream;
|
||||||
|
@ -105,7 +110,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
|
||||||
Padding(
|
Padding(
|
||||||
child: SelectableText(
|
child: SelectableText(
|
||||||
'There was an issue while attempting to enroll this device. Contact your administrator to obtain a new enrollment code.'),
|
'There was an issue while attempting to enroll this device. Contact your administrator to obtain a new enrollment code.'),
|
||||||
padding: EdgeInsets.symmetric(vertical: 20)),
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20)),
|
||||||
Padding(
|
Padding(
|
||||||
child: SelectableText.rich(TextSpan(children: [
|
child: SelectableText.rich(TextSpan(children: [
|
||||||
TextSpan(text: 'If the problem persists, please let us know at '),
|
TextSpan(text: 'If the problem persists, please let us know at '),
|
||||||
|
@ -121,9 +126,9 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
|
||||||
),
|
),
|
||||||
TextSpan(text: ' and provide the following error:'),
|
TextSpan(text: ' and provide the following error:'),
|
||||||
])),
|
])),
|
||||||
padding: EdgeInsets.only(bottom: 10)),
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10)),
|
||||||
Container(
|
Container(
|
||||||
child: Padding(child: SelectableText(this.error!), padding: EdgeInsets.all(10)),
|
child: Padding(child: SelectableText(this.error!), padding: EdgeInsets.all(16)),
|
||||||
color: Theme.of(context).colorScheme.errorContainer,
|
color: Theme.of(context).colorScheme.errorContainer,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -151,30 +156,59 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return SimplePage(
|
return SimplePage(title: Text('Enroll with Managed Nebula'), child: child, alignment: alignment);
|
||||||
title: Text('Enroll with Managed Nebula', style: TextStyle(fontWeight: FontWeight.bold)),
|
|
||||||
child: Padding(child: child, padding: EdgeInsets.symmetric(horizontal: 10)),
|
|
||||||
alignment: alignment);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _codeEntry() {
|
Widget _codeEntry() {
|
||||||
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
String? validator(String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Code or link is required';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> onSubmit() async {
|
||||||
|
final bool isValid = _formKey.currentState?.validate() ?? false;
|
||||||
|
if (!isValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
code = EnrollmentScreen.parseCode(enrollInput.text);
|
||||||
|
error = null;
|
||||||
|
_enroll();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
final input = Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
child: PlatformTextFormField(
|
||||||
|
controller: enrollInput,
|
||||||
|
validator: validator,
|
||||||
|
hintText: 'from admin.defined.net',
|
||||||
|
cupertino: (_, __) => CupertinoTextFormFieldData(
|
||||||
|
prefix: Text("Code or link"),
|
||||||
|
),
|
||||||
|
material: (_, __) => MaterialTextFormFieldData(
|
||||||
|
decoration: const InputDecoration(labelText: 'Code or link'),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
final form = Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Platform.isAndroid ? input : ConfigSection(children: [input]),
|
||||||
|
);
|
||||||
|
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 20),
|
padding: EdgeInsets.symmetric(vertical: 32),
|
||||||
child: PlatformTextField(
|
child: form,
|
||||||
hintText: 'defined.net enrollment code or link',
|
),
|
||||||
controller: enrollInput,
|
Padding(
|
||||||
)),
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
PlatformTextButton(
|
child: Row(children: [Expanded(child: PrimaryButton(child: Text('Submit'), onPressed: onSubmit))]))
|
||||||
child: Text('Submit'),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
code = EnrollmentScreen.parseCode(enrollInput.text);
|
|
||||||
error = null;
|
|
||||||
_enroll();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
78
lib/screens/LicensesScreen.dart
Normal file
78
lib/screens/LicensesScreen.dart
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||||
|
import 'package:mobile_nebula/components/SimplePage.dart';
|
||||||
|
import 'package:mobile_nebula/services/utils.dart';
|
||||||
|
import '../../oss_licenses.dart';
|
||||||
|
|
||||||
|
String capitalize(String input) {
|
||||||
|
return input[0].toUpperCase() + input.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
class LicensesScreen extends StatelessWidget {
|
||||||
|
const LicensesScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimplePage(
|
||||||
|
title: const Text("Licences"),
|
||||||
|
scrollable: SimpleScrollable.none,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: allDependencies.length,
|
||||||
|
itemBuilder: (_, index) {
|
||||||
|
var dep = allDependencies[index];
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
child: PlatformListTile(
|
||||||
|
onTap: () {
|
||||||
|
Utils.openPage(
|
||||||
|
context,
|
||||||
|
(_) => LicenceDetailPage(
|
||||||
|
title: capitalize(dep.name),
|
||||||
|
licence: dep.license!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
title: Text(
|
||||||
|
capitalize(dep.name),
|
||||||
|
),
|
||||||
|
subtitle: Text(dep.description),
|
||||||
|
trailing: Icon(context.platformIcons.forward, size: 18)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//detail page for the licence
|
||||||
|
class LicenceDetailPage extends StatelessWidget {
|
||||||
|
final String title, licence;
|
||||||
|
const LicenceDetailPage({super.key, required this.title, required this.licence});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SimplePage(
|
||||||
|
title: Text(title),
|
||||||
|
scrollable: SimpleScrollable.none,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(5),
|
||||||
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
licence,
|
||||||
|
style: const TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -346,7 +346,7 @@ class MaterialTheme {
|
||||||
bodyColor: colorScheme.onSurface,
|
bodyColor: colorScheme.onSurface,
|
||||||
displayColor: colorScheme.onSurface,
|
displayColor: colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
scaffoldBackgroundColor: colorScheme.background,
|
scaffoldBackgroundColor: colorScheme.surface,
|
||||||
canvasColor: colorScheme.surface,
|
canvasColor: colorScheme.surface,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
24
pubspec.lock
24
pubspec.lock
|
@ -89,6 +89,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.8"
|
version: "1.0.8"
|
||||||
|
dart_pubspec_licenses:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dart_pubspec_licenses
|
||||||
|
sha256: "23ddb78ff9204d08e3109ced67cd3c6c6a066f581b0edf5ee092fc3e1127f4ea"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.4"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -134,6 +142,14 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_oss_licenses:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: flutter_oss_licenses
|
||||||
|
sha256: e4bbaeb00bc768e8430ee0c95ad304d2f256fb15194d30b912cea269871c8885
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.4"
|
||||||
flutter_platform_widgets:
|
flutter_platform_widgets:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -216,6 +232,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.19.0"
|
version: "0.19.0"
|
||||||
|
json_annotation:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: json_annotation
|
||||||
|
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.9.0"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -41,6 +41,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_oss_licenses: ^3.0.4
|
||||||
|
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
|
|
Loading…
Add table
Reference in a new issue