Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from LinwoodCloud/develop
Browse files Browse the repository at this point in the history
Develop 1.2.3
  • Loading branch information
CodeDoctorDE authored Mar 2, 2021
2 parents ebcf75c + 2f4ff15 commit f631253
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 44 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.2.3 (Narcg 2, 2021)

* Add a backend on default
* Fix different app bars
* Fix servers offline issues
* Add changelog to settings

## 1.2.2 (February 24, 2021)

* Fix responsive rebuild issues
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

> A free, opensource, serverless learning platform. A linwood project.
![Play store badge](https://img.shields.io/endpoint?color=green&style=for-the-badge&url=https%3A%2F%2Fplayshields.herokuapp.com%2Fplay%3Fi%3Dcom.github.linwoodcloud.dev_doctor%26l%3DPlay%2520Store%26m%3D%24version)
[![GitHub License badge](https://img.shields.io/github/license/LinwoodCloud/dev_doctor?style=for-the-badge)](https://github.com/LinwoodCloud/dev_doctor/blob/main/LICENSE)
[![Discord badge](https://img.shields.io/discord/735424757142519848?style=for-the-badge)](https://discord.linwood.tk)

## Introduction

### Learn everything
Expand All @@ -26,6 +30,8 @@ Click [here](https://dev-doctor.cf) and try it. You have nothing to lose!
#### Stores

* Play Store: <https://play.google.com/store/apps/details?id=com.github.linwoodcloud.dev_doctor>
* SkyDroid: <https://to.skydroid.app/com.github.linwoodcloud.dev_doctor.izzyondroid>
* FDroid: <https://www.f-droid.org/en/packages/com.github.linwoodcloud.dev_doctor/>

### iOS

Expand Down
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ android {
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
Expand All @@ -68,6 +69,8 @@ flutter {
}

dependencies {
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.3.0'
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
3 changes: 1 addition & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
4 changes: 4 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Add a backend on default
Fix different app bars
Fix servers offline issues
Add changelog to settings
3 changes: 2 additions & 1 deletion lib/backends/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:math';

import 'package:dev_doctor/models/collection.dart';
import 'package:dev_doctor/models/server.dart';
import 'package:dev_doctor/widgets/appbar.dart';
import 'package:dev_doctor/widgets/image.dart';
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
Expand Down Expand Up @@ -173,7 +174,7 @@ class _BackendsPageState extends State<BackendsPage> with TickerProviderStateMix
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("backends.title").tr(), actions: [
appBar: MyAppBar(title: "backends.title".tr(), actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
Expand Down
5 changes: 2 additions & 3 deletions lib/backends/user.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:dev_doctor/models/collection.dart';
import 'package:dev_doctor/models/server.dart';
import 'package:dev_doctor/widgets/appbar.dart';
import 'package:dev_doctor/widgets/image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
Expand Down Expand Up @@ -36,10 +37,8 @@ class BackendUserPage extends StatelessWidget {

Widget _buildView(BackendUser backendUser) {
var entries = backendUser.buildEntries();
print(entries[0]);
print(entries.length);
return Scaffold(
appBar: AppBar(title: Text(backendUser.name)),
appBar: MyAppBar(title: backendUser.name),
body: Scrollbar(
child: SingleChildScrollView(
child: Wrap(
Expand Down
3 changes: 2 additions & 1 deletion lib/courses/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:math';

import 'package:dev_doctor/models/course.dart';
import 'package:dev_doctor/models/server.dart';
import 'package:dev_doctor/widgets/appbar.dart';
import 'package:dev_doctor/widgets/image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
Expand Down Expand Up @@ -115,7 +116,7 @@ class _CoursesPageState extends State<CoursesPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("courses.title").tr(), actions: [
appBar: MyAppBar(title: "courses.title".tr(), actions: [
IconButton(
icon: Icon(Icons.search_outlined),
onPressed: () {
Expand Down
5 changes: 3 additions & 2 deletions lib/courses/part/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:dev_doctor/models/items/quiz.dart';
import 'package:dev_doctor/models/items/text.dart';
import 'package:dev_doctor/models/items/video.dart';
import 'package:dev_doctor/models/part.dart';
import 'package:dev_doctor/widgets/appbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';

Expand Down Expand Up @@ -55,8 +56,8 @@ class _PartItemLayoutState extends State<PartItemLayout> {
bloc?.fetch(serverId: serverId, courseId: courseId, partId: index);
},
),
appBar: AppBar(
title: Text(snapshot.data.name),
appBar: MyAppBar(
title: snapshot.data.name,
bottom: TabBar(
isScrollable: true,
onTap: (index) => Modular.to.pushReplacementNamed(
Expand Down
14 changes: 10 additions & 4 deletions lib/loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'yaml.dart';

Future<Map<String, dynamic>> loadFile(String path, {String type}) async {
try {
var result = await loadJsonFile(path);
var result = await loadJsonFile(path) ?? {};
if (type == null) result['type'] = 'json';
return result;
} catch (e) {
var result = await loadYamlFile(path);
var result = await loadYamlFile(path) ?? {};
if (type == null) result['type'] = 'yml';
return result;
}
Expand All @@ -22,6 +22,12 @@ Future<Map<String, dynamic>> loadJsonFile(String path) async {
}

Future<Map<String, dynamic>> loadYamlFile(String path) async {
var response = await http.get(Uri.parse(path + ".yml"));
return yamlMapToJson(loadYaml(utf8.decode(response.bodyBytes)));
try {
var response = await http.get(Uri.parse(path + ".yml"));
return yamlMapToJson(loadYaml(utf8.decode(response.bodyBytes)));
} catch (e) {
print(e);
}

return null;
}
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ void main() async {
await Hive.initFlutter();
await Hive.openBox('settings');
await Hive.openBox('appearance');
/*var _serversBox = */ await Hive.openBox<String>('servers');
var _serversBox = await Hive.openBox<String>('servers');
var _collectionsBox = await Hive.openBox<String>('collections');
if (_collectionsBox.isEmpty) await _collectionsBox.add('https://collection.dev-doctor.cf');
// if (_serversBox.isEmpty) await _serversBox.add('https://backend.dev-doctor.cf');
if (_serversBox.isEmpty) await _serversBox.add('https://backend.dev-doctor.cf');
runApp(ModularApp(module: AppModule(), child: AppWidget()));
}
2 changes: 1 addition & 1 deletion lib/models/collection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BackendCollection {
var current = _box.values.toList().indexOf(url);
if (current != -1) index = _box.keyAt(current);
} else if (url == null) url = _box.get(index);
data = await loadFile("$url/config");
data = await loadFile("$url/config") ?? {};
} catch (e) {
print(e);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/models/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ class CoursesServer {
Future<CoursesServer> toggle() => added ? remove() : add();

static Future<CoursesServer> fetch({String url, int index, BackendEntry entry}) async {
var data = Map<String, dynamic>();
var data = <String, dynamic>{};
try {
if (index == null) {
var current = _box.values.toList().indexOf(url);
if (current != -1) index = _box.keyAt(current);
} else if (url == null) url = Hive.box<String>('servers').get(index);
data = await loadFile("$url/config");
data = await loadFile("$url/config") ?? {};
} catch (e) {
print(e);
}
data['courses'] = data['courses'] ?? [];
data['entry'] = entry;
data['url'] = url;
data['index'] = index;
Expand Down
5 changes: 5 additions & 0 deletions lib/settings/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ class SettingsList extends StatelessWidget {
leading: Icon(Icons.code_outlined),
title: Text("settings.code").tr(),
onTap: () => launch("https://github.com/LinwoodCloud/dev-doctor")),
ListTile(
leading: Icon(Icons.history_outlined),
title: Text("settings.changelog").tr(),
onTap: () =>
launch("https://github.com/LinwoodCloud/dev_doctor/blob/main/CHANGELOG.md")),
ListTile(
leading: Icon(Icons.privacy_tip_outlined),
title: Text("settings.privacypolicy").tr(),
Expand Down
20 changes: 13 additions & 7 deletions lib/settings/servers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,32 @@ class _ServersSettingsPageState extends State<ServersSettingsPage> {
super.initState();
}

Future<List<CoursesServer>> _buildFuture() async {
var urls = _serversBox.values.toList().asMap();
var servers = <CoursesServer>[];
for (var key in urls.keys) {
var value = urls[key];
servers.add(await CoursesServer.fetch(url: value, index: key));
}
return servers;
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(title: "settings.servers.title".tr()),
body: SettingsLayout(
child: ValueListenableBuilder(
valueListenable: _serversBox.listenable(),
builder: (context, Box<String> box, _) => FutureBuilder(
future: Future.wait(_serversBox.values
.toList()
.asMap()
.map((index, e) => MapEntry(index, CoursesServer.fetch(url: e, index: index)))
.values),
builder: (context, Box<String> box, _) => FutureBuilder<List<CoursesServer>>(
future: _buildFuture(),
builder: (context, snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return Center(child: CircularProgressIndicator());
default:
if (snapshot.hasError) return Text('Error: ${snapshot.error}');
var data = snapshot.data as List<CoursesServer>;
var data = snapshot.data;
return Scrollbar(
child: ListView.builder(
itemCount: box.length,
Expand Down
5 changes: 4 additions & 1 deletion lib/widgets/appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ class MyAppBar extends StatelessWidget with PreferredSizeWidget {
final Size preferredSize;
final List<Widget> actions;

MyAppBar({this.title, this.actions, Key key})
final PreferredSizeWidget bottom;

MyAppBar({this.title, this.actions, Key key, this.bottom})
: preferredSize = Size.fromHeight(50.0),
super(key: key);

Expand All @@ -15,6 +17,7 @@ class MyAppBar extends StatelessWidget with PreferredSizeWidget {
return AppBar(
elevation: 5.0,
title: Text(title),
bottom: bottom,
actions: actions,
//actions: [IconButton(icon: Icon(Icons.settings_outlined), onPressed: () {})],
automaticallyImplyLeading: true,
Expand Down
17 changes: 5 additions & 12 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
dart_style:
dependency: transitive
description:
Expand Down Expand Up @@ -288,7 +281,7 @@ packages:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.20.0-nullsafety.3"
version: "0.21.0-nullsafety.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -378,7 +371,7 @@ packages:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.4"
version: "0.3.5"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -553,7 +546,7 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.26.0-nullsafety.1"
version: "0.26.0"
shared_preferences:
dependency: transitive
description:
Expand Down Expand Up @@ -712,7 +705,7 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
version: "6.0.1"
url_launcher_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -817,7 +810,7 @@ packages:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.1.0"
sdks:
dart: ">=2.12.0-259.9.beta <3.0.0"
flutter: ">=1.24.0-7.0"
10 changes: 5 additions & 5 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: '1.2.2+6'
version: '1.2.3+7'

environment:
sdk: ">=2.7.0 <3.0.0"
Expand All @@ -27,22 +27,22 @@ dependencies:
enum_to_string: ^2.0.0-nullsafety.1
http: ^0.13.0
hive: ^1.4.4+1
rxdart: ^0.26.0-nullsafety.1
rxdart: ^0.26.0
hive_flutter: ^0.3.1
flutter_modular: ^3.0.0-nullsafety.45
url_launcher: ^6.0.0-nullsafety.7
flutter_markdown: ^0.5.2
#universal_html: ^1.2.4
flutter_svg: ^0.20.0-nullsafety.3
flutter_svg: ^0.21.0-nullsafety.0
flutter_inappwebview: ^4.0.0+4
xml: ^5.0.0-nullsafety.1
flutter_localized_locales: ^2.0.1


# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
yaml: ^3.0.0
# cupertino_icons: ^1.0.2
yaml: ^3.1.0
flutter_icons:
android: true
ios: true
Expand Down
1 change: 1 addition & 0 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"information": "Informationen",
"title": "Einstellungen",
"privacypolicy": "Datenschutzerklärung",
"changelog":"Änderungsliste",
"home": {
"title": "Start",
"username": "Benutzername"
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"information": "Information",
"title": "Settings",
"privacypolicy": "Privacy Policy",
"changelog":"Changelog",
"home": {
"title": "Home",
"username": "Username"
Expand Down

1 comment on commit f631253

@vercel
Copy link

@vercel vercel bot commented on f631253 Mar 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.