From 3f068f246e7d93f70b970eb4ecf80df065ab4755 Mon Sep 17 00:00:00 2001 From: zoe Date: Sat, 9 Jul 2022 12:48:21 +0200 Subject: [PATCH] change readme --- README.md | 17 ++--------------- lib/business_logic/timeline/timeline.dart | 14 +++++++++++++- lib/pages/timeline/timeline.dart | 2 -- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c7a95a7..e7575f1 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,3 @@ -# slothmu +# loris -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) - -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +the best fedi client for gotosocial and mastodon (soon)(i promise) diff --git a/lib/business_logic/timeline/timeline.dart b/lib/business_logic/timeline/timeline.dart index f26a27a..bb9864d 100644 --- a/lib/business_logic/timeline/timeline.dart +++ b/lib/business_logic/timeline/timeline.dart @@ -1,20 +1,32 @@ +import 'dart:convert'; + import 'package:http/http.dart' as http; import '../settings.dart' as settings; import '../../global.dart' as global; +class Timeline {} + Future getTimelineFromServer() async { + const limit = 4; final token = await settings.loadToken(); final baseUrl = await settings.loadInstanceUrl(); final url = Uri( scheme: "https", host: baseUrl, path: "/api/v1/timelines/home", + queryParameters: {"limit": limit.toString()}, ); - Map headers = {"Authorization": "Bearer $token"}; headers.addAll(global.defaultHeaders); final response = await http.get(url, headers: headers); + final json = jsonDecode(response.body); + + int i = 0; + while (i < limit) { + print(json[i]["id"]); + i ++; + } return response; } diff --git a/lib/pages/timeline/timeline.dart b/lib/pages/timeline/timeline.dart index 44ee82a..99d0b0d 100644 --- a/lib/pages/timeline/timeline.dart +++ b/lib/pages/timeline/timeline.dart @@ -30,8 +30,6 @@ class _TimelineState extends State { Future fetchMore() async { loading = true; final response = await tl.getTimelineFromServer(); - print(response.body); - print(response.statusCode); setState(() { if (children.isNotEmpty) { children.removeAt(children.length - 1);