Skip to content

Commit

Permalink
Fixed issue with Android Play Store titles that contained "\u0027".
Browse files Browse the repository at this point in the history
  • Loading branch information
larryaasen committed Apr 4, 2024
1 parent 332af01 commit 12e3161
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
## Next
## 10.1.0

- Added client headers that can optionally be passed in with a client. (Fix for [PR](https://github.com/larryaasen/upgrader/pull/386))
- [[386](https://github.com/larryaasen/upgrader/pull/386)] Added client headers that can optionally be passed in with a client.
- [[375](https://github.com/larryaasen/upgrader/issues/375)] Fixed issue with Android Play Store titles that contained "\u0027".

## 10.0.1

- Allowed for device_info_plus 10.0.0 and package_info_plus 6.0.0.

## 10.0.0

This major update changes the structure of how the internal state is maintained and how access to app stores is provided. The API has not changed for the standard use cases. However, the way in which Appcast is used has changed slightly.
Expand Down
5 changes: 3 additions & 2 deletions lib/src/play_store_search_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import 'package:html/dom.dart';
import 'package:html/parser.dart' show parse;
import 'package:html/parser.dart';
import 'package:http/http.dart' as http;
import 'package:version/version.dart';

Expand Down Expand Up @@ -264,9 +264,10 @@ extension PlayStoreResults on PlayStoreSearchAPI {
.indexOf(patternEndOfString);
final storeName =
nameElement.substring(storeNameStartIndex, storeNameEndIndex);
final storeNameCleaned = storeName.replaceAll(r'\u0027', '\'');

final versionElement = additionalInfoElementsFiltered
.where((element) => element.text.contains("\"$storeName\""))
.where((element) => element.text.contains("\"$storeNameCleaned\""))
.first
.text;
final storeVersionStartIndex =
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: upgrader
description: Flutter package for prompting users to upgrade when there is a newer version of the app in the store.
version: 10.0.1
version: 10.1.0
homepage: https://github.com/larryaasen/upgrader

environment:
Expand Down
6 changes: 6 additions & 0 deletions test/play_store_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,10 @@ void main() {
r'\[\Minimum supported app version\:[\s]*(?<version>[^\s]+)[\s]*\]'),
'4.5.6+1');
});

test('testing special characters', () async {
const msg = 'McDonald\u0027s';
expect(msg.replaceAll(r"\u0027", "'"), 'McDonald\'s');
expect(msg.replaceAll(r"\u0027", '\''), 'McDonald\'s');
});
}

0 comments on commit 12e3161

Please sign in to comment.