Commit 060ce073 authored by Tiago Cunha's avatar Tiago Cunha

Ask for permission

parent f9935267
......@@ -6,123 +6,126 @@ apply plugin: 'com.github.triplet.play'
apply from: '../config/quality/quality.gradle'
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath rootProject.ext.androidPlugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath rootProject.ext.retroLambdaPlugin
classpath rootProject.ext.retroLambdaPatch
classpath rootProject.ext.realmPlugin
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
}
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath rootProject.ext.androidPlugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath rootProject.ext.retroLambdaPlugin
classpath rootProject.ext.retroLambdaPatch
classpath rootProject.ext.realmPlugin
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.github.triplet.gradle:play-publisher:1.1.5'
}
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "chat.rocket.android"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 3
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
signingConfigs {
release {
storeFile project.rootProject.file('Rocket.jks').getCanonicalFile()
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS")
keyPassword System.getenv("KEY_PASSWORD")
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "chat.rocket.android"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 3
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
signingConfigs {
release {
storeFile project.rootProject.file('Rocket.jks').getCanonicalFile()
storePassword System.getenv("KEYSTORE_PASSWORD")
keyAlias System.getenv("KEY_ALIAS")
keyPassword System.getenv("KEY_PASSWORD")
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
productFlavors {
qa {
// something - qa builds will have some extra stuff for alpha testers
productFlavors {
qa {
// something - qa builds will have some extra stuff for alpha testers
}
prod {
// another
}
}
prod {
// another
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig file("lint.xml")
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
//avoiding okio error: https://github.com/square/okhttp/issues/896
lintConfig file("lint.xml")
}
}
play {
jsonFile = file('rocket-chat.json')
track = "${track}"
jsonFile = file('rocket-chat.json')
track = "${track}"
}
repositories {
mavenCentral()
maven { url 'https://github.com/lijingle1/stetho-realm/raw/master/maven-repo' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url "https://clojars.org/repo/" } //for icepick.
mavenCentral()
maven { url 'https://github.com/lijingle1/stetho-realm/raw/master/maven-repo' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url "https://clojars.org/repo/" } //for icepick.
}
dependencies {
compile project(':log-wrapper')
compile project(':android-ddp')
compile project(':rocket-chat-android-widgets')
compile project(':realm-helpers')
compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportDesign
compile project(':log-wrapper')
compile project(':android-ddp')
compile project(':rocket-chat-android-widgets')
compile project(':realm-helpers')
compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportDesign
qaCompile('com.instabug.library:instabug:3.1.0') {
exclude group: 'io.reactivex'
}
compile 'com.android.support:multidex:1.0.1'
qaCompile('com.instabug.library:instabug:3.1.0') {
exclude group: 'io.reactivex'
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-core:10.0.0'
compile 'com.google.firebase:firebase-crash:10.0.0'
compile 'com.google.firebase:firebase-core:10.0.0'
compile 'com.google.firebase:firebase-crash:10.0.0'
compile rootProject.ext.okhttp3
compile rootProject.ext.picasso
compile rootProject.ext.okhttp3
compile rootProject.ext.picasso
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile 'com.uphyca:stetho_realm:2.0.1'
compile 'com.facebook.stetho:stetho:1.4.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.1'
compile 'com.uphyca:stetho_realm:2.0.1'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
compile 'com.trello:rxlifecycle:1.0'
compile 'com.trello:rxlifecycle-android:1.0'
compile 'com.trello:rxlifecycle-components:1.0'
compile 'com.trello:rxlifecycle:1.0'
compile 'com.trello:rxlifecycle-android:1.0'
compile 'com.trello:rxlifecycle-components:1.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
compile 'frankiesardo:icepick:3.2.0'
provided 'frankiesardo:icepick-processor:3.2.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.3.0'
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.0'
}
apply plugin: 'com.google.gms.google-services'
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="chat.rocket.android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".RocketChatApplication"
......@@ -16,23 +17,23 @@
android:name=".activity.MainActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.AddServerActivity"
android:windowSoftInputMode="adjustResize"/>
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activity.ServerConfigActivity"
android:windowSoftInputMode="adjustResize"/>
android:windowSoftInputMode="adjustResize" />
<service android:name=".service.RocketChatService"/>
<service android:name=".service.RocketChatService" />
<service android:name=".service.notification.NotificationDismissalCallbackService"/>
<service android:name=".service.notification.NotificationDismissalCallbackService" />
</application>
</manifest>
package chat.rocket.android.fragment.chatroom;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
......@@ -31,6 +33,7 @@ import chat.rocket.android.layouthelper.chatroom.MessageComposerManager;
import chat.rocket.android.layouthelper.chatroom.MessageListAdapter;
import chat.rocket.android.layouthelper.chatroom.PairedMessage;
import chat.rocket.android.log.RCLog;
import chat.rocket.android.message.AbstractMessageSpec;
import chat.rocket.android.message.AudioUploadMessageSpec;
import chat.rocket.android.message.AbstractUploadMessageSpec;
import chat.rocket.android.message.ImageUploadMessageSpec;
......@@ -48,10 +51,13 @@ import chat.rocket.android.realm_helper.RealmObjectObserver;
import chat.rocket.android.realm_helper.RealmStore;
import chat.rocket.android.service.RocketChatService;
import chat.rocket.android.widget.message.MessageComposer;
import permissions.dispatcher.NeedsPermission;
import permissions.dispatcher.RuntimePermissions;
/**
* Chat room screen.
*/
@RuntimePermissions
public class RoomFragment extends AbstractChatRoomFragment
implements OnBackPressListener, RealmModelListAdapter.OnItemClickListener<PairedMessage> {
......@@ -67,7 +73,8 @@ public class RoomFragment extends AbstractChatRoomFragment
private MessageComposerManager messageComposerManager;
private MessageSelectionDialogFragment.ClickListener messageSelectionClickListener =
messageSpec -> messageSpec.onSelect(RoomFragment.this);
messageSpec -> RoomFragmentPermissionsDispatcher
.onMessageSpecSelectedWithCheck(RoomFragment.this, messageSpec);
public RoomFragment() {
}
......@@ -365,4 +372,16 @@ public class RoomFragment extends AbstractChatRoomFragment
public boolean onBackPressed() {
return closeSideMenuIfNeeded();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
RoomFragmentPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults);
}
@NeedsPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
protected void onMessageSpecSelected(AbstractMessageSpec messageSpec) {
messageSpec.onSelect(RoomFragment.this);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment