Compare commits

...

545 Commits

Author SHA1 Message Date
Benjamin Halko
6ef1b072e8 build: Bump version to v1.17.2 2023-12-11 18:27:19 -08:00
Benjamin
ca9ef544ce chore: merge dev to main (#1545) 2023-12-11 18:23:08 -08:00
oSumAtrIX
7831a3438d fix: Include new patches that are used by default 2023-12-12 02:32:57 +01:00
oSumAtrIX
1fad90441c perf: Use hashset for fast comparison 2023-12-12 02:32:45 +01:00
validcube
7f26c5bd45 revert: "feat: improve predictive back (#1487)"
This reverts commit 06ff36c836.

Signed-off-by: validcube <pun.butrach@gmail.com>
2023-12-11 19:02:13 +07:00
Pun Butrach
637641cf54 feat: output suggested version into patch log (#1557)
Signed-off-by: validcube <pun.butrach@gmail.com>
2023-12-11 11:26:52 +07:00
Pun Butrach
d9a316abbb docs(contributing): update branding 2023-12-09 11:49:19 +07:00
Pun Butrach
093cfa5269 docs(contributing): use correct semantic 2023-12-09 11:48:20 +07:00
Pun Butrach
61a025de4d docs: correct styling issue 2023-12-09 11:47:26 +07:00
Dhruvan Bhalara
7df1ae7ed8 feat: append patch version to the APK name while sharing/exporting (#1547) 2023-12-05 12:58:32 +05:45
Pun Butrach
eb6e75b156 ci: use migrate setup-java to Node 20 (#1542) 2023-12-05 09:43:04 +07:00
validcube
8480b3ac3d chore: update repository's owner name 2023-12-02 17:39:02 +07:00
validcube
6339a31fec build(dart-dependency): bump FlutterToast to v8.2.4 2023-12-02 17:35:35 +07:00
validcube
71b5bb3f8f build(dart-dependency): prefer immutable for dependency using git 2023-12-02 17:33:42 +07:00
Ushie
a9878dbbdf chore: Merge dev to main (#1544) 2023-12-02 03:46:17 +03:00
Ushie
b1fb9dd7d3 build: Bump version to v1.17.1 2023-12-02 03:44:51 +03:00
Dhruvan Bhalara
de51fbd7be fix: Incorrect duplicate filename handling when exporting files (#1541) 2023-12-01 20:31:46 +05:45
Ax333l
c9412a97d0 build(dependency): Bump patcher to 19.1.0 2023-12-01 13:22:38 +01:00
Ushie
63c29bdd75 chore: Merge dev to main (#1529) 2023-11-27 11:06:43 +03:00
Ushie
bace26063d build: Bump version to v1.17.0 2023-11-27 11:05:56 +03:00
Benjamin
7931eb97b9 feat: updated logs (#1526) 2023-11-25 17:06:18 -08:00
aAbed
9df89c7b74 fix: Disable wakelock when patching is canceled (#1514) 2023-11-22 16:21:27 +03:00
aAbed
78978276c4 fix(App Selector): Unable to select APK from storage when asked to (#1513) 2023-11-22 16:20:51 +03:00
Ushie
011eddbbc5 chore: Merge dev to main (#1478) 2023-11-21 17:37:40 +03:00
Ushie
4e9f3fe1dc build: Bump version to v1.16.0 2023-11-21 17:36:24 +03:00
Aditya Arora
9bd48c19ff feat: ability to search query for suggested version (#1151)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-11-21 17:33:21 +03:00
Pun Butrach
c0516c3665 ci(build): Improve pull request build (#1305)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-11-20 14:50:44 +07:00
Pun Butrach
06ff36c836 feat: improve predictive back (#1487)
Signed-off-by: validcube <pun.butrach@gmail.com>
2023-11-20 14:49:39 +07:00
Pun Butrach
98c16eb1dc docs(readme): remove redundant feature information 2023-11-20 07:34:08 +07:00
KAZI MMT
35d80840e5 fix: Remove incorrect punctuation (#1499) 2023-11-19 05:38:34 +01:00
validcube
ad3a778fb9 refactor: apply lint from analyzer 2023-11-12 10:02:40 +05:45
Pun Butrach
d25d1efe9c fix(build): allow profile variant to compile
fix backported from #1305
2023-11-12 10:02:10 +05:45
Pun Butrach
de58dff423 docs: improve readme (#1484) 2023-11-12 10:02:07 +05:45
Pun Butrach
ec26e4d8d1 feat: update color scheme (#1483) 2023-11-12 09:59:55 +05:45
validcube
c24da41505 refactor: replace deprecated command 2023-11-12 09:59:50 +05:45
Pun Butrach
f785185e1c chore: update label for template 2023-11-11 13:19:01 +07:00
aAbed
5ed3ed9a2d fix: patcher logs hiding behind navigation bar (#1476) 2023-11-11 12:00:21 +07:00
oSumAtrIX
a3adace60e build: Update Gradle to v8.4 2023-11-08 17:22:06 +01:00
oSumAtrIX
3db4de09e2 chore: Remove unnecessary project files 2023-11-08 17:21:02 +01:00
aAbed
70b2ee0a84 feat: Disable selection of un-suggested app version by default (#1471)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-11-08 03:38:54 +01:00
aAbed
e7d82850c9 fix: Log saved patch option values (#1420) 2023-11-07 23:37:59 +01:00
oSumAtrIX
e6a8f4e6dc build: Bump version to v1.15.1 2023-11-04 22:41:48 +01:00
oSumAtrIX
494e268bc5 fix: Use correct method name for string replacement 2023-11-04 22:41:27 +01:00
oSumAtrIX
e1c6f65b7e chore: Merge branch dev to main (#1446) 2023-11-04 22:10:14 +01:00
oSumAtrIX
89075c5588 build: Bump version to v1.15.0 2023-11-04 22:08:20 +01:00
Benjamin
c7fa9b8ce7 chore: upgrade dependencies (#1404) 2023-11-04 22:08:20 +01:00
oSumAtrIX
cb70082d31 docs: Remove unneeded steps to build from source 2023-11-04 22:08:19 +01:00
Mr. X
48b9ac8f5b docs: use correct directory path (#1440) 2023-11-04 22:08:19 +01:00
aAbed
0be568bbbd fix: Hide empty patches category labels (#1439) 2023-11-04 22:08:19 +01:00
aAbed
ba44fa620f build: Bump dependencies to support patch option values (#1431)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-11-04 22:08:19 +01:00
Ushie
dde402afbf chore: merge dev to main (#1437) 2023-10-26 17:22:07 +03:00
Ushie
bbe5142ca9 build: bump version to v1.14.2 2023-10-26 17:21:25 +03:00
aAbed
e74ffac5b0 fix: unable to use custom API (#1435) 2023-10-26 17:20:34 +03:00
Ushie
cfb8980e3a chore: merge dev to main (#1425) 2023-10-25 11:42:54 +03:00
Ushie
e06e1bdcbe build: bump version to v1.14.1 2023-10-25 11:42:19 +03:00
Ushie
d60ced2f61 fix: remove codeblock from log export
Fixes: #1416
2023-10-25 11:40:30 +03:00
aAbed
e68689828e fix: Material You toggle not updating sometimes (#1421) 2023-10-25 11:37:03 +03:00
validcube
ba932758c8 build: bump version to v1.14.0 2023-10-21 23:00:51 +07:00
Pun Butrach
ee43fa6311 chore: merge dev to main (#1399) 2023-10-21 22:58:58 +07:00
Pun Butrach
ad6b164d51 feat: root status in export patch log (#1407)
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-10-21 17:46:51 +07:00
validcube
4a5510acb2 refactor: remove the remaining of semantic release
Removal reason: not maintained
2023-10-21 15:37:23 +07:00
validcube
970dbc4428 refactor(social): use correct github organisation name
the correct name is "ReVanced" not "revanced", we changed for a while now.
2023-10-21 15:33:36 +07:00
validcube
f8f37325eb refactor(social): change Twitter to X 2023-10-21 15:32:13 +07:00
Benjamin
bb999019ef feat: show patch options in error log (#1394) 2023-10-17 13:21:59 +07:00
KobeW50
533b6a155a feat: clarify "Version compatibility check" description (#1397) 2023-10-17 13:20:46 +07:00
KobeW50
4cdc92388c refactor: fix patch log order to be consistent with settings order (#1398) 2023-10-17 13:19:18 +07:00
Pun Butrach
ccc6be1e71 refactor(accessibility): improve patch options (#1369)
Co-authored-by: Palm <palmpasuthorn@gmail.com>
2023-10-16 16:47:59 +07:00
Ushie
b355778a92 chore: merge dev to main (#1388) 2023-10-15 20:19:54 +03:00
Ushie
6a12e8f37a build: bump version to v1.13.1 2023-10-15 20:19:23 +03:00
Ushie
59adb91f5f fix(settings): inverted version compatibility switch 2023-10-15 20:16:58 +03:00
KobeW50
53677e2f39 fix: typo in reset patch selection dialog (#1387) 2023-10-15 20:14:19 +03:00
validcube
1c74f43b22 build: bump version to 1.13.0 2023-10-15 18:22:42 +07:00
Pun Butrach
b4801970e8 chore: merge dev to main (#1384)
ReVanced Manager 1.13.0!!
2023-10-15 18:18:09 +07:00
Pun Butrach
7a3a6b512f docs(building): use new highlight format 2023-10-15 18:04:19 +07:00
Pun Butrach
72ea33b6de fix(patch_selector): correct popup menu style
fix: #1372
2023-10-15 17:46:44 +07:00
Pun Butrach
d97192e0ee refactor(patch_options): disable card tap (#1368) 2023-10-15 16:56:43 +07:00
KobeW50
196d9fe4d2 refactor: reorganize and rename settings (#1307)
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-10-15 16:56:02 +07:00
Benjamin
e960fcc303 feat: add user agent (#1380)
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
2023-10-15 16:51:31 +07:00
Benjamin
f334da95ff feat: Remove full external storage access (#1381) 2023-10-15 16:44:11 +07:00
aAbed
5d5f311e36 fix(settings-view): list items jumping on scroll up (#1375) 2023-10-15 16:17:28 +07:00
aAbed
d577e97758 fix(app-bar): title not hiding completely (#1376) 2023-10-15 16:16:55 +07:00
aAbed
2dc92e26d3 fix(patches-selector): ignore punctuation marks when searching for patch (#1377) 2023-10-14 19:43:18 +07:00
oSumAtrIX
f4994a36a3 chore: Merge branch dev to main (#1366) 2023-10-13 00:22:02 +02:00
oSumAtrIX
7a785a8163 build: Bump version to v1.12.1 2023-10-13 00:14:14 +02:00
oSumAtrIX
6ad0d860c7 fix: Load patches from older versions of ReVanced Manager correctly 2023-10-13 00:12:27 +02:00
oSumAtrIX
38a2fa55df chore: Merge branch dev to main (#1350) 2023-10-12 21:58:29 +02:00
oSumAtrIX
a21b170b52 build: Bump version to v1.12.0 2023-10-12 21:55:06 +02:00
oSumAtrIX
44265b2362 chore: Setup Crowdin configuration file 2023-10-12 18:51:16 +02:00
oSumAtrIX
069193342b docs: use correct alert syntax 2023-10-12 14:25:13 +02:00
oSumAtrIX
54e9a56cda docs: Add options setting 2023-10-12 14:22:20 +02:00
oSumAtrIX
39bc9227dc docs: Improve readability 2023-10-12 14:20:44 +02:00
aAbed
ac636670c3 feat: Add patch options (#1354) 2023-10-12 02:00:39 +02:00
MD Danish Ansari
2abadc73e4 fix: selected patches order (#1345) 2023-10-10 18:54:42 +07:00
KobeW50
377368f6bf docs: reflect the latest changes of ReVanced Manager (#1349) 2023-10-10 01:07:58 +07:00
Sagar
4085c10bfc fix: search with package name (#1344) 2023-10-09 11:22:15 +07:00
oSumAtrIX
657ba11e7e chore: Merge branch dev to main (#1340) 2023-10-07 02:04:26 +02:00
oSumAtrIX
a9ae45fe63 build: Bump version to v1.11.2 2023-10-07 02:01:10 +02:00
oSumAtrIX
61bb39b46f build: Bump dependencies to improve merging integrations speed 2023-10-07 02:01:10 +02:00
Benjamin Halko
2ad106f7d7 fix(export-settings): remove boolean workaround 2023-10-07 02:01:09 +02:00
Benjamin
8fd4fe0e55 feat(patcher): improve logs (#1299)
Co-authored-by: Ushie <ushiekane@gmail.com>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-10-07 02:01:09 +02:00
oSumAtrIX
b1c9aedac3 build: Bump version to v1.11.1 2023-10-05 17:45:56 +02:00
oSumAtrIX
a80415be02 build: Bump dependencies 2023-10-05 17:45:56 +02:00
oSumAtrIX
d9acd0d74b chore: Merge branch dev to main (#1329) 2023-10-05 01:35:08 +02:00
oSumAtrIX
7ae09159ba build: Bump version to v1.11.0 2023-10-05 01:23:48 +02:00
oSumAtrIX
a709abd80c perf: Do not load patches twice (#1328) 2023-10-04 21:58:25 +02:00
Benjamin Halko
cd07f39b69 fix: reset patches after patching 2023-10-04 12:16:56 -07:00
Benjamin Halko
f7c11d07a8 fix(export-settings): export patches as json object 2023-10-04 11:33:13 -07:00
oSumAtrIX
b07439d402 fix: Reload patches 2023-10-04 19:38:34 +02:00
oSumAtrIX
d8eadc2a2d feat: Use simpler wording 2023-10-04 19:01:17 +02:00
oSumAtrIX
3a88d4d3e6 build: Bump dependencies 2023-10-04 18:39:24 +02:00
oSumAtrIX
012110f008 perf: Do not load patches twice 2023-10-04 18:39:24 +02:00
oSumAtrIX
4de274bf62 feat: Export settings migration activity (#1308) 2023-10-01 19:12:31 +02:00
oSumAtrIX
76b89baee3 build: Bump dependencies (#1311) 2023-10-01 19:03:26 +02:00
oSumAtrIX
697ae92031 Apply suggestions from code review [skip ci] 2023-10-01 19:02:49 +02:00
oSumAtrIX
c87f92b346 feat: Adjust install dialog labels 2023-10-01 06:21:03 +02:00
oSumAtrIX
6961bb7fd0 fix: Do not delete cached downloads 2023-10-01 04:48:24 +02:00
oSumAtrIX
6e26130744 chore: Add todo 2023-09-30 22:15:46 +02:00
oSumAtrIX
123a375a27 refactor: Remove unused strings 2023-09-30 22:14:51 +02:00
oSumAtrIX
2b4b3ca0a5 fix: Retrieve app information from patched app 2023-09-30 21:40:03 +02:00
oSumAtrIX
c4a795418f fix: Move installation log to correct place 2023-09-30 21:13:32 +02:00
oSumAtrIX
91837ebade feat: Remove original package name in app info view 2023-09-30 21:07:26 +02:00
oSumAtrIX
0492e910ea fix: Fill the preferred action 2023-09-30 20:11:53 +02:00
oSumAtrIX
36c86e22b1 fix: Load installed apps 2023-09-30 20:03:09 +02:00
oSumAtrIX
6bdc0c7bb2 feat: Simplify label 2023-09-30 19:58:45 +02:00
aAbed
1e8d8f749a fix: do not ask for patches consent before initializing model 2023-09-30 14:57:48 +05:45
oSumAtrIX
2e8e3b0d1e fix: Do not hardcode any predefined packages 2023-09-29 20:12:39 +02:00
oSumAtrIX
15b8613d3c feat: Only log relevant records 2023-09-29 19:40:22 +02:00
oSumAtrIX
8ce266bc94 perf: Reduce amount of network requests 2023-09-29 18:39:07 +02:00
oSumAtrIX
8661d72e45 feat: Simplify label 2023-09-29 17:00:34 +02:00
oSumAtrIX
62505f2543 build: Bump dependencies 2023-09-28 17:36:10 +02:00
Pun Butrach
37986c58ec docs(building): correct path to gradle.properties 2023-09-28 21:45:41 +07:00
Benjamin Halko
2968d96fe9 remove log import 2023-09-27 14:42:11 -07:00
Benjamin Halko
e7c8d0e78c use same fingerprint 2023-09-27 14:36:39 -07:00
Benjamin Halko
83cbb34a5b use revanced fingerprint 2023-09-27 14:27:38 -07:00
Benjamin Halko
7559c7b67e verify fingerprint of calling app 2023-09-27 14:17:29 -07:00
Benjamin Halko
02822f4b38 remove user interaction 2023-09-27 13:47:59 -07:00
Benjamin Halko
96736afb94 make bars transparent 2023-09-27 12:32:19 -07:00
Benjamin Halko
72ae132fcd make export settings activity transparent 2023-09-27 12:21:27 -07:00
Benjamin Halko
2250e1bcab convert Booleans to Ints 2023-09-26 16:46:49 -07:00
Benjamin Halko
d9d5b746c3 Added ExportSettingsActivity 2023-09-26 16:21:46 -07:00
Benjamin Halko
f1ea306291 change booleans to numbers 2023-09-25 14:42:40 -07:00
Benjamin Halko
378d62395a remove newlines from base64 output 2023-09-25 10:15:56 -07:00
Benjamin Halko
99c92069b9 export saved patches and keystore 2023-09-25 08:43:10 -07:00
Benjamin Halko
2a89ef797f feat: share settings 2023-09-24 16:56:25 -07:00
Ushie
5838550188 build: bump version to v1.10.3 2023-09-23 13:10:46 +03:00
Ushie
e0e01ae3ee chore: merge dev to main (#1300) 2023-09-23 13:10:08 +03:00
Benjamin
0983ba8a0f fix: search bar overflow (#1301) 2023-09-23 00:51:25 +03:00
Ushie
0bfa776ce7 fix: npe when loading patch bundle on android 8 2023-09-23 00:24:17 +03:00
Pun Butrach
d2b09936d1 chore: merge dev to main (#1295) 2023-09-22 22:08:13 +07:00
Pun Butrach
68e9f0f7c1 build: bump version 1.10.2
!!
2023-09-22 22:05:31 +07:00
Benjamin
c3d345de80 fix: force disable material you on Android 11 and below (#1293) 2023-09-22 21:05:13 +07:00
Pun Butrach
385c0e246a build: use correct version code
The user won't notice it :shhh: we're fine, continue as normal.
2023-09-21 19:32:10 +07:00
Benjamin Halko
5ead49a5b7 build: bump version to v1.10.1 2023-09-20 20:06:19 -07:00
Benjamin
c0760b1347 chore: merge dev to main (#1289) 2023-09-20 20:04:10 -07:00
Benjamin Halko
e01b323aee fix: make entire theme item clickable 2023-09-20 20:03:47 -07:00
Benjamin Halko
6f4866ef63 fix: default theme not following system (#1288) 2023-09-20 20:03:15 -07:00
Benjamin Halko
1b6d72661c build: bump version to v1.10.0 2023-09-20 17:40:23 -07:00
Benjamin
c59d4aea81 chore: merge dev to main (#1239) 2023-09-20 17:35:01 -07:00
Benjamin
6260a80738 feat(settings - appearance): add system option (#1279)
Closes #1260
2023-09-21 03:25:23 +03:00
Benjamin
e75d3c8273 fix(install-type): update padding and enable radio list scrolling (#1287)
fix(install-type): update padding and enable radio list scrolling
2023-09-20 17:24:37 -07:00
Benjamin Halko
b7acb475e9 fix: update install type dialog padding 2023-09-20 16:57:13 -07:00
Benjamin
42b6bbff7c fix: update youtube link (#1286) 2023-09-21 02:16:55 +03:00
aAbed
4b8542b35b fix: load patches via PatchBundle (#1242) 2023-09-21 01:35:32 +03:00
Julienraptor01
9ad1d6cbfb fix(custom-sources): ignore casing when checking if default repo is being used (#1281) 2023-09-21 00:42:29 +03:00
KobeW50
4cdd9acd73 docs(readme): add documentation and minor fixes (#1264)
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
2023-09-16 17:38:06 +07:00
Benjamin
f4b0a695d6 fix: improve app list loading speed (#1166) 2023-09-15 22:58:15 +07:00
Benjamin
b525ea1ba4 ci: remove analyze workflow (#1262)
Code style is not enforced so analysis is not needed.
2023-09-12 23:40:00 +07:00
Pun Butrach
c1fc2c4766 ci: bump actions/checkout to v4 2023-09-10 14:43:58 +07:00
Ushie
5c733932c7 ci(pr-build): revert "sign apk with keystore (#1231)"
This reverts commit 8bf08ff464, as it fails for PRs originating from forks
2023-09-08 01:14:13 +02:00
Ushie
d1218616ec docs(readme): minor improvements 2023-09-08 01:14:13 +02:00
aAbed
2bf6a03d56 fix: back button closing the app from any page 2023-09-08 01:14:13 +02:00
Pun Butrach
b6ee63c1ea ci(pr-build): sign apk with keystore (#1231) 2023-09-08 01:14:13 +02:00
oSumAtrIX
6d08efdcd7 chore: fix issue template 2023-09-08 01:13:42 +02:00
Ushie
a0a43a5651 build: bump version to v1.9.5 2023-09-08 01:13:42 +02:00
Ushie
3af2f5b032 chore: merge dev to main (#1177) 2023-09-04 04:15:12 +03:00
Ushie
8f54b226b4 refactor(patches-selector): improve universal patches header 2023-09-03 21:14:09 +03:00
Ushie
9f64011b26 fix: npe when patching on android 8 2023-09-03 20:54:42 +03:00
Pun Butrach
c5fc54e721 fix(installer): open the patched app after install (#1233) 2023-09-03 21:48:28 +07:00
Jay Gajjar
fc8a4fc5b6 fix: Don't use 'BuildContext's across async gaps. (#1148) 2023-09-03 01:47:20 +03:00
Benjamin
6f9ab232ae chore: ignore the root .gradle folder (#1160) 2023-09-02 09:29:49 -07:00
aAbed
8cb96f1e45 fix: permissions handling at first launch 2023-08-31 19:34:12 +05:45
Pun Butrach
5733acb77a build(dependency): update patcher to v14.2.2
https://github.com/ReVanced/revanced-patcher/releases/tag/v14.2.2
2023-08-31 20:35:24 +07:00
oSumAtrIX
e49bcb2a69 chore: simplify issue templates (#1165) 2023-08-31 17:36:29 +07:00
Ushie
42e41c399f fix: hide install button on error 2023-08-28 19:05:30 +03:00
Ushie
166a3180d3 build: correct version code 2023-08-28 03:20:15 +03:00
Ushie
3bf4982f23 chore: merge dev to main (#1163) 2023-08-28 02:47:47 +03:00
oSumAtrIX
f4e1cccfac build: bump version to v1.9.4 2023-08-28 01:44:46 +02:00
oSumAtrIX
7911a8f49e fix: properly log messages and progress 2023-08-28 01:44:46 +02:00
oSumAtrIX
64a96fc3ce fix: close before returning 2023-08-28 01:44:46 +02:00
BenjaminHalko
8e2cfbddc5 fix: ignore the root .gradle folder 2023-08-27 14:05:39 -07:00
oSumAtrIX
45fae3f0fd build: bump ReVanced Patcher back to v14.2.1
This reverts the previous regression with the dependency to ReVanced Patcher.
2023-08-27 22:35:03 +02:00
aAbed
e45a7824c1 build: bump version to v1.9.3 2023-08-27 13:27:53 +07:00
aAbed
5d72c48a76 chore: merge dev to main (#1157) 2023-08-27 13:27:01 +07:00
aAbed
d6169c6fa2 fix: broken settings page 2023-08-27 11:55:21 +05:45
Ushie
9df6d52e2d build: bump version to v1.9.2 2023-08-27 05:40:50 +03:00
Ushie
239de8e923 chore: merge dev to main (#1156) 2023-08-27 05:40:13 +03:00
Ushie
7d553a87f3 build: revert patcher to v11.0.4 2023-08-27 05:39:24 +03:00
Ushie
557b42bc56 build: bump version to 1.9.1 2023-08-27 03:58:30 +03:00
Ushie
8423914748 chore: merge dev to main (#1155) 2023-08-27 03:57:57 +03:00
Ushie
07dce23794 build: bump patcher to v14.2.0 2023-08-27 03:55:56 +03:00
Ushie
18fd0552db build: bump version to v1.9.0 2023-08-27 02:23:36 +03:00
Ushie
d537d48f8e chore: merge dev to main (#1125) 2023-08-27 02:21:48 +03:00
Ushie
b456512bbb build: bump patcher to v14.1.0 (#1153)
Co-authored-by: aAbed <aabedhkhan@gmail.com>
2023-08-27 02:21:16 +03:00
Pun Butrach
d9953b1473 fix(installer): use correct elevation level 2023-08-24 19:00:50 +07:00
aAbed
c6ac898390 fix: universal patches not selectable 2023-08-17 18:25:23 +05:45
Pun Butrach
43f98cec43 build: make variant more identifiable
Release variant will use the "ReVanced Manager" app name, Debug will use "ReVanced Manager Debug"
2023-08-15 21:31:34 +07:00
Pun Butrach
63175cdec6 ci(build): create debug variant instead of release 2023-08-15 20:55:11 +07:00
Pun Butrach
6436a1ec61 build: debug apk come with application suffix
Instead of using the same one as Release, app.revanced.manager.flutter - We add .debug to it, yay, co-installation of two variants!
2023-08-15 20:37:43 +07:00
aAbed
c400619338 feat: disable changing patches selection by default (#1132)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-15 16:05:27 +07:00
Ushie
dcd5ba41cf build: add mavenlocal to repositories 2023-08-14 03:40:05 +03:00
Pun Butrach
7525e52fab fix(installer): use correct bg colour for dialog 2023-08-12 15:07:04 +07:00
Pun Butrach
72fd24e624 fix: use i18n translation for installer page 2023-08-12 15:06:17 +07:00
Pun Butrach
11d8f9fd30 refactor: apply changes according to Dart
trailing commas
2023-08-12 14:53:54 +07:00
Pun Butrach
4b0c8cecc8 ci(build): update event trigger
This add ".github/workflows/pr-build.yml" to build on every change to the CI Build to check if there's no error when it got modified.

And also remove "fastlane/**" because that's not related to the ReVanced Manager's code
2023-08-12 13:56:18 +07:00
Dhruvan Bhalara
372ce174c9 fix: overlapping issue in application selection page (#1128) 2023-08-11 19:19:44 +03:00
kitadai31
381daff980 fix: exclude x86 aapt2 binary from release builds (#1126) 2023-08-11 19:19:33 +03:00
Subhamoy Biswas
94acebbebd docs(fixed): replaced some emoji icons, not rendering on chromium based browsers on windows (#1123) 2023-08-11 10:17:46 +07:00
aAbed
f90f6e81ee feat: patch apps without internet (#1114) 2023-08-11 08:11:19 +07:00
Dhruvan Bhalara
97e37f304b refactor: migrate MediaQuery properties to InheritedModel (#1115)
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-08-10 15:25:07 +03:00
Pun Butrach
f5e45ead26 ci(build): don't build on every pull request unrelated to application 2023-08-10 19:14:13 +07:00
Pun Butrach
14f765f4b4 ci(build): don't cache Gradle
Gradle take up so much space in cache that it wouldn't make sense for us to cache it since we are rapidly hitting the cache limit every time.
2023-08-10 19:12:15 +07:00
Pun Butrach
b77d46b2c2 feat(installer): redesign utility options (#1062)
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-08-10 19:02:30 +07:00
Ushie
1442916b20 build: bump version to 1.8.0 2023-08-10 03:01:03 +03:00
Ushie
c6a5f42d23 chore: merge dev to main (#1120) 2023-08-10 03:00:27 +03:00
Ushie
580d50eb8d fix: use right label for auto patch 2023-08-10 00:05:47 +03:00
Ushie
9a66b6e50d fix(root-install): create service and postfs directories if they dont exist (#1116)
Fixes #860
2023-08-09 23:57:09 +03:00
aAbed
acec064cb7 feat(patcher-view): show notice for removed patches that were used previously (#1107) 2023-08-09 22:32:13 +03:00
aAbed
ea05d13a1f fix(patches-selector): New tag showing for old patches (#1113) 2023-08-09 22:31:37 +03:00
Ushie
fd741f2ccf build: bump version to v1.7.0 2023-08-08 03:52:03 +03:00
Ushie
055c52178f chore: merge dev branch to main branch (#1096) 2023-08-08 03:51:05 +03:00
aAbed
722a5859a5 fix: pair integrations and patches updates (#1102) 2023-08-08 03:30:48 +03:00
aAbed
1714c3fa86 feat(patches-selector): show New tag for new patches (#1099) 2023-08-07 22:28:09 +07:00
Pun Butrach
131df28110 docs(managing): update to reflect current changes
The chip was removed because it was not implemented for too long.
2023-08-07 20:13:23 +07:00
aAbed
1be284f8d8 feat: switch to the new ReVanced API (#1101) 2023-08-07 17:14:16 +07:00
Pun Butrach
218e53ae75 refactor(analysis): migrate deprecated rule
deprecated since Dart 2.0, yike
2023-08-06 14:41:15 +07:00
Pun Butrach
264d8d90c4 refactor: apply changes according to analysis
trailing commas, and sort import alphabetically
2023-08-06 14:39:46 +07:00
aAbed
0b529c2629 fix(patches-selector): separate all universal patches to the bottom (#1092) 2023-08-06 12:12:01 +07:00
aAbed
5abcc7191f fix: experimental/universal patches being used even when turned off (#1090)
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
2023-08-06 12:10:57 +07:00
aAbed
5346f6e1bf fix(patch-item): hide universal patches if not enabled (#1087) 2023-08-05 20:19:36 +07:00
oSumAtrIX
2f471b3de4 fix: use user friendly strings (#1088) 2023-08-05 20:19:03 +07:00
Ushie
3cf06efddf build: bump version to v1.6.1 2023-08-04 03:33:19 +03:00
Ushie
1f4f0a3bb7 build: revert patcher to v11.0.4 2023-08-04 03:32:50 +03:00
Ushie
c07f8eae9b build: bump version to v1.6.0 2023-08-04 00:54:13 +03:00
aAbed
374eb3d06d feat: abort patching process at any time (#1072) 2023-08-04 00:40:08 +03:00
BrentBoyMeBob
fe75b75ddc feat: dpi responsive layout (#361) 2023-08-04 00:38:38 +03:00
Pun Butrach
d3790bf64b refactor: remove unimplemented features (#1061)
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-08-03 23:58:50 +03:00
aAbed
f905a52988 feat: allow control over patches update (#1063)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-08-03 23:23:56 +03:00
aAbed
e55f427b05 build: bump patcher version to v12.1.1 2023-08-04 01:53:19 +05:45
aAbed
0f000fc4d1 build: bump version to v1.5.2 2023-08-04 01:52:24 +05:45
Ushie
a0339e3c19 chore: merge dev to main (#1077) 2023-08-03 05:24:25 +03:00
Ushie
9cfa274d81 build: bump version to v1.5.1 2023-08-03 05:23:47 +03:00
Ushie
8c79f5e371 build: bump patcher to v12.1.0 2023-08-03 05:23:16 +03:00
aAbed
0d716513d7 fix: keystore password dialog showing up before importing (#1068) 2023-08-03 08:36:39 +07:00
Ushie
08f6724060 chore: merge dev branch to main branch (#1060) 2023-08-03 02:20:24 +03:00
Ushie
29daf51e64 build: bump version to 2023-08-03 02:19:14 +03:00
Pun Butrach
b3b2b01c0f ci(build): use pr event trigger for now
I just heard of cache eviction policy :)
2023-08-01 20:20:27 +07:00
Pun Butrach
c3212d0308 ci(build): update event trigger
Run on every PR

Run on every Push, ignore main branch, and ignore tag
2023-08-01 19:32:52 +07:00
Pun Butrach
aaa114ba13 ci(pr-build): reinstate functionality
PR Build was never use because it have to be manually trigger
2023-08-01 19:26:26 +07:00
Pun Butrach
8ca6418630 refactor(settings): improve clarity of the warning dialogs (#1058) 2023-07-31 21:53:23 +07:00
Pun Butrach
95632b7f55 chore(deps): update revanced-patcher to v12.0.0 2023-07-30 11:49:01 +07:00
aAbed
64744b2abf fix: original.apk not found despite existing (#1052) 2023-07-30 10:35:34 +07:00
aAbed
096b315701 fix(patch-item): remove redundant patch version completely (#1059)
https://github.com/ReVanced/revanced-patches/pull/2709
2023-07-29 16:21:30 +07:00
Pun Butrach
c27ca08d3a docs: leftovers from 6495687841 2023-07-29 16:08:54 +07:00
Aunali321
0011222371 chore:fix incorrect version 2023-07-23 14:25:11 +05:30
Aunali321
29db947e25 fix: using non const value in a const variable 2023-07-23 14:04:35 +05:30
Aunali321
fd43ac7581 chore: merge dev branch to main branch (#1032) 2023-07-23 13:53:25 +05:30
Aunali321
e49c19b3cd feat: support older version of android for reddit client patches 2023-07-23 13:51:36 +05:30
Pun
06f0e59967 chore(deps): update libsu to v5.2.0 2023-07-22 13:21:13 +07:00
Pun
c5fc5ee93b build: speed up compilation time
faster build faster build faster build faster build faster build
2023-07-19 18:30:50 +07:00
Dhruvan Bhalara
159c85bd1f fix: close previous dialog when user reset the API URL (#1025) 2023-07-16 21:04:35 +07:00
Pun
2460acf0f4 ci(analyze): don't run when PR is in draft 2023-07-16 17:10:29 +07:00
Pun
6495687841 docs: correct misspelling (EN_US)
This correct spelling to English American, because by default, we use English US.
2023-07-16 16:31:08 +07:00
Pun
d229ccb36c ci(analyze): clarify job name that the job do static analysis & format checking 2023-07-16 16:21:16 +07:00
Pun
4d6a57ddcf ci(analyze): restore run when commit push to dev branch 2023-07-16 16:17:15 +07:00
Aabed Khan
d161d55aaf fix: patched applications not showing at launch (#1031) 2023-07-16 12:46:01 +07:00
Pun
768ad0c9bc chore: merge dev branch to main branch (#1011)
ReVanced Manager v1.4.1
2023-07-15 20:33:30 +07:00
Pun Butrach
29323d4e20 build: update app version to v1.4.1 2023-07-15 12:55:59 +07:00
Pun Butrach
630b22e193 refactor: applies changes from formatter & linter 2023-07-15 12:41:03 +07:00
Aabed Khan
79116f9e67 fix(patched-applications): non-patched app showing on Installed section (#1022) 2023-07-15 08:11:51 +07:00
Aabed Khan
eb58475259 fix: showing Installed when it's actually not (#1021) 2023-07-15 08:10:36 +07:00
ponces
a879ac30fb fix: prevent unsupported operation exception (#1018) 2023-07-14 17:55:04 +07:00
Aabed Khan
c5b0621323 fix(navigation-view): back button closing the app from any page (#1019) 2023-07-13 19:25:48 +05:45
Aabed Khan
0462815014 fix(app-selector): fix text overflow on small screen (#1017) 2023-07-13 00:16:53 +05:45
Aabed Khan
e64318c947 fix(app-selector): fix text overflow on small screen 2023-07-13 00:14:47 +05:45
Pun Butrach
b784482788 chore: update libsu to 5.1.0
This should fixes some issues with root
2023-07-11 19:28:59 +07:00
Aabed Khan
2834e8b348 fix: patchable apps not showing if none of them is installed (#1009) 2023-07-11 17:11:45 +07:00
Aunali321
b23dfd4289 chore: merge dev branch to main branch (#1010) 2023-07-11 01:24:54 +05:30
Aunali321
217d525cb2 build: update app version to v1.4.0 2023-07-11 01:22:57 +05:30
Aunali321
85b166cbda fix: update hardcoded patch name 2023-07-11 01:21:45 +05:30
Pun Butrach
9a57f8b858 ci(build): use correct JDK version
There's no reasons to go higher than JDK 11 since we compile the application using JDK 11
2023-07-10 21:42:24 +07:00
Pun
3bfdc932c2 chore: update app description
👍👍 Patch your favourite apps, right on your device.
2023-07-10 21:27:20 +07:00
Ushie
48c878af21 chore: merge dev branch to main branch (#996) 2023-07-10 16:56:50 +03:00
Pun Butrach
490a7a58fc build: update app version to v1.3.9
ReVanced Manager, 1.3.9 (10030009)

See PR #996
2023-07-10 20:40:40 +07:00
Pun Butrach
567b1a3ace refactor: improve code readability according to linter 2023-07-10 19:45:50 +07:00
Pun Butrach
6a45db8a38 refactor: improve code readability according to formatter 2023-07-10 19:36:50 +07:00
Pun
b272988929 build: always compile with the latest SDK supported by Flutter
`targetSdkVersion` is still the same, we want to test the application first before bumping up to latest.
2023-07-10 18:43:07 +07:00
Aabed Khan
9828857570 fix: fixed typo 2023-07-10 12:16:51 +05:45
KobeW50
ecb54d8e44 docs: improve clarity of speech in issue template (#1005)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-07-09 23:15:20 +02:00
Aabed Khan
344717b021 fix: app crash after custom source (#1003) 2023-07-08 23:07:19 +05:45
Aabed Khan
da6cf585c0 fix: app crash after custom source 2023-07-08 22:26:31 +05:45
Pun Butrach
9e93177afd feat: show warning dialog when resetting stored patches
This prevent user from accidentally resetting stored patches by showing
them warning dialog.
2023-07-08 11:01:10 +07:00
Pun Butrach
16318efb01 refactor: seperate translation string by context 2023-07-08 10:45:13 +07:00
Pun Butrach
e83e13b6d4 refactor: fix more problem with analyser
Missing trailing comma in app_selector_view
2023-07-07 22:21:22 +07:00
Pun Butrach
7c2c695d88 refactor: apply changes from analyser 2023-07-07 22:15:12 +07:00
Pun Butrach
c7b227529d chore: disable unnecessary tooltip
Remove tooltip in Navigation View, there's no impact to accessibility.

Tested using: Android TalkBack
2023-07-07 22:11:13 +07:00
oSumAtrIX
14f49e9d30 docs: fix description for next page 2023-07-05 15:43:40 +02:00
Aabed Khan
1875c4ee73 fix: update button being clickable when offline (#987) 2023-07-05 19:59:53 +07:00
Pun Butrach
76c68baa1f build: update gradle to v7.6.2 2023-07-01 18:21:49 +07:00
Aunali321
68876a4414 build: bump version to v1.3.8 and patcher dep 2023-07-01 14:33:25 +05:30
Ushie
26d7e5b60f build: bump version to v1.3.7 and patcher dep 2023-07-01 02:46:43 +03:00
Ushie
e78af6ae99 chore: merge dev to main (#976) 2023-07-01 02:41:57 +03:00
Aabed Khan
6fe05cd86e feat: show all the unseen changelogs on changelog section (#970) 2023-07-01 02:41:03 +03:00
Aabed Khan
4100d7a391 fix: different message when trying to patch spilt apk (#973) 2023-07-01 02:40:30 +03:00
Ushie
c1cc812ea4 build: bump version to v1.3.6 2023-06-24 19:17:59 +03:00
Ushie
9663e3f0f4 chore: merge dev branch to main branch (#945) 2023-06-24 19:16:22 +03:00
Aabed Khan
941f618153 fix(app-selector): remove direct use of strings (#944) 2023-06-23 16:39:12 +03:00
Aabed Khan
716a30bf7b fix: experimental patches stay selected when toggled off (#946) 2023-06-23 16:37:23 +03:00
Aabed Khan
d051ae576b feat(updater): download successful dialog (#938) 2023-06-23 16:36:36 +03:00
ponces
35e99cb014 feat(mount): use /data/adb/revanced again and ensure migration scenario (#948) 2023-06-23 01:03:03 +03:00
taku
af054fba49 docs: improve clarity of footnotes [skip ci] (#950) 2023-06-17 14:48:57 +02:00
Aabed Khan
58d837d641 feat(app-selector): Improve app item UI to avoid overflow issues (#943) 2023-06-16 10:04:55 +03:00
Aabed Khan
6cc1bd21cd fix(updater): ability to start again after cancelling (#937) 2023-06-16 10:04:07 +03:00
oSumAtrIX
cebfa7c8ae docs: simplify steps 2023-06-16 05:09:52 +02:00
oSumAtrIX
e2d7ab8f8f chore: fix broken docs link 2023-06-15 16:42:09 +02:00
Aabed Khan
ec77987fcd feat(app-selector): improve skeleton UI (#939) 2023-06-15 12:57:39 +03:00
ponces
b161608d02 feat(patches-selector): improve disabled card UI (#941) 2023-06-15 12:54:49 +03:00
Aabed Khan
5e7458ff1c fix: import patches selects unsupported patches (#942) 2023-06-14 21:34:11 +07:00
Pun
ed06aaa1f5 docs(readme): fix invalid url for building manager from source
📜 fix invalid URL for building manager from source.

Old: https://github.com/revanced/revanced-manager/blob/docs/docs/5_building-from-source.md
New: https://github.com/revanced/revanced-manager/blob/main/docs/4_building.md
2023-06-14 19:52:10 +07:00
Aunali321
13b7179941 fix: fix not asking for permission 2023-06-12 09:56:49 +05:30
Aunali321
da0d88d86f build: bump patcher 2023-06-12 09:08:29 +05:30
Aunali321
b7347c312a build: bump version to v1.3.4 2023-06-12 08:59:49 +05:30
Aunali321
c876f2f7e3 feat: add permission to manage storage 2023-06-12 08:59:14 +05:30
Aunali321
adad5fd8ff build: bump version to v1.3.3 2023-06-12 07:02:49 +05:30
Aunali321
2aaa7ae8c9 chore: merge dev to main (#935) 2023-06-12 07:01:12 +05:30
Aunali321
1f64ea37bd fix: using wrong string 2023-06-12 06:59:43 +05:30
Aunali321
cac1525da0 build: bump patcher 2023-06-12 06:02:16 +05:30
Aunali321
1ad906fedc refactor: improve code 2023-06-12 06:01:57 +05:30
Aabed Khan
20ffef39a3 fix: update button being shown as clickable on launch (#932) 2023-06-12 05:55:53 +05:30
Aabed Khan
185460c054 chore(fastlane): update description (#933)
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-06-12 03:21:33 +03:00
Aabed Khan
0079e74d77 feat: clarify suggested version in app list (#934)
Co-authored-by: Aunali321 <48486084+Aunali321@users.noreply.github.com>
2023-06-12 05:35:02 +05:30
oSumAtrIX
a8e019482f ci: add workflow to update documentation repository 2023-06-10 23:41:36 +02:00
Yaros
f01b8e47aa fix: aborting message changed (#928)
Change aborting message from "aborting..." to "aborted..."

----------------------
Co-authored-by: Ushie <github@ushie.dev>
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-06-09 17:34:55 +07:00
Pun
e43dfb7599 docs(troubleshooting): fix markdown styling (#929)
`docs`: `84a9168` - Self-explanatory, fix markdown styling issue
2023-06-09 17:24:31 +07:00
Ushie
6b8cfe2b49 build: bump version to v1.3.2 2023-06-09 11:42:06 +03:00
Ushie
7f7b14bae3 fix: use correct variable name for armv7 check 2023-06-09 11:40:54 +03:00
Ushie
810b02d9fd build: bump version to v1.3.1 2023-06-09 10:45:22 +03:00
Ushie
62813145b2 chore: merge dev to main (#926) 2023-06-09 01:59:18 +03:00
Ushie
4877058253 chore(fastlane): add banner 2023-06-09 01:58:02 +03:00
Ushie
2a9fd3abb8 chore(fastlane): add missing directory 2023-06-09 01:57:49 +03:00
Ushie
a244f7b598 chore: merge dev to main 2023-06-08 21:31:41 +03:00
Ushie
5396457ad5 chore: move fastlane to correct directory 2023-06-08 21:30:44 +03:00
Ushie
0186b6ea61 chore: merge dev to main (#924) 2023-06-07 20:18:21 +03:00
fe
f6e99f7e88 fix: return fetched patch version if non default patch repo is used (#922) 2023-06-07 20:16:25 +03:00
Pun
c24a3828be ci(analyze): don't run when pushed to repository (#920) 2023-06-07 20:15:43 +03:00
Pun
2e38a4567a feat: clarify architecture in about section
This commit changes `Arch` to `Supported Arch(s)`
2023-06-07 20:13:42 +03:00
Yaros
67c5d67a61 feat: update icons for the new logo
fixed #918
2023-06-07 20:10:14 +03:00
Aunali321
9592dde534 feat: add fastlane for F-Droid (#889)
Co-authored-by: Ushie <ushiekane@gmail.com>
2023-06-07 19:59:17 +03:00
oSumAtrIX
d030b0af70 docs: init (#911)
Co-authored-by: afn <_@afn.lol>
2023-06-07 12:01:36 +02:00
MrAngelos6
4ccb9ac94d fix: remove redundant "v" in the downloader screen (#895) 2023-05-26 13:54:52 +03:00
Ushie
8af62b917c build: bump version to 1.3.0 (#892) 2023-05-24 23:33:04 +03:00
Steven
311f114132 chore: update v1.3.0 2023-05-24 21:46:00 +02:00
Ushie
d015bd03f7 chore: merge dev to main (#891) 2023-05-24 22:17:16 +03:00
oSumAtrIX
a61b9de0fa chore(deps): bump revanced-patcher to 9.0.0 2023-05-24 02:02:59 +02:00
Ushie
ef1b283917 chore(deps): bump revanced-patcher to 8.0.0 (#880) 2023-05-24 01:07:22 +05:30
Ushie
c677f00105 build: bump version to v1.2.0 2023-05-20 02:30:18 +03:00
Ushie
8d2f778dfe chore: merge dev to main (#881) 2023-05-20 02:28:58 +03:00
Aunali321
c549d102f6 build: migrate to dart 3 (#871) 2023-05-20 04:07:53 +05:30
Aunali321
39a9ee4e9d chore: remove coreLibraryDesugaring (#873) 2023-05-20 04:05:46 +05:30
Sangam Shrestha
a27dc6ad1c feat: migrate to dart3 2023-05-19 14:23:48 +05:45
kitadai31
8ccb75fc8d chore: remove coreLibraryDesugaring 2023-05-17 15:38:03 +09:00
Ushie
8fc86dbe02 feat: allow selecting installed if app is full apk 2023-05-13 04:54:35 +03:00
Sebok Andras
359f052608 fix: export keystore not working in some conditions (#862) 2023-05-12 19:36:47 +03:00
Hokora Yinphine
4150e2265c fix: use correct version in update download dialog (#859) 2023-05-10 13:23:02 +03:00
Dhruvan Bhalara
b803ce7435 fix: system navigation overlapping UI (#853) 2023-05-10 13:18:51 +03:00
Aunali321
289c6cd7a9 chore: merge dev to main (#857) 2023-05-08 21:46:33 +05:30
Aunali321
31fc7b74c2 build: bump version to v1.1.0 2023-05-08 21:38:19 +05:30
Aunali321
3e565f25be fix(appselector): closing dialog closes app selector 2023-05-08 21:27:07 +05:30
Aunali321
e509be4e21 chore(deps): bump patcher to 7.1.1 2023-05-08 21:19:45 +05:30
Aunali321
170fc537ac fix: fix armv7 dialog shown for x86, x86_64 2023-05-07 04:14:57 +05:30
Aunali321
3fe5882145 feat: remove cronet 2023-05-06 05:39:46 +05:30
Aunali321
a290791410 chore: merge dev to main (#844) 2023-05-06 03:26:14 +05:30
Pun
2ebd38ff68 feat: add checksums verification to Gradle (#813) 2023-05-03 21:38:47 +03:00
Dhruvan Bhalara
cd987a5b19 fix: broken filename when saving files with the same name (#837) 2023-05-03 21:34:30 +03:00
Ushie
7f1dab7ee1 ci: temporarily restore old release workflow 2023-05-02 17:50:07 +03:00
SodaWithoutSparkles
bed3945aa5 feat: clarify warning and consequences for ARMv7 users (#836) 2023-05-02 16:41:11 +07:00
Aunali321
15a32a18b7 fix: fix broken manager update implmentation 2023-04-30 17:38:08 +07:00
Palm
d2e8e7dd5d chore: comply with review changes 2023-04-30 01:03:36 +07:00
Palm
ce12ec89c4 ci(release): automatically bump version codes 2023-04-29 20:53:54 +07:00
EvadeMaster
b286444ad9 fix(i18n): update translation for refreshSucess 2023-04-29 20:43:02 +07:00
EvadeMaster
941263102d refactor: change name from "recommendedVersion" to "suggestedVersion" 2023-04-29 20:43:02 +07:00
Palm
e2ed296dc7 chore(deps): constrain get_it to 7.2.0 2023-04-29 19:46:07 +07:00
Ushie
cfc866bef2 feat: change continue anyways to cancel 2023-04-29 15:37:30 +03:00
Sebok Andras
affba669ce feat: add continue anyway button to select from storage dialog (#810) 2023-04-29 15:36:25 +03:00
Palm
7230152ab8 chore: fix issues with gitignore [skip ci] 2023-04-29 17:42:19 +07:00
Palm
21fee7171f chore: update pubspec version
skip-checks: true
2023-04-29 15:40:25 +07:00
SodaWithoutSparkles
ad17995f28 feat: improve suggested app version text (#822) 2023-04-28 17:41:28 +03:00
Yaros
ac830cbe7f fix: resized monochrome icon to match the original (#789)
cherry-pick from 6281ae82876c69ff4194a782e4b08b398a1285d6
2023-04-27 18:12:48 +07:00
Aunali321
65da6af3f9 fix: update pubspec version 2023-04-21 14:56:31 +03:00
oSumAtrIX
3d90bf7588 ci: bypass push permission on protected branches with owner PAT 2023-04-21 14:55:29 +03:00
EvadeMaster
62ef1c88fe feat: resetting source to default dismiss the sources pop-up (#797)
* feat: resetting source to default dismiss the sources pop-up

* chore: format using `dart format`
2023-04-21 00:29:37 +05:30
Aunali321
d6918920b6 chore: add missing translations 2023-04-20 23:53:24 +05:30
Aunali321
cdfb09fbfa feat: warning for armv7 devices 2023-04-20 23:20:30 +05:30
Aunali321
bb681e31c9 feat: disable selecting installed apps for nonroot 2023-04-20 22:25:29 +05:30
Aunali321
c7483936ec docs: remove alpha disclaimer 2023-04-20 05:07:46 +05:30
Aunali321
0a1f2da33d feat: appreciation message for new contributors 2023-04-20 05:04:37 +05:30
Aunali321
f5aafdb7d6 feat: progress bar for manager updates 2023-04-20 04:45:46 +05:30
Aunali321
c9adf1c492 style: sort imports 2023-04-19 01:32:43 +05:30
Aunali321
4c9cb560e3 feat: auto select default patches 2023-04-19 01:21:08 +05:30
Yaros
f0b028279c fix: open contributor links externally (#791) 2023-04-18 19:46:16 +05:30
Aman Sikarwar
197770b68b chore: update dependencies (#772)
* chore: updated some dependencies

* refactor: reimplemented cache interceptor

* Revert "Updated dependencies & migrated breaking changes"

This reverts commit e6743b0d6b2552fdbf1c99d23e158e682362dd5d.

* chore: migrated flutter_local_notifications

* revert: reimplemented cache interceptor
2023-04-18 19:45:29 +05:30
EvadeMaster
37b583f560 feat: trim extra space when setting custom source (#771) 2023-04-18 17:15:04 +07:00
Sebok Andras
dca2d4fe12 feat: add option to import/export keystore (#776)
* feat: add option to import/export keystore

* change the order of import/export keystore buttons

* feat: add option to change the keystore password
2023-04-18 15:08:10 +05:30
Aunali321
3b677f8ae3 feat: improve ux (#752)
* feat: restart app toast when changing sources, api url

* fix: potentially fix manager stuck on black screen

* feat: remove select all patches chip

* feat: show all apps and recommended versions

* chore(i18n): remove unused strings

remove unused strings left out in 7e05bca

* feat: select install type before patching

* feat: update patches button (#782)

* feat: update patches button

* feat: show toast when force refresh

* chore: don't translate "ReVanced Manager" and "ReVanced Patches"

* Revert "feat: select install type before patching"

This reverts commit 74e0c09b54.

* feat: rename recommended patches to default patches

* feat: add missing localization

* feat: display restart app toast for resetting source

---------

Co-authored-by: EvadeMaster <93124920+EvadeMaster@users.noreply.github.com>
2023-04-18 13:27:26 +05:30
Palm
0b952578d1 ci(release): update semantic-release 2023-04-02 02:37:49 +07:00
EvadeMaster
054afbbedd feat: confirmation dialog for deleting keystore (#764)
* feat: confirmation dialog for deleting keystore

* refactor(i18n): apply suggestion from code-reviewer

Co-authored-by: Ushie <github@ushie.dev>

* refactor: apply suggestion from code-reviewer

Co-authored-by: Mipirakas <borismichiels@gmail.com>

---------

Co-authored-by: Ushie <github@ushie.dev>
Co-authored-by: Mipirakas <borismichiels@gmail.com>
2023-04-01 21:02:28 +07:00
Palm
866a6e4a44 chore(CHANGELOG): reset changelog 2023-03-30 23:29:26 +07:00
Palm
8ea7dd478b ci(release): update node dependencies 2023-03-30 23:20:31 +07:00
EvadeMaster
7839252934 ci(analyze): only run when necessary (#766)
* ci(analyser): only run on lib/`.dart` changes

* ci(analyser): runs on workflow changes

* ci(analyze): run on all dart file changes

---------

Co-authored-by: Palm <palmpasuthorn@gmail.com>
2023-03-29 20:51:08 +03:00
EvadeMaster
fa4063220f ci: dart analyser (#761)
* ci: dart analyser

* ci(analyser): clarify the dart analysing step

* refactor: ignore generated files

* ci(analyser): apply suggestion from code-reviewer

Co-Authored-By: Palm <palmpasuthorn@gmail.com>

* ci(analyser): apply suggestion from code-reviewer

Co-Authored-By: Palm <palmpasuthorn@gmail.com>

* ci(analyser): apply suggestion from code-reviewer

Co-authored-by: Palm <palmpasuthorn@gmail.com>

---------

Co-authored-by: Palm <palmpasuthorn@gmail.com>
2023-03-28 15:47:34 +07:00
Palm
d214a02abd ci(release): fix argument parsing of npm exec 2023-03-26 23:02:57 +07:00
Palm
d1c12edd1b ci(release): use appropriate npm commands for ci environment 2023-03-26 23:02:57 +07:00
Palm
ded1a44c37 ci(release): fix step not moving artifact to accessible path 2023-03-26 23:02:57 +07:00
Ushie
790a6cd1e3 ci(release): remove unnecessary variables in flutter build step 2023-03-26 18:57:27 +03:00
EvadeMaster
a79f883a0f ci: use caching to speed up workflows (#760)
Use caching to speed up workflows: 9-14 minutes (ish) to 6-8 minutes (ish)

Commits:
* ci(release): use GitHub cache

* ci(release): restore signing
2023-03-26 20:02:56 +07:00
Palm
d9c5a540a3 ci(release): fix wrong artifact name and ci not uploading build 2023-03-24 01:01:44 +07:00
Palm
276f33b9ec ci: use semantic-release (#746) 2023-03-23 17:34:52 +01:00
Ushie
ded59d2da0 feat(ci): update crowdin workflow to use new main branch 2023-03-20 22:39:29 +03:00
Ushie
62f7a820d8 feat: remove notice about stale development [skip ci] 2023-03-20 18:03:58 +03:00
Ushie
7063ffa013 build: bump version to v0.0.57 2023-03-14 21:00:48 +03:00
Ushie
bf4dc3c095 chore: bump stacked
stacked: ^3.0.0 -> ^3.2.0
stacked_generator: ^0.8.0 -> ^1.0.0
stacked_services: ^0.9.3 -> ^1.0.0
2023-03-14 21:00:28 +03:00
EvadeMaster
c10e5848bf Merge pull request #707 from revanced/dev
chore: merge branch `dev` to `flutter`
2023-03-14 22:07:35 +07:00
EvadeMaster
92a3b0d6e0 feat(style): use native switch & chip (#732)
* chore: remove useless themedata

* feat(style): new switch

* feat(style): use native chip components

* chore: remove unused import

* feat(accessibility): set tooltip

* chore: remove unneeded themedata

* chore: fix theme

* feat(i18n): add 3 new strings

* feat(style): correct material 3 theme on nondynamic
2023-03-14 21:53:42 +07:00
Aunali321
b475bd25c8 build: remove env setup step 2023-03-11 23:01:26 +05:30
Aunali321
d318224a6f fix: black screen after resetting custom sources 2023-03-06 18:08:48 +05:30
Aunali321
0074fee865 build: new ci (#731)
New Build CI

Commits:
* buid: re-do ci

* build: ignore tags

* build: get the latest flutter version automatically && formatting

---------

Co-authored-by: EvadeMaster <93124920+EvadeMaster@users.noreply.github.com>
2023-03-05 16:23:51 +07:00
Aunali321
5617535a63 refactor: remove sentry and crowdin (#730)
We no longer use sentry and crowdin.
2023-03-05 16:12:46 +07:00
EvadeMaster
68ccefc59f revert: "refactor: update deprecated and minor code refactors (#710)"
This reverts commit 6829d3cdea.

Signed-off-by: EvadeMaster <93124920+EvadeMaster@users.noreply.github.com>
2023-03-03 18:06:24 +07:00
Ushie
6d60541626 chore(deps): meet patcher breaking changes 2023-03-03 03:11:44 +03:00
EvadeMaster
a635e5b8d0 chore: addFiles -> addIntegrations (#725)
fix #721
2023-03-02 14:51:35 +07:00
EvadeMaster
48a10440fe ci(build): remove environment on PR build 2023-03-02 11:06:15 +07:00
EvadeMaster
8e3ba88318 chore: bump gradle 7.5-rc.1 -> 7.6.1 (#717)
* chore: upgrade gradle from 7.5-rc.1 -> 7.6.1

* chore: remove unrelated changes
2023-02-27 19:26:10 +07:00
EvadeMaster
ab8fccc544 chore(deps): bump patcher version from 6.4.3 -> 7.0.0 2023-02-27 19:19:19 +07:00
EvadeMaster
8319dc9164 fix: improperly sized monochrome icon (#715) 2023-02-27 19:07:44 +07:00
Sailesh Dahal
6829d3cdea refactor: update deprecated and minor code refactors (#710)
Improve code readability & additional refactoring

Commits:
chore: exclude generated from analyzer

refactor: add SharedPreferences to locator

refactor: access shared pref from locator, and code refactor

refactor: remove unwanted `await`

refactor: remove `const` from `CacheConfig`
2023-02-27 19:06:05 +07:00
EvadeMaster
3ae4d69110 chore: migrate deprecation code && code cleanup (#708)
Fixes all issues in `flutter analyze`.
<Reviewed>

Commits:
* chore: migrate deprecated text style

* chore: migrate `toggleableActiveColor` to individual theme

* chore: don't use 'BuildContext's across async gaps
2023-02-20 16:53:53 +07:00
LisoUseInAIKyrios
dc665f227e fix: use high resolution adaptive icons (#675)
Use high-resolution icons instead of the low-resolution ones on ReVanced Manager.

Commits:
* High resolution adaptive icons, built using revanced-logo-no-background.svg

Same icons currently used for ReVanced YouTube.

* tweak background color to match revanced-logo-no-background.svg

* recreated foreground using 'revanced-logo-shape.svg'

* updated full resolution icons, using same ratio as original SVG

* updated icons with gradient border
2023-02-17 19:28:01 +07:00
EvadeMaster
a83496568f chore: code cleanup (#681)
Improve the readability of the code.

Commits:
* chore: correct typos `fragement` to `fragment`

* chore: put a single newline at end of file.
2023-02-17 18:53:23 +07:00
Alex
12d25570af fix: Long patch description truncated (#702)
fix: long patch description truncated (#702)

Allow flexible height
2023-02-14 18:42:24 +07:00
EvadeMaster
378c947654 chore: bump version to v0.0.56 2023-02-12 13:04:34 +07:00
EvadeMaster
bd39a3140e feat: fix patch bundle version no longer displayed (#686) 2023-02-12 00:02:30 +07:00
Boris Michiels
7d3ca3dec1 fix: display patches version on first load (#687) 2023-02-12 00:00:01 +07:00
oSumAtrIX
1cb556c8f8 chore: bump version to 0.0.55 2023-02-11 23:59:53 +07:00
oSumAtrIX
8c8f96de1c build: bump patcher version 2023-02-11 23:59:47 +07:00
EvadeMaster
318cd87a9a feat(style): use the correct m3 theming (partially) (#680) 2023-02-07 15:46:29 +03:00
Aunali321
5d63d5c2d3 feat: potentially fix apps disappearing when update is available (#674) 2023-01-31 15:42:00 +03:00
Ushie
7d347fccc6 build: bump version to v0.0.54 2023-01-30 15:57:06 +03:00
Jay Gajjar
a54ca799b9 feat: update rules of analysis_options.yaml. and solved all problems (#665)
* update rules of analysis_options.yaml. and solved all problems

* refactor: fix remaining problems

---------

Co-authored-by: Ushie <ushiekane@gmail.com>
2023-01-30 15:35:06 +03:00
Mipirakas
f5bc1a996f feat: remove select all icon from searchbar (#669) 2023-01-30 15:13:25 +03:00
Mipirakas
8591bc4d01 chore: update cr_file_saver (#668)
Co-authored-by: Ushie <github@ushie.dev>
2023-01-30 15:11:31 +03:00
EvadeMaster
40888c07f3 feat: fix overflow text & separate version from patch name (#666)
* chore: Add note

* feat: Fix overflow text & seperate version from patch title

* feat: Fix overflow text & separate version from patch name
2023-01-30 15:07:25 +03:00
Mipirakas
1c965c3788 refactor: cleanup remember patches feature (#630) 2023-01-30 15:03:55 +03:00
Bennett
4df690c2a2 feat: monochrome icon + predictive back gesture (#591)
* Add monochrome icon

* Enable predictive back gesture

* feat: monochrome icon + predictive back gesture
2023-01-30 01:23:56 +03:00
Abhiram
d6abb61e2b ci(build): update workflow actions (#662)
- Bump upload-artifact to v3

- Update crowdin/github-action according to new versioning format [https://github.com/crowdin/github-action/releases/tag/v1.6.0]
2023-01-29 23:56:13 +03:00
oSumAtrIX
3434c862e9 feat: improve note [skip ci] 2023-01-28 07:49:57 +01:00
EvadeMaster
ea8af926fa chore: update broken documentation link (#659)
* chorus: fix invalid documentation link

* chorus: Update broken documentation link
2023-01-22 16:18:41 +03:00
EvadeMaster
c3df48174c feat: warn user for selecting all patches (#649) 2023-01-21 16:37:28 +01:00
oSumAtrIX
f1e60f96c4 chore: bump version to 0.0.53 2023-01-18 22:07:00 +01:00
oSumAtrIX
cdd852678b build: bump patcher version 2023-01-18 22:07:00 +01:00
Ushie
bf518b5467 bump: kotlin gradle plugin 2023-01-18 22:07:00 +01:00
oSumAtrIX
ffd53fab26 feat: clarify acknowledgement label (#608) 2023-01-14 20:23:49 +03:00
oSumAtrIX
5aad7dad35 chore: fix incorrect wording 2023-01-12 21:03:11 +01:00
oSumAtrIX
b1c1a9f4e1 feat: stale development notice [skip ci] 2023-01-07 14:24:43 +01:00
oSumAtrIX
d847a8e0b2 build: bump version to v0.0.52 2022-12-19 01:39:48 +01:00
oSumAtrIX
9668730b5d build: bump patcher version (#610) 2022-12-19 01:35:58 +01:00
Ushie
dc049cf26a New Crowdin translations by Github Action (#601)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2022-12-16 22:41:26 +03:00
Ushie
82c2b2f128 build: bump version to v0.0.51 2022-12-15 21:24:06 +03:00
Ushie
5f81d65911 feat: sort by amount of patches, display patches count, setting to enable universal patches (#593)
* feat: sort by amount of patches

* feat: display patches count in application card

* feat: setting to enable universal patches
2022-12-15 23:35:45 +05:30
Ushie
19f990c564 build: bump version to v0.0.50 2022-12-14 14:17:38 +03:00
Ushie
62467007b2 Revert "feat: display app's patch count in appcard"
This reverts commit 8d4e4ba6c9.
2022-12-14 13:20:17 +03:00
Ushie
d7624e5e1f Revert "feat: filter apps by patch count"
This reverts commit d78868b462.
2022-12-14 13:19:59 +03:00
oSumAtrIX
4505f10e50 build: bump version number 2022-12-14 06:04:42 +01:00
oSumAtrIX
3ce3df5e19 build: bump patcher version 2022-12-14 06:04:10 +01:00
Ushie
8d4e4ba6c9 feat: display app's patch count in appcard 2022-12-14 02:12:57 +03:00
Ushie
d78868b462 feat: filter apps by patch count 2022-12-14 01:52:06 +03:00
Canny
01a681ad00 build: bump version to v0.0.48 2022-12-12 22:34:39 +03:00
Canny
adfeb61eab fix: print patch fail cause if message is null 2022-12-12 22:32:11 +03:00
Ushie
8c3faac343 build: bump version to v0.0.47 2022-12-12 17:09:32 +03:00
Ushie
c81acce31c feat: improve patch fail logging 2022-12-12 17:09:32 +03:00
Aunali321
fe629ce77c Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-12-11 18:04:06 +05:30
Aunali321
5c27add2b2 bump:bump version to v0.0.46 2022-12-11 18:04:00 +05:30
aliernfrog
ff90dae695 feat: add support for shared patches (#577)
* fix: avoid npe if a patch has empty compatible package.

* feat: support for shared patches

* fix: incorrect bool check and cleanup

Co-authored-by: Aunali321 <aunvakil.aa@gmail.com>
2022-12-11 18:00:44 +05:30
Aunali321
4f8aec6a05 build: bump version to v0.0.45 2022-12-09 17:47:51 +05:30
Syed Ahmad
ba8df57580 Update broken link (#569) 2022-12-09 17:42:09 +05:30
Logykk
3bab1940c1 Support Gitea repositories (#570) 2022-12-09 17:40:43 +05:30
oSumAtrIX
e300c92215 build: bump version to v0.0.44 2022-12-06 03:15:23 +01:00
oSumAtrIX
99764e25ed build: bump patcher dependency version 2022-12-06 03:14:35 +01:00
Aunali321
b5dcae11a4 Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-11-29 21:16:54 +05:30
Aunali321
f69f475ab9 build: bump version to v0.0.43 2022-11-29 21:16:42 +05:30
annon
061e929705 feat: Changelog in update dialog (#551)
* add update confirmation dialog

* fix loader placement
2022-11-29 21:15:44 +05:30
Aunali321
9e8193a6ac fix: selected patches not being remembered. 2022-11-29 21:12:46 +05:30
Aunali321
1601796c6c build: bump patcher dependency. 2022-11-29 21:03:12 +05:30
Aunali321
a0af0dde0a fix: disable changing languages for now. 2022-11-29 17:45:42 +05:30
Ushie
c5ba6a238a ci(crowdin): upload sources only 2022-11-29 14:29:30 +03:00
Ushie
3c3ebe7d9d build: bump version to v0.0.42 2022-11-26 22:14:56 +03:00
Ushie
b7227bfad7 fix(build): use correct step id 2022-11-26 22:14:42 +03:00
Ushie
447c16cff1 fix(build): migrate env name to new workflow 2022-11-26 21:17:57 +03:00
Ushie
47529ae3f5 build: workflows for PRs & all commits 2022-11-26 21:16:29 +03:00
Ushie
149af96d51 New Crowdin translations by Github Action (#541)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2022-11-26 16:43:08 +03:00
Nico Mexis
14e9dd1c04 fix: update workflow actions (#482)
* fix: update workflow actions

* fix: sign apk parameters
2022-11-26 16:34:14 +03:00
ᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠᅠ
ec9ef98981 feat(apiUrl): fix textbox hint (#521) 2022-11-26 16:33:18 +03:00
d4rkk3y
922f474b59 fix: apply correct patch if patch names are same (#535) 2022-11-24 20:14:04 +03:00
Ushie
795a1c78df build: bump version to v0.0.41 2022-11-24 00:36:03 +03:00
Canny
6ea055d486 feat: use secrets for keys (#528) 2022-11-24 00:27:00 +03:00
Aunali321
b0c4567cb8 feat: use github to get latest patches version if custom sources are used. 2022-11-23 10:03:56 +05:30
Aunali321
6e05120aa5 feat: add chips for patches selection. 2022-11-23 09:48:10 +05:30
Ushie
c5958f1257 docs: add translation field 2022-11-15 14:20:23 +03:00
Aunali321
0faf86c9e9 refactor: restructure codebase. (#501)
* refactor: separate language selection to own widget.

* feat: separate theme changer to own widget.

* refactor: move Appearance UI to separate class.

* refactor: move language selection UI to separate class.

* refactor: move sources selection to separate file.

* refactor: move sources selection to separate file.

* refactor: split settings sections in separate files.

* refactor: move logging section to separate file.

* fix: show toast on bottom.

* fix: recommended patches not being selected by default.

* fix: patch selection selecting non recommended patches.

* fix: experimental toggle not updating.
2022-11-12 21:25:33 +05:30
oSumAtrIX
ee689922a3 feat: do not update on tracing logs 2022-11-11 16:15:23 +01:00
Aunali321
be77a181ec feat: EXPERIMENTAL language switching. 2022-11-10 23:03:07 +05:30
Aunali321
30376c960f build: bump version to v0.0.40 2022-11-10 12:14:50 +05:30
Palm
405147b1c5 fix(i18n): locale capitalization and grammar (#496)
* fix(i18n): locale capitalization and grammar

* fix(i18n): add some more changes requested
2022-11-09 19:07:28 +05:30
Aunali321
d545dfe49b refactor: move exporting patches to another section 2022-11-09 14:20:32 +05:30
Boris M
c571cf2c53 feat: ability to store and load selected patches (#469)
* feat: ability to store and load selected patches

* fix: I18n

* fix: do not append but truncate file

* fix: use json file, minor fixes

* fix: better ui

* WIP

* feat: load patches selection after app selection

* feat: import/export json file

* fix: reformat code

* fix: rare bug on import feature fixed

* fix: move export/ipmort to settings page & import full json

* fix: minor improvements

* fix: minor code quality improvements

* fix: export filename fix

* fix: select list element istead of removing it
2022-11-09 13:06:04 +05:30
Boris M
fd5d71e24d fix: delete cached apk files when picking new one (#481) 2022-11-09 13:05:26 +05:30
Boris M
2c3809d2bc feat: show selected patches count in patches selector view & patch selector card (#466)
* feat: show selected patches count in patches selector view & patch selector card

* fix: add Widget on row

* fix: formatting

* fix: same text style for count
2022-11-09 13:02:39 +05:30
Ushie
0fc8e7cbc8 feat: crowdin workflow 2022-11-05 01:31:56 +03:00
Ushie
787e47f634 Update Crowdin configuration file 2022-11-04 23:14:55 +03:00
nkitsaini
dc47da75f2 feat: Adding support for Exporting APK (#439)
* feat: Adding Export APK support

* Using cr_file_saver to simplify export
2022-11-02 17:22:40 +05:30
Ushie
6b999b0a0c build: bump version to v0.0.39 2022-11-02 00:06:29 +03:00
oSumAtrIX
b00d2d16d4 feat: simplify logging (#305)
Co-authored-by: Ushie <ushiekane@gmail.com>
2022-11-02 00:02:51 +03:00
Boris M
97d4da568b fix: allow tapping on patch card when experimental switch is enabled (#464) 2022-11-02 00:02:33 +03:00
Ushie
e563049f6a build: bump version to v0.0.38 2022-11-01 19:04:23 +03:00
Ushie
cc00d0dc08 bump: kotlin gradle plugin (#461) 2022-11-01 19:03:26 +03:00
Aunali321
2a220c3984 fix: custom sources. 2022-11-01 19:03:30 +05:30
Aunali321
1d440d25be fix: dont select all patches if experimental toggle is off. 2022-11-01 15:36:06 +05:30
Aunali321
ba5234e850 feat: experimental settings to allow patch on any app version. 2022-11-01 15:26:15 +05:30
Ushie
293f7150f1 build: bump version to v0.0.37 2022-10-31 00:59:57 +03:00
Ushie
41b1cec8d3 feat: move to new API domain 2022-10-31 00:57:12 +03:00
Ushie
c129c1eeae build: bump version to v0.0.36
totally didnt forget to bump last night
2022-10-20 10:08:33 +03:00
Ushie
caa9694543 feat: improve explanation of update being unusable 2022-10-20 00:15:48 +03:00
Aunali321
ac79765372 fix: keystore name typo. 2022-10-19 18:55:27 +05:30
Aunali321
39500f054d feat: disable sentry for time being. 2022-10-19 18:53:13 +05:30
Aunali321
f2d5cc91db Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-10-19 16:33:00 +05:30
Aunali321
84a788fd9e feat: toast for disabled updates. 2022-10-19 16:32:54 +05:30
Ushie
3778bfe1b5 feat(installer): remove restriction of Share APK, closes #410 (#412)
Share APK has a requirement of needing to install the patched app before sharing, this PR removes that as I see no reason for this restriction
2022-10-18 16:16:04 +03:00
146 changed files with 8482 additions and 3319 deletions

3
.env
View File

@@ -1,3 +0,0 @@
sentryDSN=
apiKey=
appId=

View File

@@ -1,5 +1,5 @@
name: 🐞 Bug report
description: Report a very clearly broken issue.
description: Create a new bug report.
title: 'bug: <title>'
labels: [bug]
body:
@@ -8,53 +8,20 @@ body:
value: |
# ReVanced Manager bug report
Important to note that your issue may have already been reported before. Please check for existing issues [here](https://github.com/revanced/revanced-manager/labels/bug).
- type: dropdown
attributes:
label: Type
options:
- Error while running the manager
- Error at runtime
- Cosmetic
- Other
validations:
required: true
Please check for existing issues [here](https://github.com/revanced/revanced-manager/labels/bug) before creating a new one.
- type: textarea
attributes:
label: Bug description
description: How did you find the bug? Any additional details that might help?
description: |
- Describe your bug in detail
- Add steps to reproduce the bug if possible (Step 1. Download some files. Step 2. ...)
- Add images and videos if possible
- List selected patches if applicable
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Add the steps to reproduce this bug including your environment.
placeholder: Step 1. Download some files. Step 2. ...
validations:
required: true
- type: textarea
attributes:
label: Android version
description: Android version used.
validations:
required: true
- type: textarea
attributes:
label: Manager version
description: Manager version used.
validations:
required: true
- type: textarea
attributes:
label: Target package name
description: App you tried to patch.
validations:
required: true
- type: textarea
attributes:
label: Target package version.
description: Version of the app you tried to patch.
label: Version of ReVanced Manager and version & name of application you tried to patch
validations:
required: true
- type: dropdown
@@ -64,57 +31,31 @@ body:
- Non-root
- Root
validations:
required: true
required: false
- type: textarea
attributes:
label: Patches selected.
description: Patches you selected for the app.
validations:
required: true
- type: textarea
attributes:
label: Device logs (exported using Manager settings).
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
label: Device logs
description: Export logs in ReVanced Manager settings.
render: shell
validations:
required: true
- type: textarea
attributes:
label: Installer logs (exported using Installer menu option) [unneeded if issue is not during patching].
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
label: Patcher logs
description: Export logs in "Patcher" screen.
render: shell
validations:
required: false
- type: textarea
attributes:
label: Screenshots or videos
description: Add screenshots or videos that show the bug here.
placeholder: Drag and drop the screenshots/videos into this box.
validations:
required: false
- type: textarea
attributes:
label: Solution
description: If applicable, add a possible solution.
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: Add additional context here.
validations:
required: false
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
description: Your issue will be closed if you don't follow the checklist below!
options:
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
- label: This request is not a duplicate of an existing issue.
required: true
- label: I have written a short but informative title.
- label: I have chosen an appropriate title.
required: true
- label: I filled out all of the requested information in this issue properly.
- label: All requested information has been provided properly.
required: true
- label: The issue is related solely to the ReVanced Manager
- label: The issue is solely related to the ReVanced Manager
required: true

View File

@@ -1,52 +1,42 @@
name: ⭐ Feature request
description: Create a detailed feature request.
description: Create a new feature request.
title: 'feat: <title>'
labels: [feature-request]
labels: 'feature request'
body:
- type: dropdown
- type: markdown
attributes:
label: Type
options:
- Functionality
- Cosmetic
- Other
validations:
required: true
value: |
# ReVanced Manager feature request
Please check for existing feature requests [here](https://github.com/revanced/revanced-manager/labels/bug) before creating a new one.
- type: textarea
attributes:
label: Issue
description: What is the current problem. Why does it require a feature request?
validations:
required: true
- type: textarea
attributes:
label: Feature
description: Describe your feature in detail. How does it solve the issue?
label: Feature description
description: Describe your feature in detail.
validations:
required: true
- type: textarea
attributes:
label: Motivation
description: Why should your feature should be considered?
description: Explain why the lack of it is a problem.
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Add additional context here.
description: In case there is something else you want to add.
validations:
required: false
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
description: Your issue will be closed if you don't follow the checklist below!
options:
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
- label: This request is not a duplicate of an existing issue.
required: true
- label: I have written a short but informative title.
- label: I have chosen an appropriate title.
required: true
- label: I filled out all of the requested information in this issue properly.
- label: All requested information has been provided properly.
required: true
- label: The issue is related solely to the ReVanced Manager
- label: The issue is solely related to the ReVanced Manager
required: true

2
.github/config.yaml vendored Normal file
View File

@@ -0,0 +1,2 @@
firstPRMergeComment: >
Thank you for contributing to ReVanced. Join us on [Discord](https://revanced.app/discord) if you want to receive a contributor role.

View File

@@ -1,39 +0,0 @@
name: "Debug Build"
on:
push:
branches:
- "flutter-disabled"
tags-ignore:
- "*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 12
uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Set up Flutter
run: flutter pub get
- name: Generate files with Builder
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Build with Flutter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: flutter build apk --debug
- name: Add version to APK
run: mv build/app/outputs/flutter-apk/app-debug.apk revanced-manager-latest.apk
- name: Publish debug APK
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
files: revanced-manager-latest.apk

121
.github/workflows/pr-build.yml vendored Normal file
View File

@@ -0,0 +1,121 @@
name: PR Build
on:
workflow_dispatch:
inputs:
# Flutter
flutter-branch:
description: Flutter branch
type: choice
default: 'stable'
options:
- stable
- beta
- dev
- master
flutter-cache:
description: Cache
type: boolean
default: true
# Application configuration
app-flavour:
description: App flavour
default: 'release'
type: choice
options:
- release
- debug
- profile
# Pull Request
pr-number:
description: PR number (No hashtag)
required: true
run-name: "Build PR ${{ inputs.pr-number }}"
jobs:
build:
name: Build the application
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Setup
env:
GH_TOKEN: ${{ github.token }}
run: |
gh repo clone ${{ github.repository }}
cd revanced-manager
gh repo set-default ${{ github.repository }}
gh pr checkout ${{ inputs.pr-number }}
echo "DATETIME=$( TZ='UTC+0' date --rfc-email )" >> $GITHUB_ENV
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: gradle
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: ${{ inputs.flutter-branch }}
cache: ${{ inputs.flutter-cache }}
- name: Install Flutter dependencies
run: flutter pub get
- name: Generate files with Builder
run: dart run build_runner build --delete-conflicting-outputs
- name: Build with Flutter
continue-on-error: true
id: flutter-build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flutter build apk --${{ inputs.app-flavour }};
- name: Prepare to comment
run: |
if [[ "${{ steps.flutter-build.outcome }}" == "success" ]]; then
echo "MESSAGE=✅ ReVanced Manager ${{ env.COMMIT_HASH }} build succeeded." >> $GITHUB_ENV
else
echo "MESSAGE=🚫 ReVanced Manager ${{ env.COMMIT_HASH }} build failed." >> $GITHUB_ENV
fi
- name: "Comment to Pull Request #${{ inputs.pr-number }}"
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ github.token }}
pr_number: ${{ inputs.pr-number }}
mode: recreate
message: |
## ⚒️ ReVanced PR Build workflow
${{ env.MESSAGE }}
You can see more details in run [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
### ⚙️ Overview
- App flavor: ${{ inputs.app-flavour }}
- Branch: ${{ inputs.flutter-branch }}
- Start time: ${{ env.DATETIME }}
- name: Upload build
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: revanced-manager-(${{ env.COMMIT_HASH }}-${{ inputs.pr-number }}-${{ inputs.app-flavour }})-${{ inputs.flutter-branch }}
path: |
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk
build/app/outputs/flutter-apk/app-${{ inputs.app-flavour }}.apk.sha1

View File

@@ -9,20 +9,21 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 12
uses: actions/setup-java@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
java-version: "17"
distribution: "zulu"
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: "stable"
- name: Set up Flutter
run: flutter pub get
- name: Generate files with Builder
run: flutter packages pub run build_runner build --delete-conflicting-outputs
run: dart run build_runner build --delete-conflicting-outputs
- name: Build with Flutter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -32,15 +33,15 @@ jobs:
run: flutter build apk
- name: Sign APK
id: sign_apk
uses: r0adkll/sign-android-release@v1
uses: ilharp/sign-android-release@v1
with:
releaseDirectory: build/app/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEYSTORE }}
releaseDir: build/app/outputs/apk/release
signingKey: ${{ secrets.SIGNING_KEYSTORE }}
keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Add version to APK
run: mv ${{steps.sign_apk.outputs.signedReleaseFile}} revanced-manager-${{ env.RELEASE_VERSION }}.apk
run: mv ${{steps.sign_apk.outputs.signedFile}} revanced-manager-${{ env.RELEASE_VERSION }}.apk
- name: Publish release APK
uses: "marvinpinto/action-automatic-releases@latest"
with:

View File

@@ -0,0 +1,19 @@
name: Update documentation
on:
push:
paths:
- docs/**
jobs:
trigger:
runs-on: ubuntu-latest
name: Dispatch event to documentation repository
if: github.ref == 'refs/heads/main'
steps:
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.DOCUMENTATION_REPO_ACCESS_TOKEN }}
repository: revanced/revanced-documentation
event-type: update-documentation
client-payload: '{"repo": "${{ github.event.repository.name }}", "ref": "${{ github.ref }}"}'

9
.gitignore vendored
View File

@@ -58,6 +58,7 @@ unlinked.ds
unlinked_spec.ds
# Android related
.gradle/
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
@@ -134,5 +135,11 @@ app.*.map.json
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
Firebase related
# Firebase related
.firebase
# Dependency directories
node_modules/
# FVM
.fvm

View File

@@ -1,6 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method v="2" />
</configuration>
</component>

103
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,103 @@
<p align="center">
<picture>
<source
width="256px"
media="(prefers-color-scheme: dark)"
srcset="assets/revanced-headline/revanced-headline-vertical-dark.svg"
>
<img
width="256px"
src="assets/revanced-headline/revanced-headline-vertical-light.svg"
>
</picture>
<br>
<a href="https://revanced.app/">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="assets/revanced-logo/revanced-logo-round.svg" />
<img height="24px" src="assets/revanced-logo/revanced-logo-round.svg" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://github.com/ReVanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://i.ibb.co/dMMmCrW/Git-Hub-Mark.png" />
<img height="24px" src="https://i.ibb.co/9wV3HGF/Git-Hub-Mark-Light.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="http://revanced.app/discord">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://reddit.com/r/revancedapp">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://t.me/app_revanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://x.com/revancedapp">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/93124920/270180600-7c1b38bf-889b-4d68-bd5e-b9d86f91421a.png">
<img height="24px" src="https://user-images.githubusercontent.com/93124920/270108715-d80743fa-b330-4809-b1e6-79fbdc60d09c.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://www.youtube.com/@ReVanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
</picture>
</a>
<br>
<br>
Continuing the legacy of Vanced
</p>
# 👋 Contribution guidelines
This document describes how to contribute to ReVanced Manager.
## 📖 Resources to help you get started
* The [documentation](/docs/README.md) provides steps to build ReVanced Manager from source
* Our [backlog](https://github.com/orgs/ReVanced/projects/12) is where we keep track of what we're working on
* [Issues](https://github.com/ReVanced/revanced-manager/issues) are where we keep track of bugs and feature requests
## 🙏 Submitting a feature request
Features can be requested by opening an issue using the
[feature request issue template](https://github.com/ReVanced/revanced-manager/issues/new?assignees=&labels=feature-request&projects=&template=feature-issue.yml&title=feat%3A+%3Ctitle%3E).
> [!NOTE]
> We may reject your request at the discretion of ReVanced Manager's maintainers,
> please provide good motivation for a request to be accepted.
## 🐞 Submitting a bug report
If you encounter a bug while using the ReVanced Manager app, open an issue using the
[bug report issue template](https://github.com/ReVanced/revanced-manager/issues/new?assignees=&labels=bug&projects=&template=bug-issue.yml&title=bug%3A+%3Ctitle%3E).
## 📝 How to contribute
> [!TIP]
> We recommend that you discuss your changes with
> the maintainers of ReVanced Manager before contributing.
> This will help you determine whether your change is acceptable.
1. Fork the repository and create a new branch based off the `dev` branch
2. Commit your changes
3. Open a pull request to the `dev` branch and reference issues that your pull request closes
4. The maintainers of ReVanced Manager will review and provide suggestions.
Once your pull request is approved and merged, it will be included in the next release of ReVanced Manager
## 🤚 I want to contribute but don't know how to code
Even if you don't know how to code, you can still contribute by
translating ReVanced Manager on [Crowdin](https://translate.revanced.app/).
❤️ Thank you for considering contributing to ReVanced Manager.

107
README.md
View File

@@ -1,30 +1,97 @@
<p align="center">
<picture>
<source
width="256px"
media="(prefers-color-scheme: dark)"
srcset="assets/revanced-headline/revanced-headline-vertical-dark.svg"
>
<img
width="256px"
src="assets/revanced-headline/revanced-headline-vertical-light.svg"
>
</picture>
<br>
<a href="https://revanced.app/">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="assets/revanced-logo/revanced-logo-round.svg" />
<img height="24px" src="assets/revanced-logo/revanced-logo-round.svg" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://github.com/ReVanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://i.ibb.co/dMMmCrW/Git-Hub-Mark.png" />
<img height="24px" src="https://i.ibb.co/9wV3HGF/Git-Hub-Mark-Light.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="http://revanced.app/discord">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032563-d4e084b7-244e-4358-af50-26bde6dd4996.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://reddit.com/r/revancedapp">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032351-9d9d5619-8ef7-470a-9eec-2744ece54553.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://t.me/app_revanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032213-faf25ab8-0bc3-4a94-a730-b524c96df124.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://x.com/revancedapp">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/93124920/270180600-7c1b38bf-889b-4d68-bd5e-b9d86f91421a.png">
<img height="24px" src="https://user-images.githubusercontent.com/93124920/270108715-d80743fa-b330-4809-b1e6-79fbdc60d09c.png" />
</picture>
</a>&nbsp;&nbsp;&nbsp;
<a href="https://www.youtube.com/@ReVanced">
<picture>
<source height="24px" media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
<img height="24px" src="https://user-images.githubusercontent.com/13122796/178032714-c51c7492-0666-44ac-99c2-f003a695ab50.png" />
</picture>
</a>
<br>
<br>
Continuing the legacy of Vanced
</p>
# 💊 ReVanced Manager
The official ReVanced Manager based on Flutter.
[![GitHub last commit](https://img.shields.io/github/last-commit/ReVanced/revanced-manager)](https://github.com/ReVanced/revanced-manager/commits "")
[![GitHub commit activity](https://img.shields.io/github/commit-activity/w/ReVanced/revanced-manager)](https://github.com/ReVanced/revanced-manager/commits "")
ReVanced Manager is an Android application that uses ReVanced Patcher to add, remove, and modify existing functionalities in Android applications.
## 💪 Features
We provide the some of the features are:
* 📱 **Portable**: ReVanced Patcher that fit in your pocket;
* 🤗 **Intuitive UI**: Help you manage your patched applications with easy-to-use interface;
* 🛠️ **Customization**: Patch with third-party sources;
* ✨ And a **lot more!**
## 🔽 Download
To download the Alpha version of Manager, go [here](https://github.com/revanced/revanced-manager/releases/latest) and install the provided APK file.
## 📝 Prerequisites
1. Android 8 or higher
2. Does not work on some armv7 devices
3. [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG/releases) required for YouTube and YouTube Music (Only for non-root)
You can get ReVanced Manager by downloading from [ReVanced site](https://revanced.app/download) or [GitHub releases](https://github.com/ReVanced/revanced-manager/releases).
## ⚠️ Disclaimer
*Please note that even though we're releasing the Manager, it is an ALPHA version. There's a big chance that the Manager might not work at all for you.*
## 📚 Everything else
## 🔴 Issues
For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose).
### 📄 Documentation
## 💭 Discussion
If you wish to discuss the Manager, a thread has been made under the [#development](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future.
Documentation on how to use the application is available [here](/docs/README.md).
### 👋 Contributing
## 🛠️ Building Manager from source
1. Setup flutter environment for your [platform](https://docs.flutter.dev/get-started/install)
2. Clone the repository locally
3. Add your github token in gradle.properties like [this](https://github.com/revanced/revanced-documentation/wiki/Building-from-source)
4. Open the project in terminal
5. Run `flutter pub get` in terminal
6. Then `flutter packages pub run build_runner build --delete-conflicting-outputs` (Must be done on each git pull)
7. To build release apk run `flutter build apk`
Thank you for considering contributing to ReVanced Manager, you can find the contribution guidelines [here](/CONTRIBUTING.md).
### 🔴 Issues
For suggestions and bug reports, open an issue [here](https://github.com/ReVanced/revanced-manager/issues/choose).
## ⚖️ License
ReVanced Manager adopts the [GNU General Public License 3.0](/LICENSE), [tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3): You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions.

View File

@@ -11,23 +11,153 @@ include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- lib/utils/env_class.g.dart
- lib/app/app.locator.dart
- lib/app/app.router.dart
- lib/models/patch.g.dart
- lib/models/patched_application.g.dart
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
- always_declare_return_types
- require_trailing_commas
- always_put_control_body_on_new_line
- always_require_non_null_named_parameters
- always_use_package_imports # we do this commonly
- annotate_overrides
- avoid_bool_literals_in_conditional_expressions
- avoid_double_and_int_checks
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_null_checks_in_equality_operators
- avoid_print
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_type_to_string
- avoid_types_as_parameter_names
- avoid_unnecessary_containers
- avoid_void_async
- avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- cast_nullable_to_non_nullable
- close_sinks # not reliable enough
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- deprecated_consistency
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- collection_methods_unrelated_type
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- library_private_types_in_public_api
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_duplicate_case_values
- no_logic_in_create_state
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_contains
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
- prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
- prefer_null_aware_operators
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_init_formals
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_test_throws_matchers
- valid_regexps
- void_checks

3
android/Gemfile Normal file
View File

@@ -0,0 +1,3 @@
source "https://rubygems.org"
gem "fastlane"

View File

@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
@@ -21,46 +22,73 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 33
compileSdk 34
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
jvmTarget = '17'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "app.revanced.manager.flutter"
minSdkVersion 26
targetSdkVersion 33
minSdk 26
targetSdk 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
resValue "string", "app_name", "ReVanced Manager"
signingConfig signingConfigs.debug
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
}
}
debug {
shrinkResources false
minifyEnabled false
resValue "string", "app_name", "ReVanced Manager Debug"
applicationIdSuffix ".debug"
signingConfig signingConfigs.debug
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
}
}
profile {
shrinkResources false
minifyEnabled false
resValue "string", "app_name", "ReVanced Manager Profile"
applicationIdSuffix ".profile"
signingConfig signingConfigs.debug
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
}
}
}
packagingOptions {
jniLibs {
useLegacyPackaging true
excludes += ['/prebuilt/**']
}
resources {
excludes += ['/prebuilt/**']
}
}
packagingOptions {
exclude '/prebuilt/**'
}
namespace 'app.revanced.manager.flutter'
}
kotlin {
jvmToolchain(17)
}
flutter {
@@ -71,14 +99,9 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// ReVanced
implementation "app.revanced:revanced-patcher:6.0.0"
implementation "app.revanced:revanced-patcher:19.1.0"
// Signing & aligning
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
implementation("com.android.tools.build:apksig:7.2.2")
// MicroG cronet
implementation("org.microg:cronet-common:$cronetVersion")
implementation("org.microg:cronet-native:$cronetVersion")
}

View File

@@ -1,4 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.revanced.manager.flutter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -1,23 +1,28 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.revanced.manager.flutter">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application
android:label="ReVanced Manager"
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:largeHeap="true"
android:extractNativeLibs="true">
android:requestLegacyExternalStorage="true">
<activity
android:name=".MainActivity"
android:exported="true"
@@ -28,13 +33,16 @@
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:resource="@style/NormalTheme"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".ExportSettingsActivity"
android:exported="true">
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />

View File

@@ -0,0 +1,83 @@
package app.revanced.manager.flutter
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Base64
import org.json.JSONObject
import java.io.ByteArrayInputStream
import java.io.File
import java.security.cert.CertificateFactory
import java.security.cert.X509Certificate
import java.security.MessageDigest
class ExportSettingsActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val callingPackageName = getCallingPackage()!!
if (getFingerprint(callingPackageName) == getFingerprint(getPackageName())) {
// Create JSON Object
val json = JSONObject()
// Default Data
json.put("keystorePassword", "s3cur3p@ssw0rd")
// Load Shared Preferences
val sharedPreferences = getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE)
val allEntries: Map<String, *> = sharedPreferences.getAll()
for ((key, value) in allEntries.entries) {
json.put(key.replace("flutter.", ""), value)
}
// Load keystore
val keystoreFile = File(getExternalFilesDir(null), "/revanced-manager.keystore")
if (keystoreFile.exists()) {
val keystoreBytes = keystoreFile.readBytes()
val keystoreBase64 = Base64.encodeToString(keystoreBytes, Base64.DEFAULT)
json.put("keystore", keystoreBase64)
}
// Load saved patches
val storedPatchesFile = File(filesDir.parentFile.absolutePath, "/app_flutter/selected-patches.json")
if (storedPatchesFile.exists()) {
val patchesBytes = storedPatchesFile.readBytes()
val patches = String(patchesBytes, Charsets.UTF_8)
json.put("patches", JSONObject(patches))
}
// Send data back
val resultIntent = Intent()
resultIntent.putExtra("data", json.toString())
setResult(Activity.RESULT_OK, resultIntent)
finish()
} else {
val resultIntent = Intent()
setResult(Activity.RESULT_CANCELED)
finish()
}
}
fun getFingerprint(packageName: String): String {
// Get the signature of the app that matches the package name
val packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES)
val signature = packageInfo.signatures[0]
// Get the raw certificate data
val rawCert = signature.toByteArray()
// Generate an X509Certificate from the data
val certFactory = CertificateFactory.getInstance("X509")
val x509Cert = certFactory.generateCertificate(ByteArrayInputStream(rawCert)) as X509Certificate
// Get the SHA256 fingerprint
val fingerprint = MessageDigest.getInstance("SHA256").digest(x509Cert.encoded).joinToString("") {
"%02x".format(it)
}
return fingerprint
}
}

View File

@@ -1,94 +1,216 @@
package app.revanced.manager.flutter
import android.os.Build
import android.app.SearchManager
import android.content.Intent
import android.os.Handler
import android.os.Looper
import androidx.annotation.NonNull
import app.revanced.manager.flutter.utils.Aapt
import app.revanced.manager.flutter.utils.aligning.ZipAligner
import app.revanced.manager.flutter.utils.signing.Signer
import app.revanced.manager.flutter.utils.zip.ZipFile
import app.revanced.manager.flutter.utils.zip.structures.ZipEntry
import app.revanced.patcher.PatchBundleLoader
import app.revanced.patcher.PatchSet
import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.util.patch.PatchBundle
import dalvik.system.DexClassLoader
import app.revanced.patcher.patch.PatchResult
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.FlowCollector
import kotlinx.coroutines.runBlocking
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.io.PrintWriter
import java.io.StringWriter
import java.util.logging.LogRecord
import java.util.logging.Logger
private const val PATCHER_CHANNEL = "app.revanced.manager.flutter/patcher"
private const val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer"
class MainActivity : FlutterActivity() {
private val handler = Handler(Looper.getMainLooper())
private lateinit var installerChannel: MethodChannel
private var cancel: Boolean = false
private var stopResult: MethodChannel.Result? = null
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
private lateinit var patches: PatchSet
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL)
installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
val patcherChannel = "app.revanced.manager.flutter/patcher"
val installerChannel = "app.revanced.manager.flutter/installer"
val openBrowserChannel = "app.revanced.manager.flutter/browser"
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, openBrowserChannel).setMethodCallHandler { call, result ->
if (call.method == "openBrowser") {
val searchQuery = call.argument<String>("query")
openBrowser(searchQuery)
result.success(null)
} else {
result.notImplemented()
}
}
val mainChannel =
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, patcherChannel)
this.installerChannel =
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, installerChannel)
mainChannel.setMethodCallHandler { call, result ->
when (call.method) {
"runPatcher" -> {
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")
val originalFilePath = call.argument<String>("originalFilePath")
val inputFilePath = call.argument<String>("inputFilePath")
val patchedFilePath = call.argument<String>("patchedFilePath")
val outFilePath = call.argument<String>("outFilePath")
val integrationsPath = call.argument<String>("integrationsPath")
val selectedPatches = call.argument<List<String>>("selectedPatches")
val options = call.argument<Map<String, Map<String, Any>>>("options")
val cacheDirPath = call.argument<String>("cacheDirPath")
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
if (patchBundleFilePath != null &&
val keystorePassword = call.argument<String>("keystorePassword")
if (
originalFilePath != null &&
inputFilePath != null &&
patchedFilePath != null &&
outFilePath != null &&
integrationsPath != null &&
selectedPatches != null &&
options != null &&
cacheDirPath != null &&
mergeIntegrations != null &&
keyStoreFilePath != null
keyStoreFilePath != null &&
keystorePassword != null
) {
cancel = false
runPatcher(
result,
patchBundleFilePath,
originalFilePath,
inputFilePath,
patchedFilePath,
outFilePath,
integrationsPath,
selectedPatches,
options,
cacheDirPath,
mergeIntegrations,
keyStoreFilePath
keyStoreFilePath,
keystorePassword
)
} else {
result.notImplemented()
}
} else result.notImplemented()
}
"stopPatcher" -> {
cancel = true
stopResult = result
}
"getPatches" -> {
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")!!
val cacheDirPath = call.argument<String>("cacheDirPath")!!
try {
val patchBundleFile = File(patchBundleFilePath)
patchBundleFile.setWritable(false)
patches = PatchBundleLoader.Dex(
patchBundleFile,
optimizedDexDirectory = File(cacheDirPath)
)
} catch (ex: Exception) {
return@setMethodCallHandler result.notImplemented()
} catch (err: Error) {
return@setMethodCallHandler result.notImplemented()
}
JSONArray().apply {
patches.forEach {
JSONObject().apply {
put("name", it.name)
put("description", it.description)
put("excluded", !it.use)
put("compatiblePackages", JSONArray().apply {
it.compatiblePackages?.forEach { compatiblePackage ->
val compatiblePackageJson = JSONObject().apply {
put("name", compatiblePackage.name)
put(
"versions",
JSONArray().apply {
compatiblePackage.versions?.forEach { version ->
put(version)
}
})
}
put(compatiblePackageJson)
}
})
put("options", JSONArray().apply {
it.options.values.forEach { option ->
JSONObject().apply {
put("key", option.key)
put("title", option.title)
put("description", option.description)
put("required", option.required)
fun JSONObject.putValue(
value: Any?,
key: String = "value"
) = if (value is Array<*>) put(
key,
JSONArray().apply {
value.forEach { put(it) }
})
else put(key, value)
putValue(option.default)
option.values?.let { values ->
put("values",
JSONObject().apply {
values.forEach { (key, value) ->
putValue(value, key)
}
})
} ?: put("values", null)
put("valueType", option.valueType)
}.let(::put)
}
})
}.let(::put)
}
}.toString().let(result::success)
}
else -> result.notImplemented()
}
}
}
fun openBrowser(query: String?) {
val intent = Intent(Intent.ACTION_WEB_SEARCH).apply {
putExtra(SearchManager.QUERY, query)
}
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
}
}
@OptIn(InternalCoroutinesApi::class)
private fun runPatcher(
result: MethodChannel.Result,
patchBundleFilePath: String,
originalFilePath: String,
inputFilePath: String,
patchedFilePath: String,
outFilePath: String,
integrationsPath: String,
selectedPatches: List<String>,
options: Map<String, Map<String, Any>>,
cacheDirPath: String,
mergeIntegrations: Boolean,
keyStoreFilePath: String
keyStoreFilePath: String,
keystorePassword: String
) {
val originalFile = File(originalFilePath)
val inputFile = File(inputFilePath)
@@ -96,125 +218,148 @@ class MainActivity : FlutterActivity() {
val outFile = File(outFilePath)
val integrations = File(integrationsPath)
val keyStoreFile = File(keyStoreFilePath)
val cacheDir = File(cacheDirPath)
Thread {
try {
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
PatchBundle.Dex(
patchBundleFilePath,
DexClassLoader(
patchBundleFilePath,
cacheDirPath,
null,
javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
} else {
TODO("VERSION.SDK_INT < CUPCAKE")
}
fun updateProgress(progress: Double, header: String, log: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.1,
"header" to "",
"log" to "Copying original apk"
"progress" to progress,
"header" to header,
"log" to log
)
)
}
}
fun postStop() = handler.post { stopResult!!.success(null) }
// Setup logger
Logger.getLogger("").apply {
handlers.forEach {
it.close()
removeHandler(it)
}
object : java.util.logging.Handler() {
override fun publish(record: LogRecord) {
if (record.loggerName?.startsWith("app.revanced") != true || cancel) return
updateProgress(-1.0, "", record.message)
}
override fun flush() = Unit
override fun close() = flush()
}.let(::addHandler)
}
try {
updateProgress(0.0, "", "Copying APK")
if (cancel) {
postStop()
return@Thread
}
originalFile.copyTo(inputFile, true)
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.2,
"header" to "Unpacking apk...",
"log" to "Unpacking input apk"
)
)
}
val patcher =
Patcher(
PatcherOptions(
inputFile,
cacheDirPath,
Aapt.binary(applicationContext).absolutePath,
cacheDirPath,
logger = ManagerLogger()
)
)
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to 0.3, "header" to "", "log" to "")
)
}
if (mergeIntegrations) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.4,
"header" to "Merging integrations...",
"log" to "Merging integrations"
)
)
}
patcher.addFiles(listOf(integrations)) {}
if (cancel) {
postStop()
return@Thread
}
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.5,
"header" to "Applying patches...",
"log" to ""
)
updateProgress(0.05, "Reading APK...", "Reading APK")
val patcher = Patcher(
PatcherOptions(
inputFile,
cacheDir,
Aapt.binary(applicationContext).absolutePath,
cacheDir.path,
true // TODO: Add option to disable this
)
)
if (cancel) {
postStop()
return@Thread
}
patcher.addPatches(patches)
patcher.executePatches().forEach { (patch, res) ->
if (res.isSuccess) {
val msg = "[success] $patch"
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.5,
"header" to "",
"log" to msg
)
)
}
return@forEach
}
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to 0.5, "header" to "", "log" to msg)
)
updateProgress(0.1, "Loading patches...", "Loading patches")
val patches = patches.filter { patch ->
val isCompatible = patch.compatiblePackages?.any {
it.name == patcher.context.packageMetadata.packageName
} ?: false
val compatibleOrUniversal =
isCompatible || patch.compatiblePackages.isNullOrEmpty()
compatibleOrUniversal && selectedPatches.any { it == patch.name }
}.onEach { patch ->
options[patch.name]?.forEach { (key, value) ->
patch.options[key] = value
}
}
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.7,
"header" to "Repacking apk...",
"log" to "Repacking patched apk"
)
)
if (cancel) {
postStop()
return@Thread
}
val res = patcher.save()
updateProgress(0.15, "Executing...", "")
// Update the progress bar every time a patch is executed from 0.15 to 0.7
val totalPatchesCount = patches.size
val progressStep = 0.55 / totalPatchesCount
var progress = 0.15
patcher.apply {
acceptIntegrations(listOf(integrations))
acceptPatches(patches)
runBlocking {
apply(false).collect(FlowCollector { patchResult: PatchResult ->
if (cancel) {
handler.post { stopResult!!.success(null) }
this.cancel()
this@apply.close()
return@FlowCollector
}
val msg = patchResult.exception?.let {
val writer = StringWriter()
it.printStackTrace(PrintWriter(writer))
"${patchResult.patch.name} failed: $writer"
} ?: run {
"${patchResult.patch.name} succeeded"
}
updateProgress(progress, "", msg)
progress += progressStep
})
}
}
if (cancel) {
postStop()
patcher.close()
return@Thread
}
updateProgress(0.8, "Building...", "")
val res = patcher.get()
patcher.close()
ZipFile(patchedFile).use { file ->
res.dexFiles.forEach {
if (cancel) {
postStop()
return@Thread
}
file.addEntryCompressData(
ZipEntry.createWithName(it.name),
it.stream.readBytes()
@@ -231,90 +376,35 @@ class MainActivity : FlutterActivity() {
ZipAligner::getEntryAlignment
)
}
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.9,
"header" to "Signing apk...",
"log" to ""
)
)
if (cancel) {
postStop()
return@Thread
}
// Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
updateProgress(0.9, "Signing...", "Signing APK")
try {
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
Signer("ReVanced", keystorePassword)
.signApk(patchedFile, outFile, keyStoreFile)
} catch (e: Exception) {
//log to console
print("Error signing apk: ${e.message}")
print("Error signing APK: ${e.message}")
e.printStackTrace()
}
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 1.0,
"header" to "Finished!",
"log" to "Finished!"
)
)
}
updateProgress(1.0, "Patched", "Patched")
} catch (ex: Throwable) {
val stack = ex.stackTraceToString()
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to -100.0,
"header" to "Aborting...",
"log" to "An error occurred! Aborting\nError:\n$stack"
)
if (!cancel) {
val stack = ex.stackTraceToString()
updateProgress(
-100.0,
"Failed",
"An error occurred:\n$stack"
)
}
}
handler.post { result.success(null) }
}.start()
}
inner class ManagerLogger : Logger {
override fun error(msg: String) {
handler.post {
installerChannel
.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}
override fun warn(msg: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}
override fun info(msg: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}
override fun trace(msg: String) {
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to -1.0, "header" to "", "log" to msg)
)
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="256"
android:viewportHeight="256">
<group android:scaleX="0.23"
android:scaleY="0.23"
android:translateX="98.56"
android:translateY="98.56">
<path
android:pathData="M253.85,4.9C254.32,3.82 254.22,2.57 253.58,1.58C252.93,0.6 251.83,0 250.64,0C243.29,0 230.47,0 225.95,0C224.96,0 224.06,0.59 223.66,1.5C216.03,18.88 144.1,182.7 130.29,214.16C129.89,215.07 128.99,215.66 128,215.66C127.01,215.66 126.11,215.07 125.71,214.16C111.9,182.7 39.97,18.88 32.34,1.5C31.94,0.59 31.04,0 30.05,0C25.53,0 12.71,0 5.36,0C4.17,0 3.07,0.6 2.42,1.58C1.78,2.57 1.68,3.82 2.15,4.9C16.78,38.3 101.47,231.61 111.24,253.9C111.8,255.18 113.06,256 114.45,256C120.29,256 135.71,256 141.55,256C142.94,256 144.2,255.18 144.76,253.9C154.52,231.61 239.22,38.3 253.85,4.9Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M130.59,131.75C130.06,132.68 129.07,133.25 128,133.25C126.93,133.25 125.94,132.68 125.4,131.75C113.45,111.06 63.88,25.19 51.93,4.5C51.4,3.57 51.4,2.43 51.93,1.5C52.47,0.57 53.46,-0 54.53,-0L201.47,-0C202.54,-0 203.53,0.57 204.06,1.5C204.6,2.43 204.6,3.57 204.06,4.5C192.12,25.19 142.54,111.06 130.59,131.75Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="128"
android:startY="-0"
android:endX="128"
android:endY="254.6"
android:type="linear">
<item android:offset="0" android:color="#FFF04E98"/>
<item android:offset="0.5" android:color="#FF5F65D4"/>
<item android:offset="1" android:color="#FF4E98F0"/>
</gradient>
</aapt:attr>
</path>
</group>
</vector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#1B1B1B</color>
</resources>
</resources>

View File

@@ -1,4 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.revanced.manager.flutter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -1,13 +1,12 @@
buildscript {
ext.cronetVersion = '102.5005.125'
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:8.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -17,21 +16,20 @@ allprojects {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = (project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")) as String
password = (project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")) as String
}
url 'https://jitpack.io'
}
mavenLocal()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View File

@@ -1,3 +1,9 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx1536M -XX:+UseParallelGC
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.caching=true
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

View File

@@ -1,6 +1,6 @@
#Mon May 09 12:07:41 MSK 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,11 +1,20 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
plugins {
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
}
}
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
include ":app"
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

View File

@@ -1,37 +1,65 @@
{
"okButton": "OK",
"cancelButton": "Cancel",
"dismissButton": "Dismiss",
"quitButton": "Quit",
"updateButton": "Update",
"enabledLabel": "Enabled",
"disabledLabel": "Disabled",
"installed":"Installed: {version}",
"suggested":"Suggested: {version}",
"yesButton": "Yes",
"noButton": "No",
"warning": "Warning",
"options": "Options",
"notice": "Notice",
"noShowAgain": "Don't show this again",
"add": "Add",
"remove": "Remove",
"navigationView": {
"dashboardTab": "Dashboard",
"patcherTab": "Patcher",
"settingsTab": "Settings"
},
"homeView": {
"refreshSuccess": "Refreshed successfully",
"widgetTitle": "Dashboard",
"updatesSubtitle": "Updates",
"patchedSubtitle": "Patched Applications",
"updatesAvailable": "Updates available",
"patchedSubtitle": "Patched apps",
"noUpdates": "No updates available",
"noInstallations": "No patched applications installed",
"installed": "Installed",
"WIP": "Work in progress...",
"noInstallations": "No patched apps installed",
"installUpdate": "Continue to install the update?",
"updateDialogTitle": "Update Manager",
"updateDialogText": "Are you sure you want to download and update ReVanced Manager?",
"notificationTitle": "ReVanced Manager was updated",
"notificationText": "Tap to open the app",
"updatePatchesDialogTitle": "Update ReVanced Patches",
"updateChangelogTitle": "Changelog",
"patchesConsentDialogText": "ReVanced Patches needs to be downloaded.",
"patchesConsentDialogText2": "This will connect you to {url}.",
"patchesConsentDialogText3": "Auto update?",
"patchesConsentDialogText3Sub": "You can change this in settings at a later time.",
"notificationTitle": "Update downloaded",
"notificationText": "Tap to install the update",
"downloadingMessage": "Downloading update...",
"downloadedMessage": "Update downloaded!",
"installingMessage": "Installing update...",
"errorDownloadMessage": "Unable to download update",
"errorInstallMessage": "Unable to install update",
"noConnection": "No internet connection"
"noConnection": "No internet connection",
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
},
"applicationItem": {
"patchButton": "Patch",
"infoButton": "Info",
"changelogLabel": "Changelog"
"infoButton": "Info"
},
"latestCommitCard": {
"loadingLabel": "Loading...",
@@ -43,21 +71,28 @@
"patcherView": {
"widgetTitle": "Patcher",
"patchButton": "Patch",
"patchDialogTitle": "Warning",
"patchDialogText": "You have selected a resource patch and a split APK installation was detected so patching errors may occur.\nAre you sure you want to proceed with patching a split base APK?"
"armv7WarningDialogText": "Patching on ARMv7 devices is not yet supported and might fail. Proceed anyways?",
"removedPatchesWarningDialogText": "The following patches have been removed since the last time you used them.\n\n{patches}\n\nProceed anyways?",
"requiredOptionDialogText" : "Some patch options have to be set."
},
"appSelectorCard": {
"widgetTitle": "Select application",
"widgetTitle": "Select an application",
"widgetTitleSelected": "Selected application",
"widgetSubtitle": "No application selected",
"noAppsLabel": "No applications found.",
"noAppsLabel": "No applications found",
"notInstalled":"App not installed",
"currentVersion": "Current",
"recommendedVersion": "Recommended",
"anyVersion": "any"
"suggestedVersion": "Suggested",
"allVersions": "All versions"
},
"patchSelectorCard": {
"widgetTitle": "Select patches",
"widgetTitleSelected": "Selected patches",
"widgetSubtitle": "Select an application first",
"widgetEmptySubtitle": "No patches selected"
},
@@ -66,111 +101,231 @@
"widgetSubtitle": "We are online!"
},
"appSelectorView": {
"viewTitle": "Select application",
"viewTitle": "Select an application",
"searchBarHint": "Search applications",
"storageButton": "Storage",
"errorMessage": "Unable to use selected application."
"selectFromStorageButton": "Select from storage",
"errorMessage": "Unable to use selected application",
"downloadToast": "Download function is not available yet",
"requireSuggestedAppVersionDialogText": "The version of the app you have selected does not match the suggested version. Please select the app that matches the suggested version.\n\nSelected version: v{selected}\nSuggested version: v{suggested}\n\nTo proceed anyway, disable \"Require suggested app version\" in the settings.",
"featureNotAvailable": "Feature not implemented",
"featureNotAvailableText": "This application is a split APK and cannot be selected. Unfortunately, this feature is only available for rooted users at the moment. However, you can still install the application by selecting its APK files from your device's storage instead"
},
"patchesSelectorView": {
"viewTitle": "Select patches",
"searchBarHint": "Search patches",
"universalPatches": "Universal patches",
"newPatches": "New patches",
"patches": "Patches",
"doneButton": "Done",
"default": "Default",
"defaultTooltip": "Select all default patches",
"none": "None",
"noneTooltip": "Deselect all patches",
"loadPatchesSelection": "Load patch selection",
"noSavedPatches": "No saved patch selection for the selected app.\nPress Done to save the current selection.",
"noPatchesFound": "No patches found for the selected app",
"selectAllPatchesWarningTitle": "Warning",
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
"setRequiredOption": "Some patches require options to be set:\n\n{patches}\n\nPlease set them before continuing."
},
"patchOptionsView": {
"customValue": "Custom value",
"resetOptionsTooltip": "Reset patch options",
"viewTitle": "Patch options",
"saveOptions": "Save",
"addOptions": "Add options",
"deselectPatch": "Deselect patch",
"tooltip": "More input options",
"selectFilePath": "Select file path",
"selectFolder": "Select folder",
"selectOption": "Select option",
"requiredOption": "This option is required",
"unsupportedOption": "This option is not supported",
"requiredOptionNull": "The following options have to be set:\n\n{options}"
},
"patchItem": {
"unsupportedWarningButton": "Warning",
"unsupportedDialogTitle": "Warning",
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nSupported versions:\n{supportedVersions}",
"unsupportedPatchVersion": "Patch is not supported for this app version.",
"unsupportedRequiredOption": "This patch contains a required option that is not supported by this app",
"patchesChangeWarningDialogText": "It is recommended to use the default patch selection and options. Changing them may result in unexpected issues.\n\nYou'll need to turn on \"Allow changing patch selection\" in settings before changing any patch selection.",
"patchesChangeWarningDialogButton": "Use default selection"
},
"installerView": {
"widgetTitle": "Installer",
"installType": "Select install type",
"installTypeDescription": "Select the installation type to proceed with.",
"installButton": "Install",
"installRootButton": "Install as Root",
"installRootType": "Mount",
"installNonRootType": "Normal",
"pressBackAgain": "Press back again to cancel",
"openButton": "Open",
"shareButton": "Share file",
"notificationTitle": "ReVanced Manager is patching",
"notificationText": "Tap to return to the installer",
"shareApkMenuOption": "Share APK",
"shareLogMenuOption": "Share log",
"installErrorDialogTitle": "Error",
"installErrorDialogText1": "Root install is not possible with the current patches selection.\nRepatch your app or choose non-root install.",
"installErrorDialogText2": "Non-root install is not possible with the current patches selection.\nRepatch your app or choose root install if you have your device rooted.",
"installErrorDialogText3": "Root install is not possible as the original APK was selected from storage.\nSelect an installed app or choose non-root install.",
"noExit": "Installer is still running..."
"exportApkButtonTooltip": "Export patched APK",
"exportLogButtonTooltip": "Export log",
"screenshotDetected": "A screenshot has been detected. If you are trying to share the log, please share a text copy instead.\n\nCopy log to clipboard?",
"copiedToClipboard": "Copied log to clipboard",
"noExit": "Installer is still running, cannot exit..."
},
"settingsView": {
"widgetTitle": "Settings",
"appearanceSectionTitle": "Appearance",
"teamSectionTitle": "Team",
"infoSectionTitle": "Info",
"debugSectionTitle": "Debugging",
"advancedSectionTitle": "Advanced",
"logsSectionTitle": "Logs",
"darkThemeLabel": "Dark Mode",
"darkThemeHint": "Welcome to the Dark Side",
"exportSectionTitle": "Import & export",
"themeModeLabel": "App theme",
"systemThemeLabel": "System",
"lightThemeLabel": "Light",
"darkThemeLabel": "Dark",
"dynamicThemeLabel": "Material You",
"dynamicThemeHint": "Enjoy an experience closer to your device",
"languageLabel": "Language",
"englishOption": "English",
"frenchOption": "French",
"sourcesLabel": "Sources",
"sourcesLabelHint": "Configure your custom sources",
"orgPatchesLabel": "Patches Organization",
"sourcesPatchesLabel": "Patches Source",
"orgIntegrationsLabel": "Integrations Organization",
"sourcesIntegrationsLabel": "Integrations Source",
"sourcesLabelHint": "Configure your sources",
"sourcesIntegrationsLabel": "Integrations source",
"sourcesResetDialogTitle": "Reset",
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
"apiURLResetDialogText": "Are you sure you want to reset API URL to its default value?",
"sourcesResetDialogText": "Are you sure you want to reset your sources to their default values?",
"apiURLResetDialogText": "Are you sure you want to reset your API URL to its default value?",
"sourcesUpdateNote": "Note: Patches will be updated to the latest version automatically.\n\nThis will reveal your IP address to the server.",
"apiURLLabel": "API URL",
"apiURLHint": "Configure your API URL",
"selectApiURL": "API URL",
"hostRepositoryLabel": "Repository API",
"orgPatchesLabel": "Patches organization",
"sourcesPatchesLabel": "Patches source",
"orgIntegrationsLabel": "Integrations organization",
"contributorsLabel": "Contributors",
"contributorsHint": "A list of contributors of ReVanced",
"logsLabel": "Logs",
"logsHint": "Share device debug logs",
"apiURLLabel": "API URL",
"apiURLHint": "Configure your custom API URL",
"selectApiURL": "Select URL",
"logsLabel": "Share logs",
"logsHint": "Share ReVanced Manager logs",
"enablePatchesSelectionLabel": "Allow changing patch selection",
"enablePatchesSelectionHint": "Allow changing the selection of patches",
"enablePatchesSelectionWarningText": "Changing the selection of patches may cause unexpected issues.\n\nEnable anyways?",
"disablePatchesSelectionWarningText": "You are about to disable changing the selection of patches.\nThe default selection of patches will be restored.\n\nDisable anyways?",
"autoUpdatePatchesLabel": "Auto update patches",
"autoUpdatePatchesHint": "Automatically update patches to the latest version",
"universalPatchesLabel": "Show universal patches",
"universalPatchesHint": "Display all apps and universal patches (may slow down the app list)",
"versionCompatibilityCheckLabel": "Version compatibility check",
"versionCompatibilityCheckHint": "Restricts patches to supported app versions",
"requireSuggestedAppVersionLabel": "Require suggested app version",
"requireSuggestedAppVersionHint": "Enforce selection of suggested app version",
"requireSuggestedAppVersionDialogText": "Selecting an app that is not the suggested version may cause unexpected issues.\n\nDo you want to proceed anyways?",
"aboutLabel": "About",
"snackbarMessage": "Copied to clipboard",
"sentryLabel": "Sentry Logging",
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
"restartAppForChanges": "Restart the app to apply changes",
"deleteKeystoreLabel": "Delete keystore",
"deleteKeystoreHint": "Delete the keystore used to sign the app",
"deletedKeystore": "Keystore deleted",
"deleteTempDirLabel": "Delete temp directory",
"deleteTempDirHint": "Delete the temporary directory used to store temporary files",
"deletedTempDir": "Temp directory deleted",
"deleteLogsLabel": "Delete logs",
"deleteLogsHint": "Delete collected manager logs",
"deletedLogs": "Logs deleted"
"deleteTempDirLabel": "Delete temporary files",
"deleteTempDirHint": "Delete unused temporary files",
"deletedTempDir": "Temporary files deleted",
"exportPatchesLabel": "Export patch selection",
"exportPatchesHint": "Export patch selection to a JSON file",
"exportedPatches": "Patch selection exported",
"noExportFileFound": "No patch selection to export",
"importPatchesLabel": "Import patch selection",
"importPatchesHint": "Import patch selection from a JSON file",
"importedPatches": "Patch selection imported",
"resetStoredPatchesLabel": "Reset patch selection",
"resetStoredPatchesHint": "Reset the stored patch selection",
"resetStoredPatchesDialogTitle": "Reset patch selection?",
"resetStoredPatchesDialogText": "The default selection of patches will be restored.",
"resetStoredPatches": "Patch selection has been reset",
"resetStoredOptionsLabel": "Reset patch options",
"resetStoredOptionsHint": "Reset all patch options",
"resetStoredOptionsDialogTitle": "Reset patch options?",
"resetStoredOptionsDialogText": "Resetting patch options will remove all saved options.",
"resetStoredOptions": "Options have been reset",
"deleteLogsLabel": "Clear logs",
"deleteLogsHint": "Delete collected ReVanced Manager logs",
"deletedLogs": "Logs deleted",
"regenerateKeystoreLabel": "Regenerate keystore",
"regenerateKeystoreHint": "Regenerate the keystore used to sign apps",
"regenerateKeystoreDialogTitle": "Regenerate keystore?",
"regenerateKeystoreDialogText": "Patched apps signed with the old keystore will no longer be able to be updated.",
"regeneratedKeystore": "Keystore regenerated",
"exportKeystoreLabel": "Export keystore",
"exportKeystoreHint": "Export the keystore used to sign apps",
"exportedKeystore": "Keystore exported",
"noKeystoreExportFileFound": "No keystore to export",
"importKeystoreLabel": "Import keystore",
"importKeystoreHint": "Import a keystore used to sign apps",
"importedKeystore": "Keystore imported",
"selectKeystorePassword": "Keystore password",
"selectKeystorePasswordHint": "Select keystore password used to sign apps",
"jsonSelectorErrorMessage": "Unable to use selected JSON file",
"keystoreSelectorErrorMessage": "Unable to use selected keystore file"
},
"appInfoView": {
"widgetTitle": "App Info",
"widgetTitle": "App info",
"openButton": "Open",
"uninstallButton": "Uninstall",
"patchButton": "Patch",
"unpatchButton": "Unpatch",
"unpatchDialogText": "Are you sure you want to unpatch this app?",
"rootDialogTitle": "Error",
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
"packageNameLabel": "Package Name",
"originalPackageNameLabel": "Original Package Name",
"installTypeLabel": "Installation Type",
"unpatchDialogText": "Are you sure you want to unpatch this app?",
"rootDialogText": "App was installed with superuser permissions, but currently ReVanced Manager has no permissions.\nPlease grant superuser permissions first.",
"packageNameLabel": "Package name",
"installTypeLabel": "Installation type",
"rootTypeLabel": "Root",
"nonRootTypeLabel": "Non-root",
"patchedDateLabel": "Patched Date",
"patchedDateLabel": "Patched date",
"appliedPatchesLabel": "Applied patches",
"patchedDateHint": "{date} at {time}",
"appliedPatchesLabel": "Applied Patches",
"appliedPatchesHint": "{quantity} applied patches",
"updateNotImplemented": "Update functionality not implemented yet"
"updateNotImplemented": "This feature has not been implemented yet"
},
"contributorsView": {
"widgetTitle": "Contributors",
"patcherContributors": "Patcher Contributors",
"patchesContributors": "Patches Contributors",
"integrationsContributors": "Integrations Contributors",
"cliContributors": "CLI Contributors",
"managerContributors": "Manager Contributors"
"patcherContributors": "Patcher contributors",
"patchesContributors": "Patches contributors",
"integrationsContributors": "Integrations contributors",
"cliContributors": "CLI contributors",
"managerContributors": "Manager contributors"
}
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 800 800" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g id="Logo"><g id="Ring"><circle id="Ring-Background" serif:id="Ring Background" cx="400" cy="400" r="400" style="fill:#1b1b1b;"/><path id="Ring1" serif:id="Ring" d="M400,0c220.766,0 400,179.234 400,400c-0,220.766 -179.234,400 -400,400c-220.766,-0 -400,-179.234 -400,-400c0,-220.766 179.234,-400 400,-400Zm-0,36c200.897,-0 364,163.103 364,364c0,200.897 -163.103,364 -364,364c-200.897,0 -364,-163.103 -364,-364c-0,-200.897 163.103,-364 364,-364Z" style="fill:url(#_Linear1);"/></g><g id="Shape"><path id="V-Shape" serif:id="V Shape" d="M538.74,269.872c1.481,-3.382 1.157,-7.283 -0.863,-10.373c-2.021,-3.091 -5.464,-4.954 -9.156,-4.954c-5.148,0 -10.435,0 -14.165,0c-3.1,0 -5.907,1.834 -7.153,4.672c-12.468,28.396 -78.273,178.273 -100.25,228.328c-1.246,2.838 -4.053,4.671 -7.154,4.671c-3.1,0 -5.907,-1.833 -7.153,-4.671c-21.977,-50.055 -87.782,-199.932 -100.25,-228.328c-1.246,-2.838 -4.053,-4.672 -7.153,-4.672c-3.73,0 -9.017,0 -14.164,0c-3.693,0 -7.135,1.863 -9.156,4.954c-2.02,3.09 -2.344,6.991 -0.863,10.373c23.557,53.766 101.872,232.519 117.871,269.034c1.743,3.979 5.674,6.549 10.018,6.549c6.293,-0 15.408,-0 21.701,-0c4.344,-0 8.275,-2.57 10.018,-6.549c15.999,-36.515 94.315,-215.268 117.872,-269.034Z" style="fill:#fff;"/><path id="Diamond" d="M408.119,395.312c-1.675,2.901 -4.77,4.688 -8.119,4.688c-3.349,-0 -6.444,-1.787 -8.119,-4.688c-16.997,-29.44 -56.156,-97.264 -73.153,-126.704c-1.675,-2.901 -1.675,-6.474 0,-9.375c1.675,-2.901 4.77,-4.688 8.119,-4.688c33.995,0 112.311,0 146.306,0c3.349,0 6.444,1.787 8.119,4.688c1.675,2.901 1.675,6.474 -0,9.375c-16.997,29.44 -56.156,97.264 -73.153,126.704Z" style="fill:url(#_Linear2);"/></g></g><defs><linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(4.89859e-14,800,-800,4.89859e-14,400.001,3.31681e-10)"><stop offset="0" style="stop-color:#f04e98;stop-opacity:1"/><stop offset="0.5" style="stop-color:#5f65d4;stop-opacity:1"/><stop offset="1" style="stop-color:#4e98f0;stop-opacity:1"/></linearGradient><linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.77155e-14,289.317,-282.535,1.73003e-14,400,254.545)"><stop offset="0" style="stop-color:#f04e98;stop-opacity:1"/><stop offset="0.5" style="stop-color:#5f65d4;stop-opacity:1"/><stop offset="1" style="stop-color:#4e98f0;stop-opacity:1"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,3 +1,4 @@
preserve_hierarchy: 1
files:
- source: /assets/i18n/en.json
- source: /assets/i18n/en_US.json
translation: /assets/i18n/%locale_with_underscore%.json

16
docs/0_prerequisites.md Normal file
View File

@@ -0,0 +1,16 @@
# 💼 Prerequisites
In order to use ReVanced Manager, certain requirements must be met.
## 🤝 Requirements
- An Android device running Android 8 or higher
- Any device architecture except ARMv7[^1]
[^1]: This constraint only applies to patches, that require patching APK resources which is why some patches may or may not work on ARMv7 architecture. You can find out, which architectures your device supports here: [⚙️ Configuring ReVanced Manager](2_4_settings.md#%E2%84%B9%EF%B8%8F-about).
## ⏭️ What's next
The next page will guide you through patching an app.
Continue: [⬇️ Installation](1_installation.md)

14
docs/1_installation.md Normal file
View File

@@ -0,0 +1,14 @@
# ⬇️ Installation
In order to use ReVanced on your Android device, ReVanced Manager must be installed.
## ✅ Installation steps
1. Download the latest version of ReVanced Manager from [here](https://github.com/revanced/revanced-manager/releases/latest)
2. Install ReVanced Manager
## ⏭️ What's next
The next page will guide you through using ReVanced Manager.
Continue: [🛠️ Usage](2_usage.md)

38
docs/2_1_patching.md Normal file
View File

@@ -0,0 +1,38 @@
# 🧩 Patching apps
The following pages will guide you through using ReVanced Manager to patch apps.
## ✅ Steps to patch apps
1. Navigate to the **Patcher** tab from the bottom navigation bar
2. Tap on the **Select an app** card
3. Choose an app to patch[^1]
> [!NOTE]
> The suggested version is visible in each app's card.
4. Tap on the **Select patches** card and select the patches you want to apply[^2].
> [!NOTE]
> Some patches have options that can or must be configured by tapping on ⚙️ icon next to the patch name.
>[!WARNING]
> If you see a warning you can click on it for more information.
5. Tap on the **Done** then **Patch** button
> [!WARNING]
> The patching process may take ~5 minutes. Exiting the app may cancel patching or increase the time it takes to patch.
6. Tap on the **Install** button
> [!NOTE]
> If you are rooted, you can mount the patched app on top of the original app.[^3]
> Optionally, you may export the patched app to storage using the option in the bottom left corner.
[^1]: Non-root users may be prompted to select an APK from storage, in which case you must source the APK file yourself. ReVanced does not provide any APK files.
[^2]: It is suggested to use the default set of patches by tapping on the **Default** button above the list of patches.
[^3]: Mounting the patched app on top of the original app will only work if the installed app version matches the version of the app selected in step 3. above.
## ⏭️ What's next
The next page will bring you back to the usage page.
Continue: [🛠️ Usage](2_usage.md)

15
docs/2_2_managing.md Normal file
View File

@@ -0,0 +1,15 @@
# 🧰 Managing patched apps
After patching an app, you may want to manage it. This page will guide you through managing patched apps.
## ✅ Steps to manage patched apps
1. Tap on the **Dashboard** tab in the bottom navigation bar
2. Tap on the **Info** button for the app you want to manage
3. Choose one of the options from the menu
## ⏭️ What's next
The next page will bring you back to the usage page.
Continue: [🛠️ Usage](2_usage.md)

14
docs/2_3_updating.md Normal file
View File

@@ -0,0 +1,14 @@
# 🔄 Updating ReVanced Manager
In order to keep up with the latest features and bug fixes, it is recommended to keep ReVanced Manager up to date.
## ✅ Updating steps
1. Navigate to the **Dashboard** tab from the bottom navigation bar
2. Tap on the **Update** button in the **Updates** section
## ⏭️ What's next
The next page will bring you back to the usage page.
Continue: [🛠️ Usage](2_usage.md)

52
docs/2_4_settings.md Normal file
View File

@@ -0,0 +1,52 @@
# ⚙️ Configuring ReVanced Manager
ReVanced Manager has settings that can be configured to your liking.
## 🎛️ Essential settings
- ### 🪛 Allow changing patch selection
Allows the user to change the patch selection from the default selection.
- ### 🔍 Version compatibility check
Constrains patches to supported app versions. Disable this to patch any version of an app.
> [!WARNING]
> Disabling this may cause issues if the patches are not compatible with the app version.
- ### 🧑‍🔬 Show universal patches
Reveals patches which can be applied to any app.
> [!WARNING]
> These patches may not work on all apps.
- ### 🧬 Sources
Override the API and download patches from a different source.
- ### 🔗 API URL
API to use to fetch updates and patches from.
- ### 💾 Imports & Exports
You can import, export or reset the following settings:
- 🔑 Keystore
- 📄 Patch selection
- ⚙️ Patch options
> [!NOTE]
> This is particularly useful if you want to backup or reset your settings.
- ### ❓ About
View information about your device and ReVanced Manager. This includes the version of ReVanced Manager and supported architectures of your device.
## ⏭️ What's next
The next page will bring you back to the usage page.
Continue: [🛠️ Usage](2_usage.md)

16
docs/2_usage.md Normal file
View File

@@ -0,0 +1,16 @@
# 🛠️ Usage
The following pages will guide you through using ReVanced Manager to patch apps, manage patched apps, and update ReVanced Manager.
## 📖 Table of contents
1. [🧩 Patching apps](2_1_patching.md)
2. [🧰 Managing patched apps](2_2_managing.md)
3. [🔄 Updating ReVanced Manager](2_3_updating.md)
4. [⚙️ Configuring ReVanced Manager](2_4_settings.md)
## ⏭️ What's next
The next page will guide you through troubleshooting ReVanced Manager.
Continue: [❔ Troubleshooting](3_troubleshooting.md)

27
docs/3_troubleshooting.md Normal file
View File

@@ -0,0 +1,27 @@
# ❔ Troubleshooting
In case you encounter any issues while using ReVanced Manager, please refer to this page for possible solutions.
- 💉 Patching fails with an error
Make sure ReVanced Manager is up to date by following [🔄 Updating ReVanced Manager](2_3_updating.md) and select the **Default** button when choosing patches.
- 🚫 App not installed as package conflicts with an existing package
An existing installation of the app you're trying to patch is conflicting with the patched app. Uninstall the existing app before installing the patched app.
- ❗️ Error code `135`, `139` or `1` when patching the app
Your device is not supported. Refer to the [Prerequisites](0_prerequisites.md) page for supported devices.
Alternatively, you can use [ReVanced CLI](https://github.com/revanced/revanced-cli) to patch the app.
- 🚨 Patched app crashes on launch
Select the **Default** button when choosing patches.
## ⏭️ What's next
The next page will teach you how to build ReVanced Manager from source.
Continue: [🔨 Building from source](4_building.md)

33
docs/4_building.md Normal file
View File

@@ -0,0 +1,33 @@
# 🛠️ Building from source
This page will guide you through building ReVanced Manager from source.
1\. Setup the Flutter environment for your [platform](https://docs.flutter.dev/get-started/install)
2\. Clone the repository
```sh
git clone https://github.com/revanced/revanced-manager.git && cd revanced-manager
```
3\. Get dependencies
```sh
flutter pub get
```
4\. Delete conflicting outputs
> [!TIP]
> Must be run every time you sync your local repository with the remote repository.
```sh
dart run build_runner build --delete-conflicting-outputs
```
5\. Build the APK
```sh
flutter build apk
```

21
docs/README.md Normal file
View File

@@ -0,0 +1,21 @@
# 💊 ReVanced Manager
This documentation explains how to use [ReVanced Manager](https://github.com/revanced/revanced-manager).
## 📖 Table of contents
0. [💼 Prerequisites](0_prerequisites.md)
1. [⬇️ Installation](1_installation.md)
2. [🛠️ Usage](2_usage.md)
1. [🧩 Patching apps](2_1_patching.md)
2. [🧰 Managing patched apps](2_2_managing.md)
3. [🔄 Updating ReVanced Manager](2_3_updating.md)
4. [⚙️ Configuring ReVanced Manager](2_4_settings.md)
3. [❔ Troubleshooting](3_troubleshooting.md)
4. [🔨 Building from source](4_building.md)
## ⏭️ Start here
The next page will tell you about the prerequisites for using ReVanced Manager.
Continue: [💼 Prerequisites](0_prerequisites.md)

2
fastlane/Appfile Normal file
View File

@@ -0,0 +1,2 @@
json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
package_name("app.revanced.manager.flutter") # e.g. com.krausefx.app

38
fastlane/Fastfile Normal file
View File

@@ -0,0 +1,38 @@
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:android)
platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end
desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do
gradle(task: "clean assembleRelease")
crashlytics
# sh "your_script.sh"
# You can also use other beta testing services here
end
desc "Deploy a new version to the Google Play"
lane :deploy do
gradle(task: "clean assembleRelease")
upload_to_play_store
end
end

48
fastlane/README.md Normal file
View File

@@ -0,0 +1,48 @@
fastlane documentation
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```sh
xcode-select --install
```
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## Android
### android test
```sh
[bundle exec] fastlane android test
```
Runs all the tests
### android beta
```sh
[bundle exec] fastlane android beta
```
Submit a new Beta Build to Crashlytics Beta
### android deploy
```sh
[bundle exec] fastlane android deploy
```
Deploy a new version to the Google Play
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

View File

@@ -0,0 +1 @@
ReVanced Manager is an Android application that uses ReVanced Patcher to add, remove, and modify existing functionalities in Android applications

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 KiB

View File

@@ -0,0 +1 @@
Patch your favorite apps, right on your device.

View File

@@ -0,0 +1 @@
ReVanced Manager

20
fastlane/report.xml Normal file

File diff suppressed because one or more lines are too long

BIN
fonts/custom-icons.ttf Normal file

Binary file not shown.

View File

@@ -1,3 +1,4 @@
import 'package:revanced_manager/services/download_manager.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
@@ -9,6 +10,8 @@ import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/views/installer/installer_view.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patch_options/patch_options_view.dart';
import 'package:revanced_manager/ui/views/patch_options/patch_options_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_view.dart';
@@ -23,6 +26,7 @@ import 'package:stacked_services/stacked_services.dart';
MaterialRoute(page: PatcherView),
MaterialRoute(page: AppSelectorView),
MaterialRoute(page: PatchesSelectorView),
MaterialRoute(page: PatchOptionsView),
MaterialRoute(page: InstallerView),
MaterialRoute(page: SettingsView),
MaterialRoute(page: ContributorsView),
@@ -32,11 +36,13 @@ import 'package:stacked_services/stacked_services.dart';
LazySingleton(classType: NavigationViewModel),
LazySingleton(classType: HomeViewModel),
LazySingleton(classType: PatcherViewModel),
LazySingleton(classType: PatchOptionsViewModel),
LazySingleton(classType: NavigationService),
LazySingleton(classType: ManagerAPI),
LazySingleton(classType: PatcherAPI),
LazySingleton(classType: RevancedAPI),
LazySingleton(classType: GithubAPI),
LazySingleton(classType: DownloadManager),
LazySingleton(classType: Toast),
],
)

View File

@@ -1,59 +1,45 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/download_manager.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/revanced_api.dart';
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
import 'package:stacked_themes/stacked_themes.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:timezone/data/latest.dart' as tz;
late SharedPreferences prefs;
Future main() async {
await ThemeManager.initialise();
await setupLocator();
WidgetsFlutterBinding.ensureInitialized();
await locator<ManagerAPI>().initialize();
String apiUrl = locator<ManagerAPI>().getApiUrl();
await locator<DownloadManager>().initialize();
final String apiUrl = locator<ManagerAPI>().getApiUrl();
await locator<RevancedAPI>().initialize(apiUrl);
bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
locator<GithubAPI>().initialize();
await locator<PatcherAPI>().initialize();
final String repoUrl = locator<ManagerAPI>().getRepoUrl();
locator<GithubAPI>().initialize(repoUrl);
tz.initializeTimeZones();
prefs = await SharedPreferences.getInstance();
// Remove this section if you are building from source and don't have sentry configured
await SentryFlutter.init(
(options) {
options
..dsn = isSentryEnabled ? '' : ''
..environment = 'alpha'
..release = '0.1'
..tracesSampleRate = 1.0
..anrEnabled = true
..enableOutOfMemoryTracking = true
..sampleRate = isSentryEnabled ? 1.0 : 0.0
..beforeSend = (event, hint) {
if (isSentryEnabled) {
return event;
} else {
return null;
}
} as BeforeSendCallback?;
},
appRunner: () {
runApp(const MyApp());
},
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// String rawLocale = prefs.getString('language') ?? 'en_US';
// String replaceLocale = rawLocale.replaceAll('_', '-');
// List<String> localeList = replaceLocale.split('-');
// Locale locale = Locale(localeList[0], localeList[1]);
const Locale locale = Locale('en', 'US');
return DynamicThemeBuilder(
title: 'ReVanced Manager',
home: const NavigationView(),
@@ -61,11 +47,18 @@ class MyApp extends StatelessWidget {
FlutterI18nDelegate(
translationLoader: FileTranslationLoader(
fallbackFile: 'en_US',
forcedLocale: locale,
basePath: 'assets/i18n',
useCountryCode: true,
),
missingTranslationHandler: (key, locale) {
log(
'--> Missing translation: key: $key, languageCode: ${locale?.languageCode}',
);
},
),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
GlobalWidgetsLocalizations.delegate,
],
);
}

View File

@@ -1,45 +1,44 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:revanced_manager/utils/string.dart';
part 'patch.g.dart';
@JsonSerializable()
class Patch {
final String name;
final String description;
final String version;
final bool excluded;
final List<String> dependencies;
final List<Package> compatiblePackages;
Patch({
required this.name,
required this.description,
required this.version,
required this.excluded,
required this.dependencies,
required this.compatiblePackages,
required this.options,
});
factory Patch.fromJson(Map<String, dynamic> json) => _$PatchFromJson(json);
factory Patch.fromJson(Map<String, dynamic> json) {
_migrateV16ToV17(json);
return _$PatchFromJson(json);
}
static void _migrateV16ToV17(Map<String, dynamic> json) {
if (json['options'] == null) {
json['options'] = [];
}
}
final String name;
final String? description;
final bool excluded;
final List<Package> compatiblePackages;
final List<Option> options;
Map<String, dynamic> toJson() => _$PatchToJson(this);
String getSimpleName() {
return name
.replaceAll('-', ' ')
.split('-')
.join(' ')
.toTitleCase()
.replaceFirst('Microg', 'MicroG');
return name;
}
}
@JsonSerializable()
class Package {
final String name;
final List<String> versions;
Package({
required this.name,
required this.versions,
@@ -48,5 +47,50 @@ class Package {
factory Package.fromJson(Map<String, dynamic> json) =>
_$PackageFromJson(json);
final String name;
final List<String> versions;
Map toJson() => _$PackageToJson(this);
}
@JsonSerializable()
class Option {
Option({
required this.key,
required this.title,
required this.description,
required this.value,
required this.values,
required this.required,
required this.valueType,
});
factory Option.fromJson(Map<String, dynamic> json) {
_migrateV17ToV19(json);
return _$OptionFromJson(json);
}
static void _migrateV17ToV19(Map<String, dynamic> json) {
if (json['valueType'] == null) {
final type = json['optionClassType'];
if (type is String) {
json['valueType'] = type
.replaceAll('PatchOption', '')
.replaceAll('List', 'Array');
json['optionClassType'] = null;
}
}
}
final String key;
final String title;
final String description;
final dynamic value;
final Map<String, dynamic>? values;
final bool required;
final String valueType;
Map toJson() => _$OptionToJson(this);
}

View File

@@ -6,9 +6,22 @@ part 'patched_application.g.dart';
@JsonSerializable()
class PatchedApplication {
PatchedApplication({
required this.name,
required this.packageName,
required this.version,
required this.apkFilePath,
required this.icon,
required this.patchDate,
this.isRooted = false,
this.isFromStorage = false,
this.appliedPatches = const [],
});
factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
_$PatchedApplicationFromJson(json);
String name;
String packageName;
String originalPackageName;
String version;
final String apkFilePath;
@JsonKey(
@@ -19,27 +32,7 @@ class PatchedApplication {
DateTime patchDate;
bool isRooted;
bool isFromStorage;
bool hasUpdates;
List<String> appliedPatches;
List<String> changelog;
PatchedApplication({
required this.name,
required this.packageName,
required this.originalPackageName,
required this.version,
required this.apkFilePath,
required this.icon,
required this.patchDate,
this.isRooted = false,
this.isFromStorage = false,
this.hasUpdates = false,
this.appliedPatches = const [],
this.changelog = const [],
});
factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
_$PatchedApplicationFromJson(json);
Map<String, dynamic> toJson() => _$PatchedApplicationToJson(this);

View File

@@ -0,0 +1,75 @@
import 'package:dio/dio.dart';
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_cache_manager/file.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
@lazySingleton
class DownloadManager {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
late final String _userAgent;
final _cacheOptions = CacheOptions(
store: MemCacheStore(),
maxStale: const Duration(days: 1),
priority: CachePriority.high,
);
Future<void> initialize() async {
_userAgent = 'ReVanced-Manager/${await _managerAPI.getCurrentManagerVersion()}';
}
Dio initDio(String url) {
var dio = Dio();
try {
dio = Dio(
BaseOptions(
baseUrl: url,
headers: {
'User-Agent': _userAgent,
},
),
);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
dio.interceptors.add(DioCacheInterceptor(options: _cacheOptions));
return dio;
}
Future<void> clearAllCache() async {
try {
await _cacheOptions.store!.clean();
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
Future<File> getSingleFile(String url) async {
return DefaultCacheManager().getSingleFile(
url,
headers: {
'User-Agent': _userAgent,
},
);
}
Stream<FileResponse> getFileStream(String url) {
return DefaultCacheManager().getFileStream(
url,
withProgress: true,
headers: {
'User-Agent': _userAgent,
},
);
}
}

View File

@@ -1,145 +1,171 @@
import 'dart:convert';
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:dio/dio.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter/foundation.dart';
import 'package:injectable/injectable.dart';
import 'package:native_dio_client/native_dio_client.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/utils/check_for_gms.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_dio/sentry_dio.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/download_manager.dart';
import 'package:revanced_manager/services/manager_api.dart';
@lazySingleton
class GithubAPI {
late Dio _dio = Dio();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(hours: 6),
maxStale: const Duration(days: 1),
);
final Map<String, String> repoAppPath = {
'com.google.android.youtube': 'youtube',
'com.google.android.apps.youtube.music': 'music',
'com.twitter.android': 'twitter',
'com.reddit.frontpage': 'reddit',
'com.zhiliaoapp.musically': 'tiktok',
'de.dwd.warnapp': 'warnwetter',
'com.garzotto.pflotsh.ecmwf_a': 'ecmwf',
'com.spotify.music': 'spotify',
};
late final Dio _dio;
late final ManagerAPI _managerAPI = locator<ManagerAPI>();
late final DownloadManager _downloadManager = locator<DownloadManager>();
void initialize() async {
try {
bool isGMSInstalled = await checkForGMS();
if (!isGMSInstalled) {
_dio = Dio(BaseOptions(
baseUrl: 'https://api.github.com',
));
print('GitHub API: Using default engine + $isGMSInstalled');
} else {
_dio = Dio(BaseOptions(
baseUrl: 'https://api.github.com',
))
..httpClientAdapter = NativeAdapter();
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
}
_dio.interceptors.add(_dioCacheManager.interceptor);
_dio.addSentry(
captureFailedRequests: true,
);
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
}
Future<void> initialize(String repoUrl) async {
_dio = _downloadManager.initDio(repoUrl);
}
Future<void> clearAllCache() async {
try {
await _dioCacheManager.clearAll();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
}
await _downloadManager.clearAllCache();
}
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
Future<Map<String, dynamic>?> getLatestRelease(
String repoName,
) async {
try {
var response = await _dio.get(
'/repos/$repoName/releases/latest',
options: _cacheOptions,
final response = await _dio.get(
'/repos/$repoName/releases',
);
return response.data;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return response.data[0];
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Future<List<String>> getCommits(
String packageName,
Future<Map<String, dynamic>?> getPatchesRelease(
String repoName,
DateTime since,
String version,
) async {
String path =
'src/main/kotlin/app/revanced/patches/${repoAppPath[packageName]}';
try {
var response = await _dio.get(
'/repos/$repoName/commits',
queryParameters: {
'path': path,
'since': since.toIso8601String(),
},
options: _cacheOptions,
final response = await _dio.get(
'/repos/$repoName/releases/tags/$version',
);
List<dynamic> commits = response.data;
return commits
.map(
(commit) => (commit['commit']['message']).split('\n')[0] +
' - ' +
commit['commit']['author']['name'] +
'\n' as String,
)
.toList();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return List.empty();
return response.data;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Future<File?> getLatestReleaseFile(String extension, String repoName) async {
Future<Map<String, dynamic>?> getLatestPatchesRelease(
String repoName,
) async {
try {
Map<String, dynamic>? release = await _getLatestRelease(repoName);
final response = await _dio.get(
'/repos/$repoName/releases/latest',
);
return response.data;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Future<Map<String, dynamic>?> getLatestManagerRelease(
String repoName,
) async {
try {
final response = await _dio.get(
'/repos/$repoName/releases',
);
final Map<String, dynamic> releases = response.data[0];
int updates = 0;
final String currentVersion =
await _managerAPI.getCurrentManagerVersion();
while (response.data[updates]['tag_name'] != 'v$currentVersion') {
updates++;
}
for (int i = 1; i < updates; i++) {
releases.update(
'body',
(value) =>
value +
'\n' +
'# ' +
response.data[i]['tag_name'] +
'\n' +
response.data[i]['body'],
);
}
return releases;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Future<File?> getLatestReleaseFile(
String extension,
String repoName,
) async {
try {
final Map<String, dynamic>? release = await getLatestRelease(repoName);
if (release != null) {
Map<String, dynamic>? asset =
final Map<String, dynamic>? asset =
(release['assets'] as List<dynamic>).firstWhereOrNull(
(asset) => (asset['name'] as String).endsWith(extension),
);
if (asset != null) {
return await DefaultCacheManager().getSingleFile(
return await _downloadManager.getSingleFile(
asset['browser_download_url'],
);
}
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return null;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
return null;
}
Future<List<Patch>> getPatches(String repoName) async {
List<Patch> patches = [];
Future<File?> getPatchesReleaseFile(
String extension,
String repoName,
String version,
String url,
) async {
try {
File? f = await getLatestReleaseFile('.json', repoName);
if (f != null) {
List<dynamic> list = jsonDecode(f.readAsStringSync());
patches = list.map((patch) => Patch.fromJson(patch)).toList();
if (url.isNotEmpty) {
return await _downloadManager.getSingleFile(
url,
);
}
final Map<String, dynamic>? release =
await getPatchesRelease(repoName, version);
if (release != null) {
final Map<String, dynamic>? asset =
(release['assets'] as List<dynamic>).firstWhereOrNull(
(asset) => (asset['name'] as String).endsWith(extension),
);
if (asset != null) {
final String downloadUrl = asset['browser_download_url'];
if (extension == '.apk') {
_managerAPI.setIntegrationsDownloadURL(downloadUrl);
} else {
_managerAPI.setPatchesDownloadURL(downloadUrl);
}
return await _downloadManager.getSingleFile(
downloadUrl,
);
}
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return List.empty();
}
return patches;
return null;
}
}

View File

@@ -1,16 +1,24 @@
import 'dart:convert';
import 'dart:io';
import 'package:device_apps/device_apps.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:injectable/injectable.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/revanced_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:timeago/timeago.dart';
@lazySingleton
class ManagerAPI {
@@ -20,15 +28,48 @@ class ManagerAPI {
final String patcherRepo = 'revanced-patcher';
final String cliRepo = 'revanced-cli';
late SharedPreferences _prefs;
String defaultApiUrl = 'https://releases.rvcd.win/';
List<Patch> patches = [];
List<Option> modifiedOptions = [];
List<Option> options = [];
Patch? selectedPatch;
BuildContext? ctx;
bool isRooted = false;
bool suggestedAppVersionSelected = true;
bool isDynamicThemeAvailable = false;
String storedPatchesFile = '/selected-patches.json';
String keystoreFile =
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-manager.keystore';
String defaultKeystorePassword = 's3cur3p@ssw0rd';
String defaultApiUrl = 'https://api.revanced.app/';
String defaultRepoUrl = 'https://api.github.com';
String defaultPatcherRepo = 'revanced/revanced-patcher';
String defaultPatchesRepo = 'revanced/revanced-patches';
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
String defaultCliRepo = 'revanced/revanced-cli';
String defaultManagerRepo = 'revanced/revanced-manager';
String? patchesVersion = '';
String? integrationsVersion = '';
bool isDefaultPatchesRepo() {
return getPatchesRepo().toLowerCase() == 'revanced/revanced-patches';
}
bool isDefaultIntegrationsRepo() {
return getIntegrationsRepo().toLowerCase() ==
'revanced/revanced-integrations';
}
Future<void> initialize() async {
_prefs = await SharedPreferences.getInstance();
isRooted = await _rootAPI.isRooted();
isDynamicThemeAvailable = (await getSdkVersion()) >= 31; // ANDROID_12_SDK_VERSION = 31
storedPatchesFile =
(await getApplicationDocumentsDirectory()).path + storedPatchesFile;
}
Future<int> getSdkVersion() async {
final AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
return info.version.sdkInt;
}
String getApiUrl() {
@@ -39,11 +80,29 @@ class ManagerAPI {
if (url.isEmpty || url == ' ') {
url = defaultApiUrl;
}
await _revancedAPI.initialize(url);
await _revancedAPI.clearAllCache();
await _prefs.setString('apiUrl', url);
}
String getRepoUrl() {
return _prefs.getString('repoUrl') ?? defaultRepoUrl;
}
Future<void> setRepoUrl(String url) async {
if (url.isEmpty || url == ' ') {
url = defaultRepoUrl;
}
await _prefs.setString('repoUrl', url);
}
String getPatchesDownloadURL() {
return _prefs.getString('patchesDownloadURL') ?? '';
}
Future<void> setPatchesDownloadURL(String value) async {
await _prefs.setString('patchesDownloadURL', value);
}
String getPatchesRepo() {
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
}
@@ -55,6 +114,109 @@ class ManagerAPI {
await _prefs.setString('patchesRepo', value);
}
bool getPatchesConsent() {
return _prefs.getBool('patchesConsent') ?? false;
}
Future<void> setPatchesConsent(bool consent) async {
await _prefs.setBool('patchesConsent', consent);
}
bool isPatchesAutoUpdate() {
return _prefs.getBool('patchesAutoUpdate') ?? false;
}
bool isPatchesChangeEnabled() {
return _prefs.getBool('patchesChangeEnabled') ?? false;
}
void setPatchesChangeEnabled(bool value) {
_prefs.setBool('patchesChangeEnabled', value);
}
bool showPatchesChangeWarning() {
return _prefs.getBool('showPatchesChangeWarning') ?? true;
}
void setPatchesChangeWarning(bool value) {
_prefs.setBool('showPatchesChangeWarning', !value);
}
bool isChangingToggleModified() {
return _prefs.getBool('isChangingToggleModified') ?? false;
}
void setChangingToggleModified(bool value) {
_prefs.setBool('isChangingToggleModified', value);
}
Future<void> setPatchesAutoUpdate(bool value) async {
await _prefs.setBool('patchesAutoUpdate', value);
}
List<Patch> getSavedPatches(String packageName) {
final List<String> patchesJson =
_prefs.getStringList('savedPatches-$packageName') ?? [];
final List<Patch> patches = patchesJson.map((String patchJson) {
return Patch.fromJson(jsonDecode(patchJson));
}).toList();
return patches;
}
Future<void> savePatches(List<Patch> patches, String packageName) async {
final List<String> patchesJson = patches.map((Patch patch) {
return jsonEncode(patch.toJson());
}).toList();
await _prefs.setStringList('savedPatches-$packageName', patchesJson);
}
String getIntegrationsDownloadURL() {
return _prefs.getString('integrationsDownloadURL') ?? '';
}
Future<void> setIntegrationsDownloadURL(String value) async {
await _prefs.setString('integrationsDownloadURL', value);
}
List<Patch> getUsedPatches(String packageName) {
final List<String> patchesJson =
_prefs.getStringList('usedPatches-$packageName') ?? [];
final List<Patch> patches = patchesJson.map((String patchJson) {
return Patch.fromJson(jsonDecode(patchJson));
}).toList();
return patches;
}
Future<void> setUsedPatches(List<Patch> patches, String packageName) async {
final List<String> patchesJson = patches.map((Patch patch) {
return jsonEncode(patch.toJson());
}).toList();
await _prefs.setStringList('usedPatches-$packageName', patchesJson);
}
Option? getPatchOption(String packageName, String patchName, String key) {
final String? optionJson =
_prefs.getString('patchOption-$packageName-$patchName-$key');
if (optionJson != null) {
final Option option = Option.fromJson(jsonDecode(optionJson));
return option;
} else {
return null;
}
}
void setPatchOption(Option option, String patchName, String packageName) {
final String optionJson = jsonEncode(option.toJson());
_prefs.setString(
'patchOption-$packageName-$patchName-${option.key}',
optionJson,
);
}
void clearPatchOption(String packageName, String patchName, String key) {
_prefs.remove('patchOption-$packageName-$patchName-$key');
}
String getIntegrationsRepo() {
return _prefs.getString('integrationsRepo') ?? defaultIntegrationsRepo;
}
@@ -74,20 +236,44 @@ class ManagerAPI {
await _prefs.setBool('useDynamicTheme', value);
}
bool getUseDarkTheme() {
return _prefs.getBool('useDarkTheme') ?? false;
int getThemeMode() {
return _prefs.getInt('themeMode') ?? 2;
}
Future<void> setUseDarkTheme(bool value) async {
await _prefs.setBool('useDarkTheme', value);
Future<void> setThemeMode(int value) async {
await _prefs.setInt('themeMode', value);
}
bool isSentryEnabled() {
return _prefs.getBool('sentryEnabled') ?? true;
bool areUniversalPatchesEnabled() {
return _prefs.getBool('universalPatchesEnabled') ?? false;
}
Future<void> setSentryStatus(bool value) async {
await _prefs.setBool('sentryEnabled', value);
Future<void> enableUniversalPatchesStatus(bool value) async {
await _prefs.setBool('universalPatchesEnabled', value);
}
bool isVersionCompatibilityCheckEnabled() {
return _prefs.getBool('versionCompatibilityCheckEnabled') ?? true;
}
Future<void> enableVersionCompatibilityCheckStatus(bool value) async {
await _prefs.setBool('versionCompatibilityCheckEnabled', value);
}
bool isRequireSuggestedAppVersionEnabled() {
return _prefs.getBool('requireSuggestedAppVersionEnabled') ?? true;
}
Future<void> enableRequireSuggestedAppVersionStatus(bool value) async {
await _prefs.setBool('requireSuggestedAppVersionEnabled', value);
}
Future<void> setKeystorePassword(String password) async {
await _prefs.setString('keystorePassword', password);
}
String getKeystorePassword() {
return _prefs.getString('keystorePassword') ?? defaultKeystorePassword;
}
Future<void> deleteTempFolder() async {
@@ -99,29 +285,34 @@ class ManagerAPI {
Future<void> deleteKeystore() async {
final File keystore = File(
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-keystore.keystore');
keystoreFile,
);
if (await keystore.exists()) {
await keystore.delete();
}
}
List<PatchedApplication> getPatchedApps() {
List<String> apps = _prefs.getStringList('patchedApps') ?? [];
final List<String> apps = _prefs.getStringList('patchedApps') ?? [];
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();
}
Future<void> setPatchedApps(List<PatchedApplication> patchedApps) async {
Future<void> setPatchedApps(
List<PatchedApplication> patchedApps,
) async {
if (patchedApps.length > 1) {
patchedApps.sort((a, b) => a.name.compareTo(b.name));
}
await _prefs.setStringList('patchedApps',
patchedApps.map((a) => json.encode(a.toJson())).toList());
await _prefs.setStringList(
'patchedApps',
patchedApps.map((a) => json.encode(a.toJson())).toList(),
);
}
Future<void> savePatchedApp(PatchedApplication app) async {
List<PatchedApplication> patchedApps = getPatchedApps();
final List<PatchedApplication> patchedApps = getPatchedApps();
patchedApps.removeWhere((a) => a.packageName == app.packageName);
ApplicationWithIcon? installed = await DeviceApps.getApp(
final ApplicationWithIcon? installed = await DeviceApps.getApp(
app.packageName,
true,
) as ApplicationWithIcon?;
@@ -135,17 +326,19 @@ class ManagerAPI {
}
Future<void> deletePatchedApp(PatchedApplication app) async {
List<PatchedApplication> patchedApps = getPatchedApps();
final List<PatchedApplication> patchedApps = getPatchedApps();
patchedApps.removeWhere((a) => a.packageName == app.packageName);
await setPatchedApps(patchedApps);
}
void clearAllData() async {
Future<void> clearAllData() async {
try {
_revancedAPI.clearAllCache();
_githubAPI.clearAllCache();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
@@ -154,63 +347,109 @@ class ManagerAPI {
}
Future<List<Patch>> getPatches() async {
try {
String repoName = getPatchesRepo();
if (repoName == defaultPatchesRepo) {
return await _revancedAPI.getPatches();
} else {
return await _githubAPI.getPatches(repoName);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return [];
if (patches.isNotEmpty) {
return patches;
}
final File? patchBundleFile = await downloadPatches();
final Directory appCache = await getTemporaryDirectory();
Directory('${appCache.path}/cache').createSync();
final Directory workDir =
Directory('${appCache.path}/cache').createTempSync('tmp-');
final Directory cacheDir = Directory('${workDir.path}/cache');
cacheDir.createSync();
if (patchBundleFile != null) {
try {
final String patchesJson = await PatcherAPI.patcherChannel.invokeMethod(
'getPatches',
{
'patchBundleFilePath': patchBundleFile.path,
'cacheDirPath': cacheDir.path,
},
);
final List<dynamic> patchesJsonList = jsonDecode(patchesJson);
patches = patchesJsonList
.map((patchJson) => Patch.fromJson(patchJson))
.toList();
return patches;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
return List.empty();
}
Future<File?> downloadPatches() async {
try {
String repoName = getPatchesRepo();
if (repoName == defaultPatchesRepo) {
return await _revancedAPI.getLatestReleaseFile(
'.jar',
defaultPatchesRepo,
);
} else {
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
final String repoName = getPatchesRepo();
final String currentVersion = await getCurrentPatchesVersion();
final String url = getPatchesDownloadURL();
return await _githubAPI.getPatchesReleaseFile(
'.jar',
repoName,
currentVersion,
url,
);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return null;
}
}
Future<File?> downloadIntegrations() async {
try {
String repoName = getIntegrationsRepo();
if (repoName == defaultIntegrationsRepo) {
return await _revancedAPI.getLatestReleaseFile(
'.apk',
defaultIntegrationsRepo,
);
} else {
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
final String repoName = getIntegrationsRepo();
final String currentVersion = await getCurrentIntegrationsVersion();
final String url = getIntegrationsDownloadURL();
return await _githubAPI.getPatchesReleaseFile(
'.apk',
repoName,
currentVersion,
url,
);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return null;
}
}
Future<File?> downloadManager() async {
return await _revancedAPI.getLatestReleaseFile('.apk', defaultManagerRepo);
return await _revancedAPI.getLatestReleaseFile(
'.apk',
defaultManagerRepo,
);
}
Future<String?> getLatestPatcherReleaseTime() async {
return await _revancedAPI.getLatestReleaseTime('.gz', defaultPatcherRepo);
Future<String?> getLatestPatchesReleaseTime() async {
if (isDefaultPatchesRepo()) {
return await _revancedAPI.getLatestReleaseTime(
'.json',
defaultPatchesRepo,
);
} else {
final release =
await _githubAPI.getLatestPatchesRelease(getPatchesRepo());
if (release != null) {
final DateTime timestamp =
DateTime.parse(release['created_at'] as String);
return format(timestamp, locale: 'en_short');
} else {
return null;
}
}
}
Future<String?> getLatestManagerReleaseTime() async {
return await _revancedAPI.getLatestReleaseTime('.apk', defaultManagerRepo);
return await _revancedAPI.getLatestReleaseTime(
'.apk',
defaultManagerRepo,
);
}
Future<String?> getLatestManagerVersion() async {
@@ -220,24 +459,87 @@ class ManagerAPI {
);
}
Future<String?> getLatestIntegrationsVersion() async {
if (isDefaultIntegrationsRepo()) {
return await _revancedAPI.getLatestReleaseVersion(
'.apk',
defaultIntegrationsRepo,
);
} else {
final release = await _githubAPI.getLatestRelease(getIntegrationsRepo());
if (release != null) {
return release['tag_name'];
} else {
return null;
}
}
}
Future<String?> getLatestPatchesVersion() async {
return await _revancedAPI.getLatestReleaseVersion(
'.json',
defaultPatchesRepo,
);
if (isDefaultPatchesRepo()) {
return await _revancedAPI.getLatestReleaseVersion(
'.json',
defaultPatchesRepo,
);
} else {
final release =
await _githubAPI.getLatestPatchesRelease(getPatchesRepo());
if (release != null) {
return release['tag_name'];
} else {
return null;
}
}
}
Future<String> getCurrentManagerVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.version;
}
Future<String> getCurrentPatchesVersion() async {
patchesVersion = _prefs.getString('patchesVersion') ?? '0.0.0';
if (patchesVersion == '0.0.0' || isPatchesAutoUpdate()) {
final String newPatchesVersion =
await getLatestPatchesVersion() ?? '0.0.0';
if (patchesVersion != newPatchesVersion && newPatchesVersion != '0.0.0') {
await setCurrentPatchesVersion(newPatchesVersion);
}
}
return patchesVersion!;
}
Future<void> setCurrentPatchesVersion(String version) async {
await _prefs.setString('patchesVersion', version);
await setPatchesDownloadURL('');
await downloadPatches();
}
Future<String> getCurrentIntegrationsVersion() async {
integrationsVersion = _prefs.getString('integrationsVersion') ?? '0.0.0';
if (integrationsVersion == '0.0.0' || isPatchesAutoUpdate()) {
final String newIntegrationsVersion =
await getLatestIntegrationsVersion() ?? '0.0.0';
if (integrationsVersion != newIntegrationsVersion &&
newIntegrationsVersion != '0.0.0') {
await setCurrentIntegrationsVersion(newIntegrationsVersion);
}
}
return integrationsVersion!;
}
Future<void> setCurrentIntegrationsVersion(String version) async {
await _prefs.setString('integrationsVersion', version);
await setIntegrationsDownloadURL('');
await downloadIntegrations();
}
Future<List<PatchedApplication>> getAppsToRemove(
List<PatchedApplication> patchedApps,
) async {
List<PatchedApplication> toRemove = [];
for (PatchedApplication app in patchedApps) {
bool isRemove = await isAppUninstalled(app);
final List<PatchedApplication> toRemove = [];
for (final PatchedApplication app in patchedApps) {
final bool isRemove = await isAppUninstalled(app);
if (isRemove) {
toRemove.add(app);
}
@@ -245,101 +547,116 @@ class ManagerAPI {
return toRemove;
}
Future<List<PatchedApplication>> getUnsavedApps(
List<PatchedApplication> patchedApps,
) async {
List<PatchedApplication> unsavedApps = [];
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
Future<List<PatchedApplication>> getMountedApps() async {
final List<PatchedApplication> mountedApps = [];
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) {
List<String> installedApps = await _rootAPI.getInstalledApps();
for (String packageName in installedApps) {
if (!patchedApps.any((app) => app.packageName == packageName)) {
ApplicationWithIcon? application = await DeviceApps.getApp(
packageName,
true,
) as ApplicationWithIcon?;
if (application != null) {
unsavedApps.add(
PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: application.apkFilePath,
icon: application.icon,
patchDate: DateTime.now(),
isRooted: true,
),
);
}
}
}
}
List<Application> userApps = await DeviceApps.getInstalledApplications(
includeSystemApps: false,
includeAppIcons: false,
);
for (Application app in userApps) {
if (app.packageName.startsWith('app.revanced') &&
!app.packageName.startsWith('app.revanced.manager.') &&
!patchedApps.any((uapp) => uapp.packageName == app.packageName)) {
ApplicationWithIcon? application = await DeviceApps.getApp(
app.packageName,
final List<String> installedApps = await _rootAPI.getInstalledApps();
for (final String packageName in installedApps) {
final ApplicationWithIcon? application = await DeviceApps.getApp(
packageName,
true,
) as ApplicationWithIcon?;
if (application != null) {
unsavedApps.add(
mountedApps.add(
PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: application.apkFilePath,
icon: application.icon,
patchDate: DateTime.now(),
isRooted: false,
isRooted: true,
),
);
}
}
}
return unsavedApps;
return mountedApps;
}
Future<void> showPatchesChangeWarningDialog(BuildContext context) {
final ValueNotifier<bool> noShow =
ValueNotifier(!showPatchesChangeWarning());
return showDialog(
barrierDismissible: false,
context: context,
builder: (context) => WillPopScope(
onWillPop: () async => false,
child: AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'),
content: ValueListenableBuilder(
valueListenable: noShow,
builder: (context, value, child) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
I18nText(
'patchItem.patchesChangeWarningDialogText',
child: const Text(
'',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 8),
CheckboxListTile(
value: value,
contentPadding: EdgeInsets.zero,
title: I18nText(
'noShowAgain',
),
onChanged: (selected) {
noShow.value = selected!;
},
),
],
);
},
),
actions: [
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () {
setPatchesChangeWarning(noShow.value);
Navigator.of(context).pop();
},
),
],
),
),
);
}
Future<void> reAssessSavedApps() async {
List<PatchedApplication> patchedApps = getPatchedApps();
List<PatchedApplication> unsavedApps = await getUnsavedApps(patchedApps);
patchedApps.addAll(unsavedApps);
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
final List<PatchedApplication> patchedApps = getPatchedApps();
// Remove apps that are not installed anymore.
final List<PatchedApplication> toRemove =
await getAppsToRemove(patchedApps);
patchedApps.removeWhere((a) => toRemove.contains(a));
for (PatchedApplication app in patchedApps) {
app.hasUpdates =
await hasAppUpdates(app.originalPackageName, app.patchDate);
app.changelog =
await getAppChangelog(app.originalPackageName, app.patchDate);
if (!app.hasUpdates) {
String? currentInstalledVersion =
(await DeviceApps.getApp(app.packageName))?.versionName;
if (currentInstalledVersion != null) {
String currentSavedVersion = app.version;
int currentInstalledVersionInt = int.parse(
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
int currentSavedVersionInt =
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
if (currentInstalledVersionInt > currentSavedVersionInt) {
app.hasUpdates = true;
}
}
}
}
// Determine all apps that are installed by mounting.
final List<PatchedApplication> mountedApps = await getMountedApps();
mountedApps.removeWhere(
(app) => patchedApps
.any((patchedApp) => patchedApp.packageName == app.packageName),
);
patchedApps.addAll(mountedApps);
await setPatchedApps(patchedApps);
}
Future<bool> isAppUninstalled(PatchedApplication app) async {
bool existsRoot = false;
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
final bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
if (app.isRooted) {
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) {
existsRoot = await _rootAPI.isAppInstalled(app.packageName);
}
@@ -348,32 +665,6 @@ class ManagerAPI {
return !existsNonRoot;
}
Future<bool> hasAppUpdates(String packageName, DateTime patchDate) async {
List<String> commits = await _githubAPI.getCommits(
packageName,
getPatchesRepo(),
patchDate,
);
return commits.isNotEmpty;
}
Future<List<String>> getAppChangelog(
String packageName, DateTime patchDate) async {
List<String> newCommits = await _githubAPI.getCommits(
packageName,
getPatchesRepo(),
patchDate,
);
if (newCommits.isEmpty) {
newCommits = await _githubAPI.getCommits(
packageName,
getPatchesRepo(),
patchDate,
);
}
return newCommits;
}
Future<bool> isSplitApk(PatchedApplication patchedApp) async {
Application? app;
if (patchedApp.isFromStorage) {
@@ -383,4 +674,74 @@ class ManagerAPI {
}
return app != null && app.isSplit;
}
Future<void> setSelectedPatches(
String app,
List<String> patches,
) async {
final File selectedPatchesFile = File(storedPatchesFile);
final Map<String, dynamic> patchesMap = await readSelectedPatchesFile();
if (patches.isEmpty) {
patchesMap.remove(app);
} else {
patchesMap[app] = patches;
}
selectedPatchesFile.writeAsString(jsonEncode(patchesMap));
}
// get default patches for app
Future<List<String>> getDefaultPatches() async {
final List<Patch> patches = await getPatches();
final List<String> defaultPatches = [];
if (isVersionCompatibilityCheckEnabled() == true) {
defaultPatches.addAll(
patches
.where(
(element) =>
element.excluded == false && isPatchSupported(element),
)
.map((p) => p.name),
);
} else {
defaultPatches.addAll(
patches
.where((element) => isPatchSupported(element))
.map((p) => p.name),
);
}
return defaultPatches;
}
Future<List<String>> getSelectedPatches(String app) async {
final Map<String, dynamic> patchesMap = await readSelectedPatchesFile();
final List<String> defaultPatches = await getDefaultPatches();
return List.from(patchesMap.putIfAbsent(app, () => defaultPatches));
}
Future<Map<String, dynamic>> readSelectedPatchesFile() async {
final File selectedPatchesFile = File(storedPatchesFile);
if (!selectedPatchesFile.existsSync()) {
return {};
}
final String string = selectedPatchesFile.readAsStringSync();
if (string.trim().isEmpty) {
return {};
}
return jsonDecode(string);
}
void resetAllOptions() {
_prefs.getKeys().where((key) => key.startsWith('patchOption-')).forEach(
(key) {
_prefs.remove(key);
},
);
}
Future<void> resetLastSelectedPatches() async {
final File selectedPatchesFile = File(storedPatchesFile);
if (selectedPatchesFile.existsSync()) {
selectedPatchesFile.deleteSync();
}
}
}

View File

@@ -1,33 +1,39 @@
import 'dart:io';
import 'package:app_installer/app_installer.dart';
import 'package:collection/collection.dart';
import 'package:device_apps/device_apps.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_file_dialog/flutter_file_dialog.dart';
import 'package:injectable/injectable.dart';
import 'package:install_plugin/install_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:share_extend/share_extend.dart';
import 'package:share_plus/share_plus.dart';
@lazySingleton
class PatcherAPI {
static const patcherChannel =
MethodChannel('app.revanced.manager.flutter/patcher');
MethodChannel('app.revanced.manager.flutter/patcher');
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final RootAPI _rootAPI = RootAPI();
late Directory _dataDir;
late Directory _tmpDir;
late File _keyStoreFile;
List<Patch> _patches = [];
File? _outFile;
List<Patch> _universalPatches = [];
List<String> _compatiblePackages = [];
Map filteredPatches = <String, List<Patch>>{};
File? outFile;
Future<void> initialize() async {
await _loadPatches();
Directory appCache = await getTemporaryDirectory();
await loadPatches();
await _managerAPI.downloadIntegrations();
final Directory appCache = await getTemporaryDirectory();
_dataDir = await getExternalStorageDirectory() ?? appCache;
_tmpDir = Directory('${appCache.path}/patcher');
_keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore');
@@ -40,250 +46,281 @@ class PatcherAPI {
}
}
Future<void> _loadPatches() async {
List<String> getCompatiblePackages() {
final List<String> compatiblePackages = [];
for (final Patch patch in _patches) {
for (final Package package in patch.compatiblePackages) {
if (!compatiblePackages.contains(package.name)) {
compatiblePackages.add(package.name);
}
}
}
return compatiblePackages;
}
List<Patch> getUniversalPatches() {
return _patches.where((patch) => patch.compatiblePackages.isEmpty).toList();
}
Future<void> loadPatches() async {
try {
if (_patches.isEmpty) {
_patches = await _managerAPI.getPatches();
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
_patches = List.empty();
}
_compatiblePackages = getCompatiblePackages();
_universalPatches = getUniversalPatches();
}
Future<List<ApplicationWithIcon>> getFilteredInstalledApps() async {
List<ApplicationWithIcon> filteredApps = [];
for (Patch patch in _patches) {
for (Package package in patch.compatiblePackages) {
try {
if (!filteredApps.any((app) => app.packageName == package.name)) {
ApplicationWithIcon? app = await DeviceApps.getApp(
package.name,
true,
) as ApplicationWithIcon?;
if (app != null) {
filteredApps.add(app);
}
Future<List<ApplicationWithIcon>> getFilteredInstalledApps(
bool showUniversalPatches,) async {
final List<ApplicationWithIcon> filteredApps = [];
final bool allAppsIncluded =
_universalPatches.isNotEmpty && showUniversalPatches;
if (allAppsIncluded) {
final appList = await DeviceApps.getInstalledApplications(
includeAppIcons: true,
onlyAppsWithLaunchIntent: true,
);
for (final app in appList) {
filteredApps.add(app as ApplicationWithIcon);
}
}
for (final packageName in _compatiblePackages) {
try {
if (!filteredApps.any((app) => app.packageName == packageName)) {
final ApplicationWithIcon? app = await DeviceApps.getApp(
packageName,
true,
) as ApplicationWithIcon?;
if (app != null) {
filteredApps.add(app);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
continue;
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
return filteredApps;
}
Future<List<Patch>> getFilteredPatches(String packageName) async {
return _patches
.where((patch) =>
!patch.name.contains('settings') &&
patch.compatiblePackages.any((pack) => pack.name == packageName))
List<Patch> getFilteredPatches(String packageName) {
if (!_compatiblePackages.contains(packageName)) {
return _universalPatches;
}
final List<Patch> patches = _patches
.where(
(patch) =>
patch.compatiblePackages.isEmpty ||
!patch.name.contains('settings') &&
patch.compatiblePackages
.any((pack) => pack.name == packageName),
)
.toList();
if (!_managerAPI.areUniversalPatchesEnabled()) {
filteredPatches[packageName] = patches
.where((patch) => patch.compatiblePackages.isNotEmpty)
.toList();
} else {
filteredPatches[packageName] = patches;
}
return filteredPatches[packageName];
}
Future<List<Patch>> getAppliedPatches(List<String> appliedPatches) async {
Future<List<Patch>> getAppliedPatches(List<String> appliedPatches,) async {
return _patches
.where((patch) => appliedPatches.contains(patch.name))
.toList();
}
bool dependencyNeedsIntegrations(String name) {
return name.contains('integrations') ||
_patches.any(
(patch) =>
patch.name == name &&
(patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
)),
);
}
Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
),
);
}
Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
(dep) => dep.contains('resource-'),
),
);
}
Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
(dep) => dep.contains('settings'),
),
);
}
Future<String> getOriginalFilePath(
String packageName,
String originalFilePath,
) async {
try {
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) {
originalFilePath = await _rootAPI.getOriginalFilePath(
packageName,
originalFilePath,
);
}
return originalFilePath;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return originalFilePath;
}
}
Future<void> runPatcher(
String packageName,
String originalFilePath,
List<Patch> selectedPatches,
) async {
bool mergeIntegrations = await needsIntegrations(selectedPatches);
bool includeSettings = await needsSettingsPatch(selectedPatches);
if (includeSettings) {
try {
Patch? settingsPatch = _patches.firstWhereOrNull(
(patch) =>
patch.name.contains('settings') &&
patch.compatiblePackages.any((pack) => pack.name == packageName),
);
if (settingsPatch != null) {
selectedPatches.add(settingsPatch);
Future<void> runPatcher(String packageName,
String apkFilePath,
List<Patch> selectedPatches,) async {
final File? integrationsFile = await _managerAPI.downloadIntegrations();
final Map<String, Map<String, dynamic>> options = {};
for (final patch in selectedPatches) {
if (patch.options.isNotEmpty) {
final Map<String, dynamic> patchOptions = {};
for (final option in patch.options) {
final patchOption = _managerAPI.getPatchOption(packageName, patch.name, option.key);
if (patchOption != null) {
patchOptions[patchOption.key] = patchOption.value;
}
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
// ignore
options[patch.name] = patchOptions;
}
}
File? patchBundleFile = await _managerAPI.downloadPatches();
File? integrationsFile;
if (mergeIntegrations) {
integrationsFile = await _managerAPI.downloadIntegrations();
}
if (patchBundleFile != null) {
if (integrationsFile != null) {
_dataDir.createSync();
_tmpDir.createSync();
Directory workDir = _tmpDir.createTempSync('tmp-');
File inputFile = File('${workDir.path}/base.apk');
File patchedFile = File('${workDir.path}/patched.apk');
_outFile = File('${workDir.path}/out.apk');
Directory cacheDir = Directory('${workDir.path}/cache');
final Directory workDir = _tmpDir.createTempSync('tmp-');
final File inputFile = File('${workDir.path}/base.apk');
final File patchedFile = File('${workDir.path}/patched.apk');
outFile = File('${workDir.path}/out.apk');
final Directory cacheDir = Directory('${workDir.path}/cache');
cacheDir.createSync();
final String originalFilePath = apkFilePath;
try {
await patcherChannel.invokeMethod(
'runPatcher',
{
'patchBundleFilePath': patchBundleFile.path,
'originalFilePath': await getOriginalFilePath(
packageName,
originalFilePath,
),
'originalFilePath': originalFilePath,
'inputFilePath': inputFile.path,
'patchedFilePath': patchedFile.path,
'outFilePath': _outFile!.path,
'integrationsPath': mergeIntegrations ? integrationsFile!.path : '',
'outFilePath': outFile!.path,
'integrationsPath': integrationsFile.path,
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
'options': options,
'cacheDirPath': cacheDir.path,
'mergeIntegrations': mergeIntegrations,
'keyStoreFilePath': _keyStoreFile.path,
'keystorePassword': _managerAPI.getKeystorePassword(),
},
);
} on Exception catch (e, s) {
print(e);
throw await Sentry.captureException(e, stackTrace: s);
}
}
}
Future<bool> installPatchedFile(PatchedApplication patchedApp) async {
if (_outFile != null) {
try {
if (patchedApp.isRooted) {
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) {
return _rootAPI.installApp(
patchedApp.packageName,
patchedApp.apkFilePath,
_outFile!.path,
);
}
} else {
await AppInstaller.installApk(_outFile!.path);
return await DeviceApps.isAppInstalled(patchedApp.packageName);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return false;
}
}
return false;
}
void sharePatchedFile(String appName, String version) {
try {
if (_outFile != null) {
String prefix = appName.toLowerCase().replaceAll(' ', '-');
String newName = '$prefix-revanced_v$version.apk';
int lastSeparator = _outFile!.path.lastIndexOf('/');
String newPath =
_outFile!.path.substring(0, lastSeparator + 1) + newName;
File shareFile = _outFile!.copySync(newPath);
ShareExtend.share(shareFile.path, 'file');
}
} on Exception catch (e, s) {
Sentry.captureException(e, stackTrace: s);
}
}
Future<void> sharePatcherLog(String logs) async {
Directory appCache = await getTemporaryDirectory();
Directory logDir = Directory('${appCache.path}/logs');
logDir.createSync();
String dateTime = DateTime.now()
.toIso8601String()
.replaceAll('-', '')
.replaceAll(':', '')
.replaceAll('T', '')
.replaceAll('.', '');
File log = File('${logDir.path}/revanced-manager_patcher_$dateTime.log');
log.writeAsStringSync(logs);
ShareExtend.share(log.path, 'file');
}
String getRecommendedVersion(String packageName) {
Map<String, int> versions = {};
for (Patch patch in _patches) {
Package? package = patch.compatiblePackages.firstWhereOrNull(
(pack) => pack.name == packageName,
);
if (package != null) {
for (String version in package.versions) {
versions.update(
version,
(value) => versions[version]! + 1,
ifAbsent: () => 1,
);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
if (versions.isNotEmpty) {
var entries = versions.entries.toList()
..sort((a, b) => a.value.compareTo(b.value));
versions
..clear()
..addEntries(entries);
versions.removeWhere((key, value) => value != versions.values.last);
return (versions.keys.toList()..sort()).last;
}
Future<void> stopPatcher() async {
try {
await patcherChannel.invokeMethod('stopPatcher');
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return '';
}
}
Future<bool> installPatchedFile(PatchedApplication patchedApp) async {
if (outFile != null) {
try {
if (patchedApp.isRooted) {
final bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) {
return _rootAPI.installApp(
patchedApp.packageName,
patchedApp.apkFilePath,
outFile!.path,
);
}
} else {
final install = await InstallPlugin.installApk(outFile!.path);
return install['isSuccess'];
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return false;
}
}
return false;
}
void exportPatchedFile(String appName, String version) {
try {
if (outFile != null) {
final String newName = _getFileName(appName, version);
FlutterFileDialog.saveFile(
params: SaveFileDialogParams(
sourceFilePath: outFile!.path,
fileName: newName,
mimeTypesFilter: ['application/vnd.android.package-archive'],
),
);
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
void sharePatchedFile(String appName, String version) {
try {
if (outFile != null) {
final String newName = _getFileName(appName, version);
final int lastSeparator = outFile!.path.lastIndexOf('/');
final String newPath =
outFile!.path.substring(0, lastSeparator + 1) + newName;
final File shareFile = outFile!.copySync(newPath);
Share.shareXFiles([XFile(shareFile.path)]);
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
String _getFileName(String appName, String version) {
final String patchVersion = _managerAPI.patchesVersion!;
final String prefix = appName.toLowerCase().replaceAll(' ', '-');
final String newName = '$prefix-revanced_v$version-patches_$patchVersion.apk';
return newName;
}
Future<void> exportPatcherLog(String logs) async {
final Directory appCache = await getTemporaryDirectory();
final Directory logDir = Directory('${appCache.path}/logs');
logDir.createSync();
final String dateTime = DateTime.now()
.toIso8601String()
.replaceAll('-', '')
.replaceAll(':', '')
.replaceAll('T', '')
.replaceAll('.', '');
final String fileName = 'revanced-manager_patcher_$dateTime.txt';
final File log = File('${logDir.path}/$fileName');
log.writeAsStringSync(logs);
FlutterFileDialog.saveFile(
params:SaveFileDialogParams(
sourceFilePath: log.path,
fileName: fileName,
),
);
}
String getSuggestedVersion(String packageName) {
final Map<String, int> versions = {};
for (final Patch patch in _patches) {
final Package? package = patch.compatiblePackages.firstWhereOrNull(
(pack) => pack.name == packageName,
);
if (package != null) {
for (final String version in package.versions) {
versions.update(
version,
(value) => versions[version]! + 1,
ifAbsent: () => 1,
);
}
}
}
if (versions.isNotEmpty) {
final entries = versions.entries.toList()
..sort((a, b) => a.value.compareTo(b.value));
versions
..clear()
..addEntries(entries);
versions.removeWhere((key, value) => value != versions.values.last);
return (versions.keys.toList()
..sort()).last;
}
return '';
}}

View File

@@ -1,101 +1,69 @@
import 'dart:async';
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:native_dio_client/native_dio_client.dart';
import 'package:dio/dio.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/utils/check_for_gms.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/download_manager.dart';
import 'package:synchronized/synchronized.dart';
import 'package:timeago/timeago.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_dio/sentry_dio.dart';
@lazySingleton
class RevancedAPI {
late Dio _dio = Dio();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(hours: 6),
maxStale: const Duration(days: 1),
);
late final Dio _dio;
late final DownloadManager _downloadManager = locator<DownloadManager>();
Future<void> initialize(String apiUrl) async {
try {
bool isGMSInstalled = await checkForGMS();
final Lock getToolsLock = Lock();
if (!isGMSInstalled) {
_dio = Dio(BaseOptions(
baseUrl: apiUrl,
));
print('ReVanced API: Using default engine + $isGMSInstalled');
} else {
_dio = Dio(BaseOptions(
baseUrl: apiUrl,
))
..httpClientAdapter = NativeAdapter();
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
}
_dio.interceptors.add(_dioCacheManager.interceptor);
_dio.addSentry(
captureFailedRequests: true,
);
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
}
Future<void> initialize(String repoUrl) async {
_dio = _downloadManager.initDio(repoUrl);
}
Future<void> clearAllCache() async {
try {
await _dioCacheManager.clearAll();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
}
await _downloadManager.clearAllCache();
}
Future<Map<String, List<dynamic>>> getContributors() async {
Map<String, List<dynamic>> contributors = {};
final Map<String, List<dynamic>> contributors = {};
try {
var response = await _dio.get('/contributors', options: _cacheOptions);
List<dynamic> repositories = response.data['repositories'];
for (Map<String, dynamic> repo in repositories) {
String name = repo['name'];
final response = await _dio.get('/contributors');
final List<dynamic> repositories = response.data['repositories'];
for (final Map<String, dynamic> repo in repositories) {
final String name = repo['name'];
contributors[name] = repo['contributors'];
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return {};
}
return contributors;
}
Future<List<Patch>> getPatches() async {
try {
var response = await _dio.get('/patches', options: _cacheOptions);
List<dynamic> patches = response.data;
return patches.map((patch) => Patch.fromJson(patch)).toList();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return List.empty();
}
}
Future<Map<String, dynamic>?> _getLatestRelease(
String extension,
String repoName,
) async {
try {
var response = await _dio.get('/tools', options: _cacheOptions);
List<dynamic> tools = response.data['tools'];
return tools.firstWhereOrNull(
(t) =>
t['repository'] == repoName &&
(t['name'] as String).endsWith(extension),
);
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return null;
}
) {
return getToolsLock.synchronized(() async {
try {
final response = await _dio.get('/tools');
final List<dynamic> tools = response.data['tools'];
return tools.firstWhereOrNull(
(t) =>
t['repository'] == repoName &&
(t['name'] as String).endsWith(extension),
);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
});
}
Future<String?> getLatestReleaseVersion(
@@ -103,52 +71,100 @@ class RevancedAPI {
String repoName,
) async {
try {
Map<String, dynamic>? release = await _getLatestRelease(
final Map<String, dynamic>? release = await _getLatestRelease(
extension,
repoName,
);
if (release != null) {
return release['version'];
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
return null;
}
Future<File?> getLatestReleaseFile(String extension, String repoName) async {
Future<File?> getLatestReleaseFile(
String extension,
String repoName,
) async {
try {
Map<String, dynamic>? release = await _getLatestRelease(
final Map<String, dynamic>? release = await _getLatestRelease(
extension,
repoName,
);
if (release != null) {
String url = release['browser_download_url'];
return await DefaultCacheManager().getSingleFile(url);
final String url = release['browser_download_url'];
return await _downloadManager.getSingleFile(url);
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return null;
}
return null;
}
StreamController<double> managerUpdateProgress =
StreamController<double>.broadcast();
void updateManagerDownloadProgress(int progress) {
managerUpdateProgress.add(progress.toDouble());
}
Stream<double> getManagerUpdateProgress() {
return managerUpdateProgress.stream;
}
void disposeManagerUpdateProgress() {
managerUpdateProgress.close();
}
Future<File?> downloadManager() async {
final Map<String, dynamic>? release = await _getLatestRelease(
'.apk',
'revanced/revanced-manager',
);
File? outputFile;
await for (final result in _downloadManager.getFileStream(
release!['browser_download_url'] as String,
)) {
if (result is DownloadProgress) {
final totalSize = result.totalSize ?? 10000000;
final progress = (result.downloaded / totalSize * 100).round();
updateManagerDownloadProgress(progress);
} else if (result is FileInfo) {
disposeManagerUpdateProgress();
// The download is complete; convert the FileInfo object to a File object
outputFile = File(result.file.path);
}
}
return outputFile;
}
Future<String?> getLatestReleaseTime(
String extension,
String repoName,
) async {
try {
Map<String, dynamic>? release = await _getLatestRelease(
final Map<String, dynamic>? release = await _getLatestRelease(
extension,
repoName,
);
if (release != null) {
DateTime timestamp = DateTime.parse(release['timestamp'] as String);
final DateTime timestamp =
DateTime.parse(release['timestamp'] as String);
return format(timestamp, locale: 'en_short');
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
return null;

View File

@@ -1,17 +1,21 @@
import 'package:flutter/foundation.dart';
import 'package:root/root.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
class RootAPI {
final String _managerDirPath = '/data/local/tmp/revanced-manager';
// TODO(ponces): remove in the future, keep it for now during migration.
final String _revancedOldDirPath = '/data/local/tmp/revanced-manager';
final String _revancedDirPath = '/data/adb/revanced';
final String _postFsDataDirPath = '/data/adb/post-fs-data.d';
final String _serviceDDirPath = '/data/adb/service.d';
Future<bool> isRooted() async {
try {
bool? isRooted = await Root.isRootAvailable();
final bool? isRooted = await Root.isRootAvailable();
return isRooted != null && isRooted;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return false;
}
}
@@ -24,8 +28,10 @@ class RootAPI {
return isRooted != null && isRooted;
}
return false;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return false;
}
}
@@ -36,53 +42,62 @@ class RootAPI {
seLinux,
String filePath,
) async {
if (permissions.isNotEmpty) {
await Root.exec(
cmd: 'chmod $permissions "$filePath"',
);
}
if (ownerGroup.isNotEmpty) {
await Root.exec(
cmd: 'chown $ownerGroup "$filePath"',
);
}
if (seLinux.isNotEmpty) {
await Root.exec(
cmd: 'chcon $seLinux "$filePath"',
);
try {
if (permissions.isNotEmpty) {
await Root.exec(
cmd: 'chmod $permissions "$filePath"',
);
}
if (ownerGroup.isNotEmpty) {
await Root.exec(
cmd: 'chown $ownerGroup "$filePath"',
);
}
if (seLinux.isNotEmpty) {
await Root.exec(
cmd: 'chcon $seLinux "$filePath"',
);
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
Future<bool> isAppInstalled(String packageName) async {
if (packageName.isNotEmpty) {
String? res = await Root.exec(
cmd: 'ls "$_managerDirPath/$packageName"',
);
if (res != null && res.isNotEmpty) {
res = await Root.exec(
cmd: 'ls "$_serviceDDirPath/$packageName.sh"',
);
return res != null && res.isNotEmpty;
}
return fileExists('$_serviceDDirPath/$packageName.sh');
}
return false;
}
Future<List<String>> getInstalledApps() async {
final List<String> apps = List.empty(growable: true);
try {
String? res = await Root.exec(
cmd: 'ls "$_managerDirPath"',
cmd: 'ls "$_revancedDirPath"',
);
if (res != null) {
List<String> apps = res.split('\n');
apps.removeWhere((pack) => pack.isEmpty);
return apps.map((pack) => pack.trim()).toList();
final List<String> list = res.split('\n');
list.removeWhere((pack) => pack.isEmpty);
apps.addAll(list.map((pack) => pack.trim()).toList());
}
// TODO(ponces): remove in the future, keep it for now during migration.
res = await Root.exec(
cmd: 'ls "$_revancedOldDirPath"',
);
if (res != null) {
final List<String> list = res.split('\n');
list.removeWhere((pack) => pack.isEmpty);
apps.addAll(list.map((pack) => pack.trim()).toList());
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return List.empty();
}
return List.empty();
return apps;
}
Future<void> deleteApp(String packageName, String originalFilePath) async {
@@ -92,8 +107,12 @@ class RootAPI {
await Root.exec(
cmd: 'su -mm -c "umount -l $originalFilePath"',
);
// TODO(ponces): remove in the future, keep it for now during migration.
await Root.exec(
cmd: 'rm -rf "$_managerDirPath/$packageName"',
cmd: 'rm -rf "$_revancedOldDirPath/$packageName"',
);
await Root.exec(
cmd: 'rm -rf "$_revancedDirPath/$packageName"',
);
await Root.exec(
cmd: 'rm -rf "$_serviceDDirPath/$packageName.sh"',
@@ -111,13 +130,13 @@ class RootAPI {
try {
await deleteApp(packageName, originalFilePath);
await Root.exec(
cmd: 'mkdir -p "$_managerDirPath/$packageName"',
cmd: 'mkdir -p "$_revancedDirPath/$packageName"',
);
await setPermissions(
'0755',
'shell:shell',
'',
'$_managerDirPath/$packageName',
'$_revancedDirPath/$packageName',
);
await saveOriginalFilePath(packageName, originalFilePath);
await installServiceDScript(packageName);
@@ -125,19 +144,24 @@ class RootAPI {
await installApk(packageName, patchedFilePath);
await mountApk(packageName, originalFilePath);
return true;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return false;
}
}
Future<void> installServiceDScript(String packageName) async {
String content = '#!/system/bin/sh\n'
await Root.exec(
cmd: 'mkdir -p "$_serviceDDirPath"',
);
final String content = '#!/system/bin/sh\n'
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 3; done\n'
'base_path=$_managerDirPath/$packageName/base.apk\n'
'base_path=$_revancedDirPath/$packageName/base.apk\n'
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
String scriptFilePath = '$_serviceDDirPath/$packageName.sh';
r'[ ! -z $stock_path ] && mount -o bind $base_path $stock_path';
final String scriptFilePath = '$_serviceDDirPath/$packageName.sh';
await Root.exec(
cmd: 'echo \'$content\' > "$scriptFilePath"',
);
@@ -145,10 +169,13 @@ class RootAPI {
}
Future<void> installPostFsDataScript(String packageName) async {
String content = '#!/system/bin/sh\n'
await Root.exec(
cmd: 'mkdir -p "$_postFsDataDirPath"',
);
final String content = '#!/system/bin/sh\n'
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
'[ ! -z \$stock_path ] && umount -l \$stock_path';
String scriptFilePath = '$_postFsDataDirPath/$packageName.sh';
r'[ ! -z $stock_path ] && umount -l $stock_path';
final String scriptFilePath = '$_postFsDataDirPath/$packageName.sh';
await Root.exec(
cmd: 'echo \'$content\' > "$scriptFilePath"',
);
@@ -156,7 +183,7 @@ class RootAPI {
}
Future<void> installApk(String packageName, String patchedFilePath) async {
String newPatchedFilePath = '$_managerDirPath/$packageName/base.apk';
final String newPatchedFilePath = '$_revancedDirPath/$packageName/base.apk';
await Root.exec(
cmd: 'cp "$patchedFilePath" "$newPatchedFilePath"',
);
@@ -169,7 +196,7 @@ class RootAPI {
}
Future<void> mountApk(String packageName, String originalFilePath) async {
String newPatchedFilePath = '$_managerDirPath/$packageName/base.apk';
final String newPatchedFilePath = '$_revancedDirPath/$packageName/base.apk';
await Root.exec(
cmd: 'am force-stop "$packageName"',
);
@@ -182,42 +209,26 @@ class RootAPI {
}
Future<bool> isMounted(String packageName) async {
String? res = await Root.exec(
final String? res = await Root.exec(
cmd: 'cat /proc/mounts | grep $packageName',
);
return res != null && res.isNotEmpty;
}
Future<String> getOriginalFilePath(
String packageName,
String originalFilePath,
) async {
bool isInstalled = await isAppInstalled(packageName);
if (isInstalled && await isMounted(packageName)) {
originalFilePath = '$_managerDirPath/$packageName/original.apk';
await setPermissions(
'0644',
'shell:shell',
'u:object_r:apk_data_file:s0',
originalFilePath,
);
}
return originalFilePath;
}
Future<void> saveOriginalFilePath(
String packageName,
String originalFilePath,
) async {
String originalRootPath = '$_managerDirPath/$packageName/original.apk';
final String originalRootPath =
'$_revancedDirPath/$packageName/original.apk';
await Root.exec(
cmd: 'mkdir -p "$_managerDirPath/$packageName"',
cmd: 'mkdir -p "$_revancedDirPath/$packageName"',
);
await setPermissions(
'0755',
'shell:shell',
'',
'$_managerDirPath/$packageName',
'$_revancedDirPath/$packageName',
);
await Root.exec(
cmd: 'cp "$originalFilePath" "$originalRootPath"',
@@ -229,4 +240,18 @@ class RootAPI {
originalFilePath,
);
}
Future<bool> fileExists(String path) async {
try {
final String? res = await Root.exec(
cmd: 'ls $path',
);
return res != null && res.isNotEmpty;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return false;
}
}
}

View File

@@ -2,9 +2,8 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
var lightCustomColorScheme = ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.light,
primary: const Color(0xff1B73E8),
seedColor: Colors.purple,
primary: const Color(0xFF4C51C0),
);
var lightCustomTheme = ThemeData(
@@ -13,7 +12,7 @@ var lightCustomTheme = ThemeData(
navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all(
TextStyle(
color: lightCustomColorScheme.secondary,
color: lightCustomColorScheme.onSurface,
fontWeight: FontWeight.w500,
),
),
@@ -22,10 +21,10 @@ var lightCustomTheme = ThemeData(
);
var darkCustomColorScheme = ColorScheme.fromSeed(
seedColor: Colors.blue,
seedColor: Colors.purple,
brightness: Brightness.dark,
primary: const Color(0xffA5CAFF),
surface: const Color(0xff1B1A1D),
primary: const Color(0xFFBFC1FF),
surface: const Color(0xFF131316),
);
var darkCustomTheme = ThemeData(
@@ -34,13 +33,12 @@ var darkCustomTheme = ThemeData(
navigationBarTheme: NavigationBarThemeData(
labelTextStyle: MaterialStateProperty.all(
TextStyle(
color: darkCustomColorScheme.secondary,
color: darkCustomColorScheme.onSurface,
fontWeight: FontWeight.w500,
),
),
),
canvasColor: const Color(0xff1B1A1D),
scaffoldBackgroundColor: const Color(0xff1B1A1D),
toggleableActiveColor: const Color(0xffA5CAFF),
canvasColor: const Color(0xFF131316),
scaffoldBackgroundColor: const Color(0xFF131316),
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
);

View File

@@ -1,94 +1,114 @@
import 'dart:ui';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/theme.dart';
import 'package:stacked_services/stacked_services.dart';
class DynamicThemeBuilder extends StatelessWidget {
class DynamicThemeBuilder extends StatefulWidget {
const DynamicThemeBuilder({
super.key,
required this.title,
required this.home,
required this.localizationsDelegates,
});
final String title;
final Widget home;
final Iterable<LocalizationsDelegate> localizationsDelegates;
const DynamicThemeBuilder({
Key? key,
required this.title,
required this.home,
required this.localizationsDelegates,
}) : super(key: key);
@override
State<DynamicThemeBuilder> createState() => _DynamicThemeBuilderState();
}
class _DynamicThemeBuilderState extends State<DynamicThemeBuilder> with WidgetsBindingObserver {
Brightness brightness = PlatformDispatcher.instance.platformBrightness;
final ManagerAPI _managerAPI = locator<ManagerAPI>();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void didChangePlatformBrightness() {
setState(() {
brightness = PlatformDispatcher.instance.platformBrightness;
});
if (_managerAPI.getThemeMode() < 2) {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
systemNavigationBarIconBrightness:
brightness == Brightness.light ? Brightness.dark : Brightness.light,
),
);
}
}
@override
Widget build(BuildContext context) {
return DynamicColorBuilder(
builder: (lightColorScheme, darkColorScheme) {
ThemeData lightDynamicTheme = ThemeData(
final ThemeData lightDynamicTheme = ThemeData(
useMaterial3: true,
canvasColor: lightColorScheme?.background,
navigationBarTheme: NavigationBarThemeData(
backgroundColor: lightColorScheme?.background,
indicatorColor: lightColorScheme?.primary.withAlpha(150),
labelTextStyle: MaterialStateProperty.all(
GoogleFonts.roboto(
color: lightColorScheme?.secondary,
color: lightColorScheme?.onSurface,
fontWeight: FontWeight.w500,
),
),
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: lightColorScheme?.secondary,
),
),
),
scaffoldBackgroundColor: lightColorScheme?.background,
colorScheme: lightColorScheme?.harmonized(),
toggleableActiveColor: lightColorScheme?.primary,
textTheme: GoogleFonts.robotoTextTheme(ThemeData.light().textTheme),
);
ThemeData darkDynamicTheme = ThemeData(
final ThemeData darkDynamicTheme = ThemeData(
useMaterial3: true,
canvasColor: darkColorScheme?.background,
navigationBarTheme: NavigationBarThemeData(
backgroundColor: darkColorScheme?.background,
indicatorColor: darkColorScheme?.primary.withOpacity(0.4),
labelTextStyle: MaterialStateProperty.all(
GoogleFonts.roboto(
color: darkColorScheme?.secondary,
color: darkColorScheme?.onSurface,
fontWeight: FontWeight.w500,
),
),
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: darkColorScheme?.secondary,
),
),
),
scaffoldBackgroundColor: darkColorScheme?.background,
colorScheme: darkColorScheme?.harmonized(),
toggleableActiveColor: darkColorScheme?.primary,
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
);
return DynamicTheme(
themeCollection: ThemeCollection(
themes: {
0: lightCustomTheme,
1: darkCustomTheme,
2: lightDynamicTheme,
3: darkDynamicTheme,
0: brightness == Brightness.light ? lightCustomTheme : darkCustomTheme,
1: brightness == Brightness.light ? lightDynamicTheme : darkDynamicTheme,
2: lightCustomTheme,
3: lightDynamicTheme,
4: darkCustomTheme,
5: darkDynamicTheme,
},
fallbackTheme: lightCustomTheme,
fallbackTheme: PlatformDispatcher.instance.platformBrightness == Brightness.light ? lightCustomTheme : darkCustomTheme,
),
builder: (context, theme) => MaterialApp(
debugShowCheckedModeBanner: false,
title: title,
navigatorKey: StackedService.navigatorKey,
onGenerateRoute: StackedRouter().onGenerateRoute,
theme: theme,
home: home,
localizationsDelegates: localizationsDelegates,
),
debugShowCheckedModeBanner: false,
title: widget.title,
navigatorKey: StackedService.navigatorKey,
onGenerateRoute: StackedRouter().onGenerateRoute,
theme: theme,
home: widget.home,
localizationsDelegates: widget.localizationsDelegates,
),
);
},
);
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
}

View File

@@ -1,13 +1,14 @@
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide SearchBar;
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/installed_app_item.dart';
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/app_skeleton_loader.dart';
import 'package:stacked/stacked.dart' hide SkeletonLoader;
import 'package:revanced_manager/ui/views/app_selector/app_selector_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/app_skeleton_loader.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/installed_app_item.dart';
import 'package:revanced_manager/ui/widgets/appSelectorView/not_installed_app_item.dart';
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
import 'package:stacked/stacked.dart' hide SkeletonLoader;
class AppSelectorView extends StatefulWidget {
const AppSelectorView({Key? key}) : super(key: key);
const AppSelectorView({super.key});
@override
State<AppSelectorView> createState() => _AppSelectorViewState();
@@ -19,16 +20,14 @@ class _AppSelectorViewState extends State<AppSelectorView> {
@override
Widget build(BuildContext context) {
return ViewModelBuilder<AppSelectorViewModel>.reactive(
onModelReady: (model) => model.initialize(),
onViewModelReady: (model) => model.initialize(),
viewModelBuilder: () => AppSelectorViewModel(),
builder: (context, model, child) => Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: FloatingActionButton.extended(
label: I18nText('appSelectorView.storageButton'),
icon: const Icon(Icons.sd_storage),
onPressed: () {
model.selectAppFromStorage(context);
Navigator.of(context).pop();
},
),
body: CustomScrollView(
@@ -36,32 +35,28 @@ class _AppSelectorViewState extends State<AppSelectorView> {
SliverAppBar(
pinned: true,
floating: true,
snap: false,
title: I18nText(
'appSelectorView.viewTitle',
child: Text(
'',
style: TextStyle(
color: Theme.of(context).textTheme.headline6!.color,
),
),
),
titleTextStyle: TextStyle(
fontSize: 22.0,
color: Theme.of(context).textTheme.titleLarge!.color,
),
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
onPressed: () => Navigator.of(context).pop(),
),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(64.0),
preferredSize: const Size.fromHeight(66.0),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8.0,
horizontal: 12.0,
),
child: SearchBar(
showSelectIcon: false,
hintText: FlutterI18n.translate(
context,
'appSelectorView.searchBarHint',
@@ -78,26 +73,72 @@ class _AppSelectorViewState extends State<AppSelectorView> {
SliverToBoxAdapter(
child: model.noApps
? Center(
child: I18nText('appSelectorCard.noAppsLabel'),
child: I18nText(
'appSelectorCard.noAppsLabel',
child: Text(
'',
style: TextStyle(
color:
Theme.of(context).textTheme.titleLarge!.color,
),
),
),
)
: model.apps.isEmpty
: model.allApps.isEmpty
? const AppSkeletonLoader()
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0)
.copyWith(bottom: 80),
.copyWith(
bottom:
MediaQuery.viewPaddingOf(context).bottom + 8.0,
),
child: Column(
children: model
.getFilteredApps(_query)
.map((app) => InstalledAppItem(
children: [
...model
.getFilteredApps(_query)
.map(
(app) => InstalledAppItem(
name: app.appName,
pkgName: app.packageName,
icon: app.icon,
patchesCount:
model.patchesCount(app.packageName),
suggestedVersion:
model.getSuggestedVersion(
app.packageName,
),
installedVersion: app.versionName!,
onTap: () => model.canSelectInstalled(
context,
app.packageName,
),
onLinkTap: () =>
model.searchSuggestedVersionOnWeb(
packageName: app.packageName,
),
),
)
,
...model
.getFilteredAppsNames(_query)
.map(
(app) => NotInstalledAppItem(
name: app,
patchesCount: model.patchesCount(app),
suggestedVersion:
model.getSuggestedVersion(app),
onTap: () {
model.selectApp(app);
Navigator.of(context).pop();
model.showDownloadToast();
},
))
.toList(),
onLinkTap: () =>
model.searchSuggestedVersionOnWeb(
packageName: app,
),
),
)
,
const SizedBox(height: 70.0),
],
),
),
),

View File

@@ -1,81 +1,329 @@
import 'dart:io';
import 'package:device_apps/device_apps.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_file_dialog/flutter_file_dialog.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:stacked/stacked.dart';
class AppSelectorViewModel extends BaseViewModel {
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final Toast _toast = locator<Toast>();
final List<ApplicationWithIcon> apps = [];
List<String> allApps = [];
bool noApps = false;
bool isRooted = false;
int patchesCount(String packageName) {
return _patcherAPI.getFilteredPatches(packageName).length;
}
List<Patch> patches = [];
Future<void> initialize() async {
apps.addAll(await _patcherAPI.getFilteredInstalledApps());
apps.sort((a, b) => a.appName.compareTo(b.appName));
noApps = apps.isEmpty;
patches = await _managerAPI.getPatches();
isRooted = _managerAPI.isRooted;
apps.addAll(
await _patcherAPI
.getFilteredInstalledApps(_managerAPI.areUniversalPatchesEnabled()),
);
apps.sort(
(a, b) => _patcherAPI
.getFilteredPatches(b.packageName)
.length
.compareTo(_patcherAPI.getFilteredPatches(a.packageName).length),
);
getAllApps();
notifyListeners();
}
void selectApp(ApplicationWithIcon application) async {
List<String> getAllApps() {
allApps = patches
.expand((e) => e.compatiblePackages.map((p) => p.name))
.toSet()
.where((name) => !apps.any((app) => app.packageName == name))
.toList();
noApps = allApps.isEmpty;
return allApps;
}
String getSuggestedVersion(String packageName) {
return _patcherAPI.getSuggestedVersion(packageName);
}
Future<bool> checkSplitApk(String packageName) async {
final app = await DeviceApps.getApp(packageName);
if (app != null) {
return app.isSplit;
}
return true;
}
Future<void> searchSuggestedVersionOnWeb({
required String packageName,
}) async {
final String suggestedVersion = getSuggestedVersion(packageName);
if (suggestedVersion.isNotEmpty) {
await openDefaultBrowser('$packageName apk version v$suggestedVersion');
} else {
await openDefaultBrowser('$packageName apk');
}
}
Future<void> openDefaultBrowser(String query) async {
if (Platform.isAndroid) {
try {
const platform = MethodChannel('app.revanced.manager.flutter/browser');
await platform.invokeMethod('openBrowser', {'query': query});
} catch (e) {
if (kDebugMode) {
print(e);
}
}
} else {
throw 'Platform not supported';
}
}
Future<void> selectApp(
BuildContext context,
ApplicationWithIcon application, [
bool isFromStorage = false,
]) async {
final String suggestedVersion =
getSuggestedVersion(application.packageName);
if (application.versionName != suggestedVersion && suggestedVersion.isNotEmpty) {
_managerAPI.suggestedAppVersionSelected = false;
if (_managerAPI.isRequireSuggestedAppVersionEnabled() &&
context.mounted) {
return showRequireSuggestedAppVersionDialog(
context,
application.versionName!,
suggestedVersion,
);
}
} else {
_managerAPI.suggestedAppVersionSelected = true;
}
locator<PatcherViewModel>().selectedApp = PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: application.apkFilePath,
icon: application.icon,
patchDate: DateTime.now(),
isFromStorage: isFromStorage,
);
await locator<PatcherViewModel>().loadLastSelectedPatches();
if (context.mounted) {
Navigator.pop(context);
}
}
Future<void> canSelectInstalled(
BuildContext context,
String packageName,
) async {
final app =
await DeviceApps.getApp(packageName, true) as ApplicationWithIcon?;
if (app != null) {
final bool isSplitApk = await checkSplitApk(packageName);
if (isRooted || !isSplitApk) {
if (context.mounted) {
await selectApp(context, app);
}
final List<Option> requiredNullOptions = getNullRequiredOptions(
locator<PatcherViewModel>().selectedPatches,
packageName,
);
if (requiredNullOptions.isNotEmpty) {
locator<PatcherViewModel>().showRequiredOptionDialog();
}
} else {
if (context.mounted) {
return showSelectFromStorageDialog(context);
}
}
}
}
Future showRequireSuggestedAppVersionDialog(
BuildContext context,
String selectedVersion,
String suggestedVersion,
) async {
return showDialog(
context: context,
builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'),
content: I18nText(
'appSelectorView.requireSuggestedAppVersionDialogText',
translationParams: {
'suggested': suggestedVersion,
'selected': selectedVersion,
},
child: const Text(
'',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
actions: [
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
),
],
),
);
}
Future showSelectFromStorageDialog(BuildContext context) async {
return showDialog(
context: context,
builder: (innerContext) => SimpleDialog(
alignment: Alignment.center,
contentPadding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
children: [
const SizedBox(height: 10),
Icon(
Icons.block,
size: 28,
color: Theme.of(innerContext).colorScheme.primary,
),
const SizedBox(height: 20),
I18nText(
'appSelectorView.featureNotAvailable',
child: const Text(
'',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
wordSpacing: 1.5,
),
),
),
const SizedBox(height: 20),
I18nText(
'appSelectorView.featureNotAvailableText',
child: const Text(
'',
style: TextStyle(
fontSize: 14,
),
),
),
const SizedBox(height: 30),
CustomMaterialButton(
onPressed: () async {
Navigator.pop(innerContext);
await selectAppFromStorage(context);
},
label: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.sd_card),
const SizedBox(width: 10),
I18nText('appSelectorView.selectFromStorageButton'),
],
),
),
const SizedBox(height: 10),
CustomMaterialButton(
isFilled: false,
onPressed: () {
Navigator.pop(innerContext);
},
label: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(width: 10),
I18nText('cancelButton'),
],
),
),
],
),
);
locator<PatcherViewModel>().selectedPatches.clear();
locator<PatcherViewModel>().notifyListeners();
}
Future<void> selectAppFromStorage(BuildContext context) async {
try {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['apk'],
final String? result = await FlutterFileDialog.pickFile(
params: const OpenFileDialogParams(
fileExtensionsFilter: ['apk'],
),
);
if (result != null && result.files.single.path != null) {
File apkFile = File(result.files.single.path!);
ApplicationWithIcon? application = await DeviceApps.getAppFromStorage(
if (result != null) {
final File apkFile = File(result);
final List<String> pathSplit = result.split('/');
pathSplit.removeLast();
final Directory filePickerCacheDir = Directory(pathSplit.join('/'));
final Iterable<File> deletableFiles =
(await filePickerCacheDir.list().toList()).whereType<File>();
for (final file in deletableFiles) {
if (file.path != apkFile.path && file.path.endsWith('.apk')) {
file.delete();
}
}
final ApplicationWithIcon? application =
await DeviceApps.getAppFromStorage(
apkFile.path,
true,
) as ApplicationWithIcon?;
if (application != null) {
locator<PatcherViewModel>().selectedApp = PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: result.files.single.path!,
icon: application.icon,
patchDate: DateTime.now(),
isFromStorage: true,
);
locator<PatcherViewModel>().selectedPatches.clear();
locator<PatcherViewModel>().notifyListeners();
if (application != null && context.mounted) {
await selectApp(context, application, true);
}
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
_toast.show('appSelectorView.errorMessage');
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
_toast.showBottom('appSelectorView.errorMessage');
}
}
List<ApplicationWithIcon> getFilteredApps(String query) {
return apps
.where((app) =>
query.isEmpty ||
query.length < 2 ||
app.appName.toLowerCase().contains(query.toLowerCase()))
.where(
(app) =>
query.isEmpty ||
query.length < 2 ||
app.appName.toLowerCase().contains(query.toLowerCase()) ||
app.packageName.toLowerCase().contains(query.toLowerCase()),
)
.toList();
}
List<String> getFilteredAppsNames(String query) {
return allApps
.where(
(app) =>
query.isEmpty ||
query.length < 2 ||
app.toLowerCase().contains(query.toLowerCase()),
)
.toList();
}
void showDownloadToast() =>
_toast.showBottom('appSelectorView.downloadToast');
}

View File

@@ -7,13 +7,13 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
class ContributorsView extends StatelessWidget {
const ContributorsView({Key? key}) : super(key: key);
const ContributorsView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<ContributorsViewModel>.reactive(
viewModelBuilder: () => ContributorsViewModel(),
onModelReady: (model) => model.getContributors(),
onViewModelReady: (model) => model.getContributors(),
builder: (context, model, child) => Scaffold(
body: CustomScrollView(
slivers: <Widget>[
@@ -23,7 +23,7 @@ class ContributorsView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
@@ -57,6 +57,7 @@ class ContributorsView extends StatelessWidget {
title: 'contributorsView.managerContributors',
contributors: model.managerContributors,
),
SizedBox(height: MediaQuery.viewPaddingOf(context).bottom),
],
),
),

View File

@@ -11,7 +11,7 @@ class ContributorsViewModel extends BaseViewModel {
List<dynamic> managerContributors = [];
Future<void> getContributors() async {
Map<String, List<dynamic>> contributors =
final Map<String, List<dynamic>> contributors =
await _managerAPI.getContributors();
patcherContributors = contributors[_managerAPI.defaultPatcherRepo] ?? [];
patchesContributors = contributors[_managerAPI.getPatchesRepo()] ?? [];

View File

@@ -1,29 +1,25 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:animations/animations.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/homeView/available_updates_card.dart';
import 'package:revanced_manager/ui/widgets/homeView/installed_apps_card.dart';
import 'package:revanced_manager/ui/widgets/homeView/latest_commit_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_chip.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
class HomeView extends StatelessWidget {
const HomeView({Key? key}) : super(key: key);
const HomeView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<HomeViewModel>.reactive(
disposeViewModel: false,
onModelReady: (model) => model.initialize(context),
fireOnViewModelReadyOnce: true,
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => locator<HomeViewModel>(),
builder: (context, model, child) => Scaffold(
body: RefreshIndicator(
color: Theme.of(context).colorScheme.secondary,
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
onRefresh: () => model.forceRefresh(context),
child: CustomScrollView(
slivers: <Widget>[
@@ -34,7 +30,7 @@ class HomeView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
@@ -48,63 +44,21 @@ class HomeView extends StatelessWidget {
'homeView.updatesSubtitle',
child: Text(
'',
style: Theme.of(context).textTheme.headline6!,
style: Theme.of(context).textTheme.titleLarge,
),
),
const SizedBox(height: 10),
LatestCommitCard(
onPressed: () =>
model.showUpdateConfirmationDialog(context),
),
LatestCommitCard(model: model, parentContext: context),
const SizedBox(height: 23),
I18nText(
'homeView.patchedSubtitle',
child: Text(
'',
style: Theme.of(context).textTheme.headline6!,
style: Theme.of(context).textTheme.titleLarge,
),
),
const SizedBox(height: 8),
Row(
children: <Widget>[
DashboardChip(
label: I18nText('homeView.updatesAvailable'),
isSelected: model.showUpdatableApps,
onSelected: (value) {
model.toggleUpdatableApps(true);
},
),
const SizedBox(width: 10),
DashboardChip(
label: I18nText('homeView.installed'),
isSelected: !model.showUpdatableApps,
onSelected: (value) {
model.toggleUpdatableApps(false);
},
)
],
),
const SizedBox(height: 14),
PageTransitionSwitcher(
transitionBuilder:
(child, primaryAnimation, secondaryAnimation) {
return FadeThroughTransition(
animation: primaryAnimation,
secondaryAnimation: secondaryAnimation,
fillColor: Colors.transparent,
child: child,
);
},
layoutBuilder: (entries) {
return Stack(
alignment: Alignment.topCenter,
children: entries,
);
},
child: model.showUpdatableApps
? AvailableUpdatesCard()
: InstalledAppsCard(),
),
const SizedBox(height: 10),
InstalledAppsCard(),
],
),
),

View File

@@ -1,55 +1,87 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:async';
import 'dart:io';
import 'package:app_installer/app_installer.dart';
import 'package:cross_connectivity/cross_connectivity.dart';
import 'package:device_apps/device_apps.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:injectable/injectable.dart';
import 'package:install_plugin/install_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/revanced_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/homeView/update_confirmation_dialog.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:timezone/timezone.dart' as tz;
@lazySingleton
class HomeViewModel extends BaseViewModel {
final NavigationService _navigationService = locator<NavigationService>();
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final GithubAPI _githubAPI = locator<GithubAPI>();
final RevancedAPI _revancedAPI = locator<RevancedAPI>();
final Toast _toast = locator<Toast>();
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
DateTime? _lastUpdate;
bool showUpdatableApps = true;
bool showUpdatableApps = false;
List<PatchedApplication> patchedInstalledApps = [];
List<PatchedApplication> patchedUpdatableApps = [];
String? _latestManagerVersion = '';
File? downloadedApk;
Future<void> initialize(BuildContext context) async {
_latestManagerVersion = await _managerAPI.getLatestManagerVersion();
if (!_managerAPI.getPatchesConsent()) {
await showPatchesConsent(context);
}
await _patcherAPI.initialize();
await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings(
android: AndroidInitializationSettings('ic_notification'),
),
onSelectNotification: (p) =>
DeviceApps.openApp('app.revanced.manager.flutter'),
onDidReceiveNotificationResponse: (response) async {
if (response.id == 0) {
_toast.showBottom('homeView.installingMessage');
final File? managerApk = await _managerAPI.downloadManager();
if (managerApk != null) {
await InstallPlugin.installApk(managerApk.path);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
}
},
);
flutterLocalNotificationsPlugin
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestPermission();
bool isConnected = await Connectivity().checkConnection();
?.requestNotificationsPermission();
final bool isConnected = await Connectivity().checkConnectivity() !=
ConnectivityResult.none;
if (!isConnected) {
_toast.show('homeView.noConnection');
_toast.showBottom('homeView.noConnection');
}
_getPatchedApps();
final NotificationAppLaunchDetails? notificationAppLaunchDetails =
await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();
if (notificationAppLaunchDetails?.didNotificationLaunchApp ?? false) {
_toast.showBottom('homeView.installingMessage');
final File? managerApk = await _managerAPI.downloadManager();
if (managerApk != null) {
await InstallPlugin.installApk(managerApk.path);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
}
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
}
@@ -65,7 +97,7 @@ class HomeViewModel extends BaseViewModel {
notifyListeners();
}
void navigateToPatcher(PatchedApplication app) async {
Future<void> navigateToPatcher(PatchedApplication app) async {
locator<PatcherViewModel>().selectedApp = app;
locator<PatcherViewModel>().selectedPatches =
await _patcherAPI.getAppliedPatches(app.appliedPatches);
@@ -74,114 +106,366 @@ class HomeViewModel extends BaseViewModel {
}
void _getPatchedApps() {
patchedInstalledApps = _managerAPI
.getPatchedApps()
.where((app) => app.hasUpdates == false)
.toList();
patchedUpdatableApps = _managerAPI
.getPatchedApps()
.where((app) => app.hasUpdates == true)
.toList();
patchedInstalledApps = _managerAPI.getPatchedApps().toList();
notifyListeners();
}
Future<bool> hasManagerUpdates() async {
String? latestVersion = await _managerAPI.getLatestManagerVersion();
String currentVersion = await _managerAPI.getCurrentManagerVersion();
// add v to current version
if (!currentVersion.startsWith('v')) {
currentVersion = 'v$currentVersion';
}
_latestManagerVersion =
await _managerAPI.getLatestManagerVersion() ?? currentVersion;
if (_latestManagerVersion != currentVersion) {
return true;
}
return false;
}
Future<bool> hasPatchesUpdates() async {
final String? latestVersion = await _managerAPI.getLatestPatchesVersion();
final String currentVersion = await _managerAPI.getCurrentPatchesVersion();
if (latestVersion != null) {
try {
int latestVersionInt =
final int latestVersionInt =
int.parse(latestVersion.replaceAll(RegExp('[^0-9]'), ''));
int currentVersionInt =
final int currentVersionInt =
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
return latestVersionInt > currentVersionInt;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return false;
}
}
return false;
}
Future<void> updateManager(BuildContext context) async {
Future<File?> downloadManager() async {
try {
_toast.show('homeView.downloadingMessage');
File? managerApk = await _managerAPI.downloadManager();
if (managerApk != null) {
await flutterLocalNotificationsPlugin.zonedSchedule(
0,
FlutterI18n.translate(
context,
'homeView.notificationTitle',
),
FlutterI18n.translate(
context,
'homeView.notificationText',
),
tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)),
const NotificationDetails(
android: AndroidNotificationDetails(
'revanced_manager_channel',
'ReVanced Manager Channel',
importance: Importance.max,
priority: Priority.high,
ticker: 'ticker',
),
),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
);
_toast.show('homeView.installingMessage');
await AppInstaller.installApk(managerApk.path);
} else {
_toast.show('homeView.errorDownloadMessage');
final response = await _revancedAPI.downloadManager();
final bytes = await response!.readAsBytes();
final tempDir = await getTemporaryDirectory();
final tempFile = File('${tempDir.path}/revanced-manager.apk');
await tempFile.writeAsBytes(bytes);
return tempFile;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
_toast.show('homeView.errorInstallMessage');
return null;
}
}
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
return showDialog(
context: parentContext,
Future<void> showPatchesConsent(BuildContext context) async {
final ValueNotifier<bool> autoUpdate = ValueNotifier(true);
await showDialog(
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
title: I18nText('homeView.updateDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('homeView.updateDialogText'),
actions: <Widget>[
title: const Text('Download ReVanced Patches?'),
content: ValueListenableBuilder(
valueListenable: autoUpdate,
builder: (context, value, child) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
I18nText(
'homeView.patchesConsentDialogText',
child: Text(
'',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: I18nText(
'homeView.patchesConsentDialogText2',
translationParams: {
'url': _managerAPI.defaultApiUrl.split('/')[2],
},
child: Text(
'',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.error,
),
),
),
),
CheckboxListTile(
value: value,
contentPadding: EdgeInsets.zero,
title: I18nText(
'homeView.patchesConsentDialogText3',
),
subtitle: I18nText(
'homeView.patchesConsentDialogText3Sub',
),
onChanged: (selected) {
autoUpdate.value = selected!;
},
),
],
);
},
),
actions: [
CustomMaterialButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(),
onPressed: () async {
await _managerAPI.setPatchesConsent(false);
SystemNavigator.pop();
},
label: I18nText('quitButton'),
),
CustomMaterialButton(
label: I18nText('yesButton'),
onPressed: () {
onPressed: () async {
await _managerAPI.setPatchesConsent(true);
await _managerAPI.setPatchesAutoUpdate(autoUpdate.value);
Navigator.of(context).pop();
updateManager(parentContext);
},
)
label: I18nText('okButton'),
),
],
),
);
}
Future<String?> getLatestPatcherReleaseTime() async {
return _managerAPI.getLatestPatcherReleaseTime();
Future<void> updatePatches(BuildContext context) async {
_toast.showBottom('homeView.downloadingMessage');
final String patchesVersion =
await _managerAPI.getLatestPatchesVersion() ?? '0.0.0';
final String integrationsVersion =
await _managerAPI.getLatestIntegrationsVersion() ?? '0.0.0';
if (patchesVersion != '0.0.0' && integrationsVersion != '0.0.0') {
await _managerAPI.setCurrentPatchesVersion(patchesVersion);
await _managerAPI.setCurrentIntegrationsVersion(integrationsVersion);
_toast.showBottom('homeView.downloadedMessage');
forceRefresh(context);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
}
Future<String?> getLatestManagerReleaseTime() async {
Future<void> updateManager(BuildContext context) async {
final ValueNotifier<bool> downloaded = ValueNotifier(false);
try {
_toast.showBottom('homeView.downloadingMessage');
showDialog(
context: context,
builder: (context) => ValueListenableBuilder(
valueListenable: downloaded,
builder: (context, value, child) {
return SimpleDialog(
contentPadding: const EdgeInsets.all(16.0),
title: I18nText(
!value
? 'homeView.downloadingMessage'
: 'homeView.downloadedMessage',
child: Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
children: [
Column(
children: [
Row(
children: [
Icon(
Icons.new_releases_outlined,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(width: 8.0),
Text(
'$_latestManagerVersion',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
],
),
const SizedBox(height: 16.0),
if (!value)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StreamBuilder<double>(
initialData: 0.0,
stream: _revancedAPI.managerUpdateProgress.stream,
builder: (context, snapshot) {
return LinearProgressIndicator(
value: snapshot.data! * 0.01,
valueColor: AlwaysStoppedAnimation<Color>(
Theme.of(context).colorScheme.secondary,
),
);
},
),
const SizedBox(height: 16.0),
Align(
alignment: Alignment.centerRight,
child: CustomMaterialButton(
label: I18nText('cancelButton'),
onPressed: () {
_revancedAPI.disposeManagerUpdateProgress();
Navigator.of(context).pop();
},
),
),
],
),
if (value)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
I18nText(
'homeView.installUpdate',
child: Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
const SizedBox(height: 16.0),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Align(
alignment: Alignment.centerRight,
child: CustomMaterialButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () {
Navigator.of(context).pop();
},
),
),
const SizedBox(width: 8.0),
Align(
alignment: Alignment.centerRight,
child: CustomMaterialButton(
label: I18nText('updateButton'),
onPressed: () async {
await InstallPlugin.installApk(
downloadedApk!.path,
);
},
),
),
],
),
],
),
],
),
],
);
},
),
);
final File? managerApk = await downloadManager();
if (managerApk != null) {
downloaded.value = true;
downloadedApk = managerApk;
// await flutterLocalNotificationsPlugin.zonedSchedule(
// 0,
// FlutterI18n.translate(
// context,
// 'homeView.notificationTitle',
// ),
// FlutterI18n.translate(
// context,
// 'homeView.notificationText',
// ),
// tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)),
// const NotificationDetails(
// android: AndroidNotificationDetails(
// 'revanced_manager_channel',
// 'ReVanced Manager Channel',
// importance: Importance.max,
// priority: Priority.high,
// ticker: 'ticker',
// ),
// ),
// androidAllowWhileIdle: true,
// uiLocalNotificationDateInterpretation:
// UILocalNotificationDateInterpretation.absoluteTime,
// );
_toast.showBottom('homeView.installingMessage');
await InstallPlugin.installApk(managerApk.path);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
_toast.showBottom('homeView.errorInstallMessage');
}
}
void updatesAreDisabled() {
_toast.showBottom('homeView.updatesDisabled');
}
Future<void> showUpdateConfirmationDialog(
BuildContext parentContext,
bool isPatches,
) {
return showModalBottomSheet(
context: parentContext,
isScrollControlled: true,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(24.0)),
),
builder: (context) => UpdateConfirmationDialog(
isPatches: isPatches,
),
);
}
Future<Map<String, dynamic>?> getLatestManagerRelease() {
return _githubAPI.getLatestManagerRelease(_managerAPI.defaultManagerRepo);
}
Future<Map<String, dynamic>?> getLatestPatchesRelease() {
return _githubAPI.getLatestPatchesRelease(_managerAPI.defaultPatchesRepo);
}
Future<String?> getLatestPatchesReleaseTime() {
return _managerAPI.getLatestPatchesReleaseTime();
}
Future<String?> getLatestManagerReleaseTime() {
return _managerAPI.getLatestManagerReleaseTime();
}
Future<void> forceRefresh(BuildContext context) async {
await Future.delayed(const Duration(seconds: 1));
if (_lastUpdate == null ||
_lastUpdate!.difference(DateTime.now()).inSeconds > 2) {
_managerAPI.clearAllData();
}
_managerAPI.clearAllData();
_toast.showBottom('homeView.refreshSuccess');
initialize(context);
}
}

View File

@@ -2,25 +2,75 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
class InstallerView extends StatelessWidget {
const InstallerView({Key? key}) : super(key: key);
const InstallerView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<InstallerViewModel>.reactive(
onModelReady: (model) => model.initialize(context),
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => InstallerViewModel(),
builder: (context, model, child) => WillPopScope(
child: SafeArea(
top: false,
bottom: model.isPatching,
child: Scaffold(
floatingActionButton: Visibility(
visible: !model.isPatching && !model.hasErrors,
child: FloatingActionButton.extended(
label: I18nText(
model.isInstalled
? 'installerView.openButton'
: 'installerView.installButton',
),
icon: model.isInstalled
? const Icon(Icons.open_in_new)
: const Icon(Icons.file_download_outlined),
onPressed: model.isInstalled
? () => {
model.openApp(),
model.cleanPatcher(),
Navigator.of(context).pop(),
}
: () => model.installTypeDialog(context),
elevation: 0,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.endContained,
bottomNavigationBar: Visibility(
visible: !model.isPatching,
child: BottomAppBar(
child: Row(
children: <Widget>[
Visibility(
visible: !model.hasErrors,
child: IconButton.filledTonal(
tooltip: FlutterI18n.translate(
context,
'installerView.exportApkButtonTooltip',
),
icon: const Icon(Icons.save),
onPressed: () => model.onButtonPressed(0),
),
),
IconButton.filledTonal(
tooltip: FlutterI18n.translate(
context,
'installerView.exportLogButtonTooltip',
),
icon: const Icon(Icons.post_add),
onPressed: () => model.onButtonPressed(1),
),
],
),
),
),
body: CustomScrollView(
controller: model.scrollController,
slivers: <Widget>[
@@ -28,43 +78,16 @@ class InstallerView extends StatelessWidget {
title: Text(
model.headerLogs,
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
onBackButtonPressed: () => model.onWillPop(context),
actions: <Widget>[
Visibility(
visible: !model.isPatching,
child: CustomPopupMenu(
onSelected: (value) => model.onMenuSelection(value),
children: {
if (!model.hasErrors)
0: I18nText(
'installerView.shareApkMenuOption',
child: const Text(
'',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
1: I18nText(
'installerView.shareLogMenuOption',
child: const Text(
'',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
},
),
),
],
bottom: PreferredSize(
preferredSize: const Size(double.infinity, 1.0),
child:
GradientProgressIndicator(progress: model.progress!)),
preferredSize: const Size(double.infinity, 1.0),
child: GradientProgressIndicator(progress: model.progress),
),
),
SliverPadding(
padding: const EdgeInsets.all(20.0),
@@ -84,66 +107,6 @@ class InstallerView extends StatelessWidget {
),
),
),
SliverFillRemaining(
hasScrollBody: false,
child: Align(
alignment: Alignment.bottomCenter,
child: Visibility(
visible: !model.isPatching && !model.hasErrors,
child: Padding(
padding: const EdgeInsets.all(20.0).copyWith(top: 0.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Visibility(
visible: model.isInstalled,
child: CustomMaterialButton(
label: I18nText('installerView.openButton'),
isExpanded: true,
onPressed: () {
model.openApp();
model.cleanPatcher();
Navigator.of(context).pop();
},
),
),
Visibility(
visible: !model.isInstalled && model.isRooted,
child: CustomMaterialButton(
isFilled: false,
label:
I18nText('installerView.installRootButton'),
isExpanded: true,
onPressed: () => model.installResult(
context,
true,
),
),
),
Visibility(
visible: !model.isInstalled,
child: const SizedBox(
width: 16,
),
),
Visibility(
visible: !model.isInstalled,
child: CustomMaterialButton(
label: I18nText('installerView.installButton'),
isExpanded: true,
onPressed: () => model.installResult(
context,
false,
),
),
),
],
),
),
),
),
),
],
),
),

View File

@@ -1,5 +1,6 @@
// ignore_for_file: use_build_context_synchronously
import 'package:device_apps/device_apps.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_background/flutter_background.dart';
@@ -14,9 +15,10 @@ import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:revanced_manager/utils/about_info.dart';
import 'package:screenshot_callback/screenshot_callback.dart';
import 'package:stacked/stacked.dart';
import 'package:wakelock/wakelock.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
class InstallerViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
@@ -29,6 +31,7 @@ class InstallerViewModel extends BaseViewModel {
'app.revanced.manager.flutter/installer',
);
final ScrollController scrollController = ScrollController();
final ScreenshotCallback screenshotCallback = ScreenshotCallback();
double? progress = 0.0;
String logs = '';
String headerLogs = '';
@@ -36,6 +39,9 @@ class InstallerViewModel extends BaseViewModel {
bool isPatching = true;
bool isInstalled = false;
bool hasErrors = false;
bool isCanceled = false;
bool cancel = false;
bool showPopupScreenshotWarning = true;
Future<void> initialize(BuildContext context) async {
isRooted = await _rootAPI.isRooted();
@@ -51,19 +57,24 @@ class InstallerViewModel extends BaseViewModel {
context,
'installerView.notificationText',
),
notificationImportance: AndroidNotificationImportance.Default,
notificationIcon: const AndroidResource(
name: 'ic_notification',
defType: 'drawable',
),
),
).then((value) => FlutterBackground.enableBackgroundExecution());
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
// ignore
} on Exception catch (e) {
if (kDebugMode) {
print(e);
} // ignore
}
}
await Wakelock.enable();
screenshotCallback.addListener(() {
if (showPopupScreenshotWarning) {
showPopupScreenshotWarning = false;
screenshotDetected(context);
}
});
await WakelockPlus.enable();
await handlePlatformChannelMethods();
await runPatcher();
}
@@ -73,10 +84,10 @@ class InstallerViewModel extends BaseViewModel {
switch (call.method) {
case 'update':
if (call.arguments != null) {
Map<dynamic, dynamic> arguments = call.arguments;
double progress = arguments['progress'];
String header = arguments['header'];
String log = arguments['log'];
final Map<dynamic, dynamic> arguments = call.arguments;
final double progress = arguments['progress'];
final String header = arguments['header'];
final String log = arguments['log'];
update(progress, header, log);
}
break;
@@ -84,7 +95,7 @@ class InstallerViewModel extends BaseViewModel {
});
}
void update(double value, String header, String log) {
Future<void> update(double value, String header, String log) async {
if (value >= 0.0) {
progress = value;
}
@@ -96,6 +107,11 @@ class InstallerViewModel extends BaseViewModel {
} else if (value == 1.0) {
isPatching = false;
hasErrors = false;
await _managerAPI.savePatches(
_patcherAPI.getFilteredPatches(_app.packageName),
_app.packageName,
);
await _managerAPI.setUsedPatches(_patches, _app.packageName);
} else if (value == -100.0) {
isPatching = false;
hasErrors = true;
@@ -124,111 +140,325 @@ class InstallerViewModel extends BaseViewModel {
Future<void> runPatcher() async {
try {
update(0.0, 'Initializing...', 'Initializing installer');
if (_patches.isNotEmpty) {
try {
update(0.1, '', 'Creating working directory');
await _patcherAPI.runPatcher(
_app.packageName,
_app.apkFilePath,
_patches,
);
} on Exception catch (e, s) {
update(
-100.0,
'Aborting...',
'An error occurred! Aborting\nError:\n$e',
);
await Sentry.captureException(e, stackTrace: s);
throw await Sentry.captureException(e, stackTrace: s);
}
} else {
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
await _patcherAPI.runPatcher(
_app.packageName,
_app.apkFilePath,
_patches,
);
} on Exception catch (e) {
update(
-100.0,
'Failed...',
'Something went wrong:\n$e',
);
if (kDebugMode) {
print(e);
}
}
// Necessary to reset the state of patches so that they
// can be reloaded again.
_managerAPI.patches.clear();
await _patcherAPI.loadPatches();
try {
if (FlutterBackground.isBackgroundExecutionEnabled) {
try {
FlutterBackground.disableBackgroundExecution();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
// ignore
} on Exception catch (e) {
if (kDebugMode) {
print(e);
} // ignore
}
}
await Wakelock.disable();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
await WakelockPlus.disable();
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
void installResult(BuildContext context, bool installAsRoot) async {
void _trimLogs(List<String> logLines, String keyword, String? newString) {
final lineCount = logLines.where((line) => line.endsWith(keyword)).length;
final index = logLines.indexWhere((line) => line.endsWith(keyword));
if (newString != null && lineCount > 0) {
logLines.insert(
index, newString.replaceAll('{lineCount}', lineCount.toString()));
}
logLines.removeWhere((lines) => lines.endsWith(keyword));
}
dynamic _getPatchOptionValue(String patchName, Option option) {
final Option? savedOption =
_managerAPI.getPatchOption(_app.packageName, patchName, option.key);
if (savedOption != null) {
return savedOption.value;
} else {
return option.value;
}
}
String _formatPatches(List<Patch> patches) {
if (patches.isEmpty) {
return 'None';
}
return patches
.map((p) =>
p.name +
(p.options.isEmpty
? ''
: ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]'))
.toList()
.join(', ');
}
String _getSuggestedVersion(String packageName) {
String suggestedVersion = _patcherAPI.getSuggestedVersion(_app.packageName);
if (suggestedVersion.isEmpty) {
suggestedVersion = 'Any';
} else {
suggestedVersion = 'v$suggestedVersion';
}
return suggestedVersion;
}
Future<void> copyLogs() async {
final info = await AboutInfo.getInfo();
// Trim out extra lines
final logsTrimmed = logs.split('\n');
_trimLogs(logsTrimmed, 'succeeded', 'Applied {lineCount} patches');
_trimLogs(logsTrimmed, '.dex', 'Compiled {lineCount} dex files');
// Get patches added / removed
final defaultPatches = _patcherAPI
.getFilteredPatches(_app.packageName)
.where((p) => !p.excluded)
.toList();
final patchesAdded =
_patches.where((p) => !defaultPatches.contains(p)).toList();
final patchesRemoved =
defaultPatches.where((p) => !_patches.contains(p)).toList();
// Options changed
final patchesChanged = defaultPatches
.where((p) =>
_patches.contains(p) &&
p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value))
.toList();
// Add Info
final formattedLogs = [
'- Device Info',
'ReVanced Manager: ${info['version']}',
'Build: ${info['flavor']}',
'Model: ${info['model']}',
'Android version: ${info['androidVersion']}',
'Supported architectures: ${info['supportedArch'].join(", ")}',
'Root permissions: ${isRooted ? 'Yes' : 'No'}', //
'\n- Patch Info',
'App: ${_app.packageName} v${_app.version} (Suggested: ${_getSuggestedVersion(_app.packageName)})',
'Patches version: ${_managerAPI.patchesVersion}',
'Patches added: ${_formatPatches(patchesAdded)}',
'Patches removed: ${_formatPatches(patchesRemoved)}',
'Options changed: ${_formatPatches(patchesChanged)}', //
'\n- Settings',
'Allow changing patch selection: ${_managerAPI.isPatchesChangeEnabled()}',
'Version compatibility check: ${_managerAPI.isVersionCompatibilityCheckEnabled()}',
'Show universal patches: ${_managerAPI.areUniversalPatchesEnabled()}',
'Patches source: ${_managerAPI.getPatchesRepo()}',
'Integration source: ${_managerAPI.getIntegrationsRepo()}', //
'\n- Logs',
logsTrimmed.join('\n'),
];
Clipboard.setData(ClipboardData(text: formattedLogs.join('\n')));
_toast.showBottom('installerView.copiedToClipboard');
}
Future<void> screenshotDetected(BuildContext context) async {
await showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText(
'warning',
),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
icon: const Icon(Icons.warning),
content: SingleChildScrollView(
child: I18nText('installerView.screenshotDetected'),
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () {
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('yesButton'),
onPressed: () {
copyLogs();
showPopupScreenshotWarning = true;
Navigator.of(context).pop();
},
),
],
),
);
}
Future<void> installTypeDialog(BuildContext context) async {
final ValueNotifier<int> installType = ValueNotifier(0);
if (isRooted) {
await showDialog(
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
title: I18nText(
'installerView.installType',
),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
icon: const Icon(Icons.file_download_outlined),
contentPadding: const EdgeInsets.symmetric(vertical: 16),
content: SingleChildScrollView(
child: ValueListenableBuilder(
valueListenable: installType,
builder: (context, value, child) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
child: I18nText(
'installerView.installTypeDescription',
child: Text(
'',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
),
RadioListTile(
title: I18nText('installerView.installNonRootType'),
contentPadding:
const EdgeInsets.symmetric(horizontal: 16),
value: 0,
groupValue: value,
onChanged: (selected) {
installType.value = selected!;
},
),
RadioListTile(
title: I18nText('installerView.installRootType'),
contentPadding:
const EdgeInsets.symmetric(horizontal: 16),
value: 1,
groupValue: value,
onChanged: (selected) {
installType.value = selected!;
},
),
],
);
},
),
),
actions: [
CustomMaterialButton(
label: I18nText('cancelButton'),
isFilled: false,
onPressed: () {
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('installerView.installButton'),
onPressed: () {
Navigator.of(context).pop();
installResult(context, installType.value == 1);
},
),
],
),
);
} else {
installResult(context, false);
}
}
Future<void> stopPatcher() async {
try {
isCanceled = true;
update(0.5, 'Canceling...', 'Canceling patching process');
await _patcherAPI.stopPatcher();
await WakelockPlus.disable();
update(-100.0, 'Canceled...', 'Press back to exit');
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
Future<void> installResult(BuildContext context, bool installAsRoot) async {
try {
_app.isRooted = installAsRoot;
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
bool rootMicroG = installAsRoot && hasMicroG;
bool rootFromStorage = installAsRoot && _app.isFromStorage;
bool ytWithoutRootMicroG =
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('installerView.installErrorDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText(
rootMicroG
? 'installerView.installErrorDialogText1'
: rootFromStorage
? 'installerView.installErrorDialogText3'
: 'installerView.installErrorDialogText2',
),
actions: <Widget>[
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
)
],
),
);
} else {
update(
1.0,
'Installing...',
_app.isRooted
? 'Installing patched file using root method'
: 'Installing patched file using nonroot method',
);
isInstalled = await _patcherAPI.installPatchedFile(_app);
if (isInstalled) {
update(1.0, 'Installed!', 'Installed!');
_app.isFromStorage = false;
_app.patchDate = DateTime.now();
_app.appliedPatches = _patches.map((p) => p.name).toList();
if (hasMicroG) {
_app.name += ' ReVanced';
_app.packageName = _app.packageName.replaceFirst(
'com.google.',
'app.revanced.',
);
}
await _managerAPI.savePatchedApp(_app);
}
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
}
}
void shareResult() {
try {
update(
1.0,
'Installing...',
_app.isRooted
? 'Installing patched file using root method'
: 'Installing patched file using nonroot method',
);
isInstalled = await _patcherAPI.installPatchedFile(_app);
if (isInstalled) {
_patcherAPI.sharePatchedFile(_app.name, _app.version);
_app.isFromStorage = false;
_app.patchDate = DateTime.now();
_app.appliedPatches = _patches.map((p) => p.name).toList();
// In case a patch changed the app name or package name,
// update the app info.
final app =
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
if (app != null) {
_app.name = app.appName;
_app.packageName = app.packageName;
}
await _managerAPI.savePatchedApp(_app);
update(1.0, 'Installed!', 'Installed!');
} else {
// TODO(aabed): Show error message.
}
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
} on Exception catch (e, s) {
Sentry.captureException(e, stackTrace: s);
}
}
void shareLog() {
_patcherAPI.sharePatcherLog(logs);
void exportResult() {
try {
_patcherAPI.exportPatchedFile(_app.name, _app.version);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
Future<void> cleanPatcher() async {
@@ -237,8 +467,10 @@ class InstallerViewModel extends BaseViewModel {
locator<PatcherViewModel>().selectedApp = null;
locator<PatcherViewModel>().selectedPatches.clear();
locator<PatcherViewModel>().notifyListeners();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}
@@ -246,23 +478,35 @@ class InstallerViewModel extends BaseViewModel {
DeviceApps.openApp(_app.packageName);
}
void onMenuSelection(int value) {
void onButtonPressed(int value) {
switch (value) {
case 0:
shareResult();
exportResult();
break;
case 1:
shareLog();
copyLogs();
break;
}
}
Future<bool> onWillPop(BuildContext context) async {
if (isPatching) {
_toast.show('installerView.noExit');
if (!cancel) {
cancel = true;
_toast.showBottom('installerView.pressBackAgain');
} else if (!isCanceled) {
await stopPatcher();
} else {
_toast.showBottom('installerView.noExit');
}
return false;
}
cleanPatcher();
if (!cancel) {
cleanPatcher();
} else {
_patcherAPI.cleanPatcher();
}
screenshotCallback.dispose();
Navigator.of(context).pop();
return true;
}

View File

@@ -6,65 +6,75 @@ import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:stacked/stacked.dart';
class NavigationView extends StatelessWidget {
const NavigationView({Key? key}) : super(key: key);
const NavigationView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<NavigationViewModel>.reactive(
onModelReady: (model) => model.initialize(context),
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => locator<NavigationViewModel>(),
builder: (context, model, child) => Scaffold(
body: PageTransitionSwitcher(
duration: const Duration(milliseconds: 400),
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return FadeThroughTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
fillColor: Theme.of(context).colorScheme.surface,
child: child,
);
},
child: model.getViewForIndex(model.currentIndex),
),
bottomNavigationBar: NavigationBar(
onDestinationSelected: model.setIndex,
selectedIndex: model.currentIndex,
destinations: <Widget>[
NavigationDestination(
icon: model.isIndexSelected(0)
? const Icon(Icons.dashboard)
: const Icon(Icons.dashboard_outlined),
label: FlutterI18n.translate(
context,
'navigationView.dashboardTab',
builder: (context, model, child) => WillPopScope(
onWillPop: () async {
if (model.currentIndex == 0) {
return true;
} else {
model.setIndex(0);
return false;
}
},
child: Scaffold(
body: PageTransitionSwitcher(
duration: const Duration(milliseconds: 400),
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return FadeThroughTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
fillColor: Theme.of(context).colorScheme.surface,
child: child,
);
},
child: model.getViewForIndex(model.currentIndex),
),
bottomNavigationBar: NavigationBar(
onDestinationSelected: model.setIndex,
selectedIndex: model.currentIndex,
destinations: <Widget>[
NavigationDestination(
icon: model.isIndexSelected(0)
? const Icon(Icons.dashboard)
: const Icon(Icons.dashboard_outlined),
label: FlutterI18n.translate(
context,
'navigationView.dashboardTab',
),
tooltip: '',
),
tooltip: '',
),
NavigationDestination(
icon: model.isIndexSelected(1)
? const Icon(Icons.build)
: const Icon(Icons.build_outlined),
label: FlutterI18n.translate(
context,
'navigationView.patcherTab',
NavigationDestination(
icon: model.isIndexSelected(1)
? const Icon(Icons.build)
: const Icon(Icons.build_outlined),
label: FlutterI18n.translate(
context,
'navigationView.patcherTab',
),
tooltip: '',
),
tooltip: '',
),
NavigationDestination(
icon: model.isIndexSelected(2)
? const Icon(Icons.settings)
: const Icon(Icons.settings_outlined),
label: FlutterI18n.translate(
context,
'navigationView.settingsTab',
NavigationDestination(
icon: model.isIndexSelected(2)
? const Icon(Icons.settings)
: const Icon(Icons.settings_outlined),
label: FlutterI18n.translate(
context,
'navigationView.settingsTab',
),
tooltip: '',
),
tooltip: '',
),
],
],
),
),
),
);

View File

@@ -1,4 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -15,23 +16,37 @@ import 'package:stacked/stacked.dart';
@lazySingleton
class NavigationViewModel extends IndexTrackingViewModel {
void initialize(BuildContext context) async {
Future<void> initialize(BuildContext context) async {
locator<Toast>().initialize(context);
SharedPreferences prefs = await SharedPreferences.getInstance();
final SharedPreferences prefs = await SharedPreferences.getInstance();
if (prefs.getBool('permissionsRequested') == null) {
await Permission.storage.request();
await prefs.setBool('permissionsRequested', true);
RootAPI().hasRootPermissions().then(
await RootAPI().hasRootPermissions().then(
(value) => Permission.requestInstallPackages.request().then(
(value) => Permission.ignoreBatteryOptimizations.request(),
),
);
}
if (prefs.getBool('useDarkTheme') == null) {
bool isDark =
MediaQuery.of(context).platformBrightness != Brightness.light;
await prefs.setBool('useDarkTheme', isDark);
await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0);
final dynamicTheme = DynamicTheme.of(context)!;
if (prefs.getInt('themeMode') == null) {
await prefs.setInt('themeMode', 0);
await dynamicTheme.setTheme(0);
}
// Force disable Material You on Android 11 and below
if (dynamicTheme.themeId.isOdd) {
const int android12SdkVersion = 31;
final AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
if (info.version.sdkInt < android12SdkVersion) {
await prefs.setInt('themeMode', 0);
await prefs.setBool('useDynamicTheme', false);
await dynamicTheme.setTheme(0);
}
}
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(

View File

@@ -0,0 +1,133 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/ui/views/patch_options/patch_options_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_options_fields.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
class PatchOptionsView extends StatelessWidget {
const PatchOptionsView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<PatchOptionsViewModel>.reactive(
onViewModelReady: (model) => model.initialize(),
viewModelBuilder: () => PatchOptionsViewModel(),
builder: (context, model, child) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold(
floatingActionButton: FloatingActionButton.extended(
onPressed: () async {
final bool saved = model.saveOptions(context);
if (saved && context.mounted) {
Navigator.pop(context);
}
},
label: I18nText('patchOptionsView.saveOptions'),
icon: const Icon(Icons.save),
),
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
title: I18nText(
'patchOptionsView.viewTitle',
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
actions: [
IconButton(
onPressed: () {
model.resetOptions();
},
icon: const Icon(
Icons.history,
),
tooltip: FlutterI18n.translate(
context,
'patchOptionsView.resetOptionsTooltip',
),
),
],
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
for (final Option option in model.visibleOptions)
if (option.valueType == 'String' ||
option.valueType == 'Int')
IntAndStringPatchOption(
patchOption: option,
removeOption: (option) {
model.removeOption(option);
},
onChanged: (value, option) {
model.modifyOptions(value, option);
},
)
else if (option.valueType == 'Boolean')
BooleanPatchOption(
patchOption: option,
removeOption: (option) {
model.removeOption(option);
},
onChanged: (value, option) {
model.modifyOptions(value, option);
},
)
else if (option.valueType ==
'StringArray' ||
option.valueType == 'IntArray' ||
option.valueType == 'LongArray')
IntStringLongListPatchOption(
patchOption: option,
removeOption: (option) {
model.removeOption(option);
},
onChanged: (value, option) {
model.modifyOptions(value, option);
},
)
else
UnsupportedPatchOption(
patchOption: option,
),
if (model.visibleOptions.length !=
model.options.length) ...[
const SizedBox(
height: 8,
),
CustomMaterialButton(
onPressed: () {
model.showAddOptionDialog(context);
},
label: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.add),
I18nText('patchOptionsView.addOptions'),
],
),
),
],
const SizedBox(
height: 80,
),
],
),
),
),
],
),
),
),
);
}
}

View File

@@ -0,0 +1,275 @@
import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
class PatchOptionsViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final String selectedApp =
locator<PatcherViewModel>().selectedApp!.packageName;
List<Option> options = [];
List<Option> savedOptions = [];
List<Option> visibleOptions = [];
Future<void> initialize() async {
options = getDefaultOptions();
for (final Option option in options) {
final Option? savedOption = _managerAPI.getPatchOption(
selectedApp,
_managerAPI.selectedPatch!.name,
option.key,
);
if (savedOption != null) {
savedOptions.add(savedOption);
}
}
if (savedOptions.isNotEmpty) {
visibleOptions = [
...savedOptions,
...options
.where(
(option) =>
option.required &&
!savedOptions.any((sOption) => sOption.key == option.key),
)
,
];
} else {
visibleOptions = [
...options.where((option) => option.required),
];
}
}
void addOption(Option option) {
visibleOptions.add(option);
notifyListeners();
}
void removeOption(Option option) {
visibleOptions.removeWhere((vOption) => vOption.key == option.key);
notifyListeners();
}
bool saveOptions(BuildContext context) {
final List<Option> requiredNullOptions = [];
for (final Option option in options) {
if (!visibleOptions.any((vOption) => vOption.key == option.key)) {
_managerAPI.clearPatchOption(
selectedApp,
_managerAPI.selectedPatch!.name,
option.key,
);
}
}
for (final Option option in visibleOptions) {
if (option.required && option.value == null) {
requiredNullOptions.add(option);
} else {
_managerAPI.setPatchOption(
option,
_managerAPI.selectedPatch!.name,
selectedApp,
);
}
}
if (requiredNullOptions.isNotEmpty) {
showRequiredOptionNullDialog(
context,
requiredNullOptions,
_managerAPI,
selectedApp,
);
return false;
}
return true;
}
void modifyOptions(dynamic value, Option option) {
final Option modifiedOption = Option(
title: option.title,
description: option.description,
values: option.values,
valueType: option.valueType,
value: value,
required: option.required,
key: option.key,
);
visibleOptions[visibleOptions
.indexWhere((vOption) => vOption.key == option.key)] = modifiedOption;
_managerAPI.modifiedOptions
.removeWhere((mOption) => mOption.key == option.key);
_managerAPI.modifiedOptions.add(modifiedOption);
}
List<Option> getDefaultOptions() {
final List<Option> defaultOptions = [];
for (final option in _managerAPI.options) {
final Option defaultOption = Option(
title: option.title,
description: option.description,
values: option.values,
valueType: option.valueType,
value: option.value is List ? option.value.toList() : option.value,
required: option.required,
key: option.key,
);
defaultOptions.add(defaultOption);
}
return defaultOptions;
}
void resetOptions() {
_managerAPI.modifiedOptions.clear();
visibleOptions =
getDefaultOptions().where((option) => option.required).toList();
notifyListeners();
}
Future<void> showAddOptionDialog(BuildContext context) async {
await showDialog(
context: context,
builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
I18nText(
'patchOptionsView.addOptions',
),
Text(
'',
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSecondaryContainer,
),
),
],
),
actions: [
CustomMaterialButton(
label: I18nText('cancelButton'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
contentPadding: const EdgeInsets.all(8),
content: Wrap(
spacing: 14,
runSpacing: 14,
children: options
.where(
(option) =>
!visibleOptions.any((vOption) => vOption.key == option.key),
)
.map((e) {
return CustomCard(
padding: const EdgeInsets.all(4),
backgroundColor: Theme.of(context).colorScheme.surface,
onTap: () {
addOption(e);
Navigator.pop(context);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
e.title,
style: const TextStyle(
fontSize: 16,
),
),
const SizedBox(height: 4),
Text(
e.description,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.onSurface,
),
),
],
),
),
],
),
),
);
}).toList(),
),
),
);
}
}
Future<void> showRequiredOptionNullDialog(
BuildContext context,
List<Option> options,
ManagerAPI managerAPI,
String selectedApp,
) async {
final List<String> optionsTitles = [];
for (final option in options) {
optionsTitles.add('${option.title}');
}
await showDialog(
context: context,
builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('notice'),
actions: [
CustomMaterialButton(
isFilled: false,
label: I18nText(
'patchOptionsView.deselectPatch',
),
onPressed: () async {
if (managerAPI.isPatchesChangeEnabled()) {
locator<PatcherViewModel>()
.selectedPatches
.remove(managerAPI.selectedPatch);
locator<PatcherViewModel>().notifyListeners();
for (final option in options) {
managerAPI.clearPatchOption(
selectedApp,
managerAPI.selectedPatch!.name,
option.key,
);
}
Navigator.of(context)
..pop()
..pop()
..pop();
} else {
PatchesSelectorViewModel().showPatchesChangeDialog(context);
}
},
),
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
content: I18nText(
'patchOptionsView.requiredOptionNull',
translationParams: {
'options': optionsTitles.join('\n'),
},
),
),
);
}

View File

@@ -9,7 +9,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
class PatcherView extends StatelessWidget {
const PatcherView({Key? key}) : super(key: key);
const PatcherView({super.key});
@override
Widget build(BuildContext context) {
@@ -22,7 +22,14 @@ class PatcherView extends StatelessWidget {
child: FloatingActionButton.extended(
label: I18nText('patcherView.patchButton'),
icon: const Icon(Icons.build),
onPressed: () => model.showPatchConfirmationDialog(context),
onPressed: () async{
if (model.checkRequiredPatchOption(context)) {
final bool proceed = model.showRemovedPatchesDialog(context);
if (proceed && context.mounted) {
model.showArmv7WarningDialog(context);
}
}
},
),
),
body: CustomScrollView(
@@ -34,7 +41,7 @@ class PatcherView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
@@ -45,7 +52,10 @@ class PatcherView extends StatelessWidget {
delegate: SliverChildListDelegate.fixed(
<Widget>[
AppSelectorCard(
onPressed: () => model.navigateToAppSelector(),
onPressed: () => {
model.navigateToAppSelector(),
model.ctx = context,
},
),
const SizedBox(height: 16),
Opacity(

View File

@@ -1,4 +1,10 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:injectable/injectable.dart';
import 'package:revanced_manager/app/app.locator.dart';
@@ -8,6 +14,8 @@ import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/utils/about_info.dart';
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
@@ -17,7 +25,9 @@ class PatcherViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
PatchedApplication? selectedApp;
BuildContext? ctx;
List<Patch> selectedPatches = [];
List<String> removedPatches = [];
void navigateToAppSelector() {
_navigationService.navigateTo(Routes.appSelectorView);
@@ -39,44 +49,107 @@ class PatcherViewModel extends BaseViewModel {
return selectedApp == null;
}
Future<bool> isValidPatchConfig() async {
bool needsResourcePatching = await _patcherAPI.needsResourcePatching(
selectedPatches,
);
if (needsResourcePatching && selectedApp != null) {
bool isSplit = await _managerAPI.isSplitApk(selectedApp!);
return !isSplit;
}
return true;
}
Future<void> showPatchConfirmationDialog(BuildContext context) async {
bool isValid = await isValidPatchConfig();
if (isValid) {
navigateToInstaller();
} else {
return showDialog(
bool showRemovedPatchesDialog(BuildContext context) {
if (removedPatches.isNotEmpty) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('patcherView.patchDialogTitle'),
title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patcherView.patchDialogText'),
content: I18nText(
'patcherView.removedPatchesWarningDialogText',
translationParams: {'patches': removedPatches.join('\n')},
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(),
onPressed: () {
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('yesButton'),
onPressed: () {
Navigator.of(context).pop();
navigateToInstaller();
showArmv7WarningDialog(context);
},
)
),
],
),
);
return false;
}
return true;
}
bool checkRequiredPatchOption(BuildContext context) {
if (getNullRequiredOptions(selectedPatches, selectedApp!.packageName)
.isNotEmpty) {
showRequiredOptionDialog(context);
return false;
}
return true;
}
void showRequiredOptionDialog([context]) {
showDialog(
context: context ?? ctx,
builder: (context) => AlertDialog(
title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patcherView.requiredOptionDialogText'),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () => {
Navigator.of(context).pop(),
},
),
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () => {
Navigator.pop(context),
navigateToPatchesSelector(),
},
),
],
),
);
}
Future<void> showArmv7WarningDialog(BuildContext context) async {
final bool armv7 = await AboutInfo.getInfo().then((info) {
final List<String> archs = info['supportedArch'];
final supportedAbis = ['arm64-v8a', 'x86', 'x86_64'];
return !archs.any((arch) => supportedAbis.contains(arch));
});
if (context.mounted && armv7) {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('warning'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patcherView.armv7WarningDialogText'),
actions: <Widget>[
CustomMaterialButton(
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(),
),
CustomMaterialButton(
label: I18nText('yesButton'),
isFilled: false,
onPressed: () {
Navigator.of(context).pop();
navigateToInstaller();
},
),
],
),
);
} else {
navigateToInstaller();
}
}
@@ -88,23 +161,93 @@ class PatcherViewModel extends BaseViewModel {
return text;
}
String getRecommendedVersionString(BuildContext context) {
String recommendedVersion =
_patcherAPI.getRecommendedVersion(selectedApp!.packageName);
if (recommendedVersion.isEmpty) {
recommendedVersion = FlutterI18n.translate(
context,
'appSelectorCard.anyVersion',
);
} else {
recommendedVersion = 'v$recommendedVersion';
}
String getCurrentVersionString(BuildContext context) {
return '${FlutterI18n.translate(
context,
'appSelectorCard.currentVersion',
)}: v${selectedApp!.version}\n${FlutterI18n.translate(
)}: v${selectedApp!.version}';
}
Future<void> searchSuggestedVersionOnWeb() async {
final String suggestedVersion =
_patcherAPI.getSuggestedVersion(selectedApp!.packageName);
if (suggestedVersion.isNotEmpty) {
await openDefaultBrowser(
'${selectedApp!.packageName} apk version v$suggestedVersion');
} else {
await openDefaultBrowser('${selectedApp!.packageName} apk');
}
}
String getSuggestedVersion() {
return _patcherAPI.getSuggestedVersion(selectedApp!.packageName);
}
String getSuggestedVersionString(BuildContext context) {
String suggestedVersion =
_patcherAPI.getSuggestedVersion(selectedApp!.packageName);
if (suggestedVersion.isEmpty) {
suggestedVersion = FlutterI18n.translate(
context,
'appSelectorCard.allVersions',
);
} else {
suggestedVersion = 'v$suggestedVersion';
}
return '${FlutterI18n.translate(
context,
'appSelectorCard.recommendedVersion',
)}: $recommendedVersion';
'appSelectorCard.suggestedVersion',
)}: $suggestedVersion';
}
Future<void> openDefaultBrowser(String query) async {
if (Platform.isAndroid) {
try {
const platform = MethodChannel('app.revanced.manager.flutter/browser');
await platform.invokeMethod('openBrowser', {'query': query});
} catch (e) {
if (kDebugMode) {
print(e);
}
}
} else {
throw 'Platform not supported';
}
}
Future<void> loadLastSelectedPatches() async {
this.selectedPatches.clear();
removedPatches.clear();
final List<String> selectedPatches =
await _managerAPI.getSelectedPatches(selectedApp!.packageName);
final List<Patch> patches =
_patcherAPI.getFilteredPatches(selectedApp!.packageName);
this
.selectedPatches
.addAll(patches.where((patch) => selectedPatches.contains(patch.name)));
if (!_managerAPI.isPatchesChangeEnabled()) {
this.selectedPatches.clear();
this.selectedPatches.addAll(patches.where((patch) => !patch.excluded));
}
if (_managerAPI.isVersionCompatibilityCheckEnabled()) {
this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch));
}
if (!_managerAPI.areUniversalPatchesEnabled()) {
this
.selectedPatches
.removeWhere((patch) => patch.compatiblePackages.isEmpty);
}
final usedPatches = _managerAPI.getUsedPatches(selectedApp!.packageName);
for (final patch in usedPatches) {
if (!patches.any((p) => p.name == patch.name)) {
removedPatches.add('${patch.name}');
for (final option in patch.options) {
_managerAPI.clearPatchOption(
selectedApp!.packageName, patch.name, option.key);
}
}
}
notifyListeners();
}
}

View File

@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide SearchBar;
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
import 'package:stacked/stacked.dart';
class PatchesSelectorView extends StatefulWidget {
const PatchesSelectorView({Key? key}) : super(key: key);
const PatchesSelectorView({super.key});
@override
State<PatchesSelectorView> createState() => _PatchesSelectorViewState();
@@ -14,22 +15,40 @@ class PatchesSelectorView extends StatefulWidget {
class _PatchesSelectorViewState extends State<PatchesSelectorView> {
String _query = '';
final _managerAPI = locator<ManagerAPI>();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
if (!_managerAPI.isPatchesChangeEnabled() &&
_managerAPI.showPatchesChangeWarning()) {
_managerAPI.showPatchesChangeWarningDialog(context);
}
});
}
@override
Widget build(BuildContext context) {
return ViewModelBuilder<PatchesSelectorViewModel>.reactive(
onModelReady: (model) => model.initialize(),
onViewModelReady: (model) => model.initialize(),
viewModelBuilder: () => PatchesSelectorViewModel(),
builder: (context, model, child) => Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: Visibility(
visible: model.patches.isNotEmpty,
child: FloatingActionButton.extended(
label: I18nText('patchesSelectorView.doneButton'),
label: Row(
children: <Widget>[
I18nText('patchesSelectorView.doneButton'),
Text(' (${model.selectedPatches.length})'),
],
),
icon: const Icon(Icons.check),
onPressed: () {
model.selectPatches();
Navigator.of(context).pop();
if (!model.areRequiredOptionsNull(context)) {
model.selectPatches();
Navigator.of(context).pop();
}
},
),
),
@@ -38,51 +57,62 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
SliverAppBar(
pinned: true,
floating: true,
snap: false,
title: I18nText(
'patchesSelectorView.viewTitle',
child: Text(
'',
style: TextStyle(
color: Theme.of(context).textTheme.headline6!.color,
),
),
),
titleTextStyle: TextStyle(
fontSize: 22.0,
color: Theme.of(context).textTheme.titleLarge!.color,
),
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
onPressed: () => Navigator.of(context).pop(),
onPressed: () {
model.resetSelection();
Navigator.of(context).pop();
},
),
actions: [
Container(
height: 2,
margin: const EdgeInsets.only(right: 16, top: 12, bottom: 12),
padding:
const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
margin: const EdgeInsets.symmetric(vertical: 12),
padding: const EdgeInsets.symmetric(horizontal: 6),
decoration: BoxDecoration(
color:
Theme.of(context).colorScheme.tertiary.withOpacity(0.5),
borderRadius: BorderRadius.circular(6),
),
alignment: Alignment.center,
child: Text(
model.patchesVersion!,
style: TextStyle(
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
PopupMenuButton(
onSelected: (value) {
model.onMenuSelection(value, context);
},
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
value: 0,
child: I18nText(
'patchesSelectorView.loadPatchesSelection',
),
),
],
),
],
bottom: PreferredSize(
preferredSize: const Size.fromHeight(64.0),
preferredSize: const Size.fromHeight(66.0),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8.0,
horizontal: 12.0,
),
child: SearchBar(
showSelectIcon: true,
hintText: FlutterI18n.translate(
context,
'patchesSelectorView.searchBarHint',
@@ -92,12 +122,6 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
_query = searchQuery;
});
},
onSelectAll: (value) {
if (value) {
model.selectAllPatcherWarning(context);
}
model.selectAllPatches(value);
},
),
),
),
@@ -117,106 +141,86 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
),
)
: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0)
.copyWith(bottom: 80),
padding:
const EdgeInsets.symmetric(horizontal: 12.0).copyWith(
bottom: MediaQuery.viewPaddingOf(context).bottom + 8.0,
),
child: Column(
children: model
.getQueriedPatches(_query)
.map(
(patch) => PatchItem(
name: patch.name,
simpleName: patch.getSimpleName(),
version: patch.version,
description: patch.description,
packageVersion: model.getAppVersion(),
supportedPackageVersions:
model.getSupportedVersions(patch),
isUnsupported: !model.isPatchSupported(patch),
isSelected: model.isSelected(patch),
onChanged: (value) =>
model.selectPatch(patch, value),
children: [
Row(
children: [
ActionChip(
label: I18nText('patchesSelectorView.default'),
tooltip: FlutterI18n.translate(
context,
'patchesSelectorView.defaultTooltip',
),
onPressed: () {
if (_managerAPI.isPatchesChangeEnabled()) {
model.selectDefaultPatches();
} else {
model.showPatchesChangeDialog(context);
}
},
),
/* TODO: Enable this and make use of new Patch Options implementation
patch.hasOptions ? ExpandablePanel(
controller: expController,
theme: const ExpandableThemeData(
hasIcon: false,
tapBodyToExpand: true,
tapBodyToCollapse: true,
tapHeaderToExpand: true,
),
header: Column(
children: <Widget>[
GestureDetector(
onLongPress: () =>
expController.toggle(),
child: PatchItem(
name: patch.name,
simpleName: patch.getSimpleName(),
description: patch.description,
version: patch.version,
packageVersion:
model.getAppVersion(),
supportedPackageVersions: model
.getSupportedVersions(patch),
isUnsupported: !model
.isPatchSupported(patch),
isSelected:
model.isSelected(patch),
onChanged: (value) => model
.selectPatch(patch, value),
child: const Padding(
padding: EdgeInsets.symmetric(
vertical: 8.0,
),
child: Text(
'Long press for additional options.',
),
),
),
),
],
),
expanded: Padding(
padding: const EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 10,
),
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 8,
),
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.tertiary
.withOpacity(0.1),
borderRadius:
BorderRadius.circular(12),
),
child: Column(
children: <Widget>[
Text(
'Patch options',
style: GoogleFonts.inter(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const OptionsTextField(
hint: 'App name'),
const OptionsFilePicker(
optionName: 'Choose a logo',
),
],
),
),
),
collapsed: Container(),
) */
)
.toList(),
const SizedBox(width: 8),
ActionChip(
label: I18nText('patchesSelectorView.none'),
tooltip: FlutterI18n.translate(
context,
'patchesSelectorView.noneTooltip',
),
onPressed: () {
if (_managerAPI.isPatchesChangeEnabled()) {
model.clearPatches();
} else {
model.showPatchesChangeDialog(context);
}
},
),
],
),
if (model.getQueriedPatches(_query).any((patch) => model.isPatchNew(patch)))
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
model.getPatchCategory(context, 'patchesSelectorView.newPatches'),
...model.getQueriedPatches(_query).map((patch) {
if (model.isPatchNew(patch)) {
return model.getPatchItem(context, patch);
} else {
return Container();
}
}),
if (model.getQueriedPatches(_query).any((patch) => !model.isPatchNew(patch) && patch.compatiblePackages.isNotEmpty))
model.getPatchCategory(context, 'patchesSelectorView.patches'),
],
),
...model.getQueriedPatches(_query).map(
(patch) {
if (patch.compatiblePackages.isNotEmpty && !model.isPatchNew(patch)) {
return model.getPatchItem(context, patch);
} else {
return Container();
}
},
),
if (model.getQueriedPatches(_query).any((patch) => patch.compatiblePackages.isEmpty))
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
model.getPatchCategory(context, 'patchesSelectorView.universalPatches'),
...model.getQueriedPatches(_query).map((patch) {
if (patch.compatiblePackages.isEmpty && !model.isPatchNew(patch)) {
return model.getPatchItem(context, patch);
} else {
return Container();
}
}),
],
),
const SizedBox(height: 70.0),
],
),
),
),

View File

@@ -1,100 +1,303 @@
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/utils/check_for_supported_patch.dart';
import 'package:stacked/stacked.dart';
import 'package:flutter/material.dart';
import 'package:stacked_services/stacked_services.dart';
class PatchesSelectorViewModel extends BaseViewModel {
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final NavigationService _navigationService = locator<NavigationService>();
final List<Patch> patches = [];
final List<Patch> currentSelection = [];
final List<Patch> selectedPatches =
locator<PatcherViewModel>().selectedPatches;
PatchedApplication? selectedApp = locator<PatcherViewModel>().selectedApp;
String? patchesVersion = '';
Set<String> savedPatchNames = {};
bool isDefaultPatchesRepo() {
return _managerAPI.getPatchesRepo() == 'revanced/revanced-patches';
}
Future<void> initialize() async {
getPatchesVersion();
patches.addAll(await _patcherAPI.getFilteredPatches(
locator<PatcherViewModel>().selectedApp!.originalPackageName,
));
patches.sort((a, b) => a.name.compareTo(b.name));
getPatchesVersion().whenComplete(() => notifyListeners());
patches.addAll(
_patcherAPI.getFilteredPatches(
selectedApp!.packageName,
),
);
final List<Option> requiredNullOptions =
getNullRequiredOptions(patches, selectedApp!.packageName);
patches.sort((a, b) {
if (b.options.any((option) => requiredNullOptions.contains(option)) &&
a.options.isEmpty) {
return 1;
} else {
return a.name.compareTo(b.name);
}
});
currentSelection.clear();
currentSelection.addAll(selectedPatches);
savedPatchNames = _managerAPI.getSavedPatches(selectedApp!.packageName).map((p) => p.name).toSet();
notifyListeners();
}
bool isSelected(Patch patch) {
return selectedPatches.any(
(element) => element.name == patch.name,
);
(element) => element.name == patch.name,
) ||
(isPatchNew(patch) && !patch.excluded);
}
void selectPatch(Patch patch, bool isSelected) {
if (isSelected && !selectedPatches.contains(patch)) {
selectedPatches.add(patch);
} else {
selectedPatches.remove(patch);
void navigateToPatchOptions(List<Option> setOptions, Patch patch) {
_managerAPI.options = setOptions;
_managerAPI.selectedPatch = patch;
_managerAPI.modifiedOptions.clear();
_navigationService.navigateToPatchOptionsView();
}
bool areRequiredOptionsNull(BuildContext context) {
final List<String> patchesWithNullRequiredOptions = [];
final List<Option> requiredNullOptions =
getNullRequiredOptions(selectedPatches, selectedApp!.packageName);
if (requiredNullOptions.isNotEmpty) {
for (final patch in selectedPatches) {
for (final patchOption in patch.options) {
if (requiredNullOptions.contains(patchOption)) {
patchesWithNullRequiredOptions.add(patch.name);
break;
}
}
}
showSetRequiredOption(context, patchesWithNullRequiredOptions);
return true;
}
notifyListeners();
return false;
}
Future<void> selectAllPatcherWarning(BuildContext context) {
Future<void> showSetRequiredOption(
BuildContext context,
List<String> patches,
) async {
return showDialog(
barrierDismissible: false,
context: context,
builder: (context) => AlertDialog(
title: I18nText('patchesSelectorView.selectAllPatchesWarningTitle'),
title: I18nText('notice'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patchesSelectorView.selectAllPatchesWarningContent'),
content: I18nText(
'patchesSelectorView.setRequiredOption',
translationParams: {
'patches': patches.map((patch) => '$patch').join('\n'),
},
),
actions: <Widget>[
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
)
onPressed: () => {
Navigator.of(context).pop(),
},
),
],
),
);
}
void selectAllPatches(bool isSelected) {
selectedPatches.clear();
if (isSelected) {
selectedPatches.addAll(patches);
void selectPatch(Patch patch, bool isSelected, BuildContext context) {
if (_managerAPI.isPatchesChangeEnabled()) {
if (isSelected && !selectedPatches.contains(patch)) {
selectedPatches.add(patch);
} else {
selectedPatches.remove(patch);
}
notifyListeners();
} else {
showPatchesChangeDialog(context);
}
}
Future<void> showPatchesChangeDialog(BuildContext context) async {
return showDialog(
context: context,
builder: (context) => AlertDialog(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
title: I18nText('warning'),
content: I18nText(
'patchItem.patchesChangeWarningDialogText',
child: const Text(
'',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
actions: [
CustomMaterialButton(
isFilled: false,
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
),
CustomMaterialButton(
label: I18nText('patchItem.patchesChangeWarningDialogButton'),
onPressed: () {
Navigator.of(context)
..pop()
..pop();
},
),
],
),
);
}
void selectDefaultPatches() {
selectedPatches.clear();
if (locator<PatcherViewModel>().selectedApp?.packageName != null) {
selectedPatches.addAll(
_patcherAPI
.getFilteredPatches(
locator<PatcherViewModel>().selectedApp!.packageName,
)
.where(
(element) =>
!element.excluded &&
(!_managerAPI.isVersionCompatibilityCheckEnabled() ||
isPatchSupported(element)),
),
);
}
notifyListeners();
}
void clearPatches() {
selectedPatches.clear();
notifyListeners();
}
void selectPatches() {
locator<PatcherViewModel>().selectedPatches = selectedPatches;
saveSelectedPatches();
if (_managerAPI.ctx != null) {
Navigator.pop(_managerAPI.ctx!);
_managerAPI.ctx = null;
}
locator<PatcherViewModel>().notifyListeners();
}
Future<String?> getPatchesVersion() async {
patchesVersion = await _managerAPI.getLatestPatchesVersion();
// print('Patches version: $patchesVersion');
return patchesVersion ?? '0.0.0';
void resetSelection() {
selectedPatches.clear();
selectedPatches.addAll(currentSelection);
notifyListeners();
}
Future<void> getPatchesVersion() async {
patchesVersion = await _managerAPI.getCurrentPatchesVersion();
}
List<Patch> getQueriedPatches(String query) {
return patches
.where((patch) =>
query.isEmpty ||
query.length < 2 ||
patch.name.toLowerCase().contains(query.toLowerCase()) ||
patch.getSimpleName().toLowerCase().contains(query.toLowerCase()))
final List<Patch> patch = patches
.where(
(patch) =>
query.isEmpty ||
query.length < 2 ||
patch.name.toLowerCase().contains(query.toLowerCase()) ||
patch.name
.replaceAll(RegExp(r'[^\w\s]+'), '')
.toLowerCase()
.contains(query.toLowerCase()),
)
.toList();
if (_managerAPI.areUniversalPatchesEnabled()) {
return patch;
} else {
return patch
.where((patch) => patch.compatiblePackages.isNotEmpty)
.toList();
}
}
String getAppVersion() {
return locator<PatcherViewModel>().selectedApp!.version;
Widget getPatchItem(BuildContext context, Patch patch) {
return PatchItem(
name: patch.name,
simpleName: patch.getSimpleName(),
description: patch.description ?? '',
packageVersion: getAppInfo().version,
supportedPackageVersions: getSupportedVersions(patch),
isUnsupported: !isPatchSupported(patch),
isChangeEnabled: _managerAPI.isPatchesChangeEnabled(),
hasUnsupportedPatchOption: hasUnsupportedRequiredOption(
patch.options,
patch,
),
options: patch.options,
isSelected: isSelected(patch),
navigateToOptions: (options) => navigateToPatchOptions(
options,
patch,
),
onChanged: (value) => selectPatch(
patch,
value,
context,
),
);
}
Widget getPatchCategory(BuildContext context, String category) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 10.0,
),
child: Container(
padding: const EdgeInsets.only(
top: 10.0,
bottom: 10.0,
left: 5.0,
),
child: I18nText(
category,
child: Text(
'',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
),
),
),
),
);
}
PatchedApplication getAppInfo() {
return locator<PatcherViewModel>().selectedApp!;
}
bool isPatchNew(Patch patch) {
if (savedPatchNames.isEmpty) {
return false;
} else {
return !savedPatchNames.contains(patch.name);
}
}
List<String> getSupportedVersions(Patch patch) {
PatchedApplication app = locator<PatcherViewModel>().selectedApp!;
Package? package = patch.compatiblePackages.firstWhereOrNull(
final PatchedApplication app = locator<PatcherViewModel>().selectedApp!;
final Package? package = patch.compatiblePackages.firstWhereOrNull(
(pack) => pack.name == app.packageName,
);
if (package != null) {
@@ -104,10 +307,42 @@ class PatchesSelectorViewModel extends BaseViewModel {
}
}
bool isPatchSupported(Patch patch) {
PatchedApplication app = locator<PatcherViewModel>().selectedApp!;
return patch.compatiblePackages.any((pack) =>
pack.name == app.packageName &&
(pack.versions.isEmpty || pack.versions.contains(app.version)));
void onMenuSelection(value, BuildContext context) {
switch (value) {
case 0:
loadSelectedPatches(context);
break;
}
}
Future<void> saveSelectedPatches() async {
final List<String> selectedPatches =
this.selectedPatches.map((patch) => patch.name).toList();
await _managerAPI.setSelectedPatches(
locator<PatcherViewModel>().selectedApp!.packageName,
selectedPatches,
);
}
Future<void> loadSelectedPatches(BuildContext context) async {
if (_managerAPI.isPatchesChangeEnabled()) {
final List<String> selectedPatches = await _managerAPI.getSelectedPatches(
locator<PatcherViewModel>().selectedApp!.packageName,
);
if (selectedPatches.isNotEmpty) {
this.selectedPatches.clear();
this.selectedPatches.addAll(
patches.where((patch) => selectedPatches.contains(patch.name)),
);
if (_managerAPI.isVersionCompatibilityCheckEnabled()) {
this.selectedPatches.removeWhere((patch) => !isPatchSupported(patch));
}
} else {
locator<Toast>().showBottom('patchesSelectorView.noSavedPatches');
}
notifyListeners();
} else {
showPatchesChangeDialog(context);
}
}
}

View File

@@ -0,0 +1,122 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
class SManageApiUrl extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final Toast _toast = locator<Toast>();
final TextEditingController _apiUrlController = TextEditingController();
Future<void> showApiUrlDialog(BuildContext context) async {
final String apiUrl = _managerAPI.getApiUrl();
_apiUrlController.text = apiUrl.replaceAll('https://', '');
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Row(
children: <Widget>[
I18nText('settingsView.apiURLLabel'),
const Spacer(),
IconButton(
icon: const Icon(Icons.manage_history_outlined),
onPressed: () => showApiUrlResetDialog(context),
color: Theme.of(context).colorScheme.secondary,
),
],
),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
leadingIcon: Icon(
Icons.api_outlined,
color: Theme.of(context).colorScheme.secondary,
),
inputController: _apiUrlController,
label: I18nText('settingsView.selectApiURL'),
hint: apiUrl,
onChanged: (value) => notifyListeners(),
),
],
),
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () {
_apiUrlController.clear();
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () {
String apiUrl = _apiUrlController.text;
if (!apiUrl.startsWith('https')) {
apiUrl = 'https://$apiUrl';
}
_managerAPI.setApiUrl(apiUrl);
_toast.showBottom('settingsView.restartAppForChanges');
Navigator.of(context).pop();
},
),
],
),
);
}
Future<void> showApiUrlResetDialog(BuildContext context) async {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('settingsView.sourcesResetDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('settingsView.apiURLResetDialogText'),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(),
),
CustomMaterialButton(
label: I18nText('yesButton'),
onPressed: () {
_managerAPI.setApiUrl('');
_toast.showBottom('settingsView.restartAppForChanges');
Navigator.of(context)
..pop()
..pop();
},
),
],
),
);
}
}
final sManageApiUrl = SManageApiUrl();
class SManageApiUrlUI extends StatelessWidget {
const SManageApiUrlUI({super.key});
@override
Widget build(BuildContext context) {
return SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.apiURLLabel',
subtitle: 'settingsView.apiURLHint',
onTap: () => sManageApiUrl.showApiUrlDialog(context),
);
}
}

View File

@@ -0,0 +1,86 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
class SManageKeystorePassword extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final TextEditingController _keystorePasswordController =
TextEditingController();
Future<void> showKeystoreDialog(BuildContext context) async {
final String keystorePasswordText = _managerAPI.getKeystorePassword();
_keystorePasswordController.text = keystorePasswordText;
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Row(
children: <Widget>[
I18nText('settingsView.selectKeystorePassword'),
const Spacer(),
IconButton(
icon: const Icon(Icons.manage_history_outlined),
onPressed: () => _keystorePasswordController.text =
_managerAPI.defaultKeystorePassword,
color: Theme.of(context).colorScheme.secondary,
),
],
),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
inputController: _keystorePasswordController,
label: I18nText('settingsView.selectKeystorePassword'),
hint: '',
onChanged: (value) => notifyListeners(),
),
],
),
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () {
_keystorePasswordController.clear();
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () {
final String passwd = _keystorePasswordController.text;
_managerAPI.setKeystorePassword(passwd);
Navigator.of(context).pop();
},
),
],
),
);
}
}
final sManageKeystorePassword = SManageKeystorePassword();
class SManageKeystorePasswordUI extends StatelessWidget {
const SManageKeystorePasswordUI({super.key});
@override
Widget build(BuildContext context) {
return SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.selectKeystorePassword',
subtitle: 'settingsView.selectKeystorePasswordHint',
onTap: () => sManageKeystorePassword.showKeystoreDialog(context),
);
}
}

View File

@@ -0,0 +1,189 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
class SManageSources extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final Toast _toast = locator<Toast>();
final TextEditingController _hostSourceController = TextEditingController();
final TextEditingController _orgPatSourceController = TextEditingController();
final TextEditingController _patSourceController = TextEditingController();
final TextEditingController _orgIntSourceController = TextEditingController();
final TextEditingController _intSourceController = TextEditingController();
Future<void> showSourcesDialog(BuildContext context) async {
final String hostRepository = _managerAPI.getRepoUrl();
final String patchesRepo = _managerAPI.getPatchesRepo();
final String integrationsRepo = _managerAPI.getIntegrationsRepo();
_hostSourceController.text = hostRepository;
_orgPatSourceController.text = patchesRepo.split('/')[0];
_patSourceController.text = patchesRepo.split('/')[1];
_orgIntSourceController.text = integrationsRepo.split('/')[0];
_intSourceController.text = integrationsRepo.split('/')[1];
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Row(
children: <Widget>[
I18nText('settingsView.sourcesLabel'),
const Spacer(),
IconButton(
icon: const Icon(Icons.manage_history_outlined),
onPressed: () => showResetConfirmationDialog(context),
color: Theme.of(context).colorScheme.secondary,
),
],
),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView(
child: Column(
children: <Widget>[
CustomTextField(
leadingIcon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
inputController: _hostSourceController,
label: I18nText('settingsView.hostRepositoryLabel'),
hint: hostRepository,
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
CustomTextField(
leadingIcon: Icon(
Icons.extension_outlined,
color: Theme.of(context).colorScheme.secondary,
),
inputController: _orgPatSourceController,
label: I18nText('settingsView.orgPatchesLabel'),
hint: patchesRepo.split('/')[0],
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 8),
CustomTextField(
leadingIcon: const Icon(
Icons.extension_outlined,
color: Colors.transparent,
),
inputController: _patSourceController,
label: I18nText('settingsView.sourcesPatchesLabel'),
hint: patchesRepo.split('/')[1],
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
CustomTextField(
leadingIcon: Icon(
Icons.merge_outlined,
color: Theme.of(context).colorScheme.secondary,
),
inputController: _orgIntSourceController,
label: I18nText('settingsView.orgIntegrationsLabel'),
hint: integrationsRepo.split('/')[0],
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 8),
CustomTextField(
leadingIcon: const Icon(
Icons.merge_outlined,
color: Colors.transparent,
),
inputController: _intSourceController,
label: I18nText('settingsView.sourcesIntegrationsLabel'),
hint: integrationsRepo.split('/')[1],
onChanged: (value) => notifyListeners(),
),
const SizedBox(height: 20),
I18nText('settingsView.sourcesUpdateNote'),
],
),
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () {
_orgPatSourceController.clear();
_patSourceController.clear();
_orgIntSourceController.clear();
_intSourceController.clear();
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () {
_managerAPI.setRepoUrl(_hostSourceController.text.trim());
_managerAPI.setPatchesRepo(
'${_orgPatSourceController.text.trim()}/${_patSourceController.text.trim()}',
);
_managerAPI.setIntegrationsRepo(
'${_orgIntSourceController.text.trim()}/${_intSourceController.text.trim()}',
);
_managerAPI.setCurrentPatchesVersion('0.0.0');
_managerAPI.setCurrentIntegrationsVersion('0.0.0');
_toast.showBottom('settingsView.restartAppForChanges');
Navigator.of(context).pop();
},
),
],
),
);
}
Future<void> showResetConfirmationDialog(BuildContext context) async {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('settingsView.sourcesResetDialogTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('settingsView.sourcesResetDialogText'),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('noButton'),
onPressed: () => Navigator.of(context).pop(),
),
CustomMaterialButton(
label: I18nText('yesButton'),
onPressed: () {
_managerAPI.setRepoUrl('');
_managerAPI.setPatchesRepo('');
_managerAPI.setIntegrationsRepo('');
_managerAPI.setCurrentPatchesVersion('0.0.0');
_managerAPI.setCurrentIntegrationsVersion('0.0.0');
_toast.showBottom('settingsView.restartAppForChanges');
Navigator.of(context)
..pop()
..pop();
},
),
],
),
);
}
}
final sManageSources = SManageSources();
class SManageSourcesUI extends StatelessWidget {
const SManageSourcesUI({super.key});
@override
Widget build(BuildContext context) {
return SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.sourcesLabel',
subtitle: 'settingsView.sourcesLabelHint',
onTap: () => sManageSources.showSourcesDialog(context),
);
}
}

View File

@@ -0,0 +1,95 @@
// ignore_for_file: use_build_context_synchronously
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/main.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:stacked/stacked.dart';
import 'package:timeago/timeago.dart' as timeago;
final _settingViewModel = SettingsViewModel();
class SUpdateLanguage extends BaseViewModel {
final Toast _toast = locator<Toast>();
late SharedPreferences _prefs;
String selectedLanguage = 'English';
String selectedLanguageLocale = prefs.getString('language') ?? 'en_US';
List languages = [];
Future<void> initialize() async {
_prefs = await SharedPreferences.getInstance();
selectedLanguageLocale =
_prefs.getString('language') ?? selectedLanguageLocale;
notifyListeners();
}
Future<void> updateLanguage(BuildContext context, String? value) async {
if (value != null) {
selectedLanguageLocale = value;
_prefs = await SharedPreferences.getInstance();
await _prefs.setString('language', value);
await FlutterI18n.refresh(context, Locale(value));
timeago.setLocaleMessages(value, timeago.EnMessages());
locator<NavigationViewModel>().notifyListeners();
notifyListeners();
}
}
Future<void> initLang() async {
languages.sort((a, b) => a['name'].compareTo(b['name']));
notifyListeners();
}
Future<void> showLanguagesDialog(BuildContext parentContext) {
initLang();
return showDialog(
context: parentContext,
builder: (context) => SimpleDialog(
title: I18nText('settingsView.languageLabel'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
children: [
SizedBox(
height: 500,
child: ListView.builder(
itemCount: languages.length,
itemBuilder: (context, index) {
return RadioListTile<String>(
title: Text(languages[index]['name']),
subtitle: Text(languages[index]['locale']),
value: languages[index]['locale'],
groupValue: selectedLanguageLocale,
onChanged: (value) {
selectedLanguage = languages[index]['name'];
_toast.showBottom('settingsView.restartAppForChanges');
updateLanguage(context, value);
Navigator.pop(context);
},
);
},
),
),
],
),
);
}
}
class SUpdateLanguageUI extends StatelessWidget {
const SUpdateLanguageUI({super.key});
@override
Widget build(BuildContext context) {
return SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.languageLabel',
subtitle: _settingViewModel.sUpdateLanguage.selectedLanguage,
onTap: () =>
_settingViewModel.sUpdateLanguage.showLanguagesDialog(context),
);
}
}

View File

@@ -0,0 +1,185 @@
// ignore_for_file: use_build_context_synchronously
import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
class SUpdateThemeUI extends StatefulWidget {
const SUpdateThemeUI({super.key});
@override
State<SUpdateThemeUI> createState() => _SUpdateThemeUIState();
}
class _SUpdateThemeUIState extends State<SUpdateThemeUI> {
final ManagerAPI managerAPI = locator<ManagerAPI>();
@override
Widget build(BuildContext context) {
return SettingsSection(
title: 'settingsView.appearanceSectionTitle',
children: <Widget>[
ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.themeModeLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
trailing: CustomMaterialButton(
label: getThemeModeName(),
onPressed: () => {showThemeDialog(context)},
),
onTap: () => {showThemeDialog(context)},
),
if (managerAPI.isDynamicThemeAvailable)
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.dynamicThemeLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.dynamicThemeHint'),
value: getDynamicThemeStatus(),
onChanged: (value) => {
setUseDynamicTheme(
context,
value,
),
},
),
],
);
}
bool getDynamicThemeStatus() {
return managerAPI.getUseDynamicTheme();
}
Future<void> setUseDynamicTheme(BuildContext context, bool value) async {
await managerAPI.setUseDynamicTheme(value);
final int currentTheme = (DynamicTheme.of(context)!.themeId ~/ 2) * 2;
await DynamicTheme.of(context)!.setTheme(currentTheme + (value ? 1 : 0));
setState(() {});
}
int getThemeMode() {
return managerAPI.getThemeMode();
}
Future<void> setThemeMode(BuildContext context, int value) async {
await managerAPI.setThemeMode(value);
final bool isDynamicTheme = DynamicTheme.of(context)!.themeId.isEven;
await DynamicTheme.of(context)!
.setTheme(value * 2 + (isDynamicTheme ? 0 : 1));
final bool isLight = value != 2 &&
(value == 1 ||
DynamicTheme.of(context)!.theme.brightness == Brightness.light);
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
systemNavigationBarIconBrightness:
isLight ? Brightness.dark : Brightness.light,
),
);
setState(() {});
}
I18nText getThemeModeName() {
switch (getThemeMode()) {
case 0:
return I18nText('settingsView.systemThemeLabel');
case 1:
return I18nText('settingsView.lightThemeLabel');
case 2:
return I18nText('settingsView.darkThemeLabel');
default:
return I18nText('settingsView.systemThemeLabel');
}
}
Future<void> showThemeDialog(BuildContext context) async {
final ValueNotifier<int> newTheme = ValueNotifier(getThemeMode());
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('settingsView.themeModeLabel'),
icon: const Icon(Icons.palette),
contentPadding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: SingleChildScrollView(
child: ValueListenableBuilder(
valueListenable: newTheme,
builder: (context, value, child) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
RadioListTile(
title: I18nText('settingsView.systemThemeLabel'),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
value: 0,
groupValue: value,
onChanged: (value) {
newTheme.value = value!;
},
),
RadioListTile(
title: I18nText('settingsView.lightThemeLabel'),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
value: 1,
groupValue: value,
onChanged: (value) {
newTheme.value = value!;
},
),
RadioListTile(
title: I18nText('settingsView.darkThemeLabel'),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
value: 2,
groupValue: value,
onChanged: (value) {
newTheme.value = value!;
},
),
],
);
},
),
),
actions: <Widget>[
CustomMaterialButton(
isFilled: false,
label: I18nText('cancelButton'),
onPressed: () {
Navigator.of(context).pop();
},
),
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () {
setThemeMode(context, newTheme.value);
Navigator.of(context).pop();
},
),
],
),
);
}
}

View File

@@ -1,17 +1,19 @@
// ignore_for_file: prefer_const_constructors
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/ui/views/settings/settingsFragment/settings_update_theme.dart';
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/settingsView/about_widget.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_switch_tile.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_tile_dialog.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
import 'package:revanced_manager/ui/widgets/settingsView/social_media_widget.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_advanced_section.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_debug_section.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_export_section.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_team_section.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
class SettingsView extends StatelessWidget {
const SettingsView({Key? key}) : super(key: key);
const SettingsView({super.key});
static const _settingsDivider =
Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0);
@@ -30,7 +32,7 @@ class SettingsView extends StatelessWidget {
child: Text(
'',
style: GoogleFonts.inter(
color: Theme.of(context).textTheme.headline6!.color,
color: Theme.of(context).textTheme.titleLarge!.color,
),
),
),
@@ -38,199 +40,22 @@ class SettingsView extends StatelessWidget {
SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
SettingsSection(
title: 'settingsView.appearanceSectionTitle',
children: <Widget>[
CustomSwitchTile(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.darkThemeLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.darkThemeHint'),
value: model.getDarkThemeStatus(),
onTap: (value) => model.setUseDarkTheme(
context,
value,
),
),
FutureBuilder<int>(
future: model.getSdkVersion(),
builder: (context, snapshot) => Visibility(
visible: snapshot.hasData &&
snapshot.data! >= ANDROID_12_SDK_VERSION,
child: CustomSwitchTile(
padding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.dynamicThemeLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.dynamicThemeHint'),
value: model.getDynamicThemeStatus(),
onTap: (value) => model.setUseDynamicTheme(
context,
value,
),
),
),
),
],
),
SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.languageLabel',
subtitle: 'English',
onTap: () => model.showLanguagesDialog(context),
),
_settingsDivider,
SettingsSection(
title: 'settingsView.teamSectionTitle',
children: <Widget>[
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.contributorsLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.contributorsHint'),
onTap: () => model.navigateToContributors(),
),
const SocialMediaWidget(
padding: EdgeInsets.symmetric(horizontal: 20.0),
),
],
),
_settingsDivider,
SettingsSection(
title: 'settingsView.advancedSectionTitle',
children: <Widget>[
SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.apiURLLabel',
subtitle: 'settingsView.apiURLHint',
onTap: () => model.showApiUrlDialog(context),
),
SettingsTileDialog(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: 'settingsView.sourcesLabel',
subtitle: 'settingsView.sourcesLabelHint',
onTap: () => model.showSourcesDialog(context),
),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.deleteKeystoreLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.deleteKeystoreHint'),
onTap: () => model.deleteKeystore,
),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.deleteTempDirLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.deleteTempDirHint'),
onTap: () => model.deleteTempDir(),
),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.deleteLogsLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.deleteLogsHint'),
onTap: () => model.deleteLogs(),
),
],
),
_settingsDivider,
SettingsSection(
title: 'settingsView.logsSectionTitle',
children: <Widget>[
CustomSwitchTile(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.sentryLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.sentryHint'),
value: model.isSentryEnabled(),
onTap: (value) => model.useSentry(value),
),
],
),
_settingsDivider,
SettingsSection(
title: 'settingsView.infoSectionTitle',
children: <Widget>[
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.logsLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.logsHint'),
onTap: () => model.exportLogcatLogs(),
),
const AboutWidget(
padding: EdgeInsets.symmetric(horizontal: 20.0),
),
ListView(
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: const [
SUpdateThemeUI(),
// _settingsDivider,
// SUpdateLanguageUI(),
_settingsDivider,
SAdvancedSection(),
_settingsDivider,
SExportSection(),
_settingsDivider,
STeamSection(),
_settingsDivider,
SDebugSection(),
],
),
],

Some files were not shown because too many files have changed in this diff Show More