Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save ktlint rules to project #230

Merged
merged 18 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
root = true

[*.{kt,kts}]
end_of_line = lf
ij_kotlin_packages_to_use_import_on_demand = true
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_imports_layout = *
ij_kotlin_indent_before_arrow_on_new_line = false
ij_kotlin_line_break_after_multiline_when_entry = true
indent_size = 4
indent_style = space
insert_final_newline = true
parameter-list-wrapping = true
ktlint_argument_list_wrapping_ignore_when_parameter_count_greater_or_equal_than = 8
ktlint_chain_method_rule_force_multiline_when_chain_operator_count_greater_or_equal_than = 4
ktlint_code_style = android_studio
ktlint_enum_entry_name_casing = upper_or_camel_cases
ktlint_function_naming_ignore_when_annotated_with = Composable
ktlint_function_signature_body_expression_wrapping = default
ktlint_ignore_back_ticked_identifier = false
max_line_length = 140


26 changes: 11 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,7 @@ captures/
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/encodings.xml
.idea/saveactions_settings.xml
.idea/deploymentTargetDropDown.xml
.idea/gradle.xml
.idea/misc.xml

.DS_Store
/build
/captures
Expand Down Expand Up @@ -87,8 +77,14 @@ GoogleService-Info.plist
GoogleService-Info.plist
Pods/
*.xcworkspace
.idea/inspectionProfiles/profiles_settings.xml
.idea/inspectionProfiles/Project_Default.xml
.idea/dictionaries/matyas.xml
/.idea/
.kotlin
.idea/.name
.idea/compiler.xml
.idea/deploymentTargetSelector.xml
.idea/gradle.xml
.idea/kotlinc.xml
.idea/misc.xml
.idea/runConfigurations.xml
.idea/vcs.xml
.idea/workspace.xml
.idea/caches/deviceStreaming.xml
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/ktlint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?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.RECEIVE_BOOT_COMPLETED"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />

<queries>
<package android:name="co.touchlab.fluttercon" />
Expand Down Expand Up @@ -36,11 +40,13 @@
</intent-filter>
</receiver>

<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
<meta-data
android:name="google_analytics_adid_collection_enabled"
android:value="false" />

<service
android:name="co.touchlab.droidcon.android.service.impl.DefaultFirebaseMessagingService"
android:exported="false">
android:name="co.touchlab.droidcon.android.service.impl.DefaultFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ import org.brightify.hyperdrive.multiplatformx.LifecycleGraph
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject

class MainActivity : ComponentActivity(), KoinComponent {
class MainActivity :
ComponentActivity(),
KoinComponent {

private val notificationSchedulingService: NotificationSchedulingService by inject()
private val syncService: SyncService by inject()
Expand All @@ -56,7 +58,7 @@ class MainActivity : ComponentActivity(), KoinComponent {
private val root = LifecycleGraph.Root(this)

private val requestPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
ActivityResultContracts.RequestPermission(),
) { isGranted: Boolean ->
}

Expand Down Expand Up @@ -103,12 +105,12 @@ class MainActivity : ComponentActivity(), KoinComponent {
modifier = Modifier
.background(Colors.primary)
.fillMaxSize(),
contentAlignment = Alignment.Center
contentAlignment = Alignment.Center,
) {
Image(
painter = painterResource(id = R.drawable.ic_splash_screen),
contentDescription = getString(R.string.droidcon_title),
modifier = Modifier.padding(32.dp)
modifier = Modifier.padding(32.dp),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MainApp : Application() {
single<AnalyticsService> {
AndroidAnalyticsService(firebaseAnalytics = Firebase.analytics)
}
} + uiModule
} + uiModule,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.google.firebase.messaging.RemoteMessage
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import org.koin.android.ext.android.inject
import org.koin.core.component.inject

class DefaultFirebaseMessagingService : FirebaseMessagingService() {
private val notificationService: AndroidNotificationService by inject()
Expand All @@ -22,10 +21,10 @@ class DefaultFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)

if (message.data.isNotEmpty() && message.data[Notification.Keys.notificationType] == Notification.Values.refreshDataType) {
if (message.data.isNotEmpty() && message.data[Notification.Keys.NOTIFICATION_TYPE] == Notification.Values.REFRESH_DATA_TYPE) {
MainScope().launch {
notificationService.handleNotification(
Notification.Remote.RefreshData
Notification.Remote.RefreshData,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@ class DefaultParseUrlViewService : ParseUrlViewService {

private val urlRegex = Patterns.WEB_URL.toRegex()

override fun parse(text: String): List<WebLink> {
return urlRegex.findAll(text).map { WebLink(it.range, it.value) }.toList()
}
override fun parse(text: String): List<WebLink> = urlRegex.findAll(text).map { WebLink(it.range, it.value) }.toList()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,16 @@ import android.content.Context
import co.touchlab.droidcon.R
import co.touchlab.droidcon.application.service.NotificationSchedulingService

class NotificationLocalizedStringFactory(
private val context: Context,
) : NotificationSchedulingService.LocalizedStringFactory {
class NotificationLocalizedStringFactory(private val context: Context) : NotificationSchedulingService.LocalizedStringFactory {

override fun reminderTitle(roomName: String?): String {
val ending = roomName?.let { context.getString(R.string.notification_reminder_title_in_room, it) } ?: ""
return context.getString(R.string.notification_reminder_title_base, ending)
}

override fun reminderBody(sessionTitle: String): String {
return context.getString(R.string.notification_reminder_body, sessionTitle)
}
override fun reminderBody(sessionTitle: String): String = context.getString(R.string.notification_reminder_body, sessionTitle)

override fun feedbackTitle(): String {
return context.getString(R.string.notification_feedback_title)
}
override fun feedbackTitle(): String = context.getString(R.string.notification_feedback_title)

override fun feedbackBody(): String {
return context.getString(R.string.notification_feedback_body)
}
override fun feedbackBody(): String = context.getString(R.string.notification_feedback_body)
}
77 changes: 41 additions & 36 deletions android/src/main/res/drawable-night/about_kotlin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,45 @@
android:height="528dp"
android:viewportWidth="2435"
android:viewportHeight="528">
<path
android:pathData="M499.8,519.9l-499.8,0l0,-499.5l499.8,0l-249.9,249.6z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="499.7"
android:startY="20.3"
android:endX="0.1"
android:endY="520"
android:type="linear">
<item android:offset="0" android:color="#FFE44857"/>
<item android:offset="0.5" android:color="#FFC711E1"/>
<item android:offset="1" android:color="#FF7F52FF"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M1104.6,18.8l-100.3,0l-216.2,231.9l0,-230.3l-79.9,0l0,499.5l79.9,0l0,-241.3l217.8,241.3l101.8,0l-230.3,-258.3z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M1375.6,170.8c-28.2,-15.7 -61.1,-25.1 -95.6,-25.1c-36,0 -68.9,7.8 -97.1,25.1c-28.2,17.3 -51.7,39.2 -67.4,67.4c-15.7,29.8 -23.5,62.7 -23.5,98.7s7.8,70.5 23.5,98.7s37.6,51.7 67.4,67.4c28.2,15.7 61.1,25.1 97.1,25.1c36,0 68.9,-7.8 97.1,-25.1c28.2,-15.7 50.1,-39.2 65.8,-67.4c15.7,-29.8 23.5,-62.7 23.5,-98.7s-9.4,-68.9 -25.1,-98.7C1425.8,209.9 1403.8,186.4 1375.6,170.8zM1369.4,400.8c-9.4,18.8 -21.9,32.9 -37.6,42.3c-15.7,11 -34.5,15.7 -54.8,15.7c-20.3,0 -39.2,-4.7 -56.4,-15.7c-15.7,-11 -28.2,-25.1 -37.6,-42.3c-9.4,-18.8 -12.5,-39.2 -12.5,-62.7s4.7,-45.4 14.1,-62.7c9.4,-18.8 21.9,-32.9 37.6,-42.3c15.7,-11 34.5,-15.7 56.4,-15.7c20.4,0 39.2,4.7 54.8,15.7c15.7,11 28.2,25.1 37.6,42.3c9.4,18.8 12.5,39.2 12.5,62.7S1378.8,382 1369.4,400.8z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M1627.9,62.7h-76.8v62.7c0,9.4 -1.6,17.2 -7.8,21.9c-4.7,4.7 -12.5,7.8 -21.9,7.8h-37.6v65.8h65.8v197.4c0,20.4 4.7,39.2 12.5,54.8c7.8,15.7 20.4,28.2 36,36c15.7,9.4 32.9,12.5 54.8,12.5h59.5v-68.9h-43.9c-11,0 -20.4,-3.1 -28.2,-12.5c-6.3,-7.8 -11,-18.8 -11,-31.3v-188h84.6v-65.8h-84.6V62.7H1627.9z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M1773.6,0h78.3v519.9h-78.3z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M1941.2,1.6h79.9v81.5h-79.9z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M1941.2,155.1h78.3v366.3h-78.3z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M2419.1,214.6c-11,-21.9 -26.6,-39.2 -47,-50.1c-20.4,-12.5 -43.9,-18.8 -70.5,-18.8c-28.2,0 -53.3,7.8 -75.2,20.4c-17.2,11 -31.3,26.6 -42.3,43.9v-56.4h-75.2v366.3h78.3V314.6c0,-20.4 3.1,-37.6 11,-53.3c7.8,-15.7 18.8,-26.6 31.3,-36c14.1,-7.8 29.8,-12.5 48.6,-12.5c17.2,0 29.8,3.1 42.3,11c12.5,7.9 20.4,17.2 26.6,29.8c6.3,12.5 9.4,28.2 9.4,45.4v219.3h78.3V289.6C2436.4,261.6 2430.2,236.6 2419.1,214.6z"
android:fillColor="#FFFFFF"/>
<path android:pathData="M499.8,519.9l-499.8,0l0,-499.5l499.8,0l-249.9,249.6z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="499.7"
android:startY="20.3"
android:endX="0.1"
android:endY="520"
android:type="linear">
<item
android:offset="0"
android:color="#FFE44857" />
<item
android:offset="0.5"
android:color="#FFC711E1" />
<item
android:offset="1"
android:color="#FF7F52FF" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M1104.6,18.8l-100.3,0l-216.2,231.9l0,-230.3l-79.9,0l0,499.5l79.9,0l0,-241.3l217.8,241.3l101.8,0l-230.3,-258.3z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M1375.6,170.8c-28.2,-15.7 -61.1,-25.1 -95.6,-25.1c-36,0 -68.9,7.8 -97.1,25.1c-28.2,17.3 -51.7,39.2 -67.4,67.4c-15.7,29.8 -23.5,62.7 -23.5,98.7s7.8,70.5 23.5,98.7s37.6,51.7 67.4,67.4c28.2,15.7 61.1,25.1 97.1,25.1c36,0 68.9,-7.8 97.1,-25.1c28.2,-15.7 50.1,-39.2 65.8,-67.4c15.7,-29.8 23.5,-62.7 23.5,-98.7s-9.4,-68.9 -25.1,-98.7C1425.8,209.9 1403.8,186.4 1375.6,170.8zM1369.4,400.8c-9.4,18.8 -21.9,32.9 -37.6,42.3c-15.7,11 -34.5,15.7 -54.8,15.7c-20.3,0 -39.2,-4.7 -56.4,-15.7c-15.7,-11 -28.2,-25.1 -37.6,-42.3c-9.4,-18.8 -12.5,-39.2 -12.5,-62.7s4.7,-45.4 14.1,-62.7c9.4,-18.8 21.9,-32.9 37.6,-42.3c15.7,-11 34.5,-15.7 56.4,-15.7c20.4,0 39.2,4.7 54.8,15.7c15.7,11 28.2,25.1 37.6,42.3c9.4,18.8 12.5,39.2 12.5,62.7S1378.8,382 1369.4,400.8z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M1627.9,62.7h-76.8v62.7c0,9.4 -1.6,17.2 -7.8,21.9c-4.7,4.7 -12.5,7.8 -21.9,7.8h-37.6v65.8h65.8v197.4c0,20.4 4.7,39.2 12.5,54.8c7.8,15.7 20.4,28.2 36,36c15.7,9.4 32.9,12.5 54.8,12.5h59.5v-68.9h-43.9c-11,0 -20.4,-3.1 -28.2,-12.5c-6.3,-7.8 -11,-18.8 -11,-31.3v-188h84.6v-65.8h-84.6V62.7H1627.9z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M1773.6,0h78.3v519.9h-78.3z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M1941.2,1.6h79.9v81.5h-79.9z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M1941.2,155.1h78.3v366.3h-78.3z"
android:fillColor="#FFFFFF" />
<path
android:pathData="M2419.1,214.6c-11,-21.9 -26.6,-39.2 -47,-50.1c-20.4,-12.5 -43.9,-18.8 -70.5,-18.8c-28.2,0 -53.3,7.8 -75.2,20.4c-17.2,11 -31.3,26.6 -42.3,43.9v-56.4h-75.2v366.3h78.3V314.6c0,-20.4 3.1,-37.6 11,-53.3c7.8,-15.7 18.8,-26.6 31.3,-36c14.1,-7.8 29.8,-12.5 48.6,-12.5c17.2,0 29.8,3.1 42.3,11c12.5,7.9 20.4,17.2 26.6,29.8c6.3,12.5 9.4,28.2 9.4,45.4v219.3h78.3V289.6C2436.4,261.6 2430.2,236.6 2419.1,214.6z"
android:fillColor="#FFFFFF" />
</vector>
Loading
Loading