Skip to content

Commit

Permalink
⬆️ Add support for Django v4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Aug 31, 2022
1 parent e1da46c commit bf9d591
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![GitHub All Releases](https://img.shields.io/github/downloads/techouse/alfred-django-docs/total.svg)
![GitHub](https://img.shields.io/github/license/techouse/alfred-django-docs.svg)

Search the [Django documentation](https://docs.djangoproject.com/en/4.0/) using [Alfred](https://www.alfredapp.com/).
Search the [Django documentation](https://docs.djangoproject.com/en/4.1/) using [Alfred](https://www.alfredapp.com/).

![demo](demo.gif)

Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include: package:lints/recommended.yaml

analyzer:
plugins:
- dart_code_metrics
Expand Down
4 changes: 2 additions & 2 deletions bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void main(List<String> arguments) async {
if (queryString.isEmpty) {
_showPlaceholder();
} else {
workflow.cacheKey = '${queryString}_${version}';
workflow.cacheKey = '${queryString}_$version';
if (await workflow.getItems() == null) {
await _performSearch(queryString, version: version);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ Future<void> _performSearch(String query, {String? version}) async {
return AlfredItem(
uid: result.objectID,
title: result.prettyTitle,
subtitle: result.content.length > 0
subtitle: result.content.isNotEmpty
? result.content.truncate(75)
: result.id,
arg: result.permalink,
Expand Down
3 changes: 2 additions & 1 deletion bin/src/constants/config.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Config {
Config._();

static const String version = '2.1.3';
static const String version = '2.1.4';
static final Uri githubRepositoryUrl =
Uri.https('github.com', '/techouse/alfred-django-docs');
static const String algoliaApplicationId = 'WODHKE4WZG';
Expand All @@ -19,5 +19,6 @@ class Config {
'v3.1',
'v3.2',
'v4',
'v4.1',
];
}
27 changes: 9 additions & 18 deletions bin/src/models/search_result.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import 'package:json_annotation/json_annotation.dart';

part 'search_result.g.dart';

@JsonSerializable()
class SearchResult {
const SearchResult({
required this.objectID,
Expand Down Expand Up @@ -38,22 +43,8 @@ class SearchResult {
'version',
];

SearchResult.fromJson(Map<String, dynamic> json)
: objectID = json['objectID'] as String,
categories = List<String>.from(json['categories'] as List),
content = json['content'] as String,
id = json['id'] as String,
permalink = json['permalink'] as String,
title = json['title'] as String,
version = json['version'] as num;

Map<String, dynamic> toJson() => {
'objectID': objectID,
'categories': categories,
'content': content,
'id': id,
'permalink': permalink,
'title': title,
'version': version,
};
factory SearchResult.fromJson(Map<String, dynamic> json) =>
_$SearchResultFromJson(json);

Map<String, dynamic> toJson() => _$SearchResultToJson(this);
}
30 changes: 30 additions & 0 deletions bin/src/models/search_result.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>2.1.3</string>
<string>2.1.4</string>
<key>webaddress</key>
<string>https://github.com/techouse</string>
</dict>
Expand Down
Loading

0 comments on commit bf9d591

Please sign in to comment.