Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
30f6e216
Commit
30f6e216
authored
Mar 27, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firebase gcm ;
device utils module
parent
2a134b93
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
4 deletions
+121
-4
build.gradle
app/build.gradle
+1
-0
google-services.json
app/google-services.json
+8
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+31
-3
RoomParkMainActivity.kt
.../com/biganto/visual/roompark/base/RoomParkMainActivity.kt
+2
-1
RoomParkMessageService.kt
...om/biganto/visual/roompark/data/RoomParkMessageService.kt
+31
-0
DeviceUtils.kt
...biganto/visual/roompark/data/data_provider/DeviceUtils.kt
+37
-0
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+3
-0
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+8
-0
No files found.
app/build.gradle
View file @
30f6e216
...
...
@@ -163,6 +163,7 @@ dependencies {
//Firebase
implementation
"com.google.firebase:firebase-analytics:$fireBaseVersion"
implementation
'com.google.firebase:firebase-messaging:20.1.3'
//CrshLytics
implementation
"com.google.firebase:firebase-crashlytics:$firebaseCrashlyticsVersion"
...
...
app/google-services.json
View file @
30f6e216
...
...
@@ -14,6 +14,14 @@
}
},
"oauth_client"
:
[
{
"client_id"
:
"740988198336-e2vel467jbici47mkokmmtuhg07gfl8k.apps.googleusercontent.com"
,
"client_type"
:
1
,
"android_info"
:
{
"package_name"
:
"com.biganto.visual.roompark"
,
"certificate_hash"
:
"f23a8c722c050ddb5e6015b9f254535ddf5387ff"
}
},
{
"client_id"
:
"740988198336-8c08r8mikgulg2s08p0fgi5j028rhn4u.apps.googleusercontent.com"
,
"client_type"
:
3
...
...
app/src/main/AndroidManifest.xml
View file @
30f6e216
...
...
@@ -3,17 +3,44 @@
package=
"com.biganto.visual.roompark"
>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<application
android:name=
".base.RoomParkApplication"
android:allowBackup=
"true"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:screenOrientation=
"userPortrait"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme.Launch"
>
<activity
android:name=
".base.RoomParkMainActivity"
<service
android:name=
".data.RoomParkMessageService"
android:enabled=
"true"
android:exported=
"false"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
</intent-filter>
<!--
Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more.-->
<meta-data
android:name=
"com.google.firebase.messaging.default_notification_icon"
android:resource=
"@drawable/ic_bell_on"
/>
<!--
Set color used with incoming notification messages. This is used when no color is set for the incoming
notification message. See README(https://goo.gl/6BKBk7) for more.
-->
<meta-data
android:name=
"com.google.firebase.messaging.default_notification_color"
android:resource=
"@color/colorAccent"
/>
</service>
<activity
android:name=
".base.RoomParkMainActivity"
android:configChanges=
"fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:windowSoftInputMode=
"stateHidden|adjustPan"
>
<intent-filter>
...
...
@@ -22,6 +49,7 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/base/RoomParkMainActivity.kt
View file @
30f6e216
...
...
@@ -20,6 +20,7 @@ import com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
com.google.android.material.textview.MaterialTextView
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.bell_switch_view.view.*
import
kotlinx.android.synthetic.main.status_layout_toolbar.view.*
import
kotlinx.android.synthetic.main.switch_toolbar.view.*
import
timber.log.Timber
...
...
@@ -105,7 +106,7 @@ class RoomParkMainActivity(
headerToolbarBack
.
text
=
it
.
backTitle
?:
""
headerToolbar
.
toolbar_title
.
text
=
it
.
title
?:
""
headerToolbar
.
subsciption_switch
er
.
setGone
(!(
it
.
switcher
?:
false
))
headerToolbar
.
bell_contain
er
.
setGone
(!(
it
.
switcher
?:
false
))
}
status
?.
let
{
statusToolbar
.
status_icon
.
setGone
(
it
.
state
==
null
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/RoomParkMessageService.kt
0 → 100644
View file @
30f6e216
package
com.biganto.visual.roompark.data
import
com.google.firebase.messaging.FirebaseMessagingService
import
com.google.firebase.messaging.RemoteMessage
import
timber.log.Timber
class
RoomParkMessageService
:
FirebaseMessagingService
()
{
}
fun
onMessageReceived
(
remoteMessage
:
RemoteMessage
)
{
// ...
// TODO(developer): Handle FCM messages here.
// Not getting messages here? See why this may be: https://goo.gl/39bRNJ
Timber
.
d
(
"From: ${remoteMessage.from}"
)
// Check if message contains a data payload.
if
(
remoteMessage
.
data
.
size
>
0
)
{
Timber
.
d
(
"Message data payload: %s"
,
remoteMessage
.
data
)
if
(
/* Check if data needs to be processed by long running job */
true
)
{
// For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.
// scheduleJob()
}
else
{
// Handle message within 10 seconds
// handleNow()
}
}
// Check if message contains a notification payload.
if
(
remoteMessage
.
notification
!=
null
)
{
Timber
.
d
(
"Message Notification Body: %s"
,
remoteMessage
.
notification
!!
.
body
)
}
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below.
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/data_provider/DeviceUtils.kt
0 → 100644
View file @
30f6e216
package
com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.roompark.domain.contract.DeviceUtilsContract
import
com.google.android.gms.tasks.OnCompleteListener
import
com.google.firebase.iid.FirebaseInstanceId
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 26.03.2020.
*/
class
DeviceUtilsRepository
@Inject
constructor
(
)
:
DeviceUtilsContract
{
override
fun
getDeviceId
():
Observable
<
String
>
=
Observable
.
create
<
String
>
{
emitter
->
FirebaseInstanceId
.
getInstance
().
instanceId
.
addOnCompleteListener
(
OnCompleteListener
{
task
->
if
(!
task
.
isSuccessful
)
{
Timber
.
w
(
task
.
exception
,
"getInstanceId failed"
)
emitter
.
onError
(
task
.
exception
!!
)
return
@OnCompleteListener
}
// Get new Instance ID token
task
.
result
?.
token
?.
let
{
emitter
.
onNext
(
it
)
}
emitter
.
onComplete
()
// Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
})
}.
subscribeOn
(
Schedulers
.
computation
())
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
30f6e216
...
...
@@ -53,6 +53,7 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
fun
filesRep
():
FilesContract
fun
subsRep
():
SubscriptionContract
fun
provideLocal
():
ILocalStore
...
...
@@ -60,6 +61,8 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
fun
providedb
():
IDb
fun
provideUtils
():
DeviceUtilsContract
fun
provideAppContext
():
Application
fun
provideFileSystem
():
FileModule
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
30f6e216
...
...
@@ -38,9 +38,17 @@ abstract class ContractRepositoryModule {
@Singleton
abstract
fun
provideEstateContract
(
impl
:
EstateRepository
):
DealContract
@Binds
@Singleton
abstract
fun
provideSubscriptionsContract
(
impl
:
SubscriptionRepository
):
SubscriptionContract
@Binds
@Singleton
abstract
fun
provideFilesContract
(
impl
:
FilesContractModule
):
FilesContract
@Binds
@Singleton
abstract
fun
provideDeviceContract
(
impl
:
DeviceUtilsRepository
):
DeviceUtilsContract
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment