2019-03-22 01:08:03 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix.utils
|
|
|
|
|
|
|
|
import android.content.Context
|
2019-04-05 22:52:20 +02:00
|
|
|
import org.mozilla.fenix.components.FenixSnackbar
|
2019-03-22 01:08:03 +01:00
|
|
|
import org.mozilla.fenix.ext.components
|
2019-05-02 17:53:40 +02:00
|
|
|
import org.mozilla.fenix.ext.getRootView
|
2019-03-22 01:08:03 +01:00
|
|
|
|
|
|
|
class ItsNotBrokenSnack(val context: Context) {
|
2019-03-22 20:38:59 +01:00
|
|
|
fun showSnackbar(issueNumber: String) {
|
2019-04-05 00:11:51 +02:00
|
|
|
val rootView =
|
2019-05-02 17:53:40 +02:00
|
|
|
context.getRootView()
|
2019-04-05 22:52:20 +02:00
|
|
|
|
2019-05-02 17:53:40 +02:00
|
|
|
rootView?.let {
|
|
|
|
FenixSnackbar.make(it, FenixSnackbar.LENGTH_SHORT)
|
|
|
|
.setText(message.replace("%", issueNumber))
|
|
|
|
.setAction("Add Tab to Issue") {
|
|
|
|
context.components.useCases.tabsUseCases.addTab
|
|
|
|
.invoke(issues + issueNumber)
|
|
|
|
}
|
|
|
|
.show()
|
|
|
|
}
|
2019-03-22 01:08:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
const val issues = "https://github.com/mozilla-mobile/fenix/issues/"
|
|
|
|
const val message = "Feature is not implemented, Issue #%"
|
|
|
|
}
|
|
|
|
}
|