Notifly 기본 설정 추가
This commit is contained in:
		| @@ -49,6 +49,9 @@ android { | ||||
|             buildConfigField 'String', 'BOOTPAY_APP_HECTO_ID', '"664c1707b18b225deca4b429"' | ||||
|             buildConfigField 'String', 'AGORA_APP_ID', '"e34e40046e9847baba3adfe2b8ffb4f6"' | ||||
|             buildConfigField 'String', 'AGORA_APP_CERTIFICATE', '"15cadeea4ba94ff7b091c9a10f4bf4a6"' | ||||
|             buildConfigField 'String', 'NOTIFLY_PROJECT_ID', '"765102ec85855aa680da35f1b0f55712"' | ||||
|             buildConfigField 'String', 'NOTIFLY_USERNAME', '"voiceon"' | ||||
|             buildConfigField 'String', 'NOTIFLY_PASSWORD', '"c6c585db0aaa4189be44d0467c7d66b6@A"' | ||||
|             manifestPlaceholders = [ | ||||
|                 URISCHEME            : "voiceon", | ||||
|                 APPLINK_HOST         : "voiceon.onelink.me", | ||||
| @@ -68,6 +71,9 @@ android { | ||||
|             buildConfigField 'String', 'BOOTPAY_APP_HECTO_ID', '"667fca5d3bab7404f831c3e4"' | ||||
|             buildConfigField 'String', 'AGORA_APP_ID', '"b96574e191a9430fa54c605528aa3ef7"' | ||||
|             buildConfigField 'String', 'AGORA_APP_CERTIFICATE', '"ae18ade3afcf4086bd4397726eb0654c"' | ||||
|             buildConfigField 'String', 'NOTIFLY_PROJECT_ID', '"5f7ebe90d1ce5f0392164b8a53a662bc"' | ||||
|             buildConfigField 'String', 'NOTIFLY_USERNAME', '"voiceon"' | ||||
|             buildConfigField 'String', 'NOTIFLY_PASSWORD', '"c6c585db0aaa4189be44d0467c7d66b6@A"' | ||||
|             manifestPlaceholders = [ | ||||
|                 URISCHEME            : "voiceon-test", | ||||
|                 APPLINK_HOST         : "voiceon-test.onelink.me", | ||||
| @@ -182,4 +188,7 @@ dependencies { | ||||
|  | ||||
|     // Appsflyer | ||||
|     implementation 'com.appsflyer:af-android-sdk:6.16.1' | ||||
|  | ||||
|     // 노티플라이 | ||||
|     implementation 'com.github.team-michael:notifly-android-sdk:1.12.0' | ||||
| } | ||||
|   | ||||
| @@ -15,6 +15,7 @@ import kr.co.vividnext.sodalive.common.ImageLoaderProvider | ||||
| import kr.co.vividnext.sodalive.common.SharedPreferenceManager | ||||
| import kr.co.vividnext.sodalive.di.AppDI | ||||
| import kr.co.vividnext.sodalive.tracking.FirebaseTracking | ||||
| import tech.notifly.Notifly | ||||
|  | ||||
| class SodaLiveApp : Application() { | ||||
|     override fun onCreate() { | ||||
| @@ -37,6 +38,8 @@ class SodaLiveApp : Application() { | ||||
|         FacebookSdk.fullyInitialize() | ||||
|  | ||||
|         setupAppsFlyer() | ||||
|  | ||||
|         setupNotifly() | ||||
|     } | ||||
|  | ||||
|     private fun isDebuggable(): Boolean { | ||||
| @@ -106,4 +109,13 @@ class SodaLiveApp : Application() { | ||||
|     private fun logUtmInFirebase() { | ||||
|         FirebaseTracking.logUtm() | ||||
|     } | ||||
|  | ||||
|     private fun setupNotifly() { | ||||
|         Notifly.initialize( | ||||
|             applicationContext, | ||||
|             BuildConfig.NOTIFLY_PROJECT_ID, | ||||
|             BuildConfig.NOTIFLY_USERNAME, | ||||
|             BuildConfig.NOTIFLY_PASSWORD, | ||||
|         ) | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -565,7 +565,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl | ||||
|     } | ||||
|  | ||||
|     private fun getMemberInfo() { | ||||
|         viewModel.getMemberInfo { | ||||
|         viewModel.getMemberInfo(context = applicationContext) { | ||||
|             notificationSettingsDialog.show(screenWidth) | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -16,7 +16,11 @@ import kr.co.vividnext.sodalive.common.SharedPreferenceManager | ||||
| import kr.co.vividnext.sodalive.settings.event.EventItem | ||||
| import kr.co.vividnext.sodalive.settings.event.EventRepository | ||||
| import kr.co.vividnext.sodalive.settings.notification.UpdateNotificationSettingRequest | ||||
| import kr.co.vividnext.sodalive.tracking.NotiflyClient | ||||
| import kr.co.vividnext.sodalive.user.UserRepository | ||||
| import java.text.SimpleDateFormat | ||||
| import java.util.Date | ||||
| import java.util.Locale | ||||
| import java.util.concurrent.Executors | ||||
|  | ||||
| class MainViewModel( | ||||
| @@ -86,7 +90,7 @@ class MainViewModel( | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|     fun getMemberInfo(showNotificationSettingsDialog: () -> Unit) { | ||||
|     fun getMemberInfo(context: Context, showNotificationSettingsDialog: () -> Unit) { | ||||
|         compositeDisposable.add( | ||||
|             userRepository.getMemberInfo(token = "Bearer ${SharedPreferenceManager.token}") | ||||
|                 .subscribeOn(Schedulers.io()) | ||||
| @@ -107,6 +111,28 @@ class MainViewModel( | ||||
|                             ) { | ||||
|                                 showNotificationSettingsDialog() | ||||
|                             } | ||||
|  | ||||
|                             val dateFormat = SimpleDateFormat( | ||||
|                                 "yyyy-MM-dd, HH:mm:ss", | ||||
|                                 Locale.getDefault() | ||||
|                             ) | ||||
|                             val lastActiveDate = dateFormat.format(Date()) | ||||
|  | ||||
|                             val params = mutableMapOf( | ||||
|                                 "nickname" to SharedPreferenceManager.nickname, | ||||
|                                 "last_active_date" to lastActiveDate, | ||||
|                                 "charge_count" to data.chargeCount, | ||||
|                                 "signup_date" to data.signupDate, | ||||
|                                 "is_auth" to data.isAuth, | ||||
|                                 "gender" to data.gender, | ||||
|                                 "can" to data.can | ||||
|                             ) | ||||
|  | ||||
|                             NotiflyClient.setUser( | ||||
|                                 context = context, | ||||
|                                 userId = SharedPreferenceManager.userId, | ||||
|                                 params = params | ||||
|                             ) | ||||
|                         } | ||||
|                     }, | ||||
|                     {} | ||||
|   | ||||
| @@ -7,6 +7,9 @@ import com.google.gson.annotations.SerializedName | ||||
| data class GetMemberInfoResponse( | ||||
|     @SerializedName("can") val can: Int, | ||||
|     @SerializedName("isAuth") val isAuth: Boolean, | ||||
|     @SerializedName("gender") val gender: String?, | ||||
|     @SerializedName("signupDate") val signupDate: String, | ||||
|     @SerializedName("chargeCount") val chargeCount: Int, | ||||
|     @SerializedName("role") val role: MemberRole, | ||||
|     @SerializedName("messageNotice") val messageNotice: Boolean?, | ||||
|     @SerializedName("followingChannelLiveNotice") | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| package kr.co.vividnext.sodalive.tracking | ||||
|  | ||||
| import android.content.Context | ||||
| import tech.notifly.Notifly | ||||
|  | ||||
| object NotiflyClient { | ||||
|     fun setUser(context: Context, userId: Long, params: Map<String, Any?>) { | ||||
|         Notifly.setUserId(context, "voiceon_user$userId") | ||||
|         Notifly.setUserProperties(context, params) | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user