Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
e82bc1b7
Commit
e82bc1b7
authored
Nov 21, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issues after merge
parent
4f0e1c6c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
23 additions
and
137 deletions
+23
-137
RepoDao.kt
...c/main/java/com/topjohnwu/magisk/data/database/RepoDao.kt
+2
-0
RepoDatabase.kt
...n/java/com/topjohnwu/magisk/data/database/RepoDatabase.kt
+0
-14
RxJava.kt
app/src/main/java/com/topjohnwu/magisk/extensions/RxJava.kt
+1
-1
LogRvItem.kt
...a/com/topjohnwu/magisk/model/entity/recycler/LogRvItem.kt
+2
-2
InstallExternalModuleEvent.kt
...pjohnwu/magisk/model/events/InstallExternalModuleEvent.kt
+1
-1
ViewEvents.kt
...main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt
+3
-2
BiometricDialog.kt
...m/topjohnwu/magisk/model/events/dialog/BiometricDialog.kt
+6
-22
FingerprintDialog.kt
...topjohnwu/magisk/model/events/dialog/FingerprintDialog.kt
+0
-82
Navigation.kt
.../java/com/topjohnwu/magisk/model/navigation/Navigation.kt
+4
-6
HideViewModel.kt
.../java/com/topjohnwu/magisk/redesign/hide/HideViewModel.kt
+0
-3
LogViewModel.kt
...in/java/com/topjohnwu/magisk/redesign/log/LogViewModel.kt
+1
-1
SuperuserViewModel.kt
...topjohnwu/magisk/redesign/superuser/SuperuserViewModel.kt
+3
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/data/database/RepoDao.kt
View file @
e82bc1b7
...
@@ -8,6 +8,8 @@ import com.topjohnwu.magisk.model.entity.module.Repo
...
@@ -8,6 +8,8 @@ import com.topjohnwu.magisk.model.entity.module.Repo
abstract
class
RepoDatabase
:
RoomDatabase
()
{
abstract
class
RepoDatabase
:
RoomDatabase
()
{
abstract
fun
repoDao
()
:
RepoDao
abstract
fun
repoDao
()
:
RepoDao
abstract
fun
repoByUpdatedDao
():
RepoByUpdatedDao
abstract
fun
repoByNameDao
():
RepoByNameDao
}
}
@Dao
@Dao
...
...
app/src/main/java/com/topjohnwu/magisk/data/database/RepoDatabase.kt
deleted
100644 → 0
View file @
4f0e1c6c
package
com.topjohnwu.magisk.data.database
import
androidx.room.Database
import
androidx.room.RoomDatabase
import
com.topjohnwu.magisk.model.entity.module.Repo
@Database
(
version
=
6
,
entities
=
[
Repo
::
class
,
RepoEtag
::
class
])
abstract
class
RepoDatabase
:
RoomDatabase
()
{
abstract
fun
repoDao
():
RepoDao
abstract
fun
repoByUpdatedDao
():
RepoByUpdatedDao
abstract
fun
repoByNameDao
():
RepoByNameDao
}
app/src/main/java/com/topjohnwu/magisk/extensions/RxJava.kt
View file @
e82bc1b7
...
@@ -54,7 +54,7 @@ fun <T> Single<T>.subscribeK(
...
@@ -54,7 +54,7 @@ fun <T> Single<T>.subscribeK(
onError
:
OnErrorListener
=
{
it
.
printStackTrace
()
},
onError
:
OnErrorListener
=
{
it
.
printStackTrace
()
},
onNext
:
OnSuccessListener
<
T
>
=
{}
onNext
:
OnSuccessListener
<
T
>
=
{}
)
=
applySchedulers
()
)
=
applySchedulers
()
.
subscribe
(
on
Success
,
onError
)
.
subscribe
(
on
Next
,
onError
)
fun
<
T
>
Maybe
<
T
>.
subscribeK
(
fun
<
T
>
Maybe
<
T
>.
subscribeK
(
onError
:
OnErrorListener
=
{
it
.
printStackTrace
()
},
onError
:
OnErrorListener
=
{
it
.
printStackTrace
()
},
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/LogRvItem.kt
View file @
e82bc1b7
...
@@ -81,7 +81,7 @@ class LogItem(val item: MagiskLog) : ObservableItem<LogItem>() {
...
@@ -81,7 +81,7 @@ class LogItem(val item: MagiskLog) : ObservableItem<LogItem>() {
override
val
layoutRes
=
R
.
layout
.
item_log_access_md2
override
val
layoutRes
=
R
.
layout
.
item_log_access_md2
val
date
=
item
.
date
.
time
.
toTime
(
timeDateFormat
)
val
date
=
item
.
time
.
toTime
(
timeDateFormat
)
var
isTop
=
false
var
isTop
=
false
@Bindable
get
@Bindable
get
set
(
value
)
{
set
(
value
)
{
...
@@ -103,7 +103,7 @@ class LogItem(val item: MagiskLog) : ObservableItem<LogItem>() {
...
@@ -103,7 +103,7 @@ class LogItem(val item: MagiskLog) : ObservableItem<LogItem>() {
item
.
packageName
==
other
.
item
.
packageName
&&
item
.
packageName
==
other
.
item
.
packageName
&&
item
.
command
==
other
.
item
.
command
&&
item
.
command
==
other
.
item
.
command
&&
item
.
action
==
other
.
item
.
action
&&
item
.
action
==
other
.
item
.
action
&&
item
.
date
==
other
.
item
.
dat
e
&&
item
.
time
==
other
.
item
.
tim
e
&&
isTop
==
other
.
isTop
&&
isTop
==
other
.
isTop
&&
isBottom
==
other
.
isBottom
isBottom
==
other
.
isBottom
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/events/InstallExternalModuleEvent.kt
View file @
e82bc1b7
...
@@ -27,7 +27,7 @@ class InstallExternalModuleEvent : ViewEvent(), ActivityExecutor {
...
@@ -27,7 +27,7 @@ class InstallExternalModuleEvent : ViewEvent(), ActivityExecutor {
fun
onActivityResult
(
context
:
Context
,
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
fun
onActivityResult
(
context
:
Context
,
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
if
(
requestCode
==
Const
.
ID
.
FETCH_ZIP
&&
resultCode
==
Activity
.
RESULT_OK
&&
data
!=
null
)
{
if
(
requestCode
==
Const
.
ID
.
FETCH_ZIP
&&
resultCode
==
Activity
.
RESULT_OK
&&
data
!=
null
)
{
// Get the URI of the selected file
// Get the URI of the selected file
val
intent
=
context
.
intent
(
FlashActivity
::
class
.
java
)
val
intent
=
context
.
intent
<
FlashActivity
>(
)
intent
.
setData
(
data
.
data
).
putExtra
(
Const
.
Key
.
FLASH_ACTION
,
Const
.
Value
.
FLASH_ZIP
)
intent
.
setData
(
data
.
data
).
putExtra
(
Const
.
Key
.
FLASH_ACTION
,
Const
.
Value
.
FLASH_ZIP
)
context
.
startActivity
(
intent
)
context
.
startActivity
(
intent
)
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/model/events/ViewEvents.kt
View file @
e82bc1b7
package
com.topjohnwu.magisk.model.events
package
com.topjohnwu.magisk.model.events
import
android.app.Activity
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
...
@@ -10,11 +11,11 @@ import com.karumi.dexter.listener.PermissionRequest
...
@@ -10,11 +11,11 @@ import com.karumi.dexter.listener.PermissionRequest
import
com.karumi.dexter.listener.multi.MultiplePermissionsListener
import
com.karumi.dexter.listener.multi.MultiplePermissionsListener
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.Const
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.base.BaseActivity
import
com.topjohnwu.magisk.data.repository.MagiskRepository
import
com.topjohnwu.magisk.data.repository.MagiskRepository
import
com.topjohnwu.magisk.extensions.DynamicClassLoader
import
com.topjohnwu.magisk.extensions.DynamicClassLoader
import
com.topjohnwu.magisk.extensions.subscribeK
import
com.topjohnwu.magisk.extensions.subscribeK
import
com.topjohnwu.magisk.extensions.writeTo
import
com.topjohnwu.magisk.extensions.writeTo
import
com.topjohnwu.magisk.base.BaseActivity
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.model.entity.module.Repo
import
com.topjohnwu.magisk.model.permissions.PermissionRequestBuilder
import
com.topjohnwu.magisk.model.permissions.PermissionRequestBuilder
import
com.topjohnwu.magisk.utils.RxBus
import
com.topjohnwu.magisk.utils.RxBus
...
@@ -136,7 +137,7 @@ class UpdateSafetyNetEvent : ViewEvent(), ContextExecutor, KoinComponent, Safety
...
@@ -136,7 +137,7 @@ class UpdateSafetyNetEvent : ViewEvent(), ContextExecutor, KoinComponent, Safety
}
}
class
ViewActionEvent
(
val
action
:
BaseActivity
<*,
*>.()
->
Unit
)
:
ViewEvent
(),
ActivityExecutor
{
class
ViewActionEvent
(
val
action
:
BaseActivity
<*,
*>.()
->
Unit
)
:
ViewEvent
(),
ActivityExecutor
{
override
fun
invoke
(
activity
:
AppCompatActivity
)
=
activity
.
run
(
action
)
override
fun
invoke
(
activity
:
AppCompatActivity
)
=
(
activity
as
BaseActivity
<*,
*>)
.
run
(
action
)
}
}
class
OpenFilePickerEvent
:
ViewEvent
()
class
OpenFilePickerEvent
:
ViewEvent
()
...
...
app/src/main/java/com/topjohnwu/magisk/model/events/dialog/BiometricDialog.kt
View file @
e82bc1b7
package
com.topjohnwu.magisk.model.events.dialog
package
com.topjohnwu.magisk.model.events.dialog
import
android.os.Handler
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.biometric.BiometricPrompt
import
com.topjohnwu.magisk.model.events.ActivityExecutor
import
com.topjohnwu.magisk.model.events.ActivityExecutor
import
com.topjohnwu.magisk.model.events.ViewEvent
import
com.topjohnwu.magisk.model.events.ViewEvent
import
com.topjohnwu.magisk.utils.BiometricHelper
class
BiometricDialog
(
class
BiometricDialog
(
builder
:
Builder
.()
->
Unit
builder
:
Builder
.()
->
Unit
...
@@ -18,26 +17,11 @@ class BiometricDialog(
...
@@ -18,26 +17,11 @@ class BiometricDialog(
}
}
override
fun
invoke
(
activity
:
AppCompatActivity
)
{
override
fun
invoke
(
activity
:
AppCompatActivity
)
{
val
handler
=
Handler
()
BiometricHelper
.
authenticate
(
val
prompt
=
BiometricPrompt
.
PromptInfo
.
Builder
()
activity
,
.
setNegativeButtonText
(
activity
.
getString
(
android
.
R
.
string
.
cancel
))
onError
=
listenerOnFailure
,
.
build
()
onSuccess
=
listenerOnSuccess
)
val
callback
=
object
:
BiometricPrompt
.
AuthenticationCallback
()
{
override
fun
onAuthenticationError
(
errorCode
:
Int
,
errString
:
CharSequence
)
{
listenerOnFailure
()
}
override
fun
onAuthenticationSucceeded
(
result
:
BiometricPrompt
.
AuthenticationResult
)
{
listenerOnSuccess
()
}
override
fun
onAuthenticationFailed
()
{
listenerOnFailure
()
}
}
BiometricPrompt
(
activity
,
{
handler
.
post
(
it
)
},
callback
)
.
authenticate
(
prompt
/*launch with no crypto for now*/
)
}
}
inner
class
Builder
internal
constructor
()
{
inner
class
Builder
internal
constructor
()
{
...
...
app/src/main/java/com/topjohnwu/magisk/model/events/dialog/FingerprintDialog.kt
deleted
100644 → 0
View file @
4f0e1c6c
package
com.topjohnwu.magisk.model.events.dialog
import
android.hardware.fingerprint.FingerprintManager
import
android.widget.Toast
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.utils.FingerprintHelper
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.view.MagiskDialog
import
timber.log.Timber
@Deprecated
(
"Use Biometrics instead"
,
ReplaceWith
(
"BiometricDialog"
,
imports
=
[
"com.topjohnwu.magisk.model.events.dialog.BiometricDialog"
]
)
)
class
FingerprintDialog
(
builder
:
Builder
.()
->
Unit
)
:
DialogEvent
()
{
private
val
callbacks
=
Builder
().
apply
(
builder
)
private
var
helper
:
Helper
?
=
null
get
()
{
if
(
field
==
null
)
{
runCatching
{
field
=
Helper
()
}.
onFailure
{
Timber
.
e
(
it
)
}
}
return
field
}
override
fun
build
(
dialog
:
MagiskDialog
)
{
dialog
.
applyIcon
(
R
.
drawable
.
ic_fingerprint
)
.
applyTitle
(
R
.
string
.
auth_fingerprint
)
.
cancellable
(
false
)
//possible fix for devices that have flawed under-screen sensor implementation
.
applyButton
(
MagiskDialog
.
ButtonType
.
POSITIVE
)
{
titleRes
=
android
.
R
.
string
.
cancel
onClick
{
callbacks
.
listenerOnFailure
()
helper
?.
cancel
()
}
}
.
onShow
{
helper
?.
authenticate
()
?:
it
.
let
{
callbacks
.
listenerOnFailure
()
Utils
.
toast
(
R
.
string
.
auth_fail
,
Toast
.
LENGTH_SHORT
)
it
.
dismiss
()
}
}
}
inner
class
Builder
internal
constructor
()
{
internal
var
listenerOnFailure
:
GenericDialogListener
=
{}
internal
var
listenerOnSuccess
:
GenericDialogListener
=
{}
fun
onFailure
(
listener
:
GenericDialogListener
)
{
listenerOnFailure
=
listener
}
fun
onSuccess
(
listener
:
GenericDialogListener
)
{
listenerOnSuccess
=
listener
}
}
private
inner
class
Helper
@Throws
(
Exception
::
class
)
constructor
()
:
FingerprintHelper
()
{
override
fun
onAuthenticationError
(
errorCode
:
Int
,
errString
:
CharSequence
)
{
dialog
.
applyMessage
(
errString
)
}
override
fun
onAuthenticationHelp
(
helpCode
:
Int
,
helpString
:
CharSequence
)
{
dialog
.
applyMessage
(
helpString
)
}
override
fun
onAuthenticationFailed
()
{
dialog
.
applyMessage
(
R
.
string
.
auth_fail
)
}
override
fun
onAuthenticationSucceeded
(
result
:
FingerprintManager
.
AuthenticationResult
)
{
callbacks
.
listenerOnSuccess
()
dialog
.
dismiss
()
}
}
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/model/navigation/Navigation.kt
View file @
e82bc1b7
...
@@ -111,12 +111,10 @@ object Navigation {
...
@@ -111,12 +111,10 @@ object Navigation {
// redesign starts here
// redesign starts here
fun
start
(
launchIntent
:
Intent
,
context
:
Context
)
{
fun
start
(
launchIntent
:
Intent
,
context
:
Context
)
{
val
destination
=
when
{
when
{
Config
.
redesign
->
RedesignActivity
::
class
.
java
Config
.
redesign
->
context
.
intent
<
RedesignActivity
>()
else
->
MainActivity
::
class
.
java
else
->
context
.
intent
<
MainActivity
>()
}
}.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
launchIntent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
context
.
intent
(
destination
)
.
putExtra
(
Const
.
Key
.
OPEN_SECTION
,
launchIntent
.
getStringExtra
(
Const
.
Key
.
OPEN_SECTION
))
.
putExtra
(
.
putExtra
(
Const
.
Key
.
OPEN_SETTINGS
,
Const
.
Key
.
OPEN_SETTINGS
,
launchIntent
.
action
==
ACTION_APPLICATION_PREFERENCES
launchIntent
.
action
==
ACTION_APPLICATION_PREFERENCES
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/hide/HideViewModel.kt
View file @
e82bc1b7
...
@@ -114,9 +114,6 @@ class HideViewModel(
...
@@ -114,9 +114,6 @@ class HideViewModel(
fun
toggleItem
(
item
:
HideProcessItem
)
=
magiskRepo
fun
toggleItem
(
item
:
HideProcessItem
)
=
magiskRepo
.
toggleHide
(
item
.
isHidden
.
value
,
item
.
item
.
packageName
,
item
.
item
.
name
)
.
toggleHide
(
item
.
isHidden
.
value
,
item
.
item
.
packageName
,
item
.
item
.
name
)
// might wanna reorder the list to display the item at the top
.
subscribeK
()
.
add
()
fun
toggle
(
item
:
KObservableField
<
Boolean
>)
=
item
.
toggle
()
fun
toggle
(
item
:
KObservableField
<
Boolean
>)
=
item
.
toggle
()
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/log/LogViewModel.kt
View file @
e82bc1b7
...
@@ -58,6 +58,7 @@ class LogViewModel(
...
@@ -58,6 +58,7 @@ class LogViewModel(
.
ignoreElement
()
.
ignoreElement
()
val
console
=
repo
.
fetchMagiskLogs
()
val
console
=
repo
.
fetchMagiskLogs
()
.
toList
()
.
map
{
it
.
map
{
ConsoleRvItem
(
it
)
}
}
.
map
{
it
.
map
{
ConsoleRvItem
(
it
)
}
}
.
observeOn
(
Schedulers
.
computation
())
.
observeOn
(
Schedulers
.
computation
())
.
map
{
it
to
itemsConsole
.
calculateDiff
(
it
)
}
.
map
{
it
to
itemsConsole
.
calculateDiff
(
it
)
}
...
@@ -90,7 +91,6 @@ class LogViewModel(
...
@@ -90,7 +91,6 @@ class LogViewModel(
}
}
fun
clearMagiskLog
()
=
repo
.
clearMagiskLogs
()
fun
clearMagiskLog
()
=
repo
.
clearMagiskLogs
()
.
ignoreElement
()
.
subscribeK
{
.
subscribeK
{
SnackbarEvent
(
R
.
string
.
logs_cleared
).
publish
()
SnackbarEvent
(
R
.
string
.
logs_cleared
).
publish
()
requestRefresh
()
requestRefresh
()
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/superuser/SuperuserViewModel.kt
View file @
e82bc1b7
...
@@ -18,8 +18,8 @@ import com.topjohnwu.magisk.model.events.dialog.SuperuserRevokeDialog
...
@@ -18,8 +18,8 @@ import com.topjohnwu.magisk.model.events.dialog.SuperuserRevokeDialog
import
com.topjohnwu.magisk.model.navigation.Navigation
import
com.topjohnwu.magisk.model.navigation.Navigation
import
com.topjohnwu.magisk.redesign.compat.CompatViewModel
import
com.topjohnwu.magisk.redesign.compat.CompatViewModel
import
com.topjohnwu.magisk.redesign.home.itemBindingOf
import
com.topjohnwu.magisk.redesign.home.itemBindingOf
import
com.topjohnwu.magisk.utils.BiometricHelper
import
com.topjohnwu.magisk.utils.DiffObservableList
import
com.topjohnwu.magisk.utils.DiffObservableList
import
com.topjohnwu.magisk.utils.FingerprintHelper
import
com.topjohnwu.magisk.utils.RxBus
import
com.topjohnwu.magisk.utils.RxBus
import
com.topjohnwu.magisk.utils.currentLocale
import
com.topjohnwu.magisk.utils.currentLocale
import
io.reactivex.Single
import
io.reactivex.Single
...
@@ -71,7 +71,7 @@ class SuperuserViewModel(
...
@@ -71,7 +71,7 @@ class SuperuserViewModel(
.
subscribeK
{
items
.
removeAll
{
it
.
itemSameAs
(
item
)
}
}
.
subscribeK
{
items
.
removeAll
{
it
.
itemSameAs
(
item
)
}
}
.
add
()
.
add
()
if
(
FingerprintHelper
.
useFingerprint
()
)
{
if
(
BiometricHelper
.
isEnabled
)
{
BiometricDialog
{
BiometricDialog
{
onSuccess
{
updateState
()
}
onSuccess
{
updateState
()
}
}.
publish
()
}.
publish
()
...
@@ -115,7 +115,7 @@ class SuperuserViewModel(
...
@@ -115,7 +115,7 @@ class SuperuserViewModel(
.
add
()
.
add
()
}
}
if
(
FingerprintHelper
.
useFingerprint
()
)
{
if
(
BiometricHelper
.
isEnabled
)
{
BiometricDialog
{
BiometricDialog
{
onSuccess
{
updateState
()
}
onSuccess
{
updateState
()
}
onFailure
{
item
.
isEnabled
.
toggle
()
}
onFailure
{
item
.
isEnabled
.
toggle
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment