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
657056e6
Commit
657056e6
authored
Jan 24, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache changelog files
parent
9d5efea6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
Const.kt
app/src/main/java/com/topjohnwu/magisk/core/Const.kt
+4
-0
ManagerInstallDialog.kt
...om/topjohnwu/magisk/events/dialog/ManagerInstallDialog.kt
+13
-1
InstallViewModel.kt
.../java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
+15
-1
fragment_install_md2.xml
app/src/main/res/layout/fragment_install_md2.xml
+1
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Const.kt
View file @
657056e6
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.core
...
@@ -2,6 +2,7 @@ package com.topjohnwu.magisk.core
import
android.os.Build
import
android.os.Build
import
android.os.Process
import
android.os.Process
import
com.topjohnwu.magisk.BuildConfig
import
java.io.File
import
java.io.File
@Suppress
(
"DEPRECATION"
)
@Suppress
(
"DEPRECATION"
)
...
@@ -61,6 +62,9 @@ object Const {
...
@@ -61,6 +62,9 @@ object Const {
const
val
PATREON_URL
=
"https://www.patreon.com/topjohnwu"
const
val
PATREON_URL
=
"https://www.patreon.com/topjohnwu"
const
val
SOURCE_CODE_URL
=
"https://github.com/topjohnwu/Magisk"
const
val
SOURCE_CODE_URL
=
"https://github.com/topjohnwu/Magisk"
val
CHANGELOG_URL
=
if
(
Version
.
isCanary
())
Info
.
remote
.
magisk
.
note
else
"https://topjohnwu.github.io/Magisk/releases/${BuildConfig.VERSION_CODE}.md"
const
val
GITHUB_RAW_URL
=
"https://raw.githubusercontent.com/"
const
val
GITHUB_RAW_URL
=
"https://raw.githubusercontent.com/"
const
val
GITHUB_API_URL
=
"https://api.github.com/"
const
val
GITHUB_API_URL
=
"https://api.github.com/"
const
val
GITHUB_PAGE_URL
=
"https://topjohnwu.github.io/magisk_files/"
const
val
GITHUB_PAGE_URL
=
"https://topjohnwu.github.io/magisk_files/"
...
...
app/src/main/java/com/topjohnwu/magisk/events/dialog/ManagerInstallDialog.kt
View file @
657056e6
package
com.topjohnwu.magisk.events.dialog
package
com.topjohnwu.magisk.events.dialog
import
android.content.Context
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.core.download.Subject
import
com.topjohnwu.magisk.core.download.Subject
import
com.topjohnwu.magisk.data.repository.NetworkService
import
com.topjohnwu.magisk.data.repository.NetworkService
import
com.topjohnwu.magisk.view.MagiskDialog
import
com.topjohnwu.magisk.view.MagiskDialog
import
org.koin.core.get
import
org.koin.core.inject
import
org.koin.core.inject
import
java.io.File
class
ManagerInstallDialog
:
MarkDownDialog
()
{
class
ManagerInstallDialog
:
MarkDownDialog
()
{
private
val
svc
:
NetworkService
by
inject
()
private
val
svc
:
NetworkService
by
inject
()
override
suspend
fun
getMarkdownText
()
=
svc
.
fetchString
(
Info
.
remote
.
magisk
.
note
)
override
suspend
fun
getMarkdownText
():
String
{
val
text
=
svc
.
fetchString
(
Info
.
remote
.
magisk
.
note
)
// Cache the changelog
val
context
=
get
<
Context
>()
context
.
cacheDir
.
listFiles
{
_
,
name
->
name
.
endsWith
(
".md"
)
}.
orEmpty
().
forEach
{
it
.
delete
()
}
File
(
context
.
cacheDir
,
"${Info.remote.magisk.versionCode}.md"
).
writeText
(
text
)
return
text
}
override
fun
build
(
dialog
:
MagiskDialog
)
{
override
fun
build
(
dialog
:
MagiskDialog
)
{
super
.
build
(
dialog
)
super
.
build
(
dialog
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
View file @
657056e6
package
com.topjohnwu.magisk.ui.install
package
com.topjohnwu.magisk.ui.install
import
android.app.Activity
import
android.app.Activity
import
android.content.Context
import
android.net.Uri
import
android.net.Uri
import
androidx.databinding.Bindable
import
androidx.databinding.Bindable
import
androidx.lifecycle.viewModelScope
import
androidx.lifecycle.viewModelScope
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.arch.BaseViewModel
import
com.topjohnwu.magisk.arch.BaseViewModel
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.data.repository.NetworkService
import
com.topjohnwu.magisk.data.repository.NetworkService
import
com.topjohnwu.magisk.events.MagiskInstallFileEvent
import
com.topjohnwu.magisk.events.MagiskInstallFileEvent
...
@@ -15,7 +18,9 @@ import com.topjohnwu.magisk.ui.flash.FlashFragment
...
@@ -15,7 +18,9 @@ import com.topjohnwu.magisk.ui.flash.FlashFragment
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.magisk.utils.set
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
org.koin.core.get
import
timber.log.Timber
import
timber.log.Timber
import
java.io.File
import
java.io.IOException
import
java.io.IOException
class
InstallViewModel
(
class
InstallViewModel
(
...
@@ -60,7 +65,16 @@ class InstallViewModel(
...
@@ -60,7 +65,16 @@ class InstallViewModel(
init
{
init
{
viewModelScope
.
launch
{
viewModelScope
.
launch
{
try
{
try
{
notes
=
svc
.
fetchString
(
Info
.
remote
.
magisk
.
note
)
val
context
=
get
<
Context
>()
File
(
context
.
cacheDir
,
"${BuildConfig.VERSION_CODE}.md"
).
run
{
notes
=
if
(
exists
())
readText
()
else
{
val
text
=
svc
.
fetchString
(
Const
.
Url
.
CHANGELOG_URL
)
writeText
(
text
)
text
}
}
}
catch
(
e
:
IOException
)
{
}
catch
(
e
:
IOException
)
{
Timber
.
e
(
e
)
Timber
.
e
(
e
)
}
}
...
...
app/src/main/res/layout/fragment_install_md2.xml
View file @
657056e6
...
@@ -214,6 +214,7 @@
...
@@ -214,6 +214,7 @@
<com.google.android.material.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
style=
"@style/WidgetFoundation.Card"
style=
"@style/WidgetFoundation.Card"
gone=
"@{viewModel.notes.empty}"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/l1"
android:layout_marginTop=
"@dimen/l1"
...
...
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