diff --git a/refilc/lib/api/client.dart b/refilc/lib/api/client.dart index 9d926bde..5c4f2090 100644 --- a/refilc/lib/api/client.dart +++ b/refilc/lib/api/client.dart @@ -3,13 +3,11 @@ import 'dart:convert'; import 'dart:developer'; import 'dart:io'; -import 'package:refilc/models/ad.dart'; import 'package:refilc/models/config.dart'; import 'package:refilc/models/news.dart'; import 'package:refilc/models/release.dart'; import 'package:refilc/models/settings.dart'; import 'package:refilc/models/shared_theme.dart'; -import 'package:refilc/models/supporter.dart'; import 'package:refilc_kreta_api/models/school.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -17,51 +15,40 @@ import 'package:http/http.dart' as http; import 'package:connectivity_plus/connectivity_plus.dart'; class FilcAPI { - // API base + // base url static const baseUrl = "https://api.refilcapp.hu"; - // Public API + // unused schools list static const schoolList = "https://api.refilcapp.hu/v3/public/school-list"; + + // news endpoint static const news = "https://staticrf-api.pages.dev/news/index.json"; - static const supporters = "0.0.0.0"; - // Private API - static const ads = "0.0.0.0"; + // analytics endpoint static const config = "$baseUrl/v3/private/config"; + + // bug report endpoint, always gets sent, no matter if the user pressed the button or no static const reportApi = "$baseUrl/v3/private/crash-report"; - static const rfPlus = "0.0.0.0"; - static const plusAuthLogin = "0.0.0.0"; - static const plusAuthCallback = "0.0.0.0"; - static const plusActivation = "0.0.0.0"; - static const plusScopes = "0.0.0.0"; - // Updates - static const repo = "QwIT-Development/app-legacy"; - static const releases = "https://api.github.com/repos/$repo/releases"; + // updates path to github + static const releases = + "https://api.github.com/repos/QwIT-Development/app-legacy/releases"; - // Share API + // theme sharing api static const themeShare = "$baseUrl/v3/shared/theme/add"; static const themeGet = "$baseUrl/v3/shared/theme/get"; static const allThemes = "$themeGet/all"; static const themeByID = "$themeGet/"; + // i don't know why it is separated static const gradeColorsShare = "$baseUrl/v3/shared/grade-colors/add"; static const gradeColorsGet = "$baseUrl/v3/shared/grade-colors/get"; static const allGradeColors = "$gradeColorsGet/all"; static const gradeColorsByID = "$gradeColorsGet/"; - // Payment API - static const payment = "0.0.0.0"; - static const stripeSheet = "0.0.0.0"; - - // Cloud Sync - // cloud sync? for what reason - static const cloudSyncApi = "0.0.0.0"; - static Future checkConnectivity() async => (await Connectivity().checkConnectivity())[0] != ConnectivityResult.none; - // nem tudom nem vazar-e senkit se, de mar ertelmetlen ez static Future?> getSchools() async { try { @@ -94,7 +81,8 @@ class FilcAPI { "rf-platform-version": settings.analyticsEnabled ? Platform.operatingSystemVersion : "unknown", - "rf-app-version": const String.fromEnvironment("APPVER", defaultValue: "?"), + "rf-app-version": + const String.fromEnvironment("APPVER", defaultValue: "?"), "rf-uinid": settings.xFilcId, }; @@ -139,45 +127,12 @@ class FilcAPI { return null; } - static Future getSupporters() async { - try { - http.Response res = await http.get(Uri.parse(supporters)); - - if (res.statusCode == 200) { - return Supporters.fromJson(jsonDecode(res.body)); - } else { - throw "HTTP ${res.statusCode}: ${res.body}"; - } - } on Exception catch (error, stacktrace) { - log("ERROR: FilcAPI.getSupporters: $error $stacktrace"); - } - return null; - } - - static Future?> getAds() async { - try { - http.Response res = await http.get(Uri.parse(ads)); - - if (res.statusCode == 200) { - return (jsonDecode(res.body) as List) - .cast() - .map((e) => Ad.fromJson(e)) - .toList(); - } else { - throw "HTTP ${res.statusCode}: ${res.body}"; - } - } on Exception catch (error, stacktrace) { - log("ERROR: FilcAPI.getAds: $error $stacktrace"); - } - return null; - } - static Future?> getReleases() async { try { http.Response res = await http.get(Uri.parse(releases)); if (res.statusCode == 200) { - return (jsonDecode(res.body) as List) + return (jsonDecode(utf8.decode(res.bodyBytes)) as List) .cast() .map((e) => Release.fromJson(e)) .toList(); @@ -299,7 +254,7 @@ class FilcAPI { http.Response res = await http.get(Uri.parse(allThemes)); if (res.statusCode == 200) { - return (jsonDecode(res.body) as List); + return (jsonDecode(utf8.decode(res.bodyBytes)) as List); } else { throw "HTTP ${res.statusCode}: ${res.body}"; } @@ -358,40 +313,6 @@ class FilcAPI { } return null; } - - // payment - static Future createPaymentSheet(String product) async { - try { - Map body = { - "product": product, - }; - - var client = http.Client(); - - http.Response res = await client.post( - Uri.parse(stripeSheet), - body: body, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - ); - - if (res.statusCode != 200) { - throw "HTTP ${res.statusCode}: ${res.body}"; - } - - return jsonDecode(res.body); - } on Exception catch (error, stacktrace) { - log("ERROR: FilcAPI.sendReport: $error $stacktrace"); - } - - return null; - } - - // cloud sync - static Future cloudSync(Map data, String token) async { - return null; - } } class ErrorReport { diff --git a/refilc_kreta_api/LICENSE b/refilc_kreta_api/LICENSE deleted file mode 100644 index 21b1553d..00000000 --- a/refilc_kreta_api/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2023, reFilc -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/refilc_kreta_api/lib/providers/share_provider.dart b/refilc_kreta_api/lib/providers/share_provider.dart index 9a6536c6..f304c71b 100644 --- a/refilc_kreta_api/lib/providers/share_provider.dart +++ b/refilc_kreta_api/lib/providers/share_provider.dart @@ -6,7 +6,6 @@ import 'package:refilc/models/shared_theme.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:uuid/uuid.dart'; -import 'package:refilc/models/user.dart'; List? _cachedThemesJson; @@ -113,9 +112,7 @@ class ShareProvider extends ChangeNotifier { Future> getAllPublicThemes(BuildContext context, {int offset = 0, int limit = 10}) async { // Fetch all themes only once if not already fetched - if (_cachedThemesJson == null) { - _cachedThemesJson = await FilcAPI.getAllSharedThemes(0); - } + _cachedThemesJson ??= await FilcAPI.getAllSharedThemes(0); List themes = []; diff --git a/refilc_mobile_ui/LICENSE b/refilc_mobile_ui/LICENSE deleted file mode 100644 index 21b1553d..00000000 --- a/refilc_mobile_ui/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2023, reFilc -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/refilc_plus/lib/ui/mobile/settings/app_icon_screen.dart b/refilc_plus/lib/ui/mobile/settings/app_icon_screen.dart index e886a9cf..d5eac6e2 100644 --- a/refilc_plus/lib/ui/mobile/settings/app_icon_screen.dart +++ b/refilc_plus/lib/ui/mobile/settings/app_icon_screen.dart @@ -1,11 +1,6 @@ import 'package:refilc/models/settings.dart'; import 'package:refilc/theme/colors/colors.dart'; import 'package:refilc_mobile_ui/common/panel/panel.dart'; -// import 'package:refilc_mobile_ui/common/panel/panel_button.dart'; -import 'package:refilc_plus/helpers/app_icon_helper.dart'; -// import 'package:refilc_plus/models/premium_scopes.dart'; -// import 'package:refilc_plus/providers/plus_provider.dart'; -// import 'package:refilc_plus/ui/mobile/plus/upsell.dart'; import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:provider/provider.dart';