Skip to content

Commit

Permalink
Removed search query paramater for security reasons & to fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieJarApps committed Aug 3, 2020
1 parent d57c1dc commit 38ba7b7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ abstract class BaseSuggestionsModel internal constructor(

private val language = locale.language.takeIf(String::isNotEmpty) ?: DEFAULT_LANGUAGE




/**
* Create a URL for the given query in the given language.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class GoogleSuggestionsModel(
.host("suggestqueries.google.com")
.encodedPath("/complete/search")
.addQueryParameter("output", "toolbar")
.addQueryParameter("hl", language)
//.addQueryParameter("hl", language)
.addEncodedQueryParameter("q", query)
.build()

@Throws(Exception::class)
override fun parseResults(responseBody: ResponseBody): List<SearchSuggestion> {
parser.setInput(responseBody.byteStream(), "ISO-8859-1")
parser.setInput(responseBody.byteStream(), encoding)
val suggestions = mutableListOf<SearchSuggestion>()
var eventType = parser.eventType
while (eventType != XmlPullParser.END_DOCUMENT) {
Expand All @@ -63,5 +63,7 @@ class GoogleSuggestionsModel(
}.newPullParser()
}

var encoding = "ISO-8859-1"

}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
<string name="tabs">Tabs</string>
<string name="theme">App theme</string>
<string name="light_theme">Light theme</string>
<string name="black_theme">Black theme</string>
<string name="black_theme">AMOLED theme</string>
<string name="blue_theme">Blue theme</string>
<string name="yellow_theme">Yellow theme</string>
<string name="green_theme">Green theme</string>
Expand Down

0 comments on commit 38ba7b7

Please sign in to comment.