Skip to content

Commit

Permalink
Issue mozilla-mobile#2325: Deprecate Pocket code moving to a-c.
Browse files Browse the repository at this point in the history
The code is already available in a-c: it just needs to be exposed and
perhaps refactored a little bit to support being exposed.
  • Loading branch information
mcomella committed May 24, 2019
1 parent 8ad0ceb commit 6b04a62
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@file:Suppress("DEPRECATION") // PocketVideoParser.

package org.mozilla.tv.firefox.helpers

import android.app.Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import java.util.concurrent.TimeoutException
private const val LOGTAG = "PocketEndpointRaw"

/** Make requests to the Pocket endpoint and returns raw data: see [PocketEndpoint] for more. */
@Deprecated("Move to android-components implementation #1976")
class PocketEndpointRaw(
private val appVersion: String,
private val pocketGlobalVideoEndpoint: Uri?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ private const val LOGTAG = "PocketVideoParser"
/**
* Handles marshalling [PocketViewModel.FeedItem.Video] objects from JSON.
*/
@Deprecated("Move to android-components implementation #1976")
object PocketVideoParser {

// Ideally, this functionality would be in a separate class but 1) we're short on time and 2) this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class PocketViewModel(
val authors: String
) : FeedItem() {
companion object {
@Suppress("DEPRECATION") // We need PocketVideoParser until we move to a-c's impl.
fun fromJSONObject(jsonObject: JSONObject) = PocketVideoParser.parse(jsonObject)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// We want the Pocket code from a-c: #1976. Unfortunately, the compiler won't let
// us suppress individual lines so we have to suppress the file.
@file:Suppress("DEPRECATION")

package org.mozilla.tv.firefox.utils

import android.app.Application
Expand Down Expand Up @@ -87,6 +91,7 @@ open class ServiceLocator(val app: Application) {
val screenshotStoreWrapper by lazy { PinnedTileImageUtilWrapper(app) }
val formattedDomainWrapper by lazy { FormattedDomainWrapper(app) }
val channelRepo by lazy { ChannelRepo(pinnedTileRepo) }
@Suppress("DEPRECATION") // We need PocketEndpointRaw until we move to a-c's impl.
val pocketEndpointRaw by lazy { PocketEndpointRaw(appVersion, buildConfigDerivables.globalPocketVideoEndpoint) }
val pocketVideoStore by lazy { PocketVideoStore(app, app.assets, pocketVideoParser::convertVideosJSON) }
val pocketVideoFetchScheduler by lazy { PocketVideoFetchScheduler(isPocketEnabledByLocale) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@file:Suppress("DEPRECATION") // The class under test is deprecated.

package org.mozilla.tv.firefox.pocket

import org.json.JSONObject
Expand Down

0 comments on commit 6b04a62

Please sign in to comment.