mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-22 11:15:10 +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
17
.github/workflows/android.yml
vendored
17
.github/workflows/android.yml
vendored
|
@ -4,10 +4,14 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -36,12 +40,21 @@ jobs:
|
|||
alias: ${{ secrets.ALIAS }}
|
||||
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||
|
||||
- name: Upload file to github
|
||||
- name: Upload to GitHub
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: 'Vanced-Manager'
|
||||
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
|
||||
uses: sinshutu/upload-to-discord@master
|
||||
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-ui-ktx:2.2.2'
|
||||
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'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
package com.vanced.manager.ui.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.ProgressBar
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.DialogFragment
|
||||
|
||||
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() {
|
||||
|
||||
|
@ -27,8 +35,45 @@ class UpdateCheckFragment : DialogFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
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() }
|
||||
|
||||
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"
|
||||
tools:context=".ui.fragments.UpdateCheckFragment">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
style="@style/CardTitle"
|
||||
android:id="@+id/update_center_text"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/update_center"
|
||||
android:textAlignment="center"
|
||||
android:fontFamily="@font/exo_semibold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
android:fontFamily="@font/exo_semibold" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/update_center_progressbar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
<TextView
|
||||
android:id="@+id/update_center_checking"
|
||||
style="@style/AppVer.Bold"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/update_center_text"
|
||||
app:layout_constraintBottom_toTopOf="@id/update_button_container"/>
|
||||
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
|
||||
android:id="@+id/update_center_progressbar"
|
||||
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/update_button_container"
|
||||
android:layout_width="match_parent"
|
||||
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">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/update_center_dismiss"
|
||||
|
@ -53,14 +70,27 @@
|
|||
android:text="@string/close"
|
||||
android:textAllCaps="false"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/update_center_recheck"
|
||||
style="@style/ButtonStyle"
|
||||
android:layout_marginStart="4dp"
|
||||
android:text="@string/re_check" />
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/update_center_recheck"
|
||||
style="@style/ButtonStyle"
|
||||
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" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
Loading…
Reference in a new issue