Skip to content

Commit

Permalink
Merge pull request luoxingran#2 from CoolestEnoch/master
Browse files Browse the repository at this point in the history
关闭自动签到,添加重置模块选项,CI版本中自动获取最新的脚本
  • Loading branch information
luoxingran authored Mar 14, 2024
2 parents e4d0b98 + 1b95151 commit 0d01e5f
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
with:
java-version: 1.8

- name: Sync latest Unblocked Music source code
run:
git clone --depth=1 https://github.com/UnblockNeteaseMusic/server.git && cd server && zip -r ../UnblockNeteaseMusic.zip . && cd .. && rm ./app/src/main/assets/UnblockNeteaseMusic.zip && rm -rf server && mv ./UnblockNeteaseMusic.zip ./app/src/main/assets/UnblockNeteaseMusic.zip

- name: Grant execute permission for gradlew
run: chmod +x gradlew

Expand All @@ -32,4 +36,4 @@ jobs:
name: app-release
path: ${{github.workspace}}/app/build/outputs/apk/release/*.apk
if-no-files-found: warn
retention-days: 180
retention-days: 30
Binary file modified app/src/main/assets/UnblockNeteaseMusic.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void refreshSetting(Context context) {
settingMap.put(listen_key, sharedPreferences.getBoolean(listen_key, false));
settingMap.put(fix_comment_key, sharedPreferences.getBoolean(fix_comment_key, false));
settingMap.put(update_key, sharedPreferences.getBoolean(update_key, true));
settingMap.put(sign_key, sharedPreferences.getBoolean(sign_key, true));
settingMap.put(sign_key, sharedPreferences.getBoolean(sign_key, false));
settingMap.put(sign_song_key, sharedPreferences.getBoolean(sign_song_key, false));

settingMap.put(proxy_master_key, sharedPreferences.getBoolean(proxy_master_key, true));
Expand Down Expand Up @@ -238,6 +238,38 @@ public boolean isEnable(String key) {
return settingMap.get(master_key) && settingMap.get(key);
}

private void deleteSetting(String key) {
if (sharedPreferences.contains(key)) {
sharedPreferences.edit().remove(key).apply();
}
}

public void resetSetting() {
deleteSetting(master_key);
deleteSetting(dex_key);
deleteSetting(warn_key);
deleteSetting(black_key);
deleteSetting(listen_key);
deleteSetting(fix_comment_key);
deleteSetting(update_key);
deleteSetting(sign_key);
deleteSetting(sign_song_key);
deleteSetting(proxy_master_key);
deleteSetting(proxy_server_key);
deleteSetting(proxy_priority_key);
deleteSetting(proxy_flac_key);
deleteSetting(proxy_gray_key);
deleteSetting(beauty_night_mode_key);
deleteSetting(beauty_tab_hide_key);
deleteSetting(beauty_bubble_hide_key);
deleteSetting(beauty_banner_hide_key);
deleteSetting(beauty_ksong_hide_key);
deleteSetting(beauty_rotation_key);
deleteSetting(beauty_black_hide_key);
deleteSetting(beauty_comment_hot_key);
deleteSetting(beauty_background_key);
}

public HashMap<String, Boolean> getSidebarSetting(LinkedHashMap<String, String> map) {
if (sidebarSettingMap == null) {
sidebarSettingMap = new HashMap<>();
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/raincat/dolby_beta/hook/SettingHook.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.raincat.dolby_beta.view.setting.FixCommentView;
import com.raincat.dolby_beta.view.setting.MasterView;
import com.raincat.dolby_beta.view.setting.ProxyView;
import com.raincat.dolby_beta.view.setting.ResetModuleView;
import com.raincat.dolby_beta.view.setting.SignSongDailyView;
import com.raincat.dolby_beta.view.setting.SignSongSelfView;
import com.raincat.dolby_beta.view.setting.SignView;
Expand Down Expand Up @@ -260,6 +261,7 @@ private void showSettingDialog(final Context context) {
proxyView.setBaseOnView(masterView);
BeautyView beautyView = new BeautyView(context);
beautyView.setBaseOnView(masterView);
ResetModuleView resetModuleView = new ResetModuleView(context);


dialogRoot.addView(new TitleView(context));
Expand All @@ -275,6 +277,7 @@ private void showSettingDialog(final Context context) {
dialogRoot.addView(signSongSelfView);
dialogRoot.addView(proxyView);
dialogRoot.addView(beautyView);
dialogRoot.addView(resetModuleView);

dialogRoot.addView(new AboutView(context));
new AlertDialog.Builder(context)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.raincat.dolby_beta.view.setting;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Toast;

import com.raincat.dolby_beta.helper.SettingHelper;
import com.raincat.dolby_beta.hook.SettingHook;
import com.raincat.dolby_beta.view.BaseDialogItem;

/**
* time : 2024/01/04
* desc : 重置模块
* version: 1.0
* </pre>
*/

public class ResetModuleView extends BaseDialogItem {
public ResetModuleView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

public ResetModuleView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public ResetModuleView(Context context) {
super(context);
}

@Override
public void init(Context context, AttributeSet attrs) {
super.init(context, attrs);
title = "重置模块";
sub = "模块出现问题可以尝试重置";
setData( false, false);

setOnClickListener(view -> {
SettingHelper.getInstance().resetSetting();
sendBroadcast(SettingHelper.refresh_setting);
Toast.makeText(context, "重置完成,手动重启网易云生效", Toast.LENGTH_SHORT).show();
});
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void init(Context context, AttributeSet attrs) {
super.init(context, attrs);
title = SettingHelper.sign_title;
key = SettingHelper.sign_key;
sub = "启用可能会被警告说你在刷云贝";
setData( true, SettingHelper.getInstance().getSetting(key));

setOnClickListener(view -> {
Expand All @@ -42,3 +43,4 @@ public void init(Context context, AttributeSet attrs) {
});
}
}

0 comments on commit 0d01e5f

Please sign in to comment.