Skip to content

Instantly share code, notes, and snippets.

@lukaspili
Last active July 19, 2017 12:55
Show Gist options
  • Save lukaspili/e00032aa5ff90f3f63bd452fc1f1af5b to your computer and use it in GitHub Desktop.
Save lukaspili/e00032aa5ff90f3f63bd452fc1f1af5b to your computer and use it in GitHub Desktop.
<manifest
package="io.bimapp"
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.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission
android:name="android.permission.ACCESS_MOCK_LOCATION"
tools:ignore="MockLocation"/>
<!-- GCM -->
<permission
android:name="io.bimapp.permission.C2D_MESSAGE"
android:protectionLevel="signature"/>
<uses-permission
android:name="io.bimapp.permission.C2D_MESSAGE"/>
<uses-permission
android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission
android:name="android.permission.WAKE_LOCK"/>
<application
android:name=".App"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:label,android:allowBackup">
<!-- GCM -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="io.bimapp"/>
</intent-filter>
</receiver>
<service
android:name=".gcm.GcmListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
</intent-filter>
</service>
<service
android:name=".gcm.InstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
</application>
</manifest>
def versionMajor = 3
def versionMinor = 3
def versionPatch = 4
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "io.bimapp"
targetSdkVersion 25
versionCode versionMajor * 100 + versionMinor * 10 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
multiDexEnabled true
setProperty("archivesBaseName", "bim-android-$versionName")
}
buildTypes {
debug {
minifyEnabled true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
}
release {
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
prod {
minSdkVersion 16
}
dev {
minSdkVersion 25
versionNameSuffix "-dev"
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
prod.setRoot('src/prod')
prod.java.srcDirs += 'src/prod/kotlin'
dev.setRoot('src/dev')
dev.java.srcDirs += 'src/dev/kotlin'
}
// kapt {
// generateStubs = true
// }
lintOptions {
abortOnError false
}
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://maven.fabric.io/public" }
maven { url "http://dl.bintray.com/tbruyelle/tbruyelle" }
maven { url = 'https://jitpack.io' }
maven { url 'http://nexus.follow-apps.com/nexus/content/repositories/releases/' }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
def android_support = "25.3.1"
compile "com.android.support:support-v4:$android_support"
compile "com.android.support:appcompat-v7:$android_support"
compile "com.android.support:recyclerview-v7:$android_support"
compile "com.android.support:design:$android_support"
compile "com.android.support:cardview-v7:$android_support" // facebook sdk needs it
compile "com.google.maps.android:android-maps-utils:0.4.3"
def play_services_version = '11.0.2'
compile "com.google.android.gms:play-services-gcm:$play_services_version"
compile "com.google.android.gms:play-services-location:$play_services_version"
compile "com.google.android.gms:play-services-maps:$play_services_version"
compile "com.google.android.gms:play-services-analytics:$play_services_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
def anko_version = '0.9'
compile "org.jetbrains.anko:anko-sdk15:$anko_version"
compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
compile "org.jetbrains.anko:anko-recyclerview-v7:$anko_version"
compile "org.jetbrains.anko:anko-design:$anko_version"
compile 'io.reactivex:rxandroid:1.2.1@aar'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.artemzin.rxjava:proguard-rules:1.1.6.0'
compile 'com.jakewharton.rxrelay:rxrelay:1.1.0'
compile 'com.jakewharton.rxbinding:rxbinding-kotlin:0.4.0'
compile 'com.tbruyelle.rxpermissions:rxpermissions:0.9.1@aar'
compile "pl.charmas.android:android-reactive-location:0.9@aar"
def retrofit_version = '2.1.0'
compile "com.squareup.retrofit2:retrofit:$retrofit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
compile "com.squareup.retrofit2:converter-moshi:$retrofit_version"
def okhttp_version = '3.3.1'
compile "com.squareup.okhttp3:okhttp:$okhttp_version"
compile "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
compile 'com.squareup.moshi:moshi:1.2.0'
compile 'com.squareup.picasso:picasso:2.6.0-SNAPSHOT'
def architect_version = '1.0-dev3.8-SNAPSHOT'
compile "com.github.lukaspili.mortar-architect:architect:$architect_version"
compile("com.github.lukaspili.mortar-architect:commons:$architect_version") {
exclude module: 'appcompat-v7'
}
def paperparcel_version = '1.0.0'
compile "com.github.grandstaish.paperparcel:paperparcel:$paperparcel_version"
kapt "com.github.grandstaish.paperparcel:compiler:$paperparcel_version"
compile 'com.google.dagger:dagger:2.8'
kapt 'com.google.dagger:dagger-compiler:2.8'
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.github.Mariovc:ImagePicker:1.0.5'
compile 'cn.gavinliu.android.lib:ShapedImageView:0.8.3'
compile 'com.commit451:PhotoView:1.2.4'
compile 'com.appeaser.sublimepickerlibrary:sublimepickerlibrary:2.1.1'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.googlecode.libphonenumber:libphonenumber:7.2.6'
compile 'com.jakewharton.timber:timber:4.1.2'
compile('com.github.markomilos:paginate:0.5.1') {
exclude module: 'recyclerview-v7'
}
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.11'
compile 'com.timehop.stickyheadersrecyclerview:library:0.4.3@aar'
compile 'com.afollestad:sectioned-recyclerview:0.2.3'
compile 'com.stripe:stripe-android:2.1.0'
compile 'io.card:android-sdk:5.5.1'
compile 'com.mixpanel.android:mixpanel-android:4.9.1'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.2.0'
compile 'com.github.ittianyu:BottomNavigationViewEx:1.1.2'
compile('com.facebook.android:facebook-android-sdk:4.24.0') {
exclude module: 'support-v4'
exclude module: 'cardview-v7'
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.0@aar') {
transitive = true
}
compile 'com.facebook.fresco:fresco:1.1.0'
compile 'com.facebook.fresco:imagepipeline-okhttp3:1.1.0'
compile 'com.github.tamir7.contacts:contacts:1.1.0'
compile 'com.qiushui:blurredview:0.8.1'
compile 'com.shawnlin:number-picker:2.1.0'
compile 'com.afollestad.material-dialogs:core:0.9.3.0'
compile ('com.followapps.android:sdk:5.0.0'){
exclude group: 'com.followapps.adaptivesdk'
}
}
class GcmListenerService : com.google.android.gms.gcm.GcmListenerService() {
override fun onMessageReceived(from: String?, data: Bundle?) {
if (data == null) return
val followAnalyticsPush = data.getString(PushManager.BUNDLE_KEY_MESSAGE)
if (FollowAnalytics.isFollowAnalyticsPushData(followAnalyticsPush)) {
FollowAnalytics.processFollowAnalyticsPush(this, followAnalyticsPush)
return
}
// ...
val tag = java.lang.Long.toString(System.currentTimeMillis())
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationIntent = Intent(this, MainActivity::class.java)
notificationIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
notificationIntent.action = tag
val contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT)
val builder = NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle(getString(R.string.app_name))
.setContentText(message)
.setAutoCancel(true)
.setContentIntent(contentIntent)
notificationManager.notify(tag, 1, builder.build())
}
}
class InstanceIDListenerService : com.google.android.gms.iid.InstanceIDListenerService() {
override fun onTokenRefresh() {
async {
val token = InstanceID.getInstance(context).getToken(GOOGLE_GCM_SENDER_ID, GoogleCloudMessaging.INSTANCE_ID_SCOPE)
mixpanel.people.setPushRegistrationId(token)
api.registerToken(token)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment