-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: moved Db, Hive stores to their respective packages.
- Loading branch information
Showing
129 changed files
with
3,623 additions
and
1,852 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
analysis_options.yaml → dio_cache_interceptor/analysis_options.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
include: package:pedantic/analysis_options.yaml | ||
|
||
analyzer: | ||
exclude: | ||
include: package:pedantic/analysis_options.yaml | ||
|
||
analyzer: | ||
exclude: | ||
- "example/**" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
lib/dio_cache_interceptor.dart → ...nterceptor/lib/dio_cache_interceptor.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
library dio_cache_interceptor; | ||
|
||
export 'io_unsupported.dart' | ||
if (dart.library.io) 'src/store/file_cache_store.dart'; | ||
export 'src/dio_cache_interceptor.dart'; | ||
export 'src/model/cache_control.dart'; | ||
export 'src/model/cache_options.dart'; | ||
export 'src/model/cache_priority.dart'; | ||
export 'src/model/cache_response.dart'; | ||
export 'src/store/backup_cache_store.dart'; | ||
export 'src/store/cache_store.dart'; | ||
export 'src/store/db_cache_store.dart'; | ||
export 'src/store/hive_cache_store.dart'; | ||
export 'src/store/file_cache_store/file_cache_store.dart'; | ||
export 'src/store/mem_cache_store.dart'; |
File renamed without changes.
30 changes: 15 additions & 15 deletions
30
lib/src/model/cache_cipher.dart → ...terceptor/lib/src/model/cache_cipher.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
/// Encrypt content/headers method. | ||
typedef Encrypt = Future<List<int>> Function(List<int> bytes); | ||
|
||
/// Decrypt content/headers method. | ||
typedef Decrypt = Future<List<int>> Function(List<int> bytes); | ||
|
||
class CacheCipher { | ||
/// Optional method to decrypt cache content | ||
final Decrypt decrypt; | ||
|
||
/// Optional method to encrypt cache content | ||
final Encrypt encrypt; | ||
|
||
const CacheCipher({required this.decrypt, required this.encrypt}); | ||
} | ||
/// Encrypt content/headers method. | ||
typedef Encrypt = Future<List<int>> Function(List<int> bytes); | ||
|
||
/// Decrypt content/headers method. | ||
typedef Decrypt = Future<List<int>> Function(List<int> bytes); | ||
|
||
class CacheCipher { | ||
/// Optional method to decrypt cache content | ||
final Decrypt decrypt; | ||
|
||
/// Optional method to encrypt cache content | ||
final Encrypt encrypt; | ||
|
||
const CacheCipher({required this.decrypt, required this.encrypt}); | ||
} |
160 changes: 80 additions & 80 deletions
160
lib/src/model/cache_control.dart → ...erceptor/lib/src/model/cache_control.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,80 @@ | ||
/// Cache-Control header subset representation | ||
class CacheControl { | ||
/// How long the response can be used from the time it was requested (in seconds). | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.8 | ||
final int? maxAge; | ||
|
||
/// 'public' / 'private'. | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.5 | ||
final String? privacy; | ||
|
||
/// Must first submit a validation request to an origin server. | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.2 | ||
final bool? noCache; | ||
|
||
/// Disallow cache, overriding any other directives (Etag, Last-Modified) | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.3 | ||
final bool? noStore; | ||
|
||
/// Other attributes not parsed | ||
final List<String> other; | ||
|
||
CacheControl({ | ||
this.maxAge, | ||
this.privacy, | ||
this.noCache = false, | ||
this.noStore = false, | ||
this.other = const [], | ||
}); | ||
|
||
static CacheControl? fromHeader(List<String>? headerValues) { | ||
if (headerValues == null) return null; | ||
|
||
int? maxAge; | ||
String? privacy; | ||
bool? noCache; | ||
bool? noStore; | ||
final other = <String>[]; | ||
|
||
for (var value in headerValues) { | ||
// Expand values since dio does not do it ! | ||
for (var expandedValue in value.split(',')) { | ||
expandedValue = expandedValue.trim(); | ||
if (expandedValue == 'no-cache') { | ||
noCache = true; | ||
} else if (expandedValue == 'no-store') { | ||
noStore = true; | ||
} else if (expandedValue == 'public' || expandedValue == 'private') { | ||
privacy = expandedValue; | ||
} else if (expandedValue.startsWith('max-age')) { | ||
maxAge = int.tryParse( | ||
expandedValue.substring(expandedValue.indexOf('=') + 1), | ||
); | ||
} else { | ||
other.add(expandedValue); | ||
} | ||
} | ||
} | ||
|
||
return CacheControl( | ||
maxAge: maxAge, | ||
privacy: privacy, | ||
noCache: noCache, | ||
noStore: noStore, | ||
other: other, | ||
); | ||
} | ||
|
||
/// Serialize cache-control values | ||
String toHeader() { | ||
final values = <String>[ | ||
maxAge != null ? 'max-age=$maxAge' : '', | ||
privacy ?? '', | ||
(noCache ?? false) ? 'no-cache' : '', | ||
(noStore ?? false) ? 'no-store' : '', | ||
...other | ||
]; | ||
|
||
return values.join(', '); | ||
} | ||
} | ||
/// Cache-Control header subset representation | ||
class CacheControl { | ||
/// How long the response can be used from the time it was requested (in seconds). | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.8 | ||
final int? maxAge; | ||
|
||
/// 'public' / 'private'. | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.5 | ||
final String? privacy; | ||
|
||
/// Must first submit a validation request to an origin server. | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.2 | ||
final bool? noCache; | ||
|
||
/// Disallow cache, overriding any other directives (Etag, Last-Modified) | ||
/// https://tools.ietf.org/html/rfc7234#section-5.2.2.3 | ||
final bool? noStore; | ||
|
||
/// Other attributes not parsed | ||
final List<String> other; | ||
|
||
CacheControl({ | ||
this.maxAge, | ||
this.privacy, | ||
this.noCache = false, | ||
this.noStore = false, | ||
this.other = const [], | ||
}); | ||
|
||
static CacheControl? fromHeader(List<String>? headerValues) { | ||
if (headerValues == null) return null; | ||
|
||
int? maxAge; | ||
String? privacy; | ||
bool? noCache; | ||
bool? noStore; | ||
final other = <String>[]; | ||
|
||
for (var value in headerValues) { | ||
// Expand values since dio does not do it ! | ||
for (var expandedValue in value.split(',')) { | ||
expandedValue = expandedValue.trim(); | ||
if (expandedValue == 'no-cache') { | ||
noCache = true; | ||
} else if (expandedValue == 'no-store') { | ||
noStore = true; | ||
} else if (expandedValue == 'public' || expandedValue == 'private') { | ||
privacy = expandedValue; | ||
} else if (expandedValue.startsWith('max-age')) { | ||
maxAge = int.tryParse( | ||
expandedValue.substring(expandedValue.indexOf('=') + 1), | ||
); | ||
} else { | ||
other.add(expandedValue); | ||
} | ||
} | ||
} | ||
|
||
return CacheControl( | ||
maxAge: maxAge, | ||
privacy: privacy, | ||
noCache: noCache, | ||
noStore: noStore, | ||
other: other, | ||
); | ||
} | ||
|
||
/// Serialize cache-control values | ||
String toHeader() { | ||
final values = <String>[ | ||
maxAge != null ? 'max-age=$maxAge' : '', | ||
privacy ?? '', | ||
(noCache ?? false) ? 'no-cache' : '', | ||
(noStore ?? false) ? 'no-store' : '', | ||
...other | ||
]; | ||
|
||
return values.join(', '); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.