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
860b08d9
Commit
860b08d9
authored
Feb 12, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add version code to downloaded upgrades
parent
691dc1d4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
16 deletions
+14
-16
ManagerUpdate.java
...in/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java
+1
-1
Const.java
src/main/java/com/topjohnwu/magisk/utils/Const.java
+1
-1
ShowUI.java
src/main/java/com/topjohnwu/magisk/utils/ShowUI.java
+10
-11
Utils.java
src/main/java/com/topjohnwu/magisk/utils/Utils.java
+2
-3
No files found.
src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java
View file @
860b08d9
...
...
@@ -40,7 +40,7 @@ public class ManagerUpdate extends BroadcastReceiver {
}
},
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_LINK
),
Utils
.
fmt
(
"MagiskManager-v%s.apk"
,
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_VERSION
)
)
intent
.
getStringExtra
(
Const
.
Key
.
INTENT_SET_FILENAME
)
);
}
}
src/main/java/com/topjohnwu/magisk/utils/Const.java
View file @
860b08d9
...
...
@@ -113,7 +113,7 @@ public class Const {
// intents
public
static
final
String
OPEN_SECTION
=
"section"
;
public
static
final
String
INTENT_SET_
VERSION
=
"version
"
;
public
static
final
String
INTENT_SET_
FILENAME
=
"filename
"
;
public
static
final
String
INTENT_SET_LINK
=
"link"
;
public
static
final
String
INTENT_PERM
=
"perm_dialog"
;
public
static
final
String
FLASH_ACTION
=
"action"
;
...
...
src/main/java/com/topjohnwu/magisk/utils/ShowUI.java
View file @
860b08d9
...
...
@@ -59,10 +59,12 @@ public class ShowUI {
public
static
void
managerUpdateNotification
()
{
MagiskManager
mm
=
MagiskManager
.
get
();
String
filename
=
Utils
.
fmt
(
"MagiskManager-v%s(%d).apk"
,
mm
.
remoteManagerVersionString
,
mm
.
remoteManagerVersionCode
);
Intent
intent
=
new
Intent
(
mm
,
ManagerUpdate
.
class
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_LINK
,
mm
.
managerLink
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_
VERSION
,
mm
.
remoteManagerVersionString
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_
FILENAME
,
filename
);
PendingIntent
pendingIntent
=
PendingIntent
.
getBroadcast
(
mm
,
Const
.
ID
.
APK_UPDATE_NOTIFICATION_ID
,
intent
,
PendingIntent
.
FLAG_UPDATE_CURRENT
);
...
...
@@ -100,7 +102,8 @@ public class ShowUI {
public
static
void
magiskInstallDialog
(
Activity
activity
)
{
MagiskManager
mm
=
Utils
.
getMagiskManager
(
activity
);
String
filename
=
Utils
.
fmt
(
"Magisk-v%s.zip"
,
mm
.
remoteMagiskVersionString
);
String
filename
=
Utils
.
fmt
(
"Magisk-v%s(%d).zip"
,
mm
.
remoteMagiskVersionString
,
mm
.
remoteMagiskVersionCode
);
new
AlertDialogBuilder
(
activity
)
.
setTitle
(
mm
.
getString
(
R
.
string
.
repo_install_title
,
mm
.
getString
(
R
.
string
.
magisk
)))
.
setMessage
(
mm
.
getString
(
R
.
string
.
repo_install_msg
,
filename
))
...
...
@@ -206,12 +209,7 @@ public class ShowUI {
};
default
:
}
Utils
.
dlAndReceive
(
activity
,
receiver
,
mm
.
magiskLink
,
filename
);
Utils
.
dlAndReceive
(
activity
,
receiver
,
mm
.
magiskLink
,
filename
);
}
).
show
();
})
...
...
@@ -228,16 +226,17 @@ public class ShowUI {
public
static
void
managerInstallDialog
(
Activity
activity
)
{
MagiskManager
mm
=
Utils
.
getMagiskManager
(
activity
);
String
filename
=
Utils
.
fmt
(
"MagiskManager-v%s(%d).apk"
,
mm
.
remoteManagerVersionString
,
mm
.
remoteManagerVersionCode
);
new
AlertDialogBuilder
(
activity
)
.
setTitle
(
mm
.
getString
(
R
.
string
.
repo_install_title
,
mm
.
getString
(
R
.
string
.
app_name
)))
.
setMessage
(
mm
.
getString
(
R
.
string
.
repo_install_msg
,
Utils
.
fmt
(
"MagiskManager-v%s.apk"
,
mm
.
remoteManagerVersionString
)))
.
setMessage
(
mm
.
getString
(
R
.
string
.
repo_install_msg
,
filename
))
.
setCancelable
(
true
)
.
setPositiveButton
(
R
.
string
.
install
,
(
d
,
i
)
->
{
Utils
.
runWithPermission
(
activity
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
()
->
{
Intent
intent
=
new
Intent
(
mm
,
ManagerUpdate
.
class
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_LINK
,
mm
.
managerLink
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_
VERSION
,
mm
.
remoteManagerVersionString
);
intent
.
putExtra
(
Const
.
Key
.
INTENT_SET_
FILENAME
,
filename
);
mm
.
sendBroadcast
(
intent
);
});
})
...
...
src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
860b08d9
...
...
@@ -82,9 +82,8 @@ public class Utils {
public
static
String
getLegalFilename
(
CharSequence
filename
)
{
return
filename
.
toString
().
replace
(
" "
,
"_"
).
replace
(
"'"
,
""
).
replace
(
"\""
,
""
)
.
replace
(
"$"
,
""
).
replace
(
"`"
,
""
).
replace
(
"("
,
""
).
replace
(
")"
,
""
)
.
replace
(
"#"
,
""
).
replace
(
"@"
,
""
).
replace
(
"*"
,
""
).
replace
(
"/"
,
"_"
)
.
replace
(
"\\"
,
"_"
);
.
replace
(
"$"
,
""
).
replace
(
"`"
,
""
).
replace
(
"*"
,
""
).
replace
(
"/"
,
"_"
)
.
replace
(
"#"
,
""
).
replace
(
"@"
,
""
).
replace
(
"\\"
,
"_"
);
}
public
static
int
getPrefsInt
(
SharedPreferences
prefs
,
String
key
,
int
def
)
{
...
...
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