80 lines
4.1 KiB
Python
Executable File
80 lines
4.1 KiB
Python
Executable File
import urllib.request
|
|
import json
|
|
import os
|
|
import subprocess
|
|
import shutil
|
|
|
|
token = "e3b515eaa0a6683c921ca3bf718e281ed30a6075"
|
|
owner_repo = "sanjeok77/ShiftRing"
|
|
tag = "v1.0.7"
|
|
title = "v1.0.7 - 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시 보장 및 설정 복귀 처리 개선"
|
|
body = """## 🚀 ShiftRing v1.0.7 릴리즈
|
|
|
|
### 🌟 주요 변경 및 개선 사항
|
|
1. **🛡️ Play Protect '유해한 앱 차단됨' 경고 원인 완벽 제거 (`AndroidManifest.xml`, `AppUpdateManager.kt`)**:
|
|
- 구글 플레이 프로텍트 자동 탐지 알고리즘에서 오진(Dropper PHA)을 유발하는 `REQUEST_INSTALL_PACKAGES`, `USE_EXACT_ALARM`, `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` 선언을 완벽히 제거
|
|
- 앱 업데이트 시 내부 임의 패키지 인스톨러 대신 안전한 표준 브라우저 다이렉트 다운로드 연동으로 전면 개편
|
|
2. **⏰ 사용 중(화면 켜짐/잠금해제)에도 실제 전체화면 알람 창 즉시 표시 보장 (`AlarmForegroundService.kt`, `AlarmReceiver.kt`, `AndroidManifest.xml`)**:
|
|
- 폰 사용 중일 때 시스템 팝업 배너로만 뜨고 알람 화면이 가려지던 문제를 해결하여, 포그라운드 서비스 및 리시버에서 `AlarmActivity`를 `singleInstance` 및 최우선 포그라운드로 즉시 띄우도록 개선
|
|
3. **🔄 전체화면 알림 등 설정 권한 이동 후 원활한 앱 복귀 처리 (`FragmentSettingsBasic.kt`, `AlarmPermissionUtil.kt`)**:
|
|
- 액티비티 컨텍스트 기반의 네이티브 백스택 유지를 통해 시스템 권한 토글 후 앱으로 자연스럽게 복귀되도록 개선"""
|
|
|
|
apk_path = "app/build/outputs/apk/release/app-release.apk"
|
|
if not os.path.exists(apk_path):
|
|
print(f"APK not found at {apk_path}")
|
|
exit(1)
|
|
|
|
print(f"Using APK at: {apk_path}")
|
|
|
|
# Create Gitea Release
|
|
url = f"https://git.webpluss.net/api/v1/repos/{owner_repo}/releases"
|
|
headers = {"Authorization": f"token {token}", "Content-Type": "application/json"}
|
|
|
|
data = json.dumps({"tag_name": tag, "name": title, "body": body, "draft": False, "prerelease": False}).encode('utf-8')
|
|
req = urllib.request.Request(url, data=data, headers=headers, method="POST")
|
|
with urllib.request.urlopen(req) as response:
|
|
result = json.loads(response.read())
|
|
release_id = result["id"]
|
|
print(f"Created Gitea Release successfully. Release ID: {release_id}")
|
|
|
|
# Upload APK asset
|
|
upload_url = f"https://git.webpluss.net/api/v1/repos/{owner_repo}/releases/{release_id}/assets"
|
|
print(f"Uploading APK to {upload_url}...")
|
|
|
|
curl_cmd = f'curl -s -X POST "{upload_url}?name=app.apk" -H "Authorization: token {token}" -F "attachment=@{apk_path}"'
|
|
upload_result = subprocess.run(curl_cmd, shell=True, capture_output=True, text=True)
|
|
print(f"Upload output: {upload_result.stdout}")
|
|
|
|
upload_json = json.loads(upload_result.stdout)
|
|
apk_uuid = upload_json.get("uuid")
|
|
direct_url = upload_json.get("browser_download_url", f"https://git.webpluss.net/attachments/{apk_uuid}")
|
|
|
|
# Copy APK to project root
|
|
shutil.copy2(apk_path, "app.apk")
|
|
print("Updated app.apk at project root.")
|
|
|
|
# Update version.json
|
|
v_info = {
|
|
"versionCode": 107,
|
|
"versionName": "1.0.7",
|
|
"apkUrl": direct_url,
|
|
"changelog": "v1.0.7: 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시, 설정 복귀 처리 개선",
|
|
"forceUpdate": False
|
|
}
|
|
with open("version.json", "w", encoding="utf-8") as f:
|
|
json.dump(v_info, f, ensure_ascii=False, indent=2)
|
|
|
|
print(f"Updated version.json with apkUrl: {direct_url}")
|
|
|
|
# Git commit and push cleanly in UTF-8
|
|
git_path = r"C:\Users\work\AppData\Roaming\MobaXterm\slash\mx86_64b\bin"
|
|
os.environ["PATH"] = git_path + os.pathsep + os.environ.get("PATH", "")
|
|
|
|
commit_msg = "v1.0.7 - 구글 플레이 프로텍트 유해앱 경고 원인 완벽 제거, 사용 중 전체화면 알람 즉시 표시 보장 및 설정 복귀 처리 개선"
|
|
subprocess.run(["git", "add", "."], check=True)
|
|
subprocess.run(["git", "commit", "-m", commit_msg], check=True)
|
|
subprocess.run(["git", "push", "origin", "main"], check=True)
|
|
|
|
print("Git commit and push completed successfully!")
|
|
print(f"Release {tag} process finished!")
|