mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-26 05:05:15 +00:00
attempt to add auto update
This commit is contained in:
parent
76cc197b6d
commit
b3f789a0b4
5 changed files with 129 additions and 33 deletions
15
.github/workflows/android.yml
vendored
15
.github/workflows/android.yml
vendored
|
@ -4,9 +4,13 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -36,12 +40,21 @@ jobs:
|
||||||
alias: ${{ secrets.ALIAS }}
|
alias: ${{ secrets.ALIAS }}
|
||||||
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
|
|
||||||
- name: Upload file to github
|
- name: Upload to GitHub
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: 'Vanced-Manager'
|
name: 'Vanced-Manager'
|
||||||
path: ${{ steps.sign-app.outputs.signedReleaseFile }}
|
path: ${{ steps.sign-app.outputs.signedReleaseFile }}
|
||||||
|
|
||||||
|
- name: Upload to GitHub releases
|
||||||
|
uses: svenstaro/upload-release-action@v1-release
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: ${{ steps.sign-app.outputs.signedReleaseFile }}
|
||||||
|
asset_name: release
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
overwrite: true
|
||||||
|
|
||||||
- name: Upload to Discord
|
- name: Upload to Discord
|
||||||
uses: sinshutu/upload-to-discord@master
|
uses: sinshutu/upload-to-discord@master
|
||||||
env:
|
env:
|
||||||
|
|
18
app/app.iml
18
app/app.iml
File diff suppressed because one or more lines are too long
|
@ -72,7 +72,7 @@ dependencies {
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.github.javiersantos:AppUpdater:2.7'
|
implementation 'com.github.ssseasonnn.RxDownload:rxdownload4:1.0.9'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
package com.vanced.manager.ui.fragments
|
package com.vanced.manager.ui.fragments
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
|
import android.widget.ProgressBar
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
|
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.rxkotlin.subscribeBy
|
||||||
|
import zlc.season.rxdownload4.download
|
||||||
|
import zlc.season.rxdownload4.file
|
||||||
|
|
||||||
class UpdateCheckFragment : DialogFragment() {
|
class UpdateCheckFragment : DialogFragment() {
|
||||||
|
|
||||||
|
@ -27,8 +35,45 @@ class UpdateCheckFragment : DialogFragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
val closebtn = view.findViewById<Button>(R.id.update_center_dismiss)
|
val closebtn = view.findViewById<Button>(R.id.update_center_dismiss)
|
||||||
|
val updatebtn = view.findViewById<Button>(R.id.update_center_update)
|
||||||
|
val recheckbtn = view.findViewById<Button>(R.id.update_center_recheck)
|
||||||
|
val checkingTxt = view.findViewById<TextView>(R.id.update_center_checking)
|
||||||
|
val loadCircle = view.findViewById<ProgressBar>(R.id.update_center_loading)
|
||||||
|
val loadBar = view.findViewById<ProgressBar>(R.id.update_center_progressbar)
|
||||||
|
|
||||||
closebtn.setOnClickListener { dismiss() }
|
closebtn.setOnClickListener { dismiss() }
|
||||||
|
|
||||||
|
recheckbtn.visibility = View.GONE
|
||||||
|
checkingTxt.text = "Update Found!"
|
||||||
|
loadCircle.visibility = View.GONE
|
||||||
|
|
||||||
|
updatebtn.setOnClickListener {
|
||||||
|
val url =
|
||||||
|
"https://github.com/X1nto/VancedInstaller/releases/lastest/download/release.apk"
|
||||||
|
url.download()
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeBy(
|
||||||
|
onNext = { progress ->
|
||||||
|
loadBar.visibility = View.VISIBLE
|
||||||
|
loadBar.progress =
|
||||||
|
"${progress.downloadSizeStr()}/${progress.totalSizeStr()}".toInt()
|
||||||
|
},
|
||||||
|
onComplete = {
|
||||||
|
val apk = url.file()
|
||||||
|
val uri = Uri.fromFile(apk)
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW)
|
||||||
|
intent.setDataAndType(uri, "application/vnd.android.package-archive")
|
||||||
|
startActivity(intent)
|
||||||
|
},
|
||||||
|
onError = {
|
||||||
|
checkingTxt.text = "Something went wrong"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,37 +12,54 @@
|
||||||
app:contentPaddingLeft="6dp"
|
app:contentPaddingLeft="6dp"
|
||||||
tools:context=".ui.fragments.UpdateCheckFragment">
|
tools:context=".ui.fragments.UpdateCheckFragment">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/CardTitle"
|
style="@style/CardTitle"
|
||||||
android:id="@+id/update_center_text"
|
android:id="@+id/update_center_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:text="@string/update_center"
|
android:text="@string/update_center"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:fontFamily="@font/exo_semibold"
|
android:fontFamily="@font/exo_semibold" />
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
<TextView
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
android:id="@+id/update_center_checking"
|
||||||
|
style="@style/AppVer.Bold"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:text="Checking For Updates..."
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/update_center_loading"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/update_center_progressbar"
|
android:id="@+id/update_center_progressbar"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/update_center_text"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toTopOf="@id/update_button_container"/>
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/update_button_container"
|
android:id="@+id/update_button_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
app:layout_constraintTop_toBottomOf="@id/update_center_progressbar"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/update_center_dismiss"
|
android:id="@+id/update_center_dismiss"
|
||||||
|
@ -53,14 +70,27 @@
|
||||||
android:text="@string/close"
|
android:text="@string/close"
|
||||||
android:textAllCaps="false"/>
|
android:textAllCaps="false"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/update_center_recheck"
|
android:id="@+id/update_center_recheck"
|
||||||
style="@style/ButtonStyle"
|
style="@style/ButtonStyle"
|
||||||
android:layout_marginStart="4dp"
|
android:layout_marginStart="4dp"
|
||||||
|
android:text="Update" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/update_center_update"
|
||||||
|
style="@style/ButtonStyle"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
android:text="@string/re_check" />
|
android:text="@string/re_check" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
Loading…
Reference in a new issue