Skip to content

Commit 597df28

Browse files
committed
Update version
1 parent 5ae25ad commit 597df28

38 files changed

+1026
-332
lines changed

.metadata

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 816a857a98237f948cbe4856a6d7d47fb48f6b71
7+
revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
88
channel: master
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
17+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
18+
- platform: android
19+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
20+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
21+
- platform: ios
22+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
23+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
24+
- platform: linux
25+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
26+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
27+
- platform: macos
28+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
29+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
30+
- platform: web
31+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
32+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
33+
- platform: windows
34+
create_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
35+
base_revision: e3429dd35f6441a7562cc6384b24a3a8666eff2a
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 31
29+
compileSdkVersion 33
3030

3131
compileOptions {
3232
sourceCompatibility JavaVersion.VERSION_1_8
@@ -45,7 +45,7 @@ android {
4545
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4646
applicationId "com.example.flutter_clean_architecture"
4747
minSdkVersion 16
48-
targetSdkVersion 31
48+
targetSdkVersion 33
4949
versionCode flutterVersionCode.toInteger()
5050
versionName flutterVersionName
5151
}

ios/Podfile.lock

+8-13
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ PODS:
88
- FMDB/standard (2.7.5)
99
- package_info (0.0.1):
1010
- Flutter
11-
- path_provider_ios (0.0.1):
12-
- Flutter
13-
- shared_preferences_ios (0.0.1):
11+
- path_provider_foundation (0.0.1):
1412
- Flutter
13+
- FlutterMacOS
1514
- sqflite (0.0.2):
1615
- Flutter
1716
- FMDB (>= 2.7.5)
@@ -21,8 +20,7 @@ DEPENDENCIES:
2120
- Flutter (from `Flutter`)
2221
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
2322
- package_info (from `.symlinks/plugins/package_info/ios`)
24-
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
25-
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
23+
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
2624
- sqflite (from `.symlinks/plugins/sqflite/ios`)
2725

2826
SPEC REPOS:
@@ -37,20 +35,17 @@ EXTERNAL SOURCES:
3735
:path: ".symlinks/plugins/fluttertoast/ios"
3836
package_info:
3937
:path: ".symlinks/plugins/package_info/ios"
40-
path_provider_ios:
41-
:path: ".symlinks/plugins/path_provider_ios/ios"
42-
shared_preferences_ios:
43-
:path: ".symlinks/plugins/shared_preferences_ios/ios"
38+
path_provider_foundation:
39+
:path: ".symlinks/plugins/path_provider_foundation/ios"
4440
sqflite:
4541
:path: ".symlinks/plugins/sqflite/ios"
4642

4743
SPEC CHECKSUMS:
48-
Flutter: 405776dd0763d7e32a8f989d4e271ca1317d080c
49-
fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037
44+
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
45+
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
5046
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
5147
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
52-
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
53-
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
48+
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
5449
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
5550
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
5651

ios/Runner.xcodeproj/project.pbxproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 51;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -217,6 +217,7 @@
217217
/* Begin PBXShellScriptBuildPhase section */
218218
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
219219
isa = PBXShellScriptBuildPhase;
220+
alwaysOutOfDate = 1;
220221
buildActionMask = 2147483647;
221222
files = (
222223
);
@@ -253,6 +254,7 @@
253254
};
254255
9740EEB61CF901F6004384FC /* Run Script */ = {
255256
isa = PBXShellScriptBuildPhase;
257+
alwaysOutOfDate = 1;
256258
buildActionMask = 2147483647;
257259
files = (
258260
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1300"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
18+
BuildableName = "Runner.app"
19+
BlueprintName = "Runner"
20+
ReferencedContainer = "container:Runner.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
34+
BuildableName = "Runner.app"
35+
BlueprintName = "Runner"
36+
ReferencedContainer = "container:Runner.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
39+
<Testables>
40+
<TestableReference
41+
skipped = "NO"
42+
parallelizable = "YES">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "331C8080294A63A400263BE5"
46+
BuildableName = "RunnerTests.xctest"
47+
BlueprintName = "RunnerTests"
48+
ReferencedContainer = "container:Runner.xcodeproj">
49+
</BuildableReference>
50+
</TestableReference>
51+
</Testables>
52+
</TestAction>
53+
<LaunchAction
54+
buildConfiguration = "Debug"
55+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
launchStyle = "0"
58+
useCustomWorkingDirectory = "NO"
59+
ignoresPersistentStateOnLaunch = "NO"
60+
debugDocumentVersioning = "YES"
61+
debugServiceExtension = "internal"
62+
allowLocationSimulation = "YES">
63+
<BuildableProductRunnable
64+
runnableDebuggingMode = "0">
65+
<BuildableReference
66+
BuildableIdentifier = "primary"
67+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
68+
BuildableName = "Runner.app"
69+
BlueprintName = "Runner"
70+
ReferencedContainer = "container:Runner.xcodeproj">
71+
</BuildableReference>
72+
</BuildableProductRunnable>
73+
</LaunchAction>
74+
<ProfileAction
75+
buildConfiguration = "Profile"
76+
shouldUseLaunchSchemeArgsEnv = "YES"
77+
savedToolIdentifier = ""
78+
useCustomWorkingDirectory = "NO"
79+
debugDocumentVersioning = "YES">
80+
<BuildableProductRunnable
81+
runnableDebuggingMode = "0">
82+
<BuildableReference
83+
BuildableIdentifier = "primary"
84+
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
85+
BuildableName = "Runner.app"
86+
BlueprintName = "Runner"
87+
ReferencedContainer = "container:Runner.xcodeproj">
88+
</BuildableReference>
89+
</BuildableProductRunnable>
90+
</ProfileAction>
91+
<AnalyzeAction
92+
buildConfiguration = "Debug">
93+
</AnalyzeAction>
94+
<ArchiveAction
95+
buildConfiguration = "Release"
96+
revealArchiveInOrganizer = "YES">
97+
</ArchiveAction>
98+
</Scheme>

ios/Runner/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@
4343
<false/>
4444
<key>CADisableMinimumFrameDurationOnPhone</key>
4545
<true/>
46+
<key>UIApplicationSupportsIndirectInputEvents</key>
47+
<true/>
4648
</dict>
4749
</plist>

ios/RunnerTests/RunnerTests.swift

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Flutter
2+
import UIKit
3+
import XCTest
4+
5+
class RunnerTests: XCTestCase {
6+
7+
func testExample() {
8+
// If you add code to the Runner application, consider adding tests here.
9+
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10+
}
11+
12+
}

lib/src/data/local/app_storage.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ class AppStorage {
1111
return AppStorage._();
1212
}
1313

14-
PrefHelper get prefHelper => AppPrefs(prefBox: Hive.box(_prefsBox));
14+
Future<PrefHelper> prefHelper() async {
15+
return AppPrefs(prefBox: await Hive.openBox(_prefsBox));
16+
}
1517
}

lib/src/data/remote/interceptor/header_interceptor.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class HeaderInterceptor extends InterceptorsWrapper {
1515
RequestOptions options, RequestInterceptorHandler handler) async {
1616
final userAgentValue = await userAgentClientHintsHeader();
1717

18-
final token = await AppStorage.init().prefHelper.getToken();
18+
final pref = await AppStorage.init().prefHelper();
19+
final token = await pref.getToken();
1920
if (token?.isNotEmpty == true) {
2021
options.headers[authHeaderKey] = '$bearer $token';
2122
}

lib/src/data/remote/interceptor/token_interceptor.dart

+14-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:flutter_clean_architecture/src/data/model/user_data_model.dart';
55
import 'package:flutter_clean_architecture/src/data/remote/api/user_api.dart';
66
import 'package:flutter_clean_architecture/src/data/remote/builder/dio_builder.dart';
77

8-
class TokenInterceptor extends Interceptor {
8+
class TokenInterceptor extends QueuedInterceptor {
99
final Dio currentDio;
1010
final String auth = 'Authorization';
1111
final String bearer = 'Bearer';
@@ -16,12 +16,19 @@ class TokenInterceptor extends Interceptor {
1616
void onError(DioError err, ErrorInterceptorHandler handler) async {
1717
if (err.response != null && err.response?.statusCode == HttpStatus.unauthorized) {
1818
// TODO Please refactor when token api ready
19-
// Lock all of request to request new token
20-
currentDio.lock();
21-
// request new token & save it
22-
final token = await requestToken();
23-
// unlock when token refreshed
24-
currentDio.unlock();
19+
20+
/// Step 1: Get current token from request
21+
/// Step 2: Compare with token from storage
22+
/// Step 3.1: If different, recall request with token from storage
23+
/// Step 3.2: If same, refresh token
24+
25+
const tokenFromRequest = '';
26+
const tokenFromStorage = '';
27+
String token = tokenFromStorage;
28+
29+
if (tokenFromRequest != tokenFromStorage) {
30+
token = await requestToken();
31+
}
2532

2633
// Re-call request
2734
final request = err.requestOptions;

lib/src/presentation/ui/app.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/scheduler.dart';
23
import 'package:flutter_clean_architecture/src/presentation/di/app_provider.dart';
34
import 'package:flutter_clean_architecture/src/presentation/ui/home/home_page.dart';
45
import 'package:flutter_clean_architecture/src/presentation/ui/theme/theme.dart';
@@ -17,7 +18,13 @@ class Application extends ConsumerWidget {
1718
supportedLocales: Resource.supportedLocales,
1819
localeResolutionCallback: (Locale? locale, Iterable<Locale> supportedLocales) {
1920
if (supportedLocales.any((element) => locale?.languageCode.contains(element.toString()) == true)) {
20-
ref.watch(localeCodeProvider.notifier).state = locale!.languageCode;
21+
String currentLanguageCode = ref.watch(localeCodeProvider);
22+
if (currentLanguageCode != locale!.languageCode) {
23+
SchedulerBinding.instance.addPostFrameCallback((_) {
24+
ref.watch(localeCodeProvider.notifier).state = locale.languageCode;
25+
});
26+
}
27+
2128
return locale;
2229
}
2330
return const Locale('en', '');

0 commit comments

Comments
 (0)