From 12e316194ce0225100492c52d6ca6f45f1339a7d Mon Sep 17 00:00:00 2001 From: Larry Aasen Date: Thu, 4 Apr 2024 08:03:40 -0400 Subject: [PATCH] Fixed issue with Android Play Store titles that contained "\u0027". --- CHANGELOG.md | 7 ++++--- lib/src/play_store_search_api.dart | 5 +++-- pubspec.yaml | 2 +- test/play_store_test.dart | 6 ++++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6562ab..e83993f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/lib/src/play_store_search_api.dart b/lib/src/play_store_search_api.dart index 984117b4..7cf22595 100644 --- a/lib/src/play_store_search_api.dart +++ b/lib/src/play_store_search_api.dart @@ -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'; @@ -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 = diff --git a/pubspec.yaml b/pubspec.yaml index 27d1436d..46b215d1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: diff --git a/test/play_store_test.dart b/test/play_store_test.dart index fa6e3586..daa25120 100644 --- a/test/play_store_test.dart +++ b/test/play_store_test.dart @@ -250,4 +250,10 @@ void main() { r'\[\Minimum supported app version\:[\s]*(?[^\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'); + }); }