Correct class and method visibility modifiers
This commit is contained in:
@@ -20,7 +20,7 @@ import org.commonmark.ext.gfm.tables.TablesExtension
|
||||
import org.commonmark.node.*
|
||||
import org.commonmark.parser.Parser
|
||||
|
||||
object MarkwonFactory {
|
||||
internal object MarkwonFactory {
|
||||
fun createForMessage(context: Context, picasso: Picasso): Markwon {
|
||||
return Markwon.builder(context)
|
||||
.usePlugin(CorePlugin.create())
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.github.gotify.client.model.Message
|
||||
import com.github.gotify.client.model.PagedMessages
|
||||
import com.github.gotify.log.Log
|
||||
|
||||
class MissedMessageUtil(private val api: MessageApi) {
|
||||
internal class MissedMessageUtil(private val api: MessageApi) {
|
||||
fun lastReceivedMessage(successCallback: SuccessCallback<Long?>) {
|
||||
api.getMessages(1, 0L).enqueue(
|
||||
Callback.call({ messages: PagedMessages? ->
|
||||
|
||||
@@ -7,7 +7,7 @@ import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.github.gotify.log.Log
|
||||
|
||||
object NotificationSupport {
|
||||
internal object NotificationSupport {
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
fun createChannels(notificationManager: NotificationManager) {
|
||||
try {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package com.github.gotify
|
||||
|
||||
class SSLSettings(val validateSSL: Boolean, val cert: String)
|
||||
internal class SSLSettings(val validateSSL: Boolean, val cert: String)
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import com.github.gotify.client.model.User
|
||||
|
||||
class Settings(context: Context) {
|
||||
internal class Settings(context: Context) {
|
||||
private val sharedPreferences: SharedPreferences
|
||||
var url: String
|
||||
get() = sharedPreferences.getString("url", "")!!
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.net.URI
|
||||
import java.net.URISyntaxException
|
||||
import java.net.URL
|
||||
|
||||
object Utils {
|
||||
internal object Utils {
|
||||
val JSON: Gson = JSON().gson
|
||||
|
||||
fun showSnackBar(activity: Activity, message: String?) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.github.gotify.api
|
||||
import java.io.IOException
|
||||
import retrofit2.Call
|
||||
|
||||
object Api {
|
||||
internal object Api {
|
||||
@Throws(ApiException::class)
|
||||
fun <T> execute(call: Call<T>): T? {
|
||||
try {
|
||||
|
||||
@@ -7,7 +7,7 @@ import android.os.Build
|
||||
import com.github.gotify.Settings
|
||||
import com.github.gotify.service.WebSocketService
|
||||
|
||||
class BootCompletedReceiver : BroadcastReceiver() {
|
||||
internal class BootCompletedReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val settings = Settings(context)
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.github.gotify.messages.MessagesActivity
|
||||
import com.github.gotify.service.WebSocketService
|
||||
import com.github.gotify.settings.ThemeHelper
|
||||
|
||||
class InitializationActivity : AppCompatActivity() {
|
||||
internal class InitializationActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var settings: Settings
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.github.gotify.log.UncaughtExceptionHandler
|
||||
import java.security.cert.X509Certificate
|
||||
import okhttp3.HttpUrl
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
internal class LoginActivity : AppCompatActivity() {
|
||||
companion object {
|
||||
// return value from startActivityForResult when choosing a certificate
|
||||
private const val FILE_SELECT_CODE = 1
|
||||
@@ -82,7 +82,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
binding.checkurl.text = getString(R.string.check_url)
|
||||
}
|
||||
|
||||
fun doCheckUrl() {
|
||||
private fun doCheckUrl() {
|
||||
val url = binding.gotifyUrl.text.toString()
|
||||
val parsedUrl = HttpUrl.parse(url)
|
||||
if (parsedUrl == null) {
|
||||
@@ -114,7 +114,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
fun showHttpWarning() {
|
||||
private fun showHttpWarning() {
|
||||
AlertDialog.Builder(ContextThemeWrapper(this, R.style.AppTheme_Dialog))
|
||||
.setTitle(R.string.warning)
|
||||
.setCancelable(true)
|
||||
@@ -123,11 +123,11 @@ class LoginActivity : AppCompatActivity() {
|
||||
.show()
|
||||
}
|
||||
|
||||
fun openLogs() {
|
||||
private fun openLogs() {
|
||||
startActivity(Intent(this, LogsActivity::class.java))
|
||||
}
|
||||
|
||||
fun toggleShowAdvanced() {
|
||||
private fun toggleShowAdvanced() {
|
||||
val selectedCertName = if (caCertContents != null) {
|
||||
getNameOfCertContent(caCertContents!!)
|
||||
} else null
|
||||
@@ -215,7 +215,7 @@ class LoginActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
fun doLogin() {
|
||||
private fun doLogin() {
|
||||
val username = binding.username.text.toString()
|
||||
val password = binding.password.text.toString()
|
||||
|
||||
@@ -251,7 +251,10 @@ class LoginActivity : AppCompatActivity() {
|
||||
.show()
|
||||
}
|
||||
|
||||
fun doCreateClient(client: ApiClient, nameProvider: EditText): DialogInterface.OnClickListener {
|
||||
private fun doCreateClient(
|
||||
client: ApiClient,
|
||||
nameProvider: EditText
|
||||
): DialogInterface.OnClickListener {
|
||||
return DialogInterface.OnClickListener { _, _ ->
|
||||
val newClient = Client().name(nameProvider.text.toString())
|
||||
client.createService(ClientApi::class.java)
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.gotify.messages
|
||||
|
||||
import com.github.gotify.client.model.Message
|
||||
|
||||
object Extras {
|
||||
internal object Extras {
|
||||
fun useMarkdown(message: Message): Boolean {
|
||||
return useMarkdown(message.extras)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.threeten.bp.OffsetDateTime
|
||||
import java.text.DateFormat
|
||||
import java.util.*
|
||||
|
||||
class ListMessageAdapter(
|
||||
internal class ListMessageAdapter(
|
||||
private val context: Context,
|
||||
private val settings: Settings,
|
||||
private val picasso: Picasso,
|
||||
|
||||
@@ -57,7 +57,10 @@ import com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import java.io.IOException
|
||||
|
||||
class MessagesActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
|
||||
internal class MessagesActivity :
|
||||
AppCompatActivity(),
|
||||
NavigationView.OnNavigationItemSelectedListener
|
||||
{
|
||||
private lateinit var binding: ActivityMessagesBinding
|
||||
private lateinit var viewModel: MessagesModel
|
||||
private var isLoadMore = false
|
||||
@@ -148,11 +151,11 @@ class MessagesActivity : AppCompatActivity(), NavigationView.OnNavigationItemSel
|
||||
binding.learnGotify.setOnClickListener { openDocumentation() }
|
||||
}
|
||||
|
||||
fun onRefreshAll(view: View?) {
|
||||
private fun onRefreshAll(view: View?) {
|
||||
refreshAll()
|
||||
}
|
||||
|
||||
fun refreshAll() {
|
||||
private fun refreshAll() {
|
||||
try {
|
||||
viewModel.picassoHandler.evict()
|
||||
} catch (e: IOException) {
|
||||
@@ -176,7 +179,7 @@ class MessagesActivity : AppCompatActivity(), NavigationView.OnNavigationItemSel
|
||||
CommitDeleteMessage().execute()
|
||||
}
|
||||
|
||||
protected fun onUpdateApps(applications: List<Application>) {
|
||||
private fun onUpdateApps(applications: List<Application>) {
|
||||
val menu: Menu = binding.navView.menu
|
||||
menu.removeGroup(R.id.apps)
|
||||
viewModel.targetReferences.clear()
|
||||
@@ -278,7 +281,7 @@ class MessagesActivity : AppCompatActivity(), NavigationView.OnNavigationItemSel
|
||||
return true
|
||||
}
|
||||
|
||||
fun doLogout() {
|
||||
private fun doLogout() {
|
||||
setContentView(R.layout.splash)
|
||||
DeleteClientAndNavigateToLogin().execute()
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.github.gotify.messages.provider.MessageState
|
||||
import com.github.gotify.picasso.PicassoHandler
|
||||
import com.squareup.picasso.Target
|
||||
|
||||
class MessagesModel(parentView: Activity) : ViewModel() {
|
||||
internal class MessagesModel(parentView: Activity) : ViewModel() {
|
||||
val settings: Settings
|
||||
val picassoHandler: PicassoHandler
|
||||
val client: ApiClient
|
||||
|
||||
@@ -4,7 +4,9 @@ import android.app.Activity
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
||||
class MessagesModelFactory(var modelParameterActivity: Activity) : ViewModelProvider.Factory {
|
||||
internal class MessagesModelFactory(
|
||||
var modelParameterActivity: Activity
|
||||
) : ViewModelProvider.Factory {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
if (modelClass == MessagesModel::class.java) {
|
||||
return modelClass.cast(MessagesModel(modelParameterActivity)) as T
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.github.gotify.client.ApiClient
|
||||
import com.github.gotify.client.api.ApplicationApi
|
||||
import com.github.gotify.client.model.Application
|
||||
|
||||
class ApplicationHolder(private val activity: Activity, private val client: ApiClient) {
|
||||
internal class ApplicationHolder(private val activity: Activity, private val client: ApiClient) {
|
||||
private var state: List<Application> = listOf()
|
||||
private var onUpdate: Runnable? = null
|
||||
private var onUpdateFailed: Runnable? = null
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.gotify.messages.provider
|
||||
|
||||
import com.github.gotify.client.model.Message
|
||||
|
||||
class MessageDeletion(
|
||||
internal class MessageDeletion(
|
||||
val message: Message,
|
||||
val allPosition: Int,
|
||||
val appPosition: Int
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.github.gotify.messages.provider
|
||||
import com.github.gotify.client.api.MessageApi
|
||||
import com.github.gotify.client.model.Message
|
||||
|
||||
class MessageFacade(api: MessageApi, private val applicationHolder: ApplicationHolder) {
|
||||
internal class MessageFacade(api: MessageApi, private val applicationHolder: ApplicationHolder) {
|
||||
private val requester: MessageRequester
|
||||
private val state: MessageStateHolder
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.github.gotify.messages.provider
|
||||
import com.github.gotify.client.model.Application
|
||||
import com.github.gotify.client.model.Message
|
||||
|
||||
object MessageImageCombiner {
|
||||
internal object MessageImageCombiner {
|
||||
fun combine(messages: List<Message>, applications: List<Application>): List<MessageWithImage> {
|
||||
val appIdToImage = appIdToImage(applications)
|
||||
val result = mutableListOf<MessageWithImage>()
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.gotify.messages.provider
|
||||
|
||||
import com.github.gotify.client.model.Message
|
||||
|
||||
class MessageState {
|
||||
internal class MessageState {
|
||||
var appId = 0L
|
||||
var loaded = false
|
||||
var hasNext = false
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.gotify.messages.provider
|
||||
|
||||
import com.github.gotify.client.model.Message
|
||||
|
||||
class MessageWithImage {
|
||||
internal class MessageWithImage {
|
||||
lateinit var message: Message
|
||||
lateinit var image: String
|
||||
}
|
||||
|
||||
@@ -11,8 +11,7 @@ import com.squareup.picasso.RequestHandler
|
||||
* Adapted from https://github.com/square/picasso/issues/1395#issuecomment-220929377 By
|
||||
* https://github.com/SmartDengg
|
||||
*/
|
||||
class PicassoDataRequestHandler : RequestHandler() {
|
||||
|
||||
internal class PicassoDataRequestHandler : RequestHandler() {
|
||||
companion object {
|
||||
private const val DATA_SCHEME = "data"
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ import okhttp3.OkHttpClient
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
||||
class PicassoHandler(private val context: Context, private val settings: Settings) {
|
||||
|
||||
internal class PicassoHandler(private val context: Context, private val settings: Settings) {
|
||||
companion object {
|
||||
private const val PICASSO_CACHE_SIZE = 50 * 1024 * 1024 // 50 MB
|
||||
private const val PICASSO_CACHE_SUBFOLDER = "picasso-cache"
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.github.gotify.service.WebSocketConnection.OnNetworkFailureRunnable
|
||||
import io.noties.markwon.Markwon
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
class WebSocketService : Service() {
|
||||
internal class WebSocketService : Service() {
|
||||
companion object {
|
||||
val NEW_MESSAGE_BROADCAST = "${WebSocketService::class.java.name}.NEW_MESSAGE"
|
||||
private const val NOT_LOADED = -2L
|
||||
|
||||
@@ -15,7 +15,7 @@ import androidx.preference.PreferenceManager
|
||||
import com.github.gotify.R
|
||||
import com.github.gotify.databinding.SettingsActivityBinding
|
||||
|
||||
class SettingsActivity : AppCompatActivity(), OnSharedPreferenceChangeListener {
|
||||
internal class SettingsActivity : AppCompatActivity(), OnSharedPreferenceChangeListener {
|
||||
private lateinit var binding: SettingsActivityBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import android.os.Build
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.github.gotify.R
|
||||
|
||||
object ThemeHelper {
|
||||
internal object ThemeHelper {
|
||||
fun setTheme(context: Context, newTheme: String) {
|
||||
AppCompatDelegate.setDefaultNightMode(ofKey(context, newTheme))
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.github.gotify.databinding.ActivityShareBinding
|
||||
import com.github.gotify.log.Log
|
||||
import com.github.gotify.messages.provider.ApplicationHolder
|
||||
|
||||
class ShareActivity : AppCompatActivity() {
|
||||
internal class ShareActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityShareBinding
|
||||
private lateinit var settings: Settings
|
||||
private lateinit var appsHolder: ApplicationHolder
|
||||
@@ -88,7 +88,7 @@ class ShareActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
|
||||
fun pushMessage() {
|
||||
private fun pushMessage() {
|
||||
val titleText = binding.title.text.toString()
|
||||
val contentText = binding.content.text.toString()
|
||||
val priority = binding.edtTxtPriority.text.toString()
|
||||
|
||||
Reference in New Issue
Block a user