Skip to content

Commit 2a40b37

Browse files
committed
Merge remote-tracking branch 'upstream/main' into mtls
2 parents 480aa0c + 2bf7c5f commit 2a40b37

File tree

111 files changed

+1420
-2905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1420
-2905
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
distribution: 'zulu'
1414
java-version: "21"
1515
- name: Set up Ruby
16-
uses: ruby/setup-ruby@v1.197.0
16+
uses: ruby/setup-ruby@v1
1717
with:
1818
bundler-cache: true
1919
- name: Run tests

.github/workflows/create-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/[email protected]
1717
- name: Set up Ruby
18-
uses: ruby/setup-ruby@v1.197.0
18+
uses: ruby/setup-ruby@v1
1919
with:
2020
bundler-cache: true
2121
- name: Set up Java

.github/workflows/deploy-production.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
with:
1414
ssh-key: ${{ secrets.RELEASE_SSH_KEY }}
1515
- name: Set up Ruby
16-
uses: ruby/setup-ruby@v1.197.0
16+
uses: ruby/setup-ruby@v1
1717
with:
1818
bundler-cache: true
1919
- name: Set up Java

.tool-versions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby 3.2.3
1+
ruby 3.4.1

Gemfile

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
source "https://rubygems.org"
22

3-
gem 'fastlane', "~> 2.225.0"
4-
gem "rexml", "~> 3.3.9"
3+
gem 'fastlane', "~> 2.226.0"
4+
gem "rexml", "~> 3.4.0"
5+
6+
7+
# Deps for fastlane
8+
# See https://github.com/fastlane/fastlane/issues/21942
9+
gem 'abbrev'
10+
gem 'logger'
11+
gem 'mutex_m'
12+
gem 'csv'

Gemfile.lock

+32-24
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ GEM
55
base64
66
nkf
77
rexml
8+
abbrev (0.1.2)
89
addressable (2.8.7)
910
public_suffix (>= 2.0.2, < 7.0)
1011
artifactory (3.0.17)
1112
atomos (0.1.3)
1213
aws-eventstream (1.3.0)
13-
aws-partitions (1.996.0)
14-
aws-sdk-core (3.211.0)
14+
aws-partitions (1.1037.0)
15+
aws-sdk-core (3.215.1)
1516
aws-eventstream (~> 1, >= 1.3.0)
1617
aws-partitions (~> 1, >= 1.992.0)
1718
aws-sigv4 (~> 1.9)
1819
jmespath (~> 1, >= 1.6.1)
19-
aws-sdk-kms (1.95.0)
20+
aws-sdk-kms (1.96.0)
2021
aws-sdk-core (~> 3, >= 3.210.0)
2122
aws-sigv4 (~> 1.5)
22-
aws-sdk-s3 (1.169.0)
23+
aws-sdk-s3 (1.177.0)
2324
aws-sdk-core (~> 3, >= 3.210.0)
2425
aws-sdk-kms (~> 1)
2526
aws-sigv4 (~> 1.5)
26-
aws-sigv4 (1.10.1)
27+
aws-sigv4 (1.11.0)
2728
aws-eventstream (~> 1, >= 1.0.2)
2829
babosa (1.0.4)
2930
base64 (0.2.0)
@@ -32,6 +33,7 @@ GEM
3233
colored2 (3.1.2)
3334
commander (4.6.0)
3435
highline (~> 2.0.0)
36+
csv (3.3.2)
3537
declarative (0.0.20)
3638
digest-crc (0.6.5)
3739
rake (>= 12.0.0, < 14.0.0)
@@ -58,17 +60,17 @@ GEM
5860
faraday-em_synchrony (1.0.0)
5961
faraday-excon (1.1.0)
6062
faraday-httpclient (1.0.1)
61-
faraday-multipart (1.0.4)
62-
multipart-post (~> 2)
63+
faraday-multipart (1.1.0)
64+
multipart-post (~> 2.0)
6365
faraday-net_http (1.0.2)
6466
faraday-net_http_persistent (1.2.0)
6567
faraday-patron (1.0.0)
6668
faraday-rack (1.0.0)
6769
faraday-retry (1.0.3)
6870
faraday_middleware (1.2.1)
6971
faraday (~> 1.0)
70-
fastimage (2.3.1)
71-
fastlane (2.225.0)
72+
fastimage (2.4.0)
73+
fastlane (2.226.0)
7274
CFPropertyList (>= 2.3, < 4.0.0)
7375
addressable (>= 2.8, < 3.0.0)
7476
artifactory (~> 3.0)
@@ -108,7 +110,7 @@ GEM
108110
tty-spinner (>= 0.8.0, < 1.0.0)
109111
word_wrap (~> 1.0.0)
110112
xcodeproj (>= 1.13.0, < 2.0.0)
111-
xcpretty (~> 0.3.0)
113+
xcpretty (~> 0.4.0)
112114
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
113115
fastlane-sirp (1.0.0)
114116
sysrandom (~> 1.0)
@@ -150,34 +152,36 @@ GEM
150152
os (>= 0.9, < 2.0)
151153
signet (>= 0.16, < 2.a)
152154
highline (2.0.3)
153-
http-cookie (1.0.7)
155+
http-cookie (1.0.8)
154156
domain_name (~> 0.5)
155157
httpclient (2.8.3)
156158
jmespath (1.6.2)
157-
json (2.7.4)
158-
jwt (2.9.3)
159+
json (2.9.1)
160+
jwt (2.10.1)
159161
base64
162+
logger (1.6.4)
160163
mini_magick (4.13.2)
161164
mini_mime (1.1.5)
162165
multi_json (1.15.0)
163166
multipart-post (2.4.1)
167+
mutex_m (0.3.0)
164168
nanaimo (0.4.0)
165169
naturally (2.2.1)
166170
nkf (0.2.0)
167-
optparse (0.5.0)
171+
optparse (0.6.0)
168172
os (1.1.4)
169-
plist (3.7.1)
173+
plist (3.7.2)
170174
public_suffix (6.0.1)
171175
rake (13.2.1)
172176
representable (3.2.0)
173177
declarative (< 0.1.0)
174178
trailblazer-option (>= 0.1.1, < 0.2.0)
175179
uber (< 0.2.0)
176180
retriable (3.1.2)
177-
rexml (3.3.9)
178-
rouge (2.0.7)
181+
rexml (3.4.0)
182+
rouge (3.28.0)
179183
ruby2_keywords (0.0.5)
180-
rubyzip (2.3.2)
184+
rubyzip (2.4.1)
181185
security (0.1.5)
182186
signet (0.19.0)
183187
addressable (~> 2.8)
@@ -199,15 +203,15 @@ GEM
199203
uber (0.1.0)
200204
unicode-display_width (2.6.0)
201205
word_wrap (1.0.0)
202-
xcodeproj (1.26.0)
206+
xcodeproj (1.27.0)
203207
CFPropertyList (>= 2.3.3, < 4.0)
204208
atomos (~> 0.1.3)
205209
claide (>= 1.0.2, < 2.0)
206210
colored2 (~> 3.1)
207211
nanaimo (~> 0.4.0)
208212
rexml (>= 3.3.6, < 4.0)
209-
xcpretty (0.3.0)
210-
rouge (~> 2.0.7)
213+
xcpretty (0.4.0)
214+
rouge (~> 3.28.0)
211215
xcpretty-travis-formatter (1.0.1)
212216
xcpretty (~> 0.2, >= 0.0.7)
213217

@@ -217,8 +221,12 @@ PLATFORMS
217221
x86_64-linux
218222

219223
DEPENDENCIES
220-
fastlane (~> 2.225.0)
221-
rexml (~> 3.3.9)
224+
abbrev
225+
csv
226+
fastlane (~> 2.226.0)
227+
logger
228+
mutex_m
229+
rexml (~> 3.4.0)
222230

223231
BUNDLED WITH
224-
2.4.21
232+
2.6.2

app/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ android {
2323
applicationId = "com.capyreader.app"
2424
minSdk = 30
2525
targetSdk = 35
26-
versionCode = 1090
27-
versionName = "2025.01.1090-dev"
26+
versionCode = 1096
27+
versionName = "2025.01.1096-dev"
2828

2929
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3030
vectorDrawables {

app/src/main/AndroidManifest.xml

+6
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,11 @@
5959
android:name="androidx.work.impl.foreground.SystemForegroundService"
6060
android:foregroundServiceType="dataSync"
6161
tools:node="merge" />
62+
63+
<receiver android:name=".ArticleStatusBroadcastReceiver" android:exported="false">
64+
<intent-filter>
65+
<action android:name="com.capyreader.ACTION_DISMISS_NOTIFICATION" />
66+
</intent-filter>
67+
</receiver>
6268
</application>
6369
</manifest>

app/src/main/java/com/capyreader/app/AccountModule.kt

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.capyreader.app
22

33
import com.capyreader.app.common.AppPreferences
4+
import com.capyreader.app.notifications.NotificationHelper
45
import com.jocmp.capy.Account
56
import com.jocmp.capy.AccountManager
67
import com.jocmp.capy.DatabaseProvider
@@ -17,4 +18,5 @@ val accountModule = module {
1718
database = get<Database>()
1819
)!!
1920
}
21+
single<NotificationHelper> { NotificationHelper(account = get(), applicationContext = get()) }
2022
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.capyreader.app
2+
3+
import android.content.BroadcastReceiver
4+
import android.content.Context
5+
import android.content.Intent
6+
import com.capyreader.app.notifications.NotificationHelper
7+
import org.koin.core.component.KoinComponent
8+
import org.koin.core.component.inject
9+
10+
class ArticleStatusBroadcastReceiver : BroadcastReceiver(), KoinComponent {
11+
private val handler: BroadcastHandler by lazy { BroadcastHandler() }
12+
13+
override fun onReceive(context: Context, intent: Intent) {
14+
if (intent.action == ACTION_DISMISS_NOTIFICATION) {
15+
val articleID = intent.getStringExtra(ARTICLE_ID) ?: return
16+
17+
handler.dismissNotification(articleID)
18+
}
19+
}
20+
21+
class BroadcastHandler : KoinComponent {
22+
private val notificationHelper by inject<NotificationHelper>()
23+
24+
fun dismissNotification(articleID: String) {
25+
notificationHelper.dismissNotifications(listOf(articleID))
26+
}
27+
}
28+
29+
companion object {
30+
const val ACTION_DISMISS_NOTIFICATION = "com.capyreader.ACTION_DISMISS_NOTIFICATION"
31+
32+
const val ARTICLE_ID = "com.capyreader.articles.article_id"
33+
}
34+
}

app/src/main/java/com/capyreader/app/MainActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import androidx.activity.enableEdgeToEdge
1010
import androidx.compose.runtime.collectAsState
1111
import androidx.compose.runtime.getValue
1212
import com.capyreader.app.common.AppPreferences
13-
import com.capyreader.app.refresher.NotificationHelper
13+
import com.capyreader.app.notifications.NotificationHelper
1414
import com.capyreader.app.ui.App
1515
import com.capyreader.app.ui.Route
1616
import org.koin.android.ext.android.get

app/src/main/java/com/capyreader/app/common/AppPreferences.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class AppPreferences(context: Context) {
7676
get() = preferenceStore.getBoolean("article_pin_top_bar", true)
7777

7878
val fontSize: Preference<Int>
79-
get() = preferenceStore.getInt("article_font_size", FontSize.default)
79+
get() = preferenceStore.getInt("article_font_size", FontSize.DEFAULT)
8080

8181
val fontFamily: Preference<FontOption>
8282
get() = preferenceStore.getEnum("article_font_family", FontOption.default)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.capyreader.app.notifications
2+
3+
import android.content.Context
4+
import androidx.work.CoroutineWorker
5+
import androidx.work.Data
6+
import androidx.work.OneTimeWorkRequestBuilder
7+
import androidx.work.OutOfQuotaPolicy
8+
import androidx.work.WorkManager
9+
import androidx.work.WorkerParameters
10+
import org.koin.core.component.KoinComponent
11+
import org.koin.core.component.inject
12+
13+
class DeleteNotificationWorker(
14+
appContext: Context,
15+
workerParams: WorkerParameters
16+
) : CoroutineWorker(appContext, workerParams), KoinComponent {
17+
private val notificationHelper by inject<NotificationHelper>()
18+
19+
override suspend fun doWork(): Result {
20+
val notificationID = inputData.getString(ARTICLE_ID) ?: return Result.failure()
21+
22+
notificationHelper.dismissNotifications(listOf(notificationID))
23+
24+
return Result.success()
25+
}
26+
27+
companion object {
28+
const val ARTICLE_ID = "article_notification_id"
29+
30+
fun performAsync(articleID: String, context: Context) {
31+
val workManager = WorkManager.getInstance(context)
32+
val data = Data
33+
.Builder()
34+
.putString(ARTICLE_ID, articleID)
35+
.build()
36+
37+
val request = OneTimeWorkRequestBuilder<DeleteNotificationWorker>()
38+
.setInputData(data)
39+
.setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST)
40+
.build()
41+
42+
workManager.enqueue(request)
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)