Skip to content

Commit de33d9d

Browse files
Tomasz KądziołkaTomasz Kądziołka
authored andcommitted
Fetched all snippets at once
1 parent 1b228bd commit de33d9d

File tree

6 files changed

+8
-5
lines changed

6 files changed

+8
-5
lines changed

app/src/main/java/pl/tkadziolka/snipmeandroid/bridge/detail/DetailModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ class DetailModel(
8686
setState(Loaded(it))
8787
mutableEvent.value = Saved(saved.uuid)
8888
},
89-
onError = {
90-
Timber.e("Couldn't load snippets, error = $it")
91-
parseError(it)
89+
onError = { error ->
90+
Timber.e("Couldn't save snippet, error = $error")
91+
parseError(error)
9292
}
9393
).also { disposables += it }
9494
}

app/src/main/java/pl/tkadziolka/snipmeandroid/bridge/main/MainModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class MainModel(
119119
.subscribeBy(
120120
onSuccess = {
121121
mutableState.value = (Loaded(user, it, pages, scope))
122+
loadNextPage()
122123
if (shouldRefresh) {
123124
mutableEvent.value = ListRefreshed
124125
shouldRefresh = false

app/src/main/java/pl/tkadziolka/snipmeandroid/domain/snippet/CreateSnippetUseCase.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class CreateSnippetUseCase(
1313
private val snippetRepository: SnippetRepository
1414
) {
1515
// TODO Test saving other snippet in app and navigation
16+
// TODO ERROR: We can still click save saved snip
1617
operator fun invoke(
1718
title: String,
1819
code: String,

flutter_module/lib/presentation/screens/details_screen.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class _DetailsPage extends HookWidget {
7777
return const SizedBox();
7878
}
7979

80+
navigator.back();
8081
model.resetEvent();
8182
navigator.goToDetails(context, snippetId);
8283
}

flutter_module/lib/presentation/screens/main_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class _MainPage extends HookWidget {
9393
},
9494
),
9595
floatingActionButton: FloatingActionButton(
96-
onPressed: () => detailsNavigator.goToDetails(context, Mocks.snippet.uuid!),
96+
onPressed: () => model.loadNextPage(),
9797
tooltip: 'Increment',
9898
child: const Icon(Icons.add),
9999
),

flutter_module/lib/presentation/widgets/snippet_action_bar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class SnippetActionBar extends StatelessWidget {
4444
StateIcon(
4545
icon: Icons.save_alt_outlined,
4646
active: snippet.isSaved,
47-
onTap: snippet.isSaved == false ? null : onSaveTap,
47+
onTap: snippet.isSaved == false ? onSaveTap : null,
4848
),
4949
const SizedBox(width: Dimens.l),
5050
StateIcon(

0 commit comments

Comments
 (0)