Skip to content

Commit

Permalink
build(variant): add google play
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashinch committed Jan 22, 2024
1 parent 27f700d commit d6c0b65
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 34 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ jobs:
with:
name: github-${{ github.sha }}
path: app/build/outputs/apk/github/release/*.apk
- uses: actions/upload-artifact@v3
with:
name: fdroid-${{ github.sha }}
path: app/build/outputs/apk/fdroid/release/*.apk
24 changes: 0 additions & 24 deletions .github/workflows/build_pull_request.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ android {
fdroid {
dimension "channel"
}
googlePlay {
dimension "channel"
applicationIdSuffix ".google.play"
}
github {
dimension "channel"
}
Expand Down
55 changes: 55 additions & 0 deletions app/src/googlePlay/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.APP_BROWSER" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
</intent>
</queries>

<application
android:name=".infrastructure.android.AndroidApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/read_you"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Reader"
android:usesCleartextTraffic="true">
<activity
android:name=".infrastructure.android.MainActivity"
android:exported="true"
android:theme="@style/Theme.Reader">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:node="remove">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

</manifest>
Binary file added app/src/googlePlay/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import me.ash.reader.infrastructure.rss.OPMLDataSource
import me.ash.reader.infrastructure.rss.RssHelper
import me.ash.reader.ui.ext.del
import me.ash.reader.ui.ext.getLatestApk
import me.ash.reader.ui.ext.isFdroid
import me.ash.reader.ui.ext.isGitHub
import okhttp3.OkHttpClient
import javax.inject.Inject

Expand Down Expand Up @@ -132,7 +132,7 @@ class AndroidApp : Application(), Configuration.Provider {
}

private suspend fun checkUpdate() {
if (isFdroid) return
if (!isGitHub) return
withContext(ioDispatcher) {
applicationContext.getLatestApk().let {
if (it.exists()) it.del()
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/me/ash/reader/ui/ext/FlavorExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import me.ash.reader.BuildConfig

const val GITHUB = "github"
const val FDROID = "fdroid"
const val GOOGLE_PLAY = "googlePlay"

const val isFdroid = BuildConfig.FLAVOR == FDROID
const val notFdroid = !isFdroid
const val isFDroid = BuildConfig.FLAVOR == FDROID
const val isGitHub = BuildConfig.FLAVOR == GITHUB
const val isGooglePlay = BuildConfig.FLAVOR == GOOGLE_PLAY
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import me.ash.reader.domain.service.AppService
import me.ash.reader.infrastructure.net.Download
import me.ash.reader.ui.ext.notFdroid
import me.ash.reader.ui.ext.isGitHub
import javax.inject.Inject

@HiltViewModel
Expand All @@ -22,7 +22,7 @@ class UpdateViewModel @Inject constructor(
preProcessor: suspend () -> Unit = {},
postProcessor: suspend (Boolean) -> Unit = {},
) {
if (notFdroid) {
if (isGitHub) {
viewModelScope.launch {
preProcessor()
appService.checkUpdate().let {
Expand Down

0 comments on commit d6c0b65

Please sign in to comment.