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

chore: update colors and clean up some code #212

Merged
merged 1 commit into from
Mar 28, 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
6 changes: 3 additions & 3 deletions .idea/codeStyles/codeStyleConfig.xml

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

12 changes: 6 additions & 6 deletions androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
xmlns:tools="http://schemas.android.com/tools">

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

<application
android:name=".AndroidMakersApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".AndroidMakersApplication"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/PreviewTheme.AndroidMakers"
Expand All @@ -32,12 +32,12 @@
android:resource="@color/white" />

<activity
android:name=".ui.MainActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
android:launchMode="singleTask"
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AndroidMakers.NoActionBar"
android:launchMode="singleTask"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -46,9 +46,9 @@
</activity>

<service
android:name=".messaging.AndroidMakersMessagingService"
android:directBootAware="true"
android:exported="false">
android:exported="false"
android:name=".messaging.AndroidMakersMessagingService">
<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 @@ -11,7 +11,10 @@ class AndroidMakersApplication : Application() {
super.onCreate()

DependenciesBuilder(this).inject(
listOf(androidViewModelModule, viewModelModule)
listOf(
androidViewModelModule,
viewModelModule
)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.paug.androidmakers.ui
package fr.paug.androidmakers

import android.content.Intent
import android.graphics.Color
Expand Down Expand Up @@ -29,7 +29,6 @@ import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.auth.GoogleAuthProvider
import dev.gitlive.firebase.auth.auth
import fr.androidmakers.store.firebase.toUser
import fr.paug.androidmakers.BuildConfig
import fr.paug.androidmakers.R
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -44,7 +43,6 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)
enableEdgeToEdge()

logFCMToken()

Expand All @@ -55,28 +53,28 @@ class MainActivity : AppCompatActivity() {
val darkTheme = isSystemInDarkTheme()

CompositionLocalProvider(
LocalPlatformContext provides rememberedActivity,
LocalPlatformContext provides rememberedActivity,
) {
KoinContext {
AndroidMakersTheme {
DisposableEffect(darkTheme) {
enableEdgeToEdge(
statusBarStyle = SystemBarStyle.auto(
Color.TRANSPARENT,
Color.TRANSPARENT,
) { darkTheme },
navigationBarStyle = SystemBarStyle.auto(
Color.TRANSPARENT,
Color.TRANSPARENT,
) { darkTheme },
statusBarStyle = SystemBarStyle.auto(
Color.TRANSPARENT,
Color.TRANSPARENT,
) { darkTheme },
navigationBarStyle = SystemBarStyle.auto(
Color.TRANSPARENT,
Color.TRANSPARENT,
) { darkTheme },
)
onDispose { }
}

MainLayout(
user = userState.value,
versionName = BuildConfig.VERSION_NAME,
versionCode = BuildConfig.VERSION_CODE.toString(),
user = userState.value,
versionName = BuildConfig.VERSION_NAME,
versionCode = BuildConfig.VERSION_CODE.toString(),
)
}
}
Expand All @@ -101,7 +99,7 @@ class MainActivity : AppCompatActivity() {
when (requestCode) {
REQ_SIGNIN -> {
val task: Task<GoogleSignInAccount> =
GoogleSignIn.getSignedInAccountFromIntent(data)
GoogleSignIn.getSignedInAccountFromIntent(data)
try {
val account: GoogleSignInAccount = task.getResult(ApiException::class.java)
val idToken = account.idToken
Expand Down Expand Up @@ -136,8 +134,8 @@ class MainActivity : AppCompatActivity() {
fun signout() {
val activity = this
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(activity.getString(R.string.default_web_client_id))
.build()
.requestIdToken(activity.getString(R.string.default_web_client_id))
.build()
val googleSignInClient = GoogleSignIn.getClient(activity, gso)

lifecycleScope.launch {
Expand All @@ -151,8 +149,8 @@ class MainActivity : AppCompatActivity() {
fun signin() {
val activity = this
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(activity.getString(R.string.default_web_client_id))
.build()
.requestIdToken(activity.getString(R.string.default_web_client_id))
.build()
val googleSignInClient = GoogleSignIn.getClient(activity, gso)

activity.startActivityForResult(googleSignInClient.signInIntent, REQ_SIGNIN)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.paug.androidmakers.ui
package fr.paug.androidmakers

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand All @@ -13,7 +13,7 @@ class MainActivityViewModel(
private val userRepository: UserRepository,
val syncBookmarksUseCase: SyncBookmarksUseCase

): ViewModel() {
) : ViewModel() {
private val _user = MutableStateFlow<User?>(null)
val user: Flow<User?> = _user

Expand All @@ -23,9 +23,9 @@ class MainActivityViewModel(

val currentUser = _user.value
if (currentUser != null) {
// fire & forget
// This is racy but oh well...
syncBookmarksUseCase(currentUser.id)
// fire & forget
// This is racy but oh well...
syncBookmarksUseCase(currentUser.id)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package fr.paug.androidmakers.di

import fr.paug.androidmakers.ui.MainActivityViewModel
import fr.paug.androidmakers.MainActivityViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import android.util.Log
import androidx.core.app.NotificationCompat
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import fr.paug.androidmakers.MainActivity
import fr.paug.androidmakers.R
import fr.paug.androidmakers.ui.MainActivity

class AndroidMakersMessagingService : FirebaseMessagingService() {

Expand Down Expand Up @@ -45,26 +45,30 @@ class AndroidMakersMessagingService : FirebaseMessagingService() {
private fun sendNotification(messageBody: String) {
val intent = Intent(this, MainActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_IMMUTABLE)
val pendingIntent = PendingIntent.getActivity(
this, 0 /* Request code */, intent,
PendingIntent.FLAG_IMMUTABLE
)

val channelId = "fcm_default_channel"
val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val notificationBuilder = NotificationCompat.Builder(this, channelId)
.setContentTitle("FCM Message")
.setContentText(messageBody)
.setSmallIcon(R.drawable.ic_notification_small)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
.setContentTitle("FCM Message")
.setContentText(messageBody)
.setSmallIcon(R.drawable.ic_notification_small)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)

val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

// Since android Oreo notification channel is needed.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(channelId,
"Channel human readable title",
NotificationManager.IMPORTANCE_DEFAULT)
val channel = NotificationChannel(
channelId,
"Channel human readable title",
NotificationManager.IMPORTANCE_DEFAULT
)
notificationManager.createNotificationChannel(channel)
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading