...
This commit is contained in:
27
.metadata
27
.metadata
@ -4,8 +4,8 @@
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "8b18dde77fa59ba7f87540c05d1aba787198e77a"
|
||||
channel: "master"
|
||||
revision: "01fde956f0d13551843a44ae16eda7ca87478603"
|
||||
channel: "beta"
|
||||
|
||||
project_type: app
|
||||
|
||||
@ -13,27 +13,8 @@ project_type: app
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: android
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: ios
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: linux
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: macos
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: web
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: windows
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
|
||||
create_revision: 01fde956f0d13551843a44ae16eda7ca87478603
|
||||
base_revision: 01fde956f0d13551843a44ae16eda7ca87478603
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
|
@ -2,7 +2,6 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:encrypt_shared_preferences/provider.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'package:f0ckapp/models/user.dart';
|
||||
|
||||
@ -10,6 +9,8 @@ class AuthController extends GetxController {
|
||||
final EncryptedSharedPreferencesAsync storage =
|
||||
EncryptedSharedPreferencesAsync.getInstance();
|
||||
|
||||
final GetConnect http = GetConnect();
|
||||
|
||||
RxnString token = RxnString();
|
||||
Rxn<User> user = Rxn<User>();
|
||||
RxBool isLoading = false.obs;
|
||||
@ -38,7 +39,8 @@ class AuthController extends GetxController {
|
||||
if (token.value != null) {
|
||||
try {
|
||||
await http.post(
|
||||
Uri.parse('https://api.f0ck.me/logout'),
|
||||
'https://api.f0ck.me/logout',
|
||||
{},
|
||||
headers: {
|
||||
'Authorization': 'Bearer ${token.value}',
|
||||
'Content-Type': 'application/json',
|
||||
@ -55,13 +57,15 @@ class AuthController extends GetxController {
|
||||
isLoading.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse('https://api.f0ck.me/login'),
|
||||
final Response<dynamic> response = await http.post(
|
||||
'https://api.f0ck.me/login',
|
||||
json.encode({'username': username, 'password': password}),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode({'username': username, 'password': password}),
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final dynamic data = json.decode(response.body);
|
||||
final dynamic data = response.body is String
|
||||
? json.decode(response.body)
|
||||
: response.body;
|
||||
if (data['token'] != null) {
|
||||
await saveToken(data['token']);
|
||||
user.value = User.fromJson(data);
|
||||
@ -83,12 +87,14 @@ class AuthController extends GetxController {
|
||||
Future<void> fetchUserInfo() async {
|
||||
if (token.value == null) return;
|
||||
try {
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse('https://api.f0ck.me/login/check'),
|
||||
final Response<dynamic> response = await http.get(
|
||||
'https://api.f0ck.me/login/check',
|
||||
headers: {'Authorization': 'Bearer ${token.value}'},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final dynamic data = json.decode(response.body);
|
||||
final dynamic data = response.body is String
|
||||
? json.decode(response.body)
|
||||
: response.body;
|
||||
user.value = User.fromJson(data);
|
||||
} else {
|
||||
await logout();
|
||||
|
@ -329,7 +329,9 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
),
|
||||
),
|
||||
if (isReady)
|
||||
SliverToBoxAdapter(
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
fillOverscroll: true,
|
||||
child: GestureDetector(
|
||||
onTap: () => settingsController.hideVideoControls(),
|
||||
behavior: HitTestBehavior.translucent,
|
||||
|
@ -133,6 +133,7 @@ class _MediaGridBody extends StatelessWidget {
|
||||
final SettingsController settingsController;
|
||||
final ScrollController scrollController;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PullexRefresh(
|
||||
|
@ -4,13 +4,13 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
import 'package:f0ckapp/models/suggestion.dart';
|
||||
|
||||
class CustomSearchDelegate extends SearchDelegate<String> {
|
||||
final MediaController controller = Get.find<MediaController>();
|
||||
final GetConnect http = GetConnect();
|
||||
Timer? _debounceTimer;
|
||||
List<Suggestion>? _suggestions;
|
||||
bool _isLoading = false;
|
||||
@ -48,14 +48,16 @@ class CustomSearchDelegate extends SearchDelegate<String> {
|
||||
}
|
||||
|
||||
Future<List<Suggestion>> fetchSuggestions(String query) async {
|
||||
final Uri uri = Uri.parse('https://api.f0ck.me/search/?q=$query');
|
||||
final String url = 'https://api.f0ck.me/search/?q=$query';
|
||||
try {
|
||||
final http.Response response = await http
|
||||
.get(uri)
|
||||
final Response<dynamic> response = await http
|
||||
.get(url)
|
||||
.timeout(const Duration(seconds: 5));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final dynamic decoded = jsonDecode(response.body);
|
||||
final dynamic decoded = response.body is String
|
||||
? jsonDecode(response.body)
|
||||
: response.body;
|
||||
if (decoded is List) {
|
||||
final suggestions = decoded
|
||||
.map((item) => Suggestion.fromJson(item as Map<String, dynamic>))
|
||||
@ -66,7 +68,9 @@ class CustomSearchDelegate extends SearchDelegate<String> {
|
||||
throw Exception('Unerwartetes Format: Es wurde eine Liste erwartet.');
|
||||
}
|
||||
} else if (response.statusCode == 400) {
|
||||
final dynamic error = jsonDecode(response.body);
|
||||
final dynamic error = response.body is String
|
||||
? jsonDecode(response.body)
|
||||
: response.body;
|
||||
final String message = error is Map<String, dynamic>
|
||||
? error['detail']?.toString() ?? 'Unbekannter Fehler.'
|
||||
: 'Unbekannter Fehler.';
|
||||
|
14
pubspec.lock
14
pubspec.lock
@ -249,7 +249,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.15.6"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
|
||||
@ -268,10 +268,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
version: "0.7.2"
|
||||
json_rpc_2:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -761,10 +761,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
||||
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.0.0"
|
||||
version: "15.0.2"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -801,10 +801,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
|
||||
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.13.0"
|
||||
version: "5.14.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -30,7 +30,6 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
http: ^1.4.0
|
||||
get: ^4.7.2
|
||||
encrypt_shared_preferences: ^0.9.9
|
||||
cached_network_image: ^3.4.1
|
||||
|
Reference in New Issue
Block a user