Skip to content

Commit

Permalink
Merge pull request #1351 from hussainmohd-a/v055e_rel
Browse files Browse the repository at this point in the history
v055f
  • Loading branch information
hussainmohd-a authored Apr 24, 2024
2 parents 6465c35 + 6ba5557 commit 66aa105
Show file tree
Hide file tree
Showing 139 changed files with 3,124 additions and 2,471 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ dependencies {
fullImplementation 'com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.5.9'

// from: https://jitpack.io/#celzero/firestack
download 'com.github.celzero:firestack:a94a7e78a6@aar'
implementation 'com.github.celzero:firestack:a94a7e78a6@aar'
download 'com.github.celzero:firestack:602a1e456d@aar'
implementation 'com.github.celzero:firestack:602a1e456d@aar'

// Work manager
implementation('androidx.work:work-runtime-ktx:2.9.0') {
Expand Down
10 changes: 5 additions & 5 deletions app/src/full/java/com/celzero/bravedns/NonStoreAppUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/
package com.celzero.bravedns

import Logger
import Logger.LOG_TAG_APP_UPDATE
import android.app.Activity
import android.util.Log
import com.celzero.bravedns.customdownloader.RetrofitManager
import com.celzero.bravedns.service.AppUpdater
import com.celzero.bravedns.service.PersistentState
Expand All @@ -25,7 +26,6 @@ import com.celzero.bravedns.util.Constants.Companion.JSON_LATEST
import com.celzero.bravedns.util.Constants.Companion.JSON_UPDATE
import com.celzero.bravedns.util.Constants.Companion.JSON_VERSION
import com.celzero.bravedns.util.Constants.Companion.UPDATE_CHECK_RESPONSE_VERSION
import com.celzero.bravedns.util.Logger.Companion.LOG_TAG_APP_UPDATE
import okhttp3.Call
import okhttp3.Callback
import okhttp3.Request
Expand All @@ -43,7 +43,7 @@ class NonStoreAppUpdater(
activity: Activity,
listener: AppUpdater.InstallStateListener
) {
Log.i(LOG_TAG_APP_UPDATE, "Beginning update check")
Logger.i(LOG_TAG_APP_UPDATE, "Beginning update check")
val url = baseUrl + BuildConfig.VERSION_CODE

val client = RetrofitManager.okHttpClient()
Expand All @@ -54,7 +54,7 @@ class NonStoreAppUpdater(
.enqueue(
object : Callback {
override fun onFailure(call: Call, e: IOException) {
Log.i(
Logger.i(
LOG_TAG_APP_UPDATE,
"onFailure - ${call.isCanceled()}, ${call.isExecuted()}"
)
Expand Down Expand Up @@ -82,7 +82,7 @@ class NonStoreAppUpdater(

response.close()
client.connectionPool.evictAll()
Log.i(
Logger.i(
LOG_TAG_APP_UPDATE,
"Server response for the new version download is $shouldUpdate (json version: $version), version number: $latest"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.celzero.bravedns

import Logger
import Logger.LOG_TAG_SCHEDULER
import android.app.Application
import android.content.pm.ApplicationInfo
import android.os.StrictMode
import android.util.Log
import com.celzero.bravedns.scheduler.ScheduleManager
import com.celzero.bravedns.scheduler.WorkScheduler
import com.celzero.bravedns.util.Logger.Companion.LOG_TAG_SCHEDULER
import org.koin.android.ext.android.get
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
Expand Down Expand Up @@ -46,7 +46,7 @@ class RethinkDnsApplication : Application() {

turnOnStrictMode()

if (DEBUG) Log.d(LOG_TAG_SCHEDULER, "Schedule job")
Logger.d(LOG_TAG_SCHEDULER, "Schedule job")
get<WorkScheduler>().scheduleAppExitInfoCollectionJob()
// database refresh is used in both headless and main project
get<ScheduleManager>().scheduleDatabaseRefreshJob()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*/
package com.celzero.bravedns.adapter

import Logger
import Logger.LOG_TAG_UI
import android.content.Context
import android.content.res.ColorStateList
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -32,7 +33,6 @@ import com.celzero.bravedns.data.AppConnection
import com.celzero.bravedns.databinding.ListItemAppDomainDetailsBinding
import com.celzero.bravedns.service.DomainRulesManager
import com.celzero.bravedns.ui.bottomsheet.AppDomainRulesBottomSheet
import com.celzero.bravedns.util.Logger
import com.celzero.bravedns.util.UIUtils.fetchColor
import com.celzero.bravedns.util.Utilities.removeBeginningTrailingCommas

Expand Down Expand Up @@ -118,7 +118,7 @@ class AppWiseDomainsAdapter(

private fun openBottomSheet(appConn: AppConnection) {
if (context !is AppCompatActivity) {
Log.w(Logger.LOG_TAG_UI, "Error opening the app conn bottom sheet")
Logger.w(LOG_TAG_UI, "Error opening the app conn bottom sheet")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*/
package com.celzero.bravedns.adapter

import Logger
import Logger.LOG_TAG_UI
import android.content.Context
import android.content.res.ColorStateList
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -32,7 +33,6 @@ import com.celzero.bravedns.data.AppConnection
import com.celzero.bravedns.databinding.ListItemAppIpDetailsBinding
import com.celzero.bravedns.service.IpRulesManager
import com.celzero.bravedns.ui.bottomsheet.AppIpRulesBottomSheet
import com.celzero.bravedns.util.Logger
import com.celzero.bravedns.util.UIUtils.fetchColor
import com.celzero.bravedns.util.Utilities.removeBeginningTrailingCommas

Expand Down Expand Up @@ -96,7 +96,7 @@ class AppWiseIpsAdapter(val context: Context, val lifecycleOwner: LifecycleOwner

private fun openBottomSheet(appConn: AppConnection) {
if (context !is AppCompatActivity) {
Log.w(Logger.LOG_TAG_UI, "Error opening the app conn bottom sheet")
Logger.w(LOG_TAG_UI, "Error opening the app conn bottom sheet")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ limitations under the License.

package com.celzero.bravedns.adapter

import Logger
import Logger.LOG_TAG_UI
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -41,7 +42,6 @@ import com.celzero.bravedns.service.VpnController
import com.celzero.bravedns.ui.bottomsheet.ConnTrackerBottomSheet
import com.celzero.bravedns.util.Constants.Companion.TIME_FORMAT_1
import com.celzero.bravedns.util.KnownPorts
import com.celzero.bravedns.util.Logger.Companion.LOG_TAG_UI
import com.celzero.bravedns.util.Protocol
import com.celzero.bravedns.util.UIUtils.getDurationInHumanReadableFormat
import com.celzero.bravedns.util.Utilities
Expand Down Expand Up @@ -114,7 +114,7 @@ class ConnectionTrackerAdapter(private val context: Context) :

private fun openBottomSheet(ct: ConnectionTracker) {
if (context !is FragmentActivity) {
Log.w(LOG_TAG_UI, "err opening the connection tracker bottomsheet")
Logger.w(LOG_TAG_UI, "err opening the connection tracker bottomsheet")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
*/
package com.celzero.bravedns.adapter

import android.app.Dialog
import Logger
import Logger.LOG_TAG_UI
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.text.format.DateUtils
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import android.widget.ImageView
import android.widget.Toast
Expand All @@ -46,7 +45,6 @@ import com.celzero.bravedns.service.DomainRulesManager.isWildCardEntry
import com.celzero.bravedns.service.FirewallManager
import com.celzero.bravedns.ui.activity.CustomRulesActivity
import com.celzero.bravedns.util.Constants
import com.celzero.bravedns.util.Logger
import com.celzero.bravedns.util.UIUtils.fetchColor
import com.celzero.bravedns.util.UIUtils.fetchToggleBtnColors
import com.celzero.bravedns.util.Utilities
Expand Down Expand Up @@ -111,7 +109,7 @@ class CustomDomainAdapter(val context: Context, val rule: CustomRulesActivity.RU
} else if (holder is CustomDomainViewHolderWithoutHeader) {
holder.update(customDomain)
} else {
Log.w(Logger.LOG_TAG_UI, "unknown view holder in CustomDomainRulesAdapter")
Logger.w(LOG_TAG_UI, "unknown view holder in CustomDomainRulesAdapter")
return
}
}
Expand Down Expand Up @@ -237,12 +235,18 @@ class CustomDomainAdapter(val context: Context, val rule: CustomRulesActivity.RU
}

private fun showEditDomainDialog(customDomain: CustomDomain) {
val dialog = Dialog(context)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setTitle(context.getString(R.string.cd_dialog_edit_title))
val dBind =
DialogAddCustomDomainBinding.inflate((context as CustomRulesActivity).layoutInflater)
dialog.setContentView(dBind.root)
val builder = MaterialAlertDialogBuilder(context).setView(dBind.root)
val lp = WindowManager.LayoutParams()
val dialog = builder.create()
dialog.show()
lp.copyFrom(dialog.window?.attributes)
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT

dialog.setCancelable(true)
dialog.window?.attributes = lp

var selectedType: DomainRulesManager.DomainType =
DomainRulesManager.DomainType.getType(customDomain.type)
Expand Down Expand Up @@ -296,14 +300,6 @@ class CustomDomainAdapter(val context: Context, val rule: CustomRulesActivity.RU
}
}

val lp = WindowManager.LayoutParams()
lp.copyFrom(dialog.window?.attributes)
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
dialog.show()
dialog.setCancelable(true)
dialog.window?.attributes = lp

dBind.dacdUrlTitle.text = context.getString(R.string.cd_dialog_title)
dBind.dacdDomainEditText.hint =
context.getString(
Expand Down
18 changes: 7 additions & 11 deletions app/src/full/java/com/celzero/bravedns/adapter/CustomIpAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
*/
package com.celzero.bravedns.adapter

import android.app.Dialog
import Logger
import Logger.LOG_TAG_UI
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.text.format.DateUtils
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import android.widget.ImageView
import android.widget.Toast
Expand All @@ -45,7 +44,6 @@ import com.celzero.bravedns.service.FirewallManager
import com.celzero.bravedns.service.IpRulesManager
import com.celzero.bravedns.ui.activity.CustomRulesActivity
import com.celzero.bravedns.util.Constants.Companion.UID_EVERYBODY
import com.celzero.bravedns.util.Logger
import com.celzero.bravedns.util.UIUtils.fetchColor
import com.celzero.bravedns.util.UIUtils.fetchToggleBtnColors
import com.celzero.bravedns.util.Utilities
Expand Down Expand Up @@ -106,7 +104,7 @@ class CustomIpAdapter(private val context: Context, private val type: CustomRule
holder.update(customIp)
}
else -> {
Log.w(Logger.LOG_TAG_UI, "unknown view holder in CustomDomainRulesAdapter")
Logger.w(LOG_TAG_UI, "unknown view holder in CustomDomainRulesAdapter")
return
}
}
Expand Down Expand Up @@ -720,18 +718,16 @@ class CustomIpAdapter(private val context: Context, private val type: CustomRule
}

private fun showEditIpDialog(customIp: CustomIp) {
val dialog = Dialog(context)
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setTitle(context.getString(R.string.ci_dialog_title))
val dBind =
DialogAddCustomIpBinding.inflate((context as CustomRulesActivity).layoutInflater)
dialog.setContentView(dBind.root)

val builder = MaterialAlertDialogBuilder(context).setView(dBind.root)
val lp = WindowManager.LayoutParams()
val dialog = builder.create()
dialog.show()
lp.copyFrom(dialog.window?.attributes)
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
dialog.show()

dialog.setCancelable(true)
dialog.window?.attributes = lp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ class DnsCryptEndpointAdapter(private val context: Context, private val appConfi
b.dnsCryptEndpointListUrlName.text = endpoint.dnsCryptName
b.dnsCryptEndpointListActionImage.isChecked = endpoint.isSelected

if (endpoint.isSelected) {
if (endpoint.isSelected && VpnController.hasTunnel()) {
keepSelectedStatusUpdated()
} else if (endpoint.isSelected) {
b.dnsCryptEndpointListUrlExplanation.text =
context.getString(R.string.rt_filter_parent_selected)
} else {
b.dnsCryptEndpointListUrlExplanation.text = ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ limitations under the License.

package com.celzero.bravedns.adapter

import Logger
import Logger.LOG_TAG_DNS
import Logger.LOG_TAG_UI
import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand All @@ -36,13 +38,10 @@ import com.bumptech.glide.request.target.CustomViewTarget
import com.bumptech.glide.request.transition.DrawableCrossFadeFactory
import com.bumptech.glide.request.transition.Transition
import com.celzero.bravedns.R
import com.celzero.bravedns.RethinkDnsApplication.Companion.DEBUG
import com.celzero.bravedns.database.DnsLog
import com.celzero.bravedns.databinding.TransactionRowBinding
import com.celzero.bravedns.glide.FavIconDownloader
import com.celzero.bravedns.ui.bottomsheet.DnsBlocklistBottomSheet
import com.celzero.bravedns.util.Logger
import com.celzero.bravedns.util.Logger.Companion.LOG_TAG_DNS_LOG
import com.celzero.bravedns.util.UIUtils.fetchColor
import com.google.gson.Gson

Expand Down Expand Up @@ -157,8 +156,8 @@ class DnsQueryAdapter(val context: Context, val loadFavIcon: Boolean) :

private fun openBottomSheet(dnsLog: DnsLog) {
if (context !is FragmentActivity) {
Log.w(
Logger.LOG_TAG_UI,
Logger.w(
LOG_TAG_UI,
"Can not open bottom sheet. Context is not attached to activity"
)
return
Expand Down Expand Up @@ -212,7 +211,7 @@ class DnsQueryAdapter(val context: Context, val loadFavIcon: Boolean) :
}
)
} catch (e: Exception) {
if (DEBUG) Log.d(LOG_TAG_DNS_LOG, "Error loading icon, load flag instead")
Logger.d(LOG_TAG_DNS, "Error loading icon, load flag instead")
displayDuckduckgoFavIcon(duckduckGoUrl, duckduckgoDomainURL)
}
}
Expand Down Expand Up @@ -259,7 +258,7 @@ class DnsQueryAdapter(val context: Context, val loadFavIcon: Boolean) :
}
)
} catch (e: Exception) {
if (DEBUG) Log.d(LOG_TAG_DNS_LOG, "Error loading icon, load flag instead")
Logger.d(LOG_TAG_DNS, "Error loading icon, load flag instead")
showFlag()
hideFavIcon()
}
Expand Down
Loading

0 comments on commit 66aa105

Please sign in to comment.