diff --git a/metadata/com.brackeys.ui.yml b/metadata/com.brackeys.ui.yml new file mode 100644 index 0000000000..b60c531946 --- /dev/null +++ b/metadata/com.brackeys.ui.yml @@ -0,0 +1,29 @@ +AntiFeatures: + - UpstreamNonFree +Categories: + - Development +License: Apache-2.0 +AuthorName: massivemadness +SourceCode: https://github.com/massivemadness/Brackeys-IDE +IssueTracker: https://github.com/massivemadness/Brackeys-IDE/issues +Changelog: https://github.com/massivemadness/Brackeys-IDE/releases + +AutoName: Brackeys IDE + +RepoType: git +Repo: https://github.com/massivemadness/Brackeys-IDE + +Builds: + - versionName: 2020.3.1 + versionCode: 10002 + commit: b058f65e73797e7bdf454c0baff87a3eeafc495a + subdir: app + patch: + - remove_playcore.patch + gradle: + - yes + +AutoUpdateMode: Version %v +UpdateCheckMode: Tags ^([0-9]+\.*)+$ +CurrentVersion: 2020.3.1 +CurrentVersionCode: 10002 diff --git a/metadata/com.brackeys.ui/remove_playcore.patch b/metadata/com.brackeys.ui/remove_playcore.patch new file mode 100644 index 0000000000..ef5aa7f61d --- /dev/null +++ b/metadata/com.brackeys.ui/remove_playcore.patch @@ -0,0 +1,234 @@ +diff --git a/app/build.gradle b/app/build.gradle +index d33ceeff..6949eb25 100644 +--- a/app/build.gradle ++++ b/app/build.gradle +@@ -82,7 +82,6 @@ dependencies { + implementation library.core + implementation library.activity + implementation library.fragment +- implementation library.playcore + + // UI + implementation library.appcompat +diff --git a/app/src/main/kotlin/com/brackeys/ui/feature/main/activities/MainActivity.kt b/app/src/main/kotlin/com/brackeys/ui/feature/main/activities/MainActivity.kt +index 99372d43..f8059c0c 100644 +--- a/app/src/main/kotlin/com/brackeys/ui/feature/main/activities/MainActivity.kt ++++ b/app/src/main/kotlin/com/brackeys/ui/feature/main/activities/MainActivity.kt +@@ -33,16 +33,11 @@ import com.brackeys.ui.feature.main.viewmodel.MainViewModel + import com.brackeys.ui.utils.extensions.fragment + import com.brackeys.ui.utils.extensions.multiplyDraggingEdgeSizeBy + import com.google.android.material.snackbar.Snackbar +-import com.google.android.play.core.install.model.ActivityResult + import dagger.hilt.android.AndroidEntryPoint + + @AndroidEntryPoint + class MainActivity : BaseActivity() { + +- companion object { +- private const val REQUEST_CODE_UPDATE = 10 +- } +- + private val viewModel: MainViewModel by viewModels() + + private lateinit var binding: ActivityMainBinding +@@ -61,21 +56,10 @@ class MainActivity : BaseActivity() { + .fragment(R.id.fragment_explorer) + + binding.drawerLayout?.multiplyDraggingEdgeSizeBy(2) +- +- viewModel.checkForUpdates() + } + + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { + super.onActivityResult(requestCode, resultCode, data) +- if (requestCode == REQUEST_CODE_UPDATE) { +- when (resultCode) { +- Activity.RESULT_OK -> { /* approved */ } +- Activity.RESULT_CANCELED -> { /* rejected */ } +- ActivityResult.RESULT_IN_APP_UPDATE_FAILED -> { +- showToast(R.string.message_in_app_update_failed) +- } +- } +- } + } + + override fun onBackPressed() { +@@ -95,22 +79,6 @@ class MainActivity : BaseActivity() { + } + + private fun observeViewModel() { +- viewModel.updateEvent.observe(this) { +- val appUpdateManager = it.first +- val appUpdateInfo = it.second +- val appUpdateType = it.third +- appUpdateManager.startUpdateFlowForResult( +- appUpdateInfo, +- appUpdateType, +- this, +- REQUEST_CODE_UPDATE +- ) +- } +- viewModel.installEvent.observe(this) { +- Snackbar.make(binding.root, R.string.message_in_app_update_ready, Snackbar.LENGTH_INDEFINITE) +- .setAction(R.string.action_restart) { viewModel.completeUpdate() } +- .show() +- } + viewModel.fullscreenEvent.observe(this) { enabled -> + if (enabled) { + window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) +@@ -127,4 +95,4 @@ class MainActivity : BaseActivity() { + + viewModel.observeSettings() + } +-} +\ No newline at end of file ++} +diff --git a/app/src/main/kotlin/com/brackeys/ui/feature/main/viewmodel/MainViewModel.kt b/app/src/main/kotlin/com/brackeys/ui/feature/main/viewmodel/MainViewModel.kt +index 7615dafc..41ca7922 100644 +--- a/app/src/main/kotlin/com/brackeys/ui/feature/main/viewmodel/MainViewModel.kt ++++ b/app/src/main/kotlin/com/brackeys/ui/feature/main/viewmodel/MainViewModel.kt +@@ -24,27 +24,17 @@ import com.brackeys.ui.domain.providers.rx.SchedulersProvider + import com.brackeys.ui.feature.base.viewmodel.BaseViewModel + import com.brackeys.ui.filesystem.base.model.FileModel + import com.brackeys.ui.utils.event.SingleLiveEvent +-import com.google.android.play.core.appupdate.AppUpdateInfo +-import com.google.android.play.core.appupdate.AppUpdateManager +-import com.google.android.play.core.install.InstallStateUpdatedListener +-import com.google.android.play.core.install.model.AppUpdateType +-import com.google.android.play.core.install.model.InstallStatus +-import com.google.android.play.core.install.model.UpdateAvailability +-import com.google.android.play.core.ktx.installStatus + import io.reactivex.rxkotlin.subscribeBy + + class MainViewModel @ViewModelInject constructor( + private val schedulersProvider: SchedulersProvider, + private val settingsManager: SettingsManager, +- private val appUpdateManager: AppUpdateManager + ) : BaseViewModel() { + + companion object { + private const val TAG = "MainViewModel" + } + +- val updateEvent: SingleLiveEvent> = SingleLiveEvent() +- val installEvent: SingleLiveEvent = SingleLiveEvent() + val fullscreenEvent: SingleLiveEvent = SingleLiveEvent() + val confirmExitEvent: SingleLiveEvent = SingleLiveEvent() + +@@ -56,37 +46,6 @@ class MainViewModel @ViewModelInject constructor( + val openAsEvent: SingleLiveEvent = SingleLiveEvent() + val propertiesEvent: SingleLiveEvent = SingleLiveEvent() + +- private val installStateUpdatedListener = InstallStateUpdatedListener { state -> +- if (state.installStatus == InstallStatus.DOWNLOADED) { +- installEvent.call() +- } +- } +- +- fun checkForUpdates() { +- // TODO: 2020/8/5 Google Play is not available in Chinese mainland +- appUpdateManager.registerListener(installStateUpdatedListener) +- appUpdateManager.appUpdateInfo +- .addOnSuccessListener { appUpdateInfo -> +- if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) { +- if (appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) { +- updateEvent.value = Triple(appUpdateManager, appUpdateInfo, AppUpdateType.FLEXIBLE) +- } else if (appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) { +- updateEvent.value = Triple(appUpdateManager, appUpdateInfo, AppUpdateType.IMMEDIATE) +- } +- } else { +- appUpdateManager.unregisterListener(installStateUpdatedListener) +- } +- } +- .addOnFailureListener { +- Log.e(TAG, it.message, it) +- } +- } +- +- fun completeUpdate() { +- appUpdateManager.unregisterListener(installStateUpdatedListener) +- appUpdateManager.completeUpdate() +- } +- + fun observeSettings() { + settingsManager.getFullscreenMode() + .asObservable() +@@ -100,4 +59,4 @@ class MainViewModel @ViewModelInject constructor( + .subscribeBy { confirmExitEvent.value = it } + .disposeOnViewModelDestroy() + } +-} +\ No newline at end of file ++} +diff --git a/app/src/main/kotlin/com/brackeys/ui/internal/di/main/MainModule.kt b/app/src/main/kotlin/com/brackeys/ui/internal/di/main/MainModule.kt +deleted file mode 100644 +index c4590a23..00000000 +--- a/app/src/main/kotlin/com/brackeys/ui/internal/di/main/MainModule.kt ++++ /dev/null +@@ -1,38 +0,0 @@ +-/* +- * Copyright 2020 Brackeys IDE contributors. +- * +- * Licensed under the Apache License, Version 2.0 (the "License"); +- * you may not use this file except in compliance with the License. +- * You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +- +-package com.brackeys.ui.internal.di.main +- +-import android.content.Context +-import com.google.android.play.core.appupdate.AppUpdateManager +-import com.google.android.play.core.appupdate.AppUpdateManagerFactory +-import dagger.Module +-import dagger.Provides +-import dagger.hilt.InstallIn +-import dagger.hilt.android.components.ActivityRetainedComponent +-import dagger.hilt.android.qualifiers.ApplicationContext +-import dagger.hilt.android.scopes.ActivityRetainedScoped +- +-@Module +-@InstallIn(ActivityRetainedComponent::class) +-object MainModule { +- +- @Provides +- @ActivityRetainedScoped +- fun provideAppUpdateManager(@ApplicationContext context: Context): AppUpdateManager { +- return AppUpdateManagerFactory.create(context) +- } +-} +\ No newline at end of file +diff --git a/dependencies.gradle b/dependencies.gradle +index 2d37c510..f19538d3 100644 +--- a/dependencies.gradle ++++ b/dependencies.gradle +@@ -36,7 +36,6 @@ ext { + core_version = '1.5.0-alpha05' + activity_version = '1.2.0-rc01' + fragment_version = '1.3.0-rc01' +- playcore_version = '1.8.1' + + // UI + appcompat_version = '1.3.0-alpha02' +@@ -96,7 +95,6 @@ ext { + core: "androidx.core:core-ktx:$core_version", + activity: "androidx.activity:activity-ktx:$activity_version", + fragment: "androidx.fragment:fragment-ktx:$fragment_version", +- playcore: "com.google.android.play:core-ktx:$playcore_version", + + // UI + appcompat: "androidx.appcompat:appcompat:$appcompat_version", +@@ -153,4 +151,4 @@ ext { + test_runner: "androidx.test:runner:$test_runner_version", + espresso_core: "androidx.test.espresso:espresso-core:$espresso_core_version" + ] +-} +\ No newline at end of file ++}