Skip to content

Commit 5ac9973

Browse files
authored
Merge pull request #65 from nimblehq/feature/31-integrate-survey-list
[#31] [#64] [Integrate] As a logged-in user, I can see the survey list on the Home screen
2 parents e9a78b3 + 8b31157 commit 5ac9973

31 files changed

+606
-97
lines changed

assets/images/dummy_background.png

-234 KB
Binary file not shown.

assets/images/placeholder.png

19.4 KB
Loading

ios/Podfile.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ PODS:
88
- Flutter
99
- package_info_plus (0.4.5):
1010
- Flutter
11+
- path_provider_foundation (0.0.1):
12+
- Flutter
13+
- FlutterMacOS
1114
- permission_handler_apple (9.1.1):
1215
- Flutter
1316

@@ -17,6 +20,7 @@ DEPENDENCIES:
1720
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
1821
- integration_test (from `.symlinks/plugins/integration_test/ios`)
1922
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
23+
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
2024
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
2125

2226
EXTERNAL SOURCES:
@@ -30,6 +34,8 @@ EXTERNAL SOURCES:
3034
:path: ".symlinks/plugins/integration_test/ios"
3135
package_info_plus:
3236
:path: ".symlinks/plugins/package_info_plus/ios"
37+
path_provider_foundation:
38+
:path: ".symlinks/plugins/path_provider_foundation/darwin"
3339
permission_handler_apple:
3440
:path: ".symlinks/plugins/permission_handler_apple/ios"
3541

@@ -39,6 +45,7 @@ SPEC CHECKSUMS:
3945
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
4046
integration_test: 13825b8a9334a850581300559b8839134b124670
4147
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
48+
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
4249
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
4350

4451
PODFILE CHECKSUM: 632d6ac0b577d6e268ff7a13a105bbc4f7941989

lib/api/data_sources/token_data_source.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class TokenDataSourceImpl extends TokenDataSource {
4545
return apiToken;
4646
}
4747

48-
return await _secureStorage.getValue(key: SecureStorageKey.apiToken)
49-
as ApiToken;
48+
return await _secureStorage.getValue<ApiToken>(
49+
key: SecureStorageKey.apiToken);
5050
}
5151

5252
@override

lib/api/response_decoder.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import 'package:japx/japx.dart';
22

33
class ResponseDecoder {
44
static Map<String, dynamic> decodeData(Map<String, dynamic> json) {
5-
return Japx.decode(json)['data'];
5+
return json.containsKey('data') ? Japx.decode(json)['data'] : json;
66
}
77

8-
static Map<String, dynamic> decode(Map<String, dynamic> json) =>
9-
Japx.decode(json);
8+
static Map<String, dynamic> decode(Map<String, dynamic> json) {
9+
return Japx.decode(json);
10+
}
1011
}

lib/l10n/app_en.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
"noInternetConnectionError": "You seem to be offline.\nPlease try again!",
1010
"genericError": "Something went wrong.\nPlease try again!",
1111
"loginFailAlertTitle": "Unable to log in",
12-
"today": "Today"
12+
"today": "Today",
13+
"errorText": "Error"
1314
}

lib/main.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import 'package:go_router/go_router.dart';
66
import 'package:survey_flutter/screens/home/home_screen.dart';
77
import 'package:survey_flutter/screens/login/login_screen.dart';
88
import 'package:survey_flutter/screens/splash/splash_screen.dart';
9+
import 'package:survey_flutter/storage/survey_storage.dart';
910
import 'package:survey_flutter/theme/app_theme.dart';
1011

1112
void main() async {
1213
WidgetsFlutterBinding.ensureInitialized();
1314
await FlutterConfig.loadEnvVariables();
15+
await setupHive();
1416
runApp(
1517
ProviderScope(
1618
child: App(),

lib/model/response/meta_response.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MetaResponse {
1919
});
2020

2121
factory MetaResponse.fromJson(Map<String, dynamic> json) =>
22-
_$MetaResponseFromJson(ResponseDecoder.decode(json));
22+
_$MetaResponseFromJson(ResponseDecoder.decodeData(json));
2323

2424
static MetaResponse dummy() {
2525
return MetaResponse(

lib/model/response/survey_response.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class SurveyResponse {
2626
id: id ?? '',
2727
title: title ?? '',
2828
description: description ?? '',
29-
coverImageUrl: coverImageUrl ?? '',
29+
coverImageUrl: highResolutionCoverImageUrl,
3030
);
31+
32+
String get highResolutionCoverImageUrl =>
33+
(coverImageUrl != null) ? "${coverImageUrl}l" : "";
3134
}

lib/model/response/surveys_container_response.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ class SurveysContainerResponse {
1717
required this.meta,
1818
});
1919

20-
factory SurveysContainerResponse.fromJson(Map<String, dynamic> json) {
21-
return _$SurveysContainerResponseFromJson(ResponseDecoder.decode(json));
22-
}
20+
factory SurveysContainerResponse.fromJson(Map<String, dynamic> json) =>
21+
_$SurveysContainerResponseFromJson(ResponseDecoder.decode(json));
2322

2423
SurveysContainerModel toSurveysContainerModel() => SurveysContainerModel(
2524
surveys:

0 commit comments

Comments
 (0)