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

android x support #494

Merged
merged 17 commits into from Jul 9, 2018
Merged

android x support #494

merged 17 commits into from Jul 9, 2018

Conversation

shiraji
Copy link
Member

@shiraji shiraji commented Jun 26, 2018

See #488

We need to wait bintray support gradle 4.6 or release this alpha version manually ✋

TODO

  • Support androidx
  • Drop support v4
  • Handle the problem with bintray-release

NOT TODO for this PR

  • Drop native fragment support

@shiraji shiraji mentioned this pull request Jun 26, 2018
@shiraji
Copy link
Member Author

shiraji commented Jun 26, 2018

It seems dropping native fragment support makes diff huge. Do you guys want me to split PR? @hotchemi @mannodermaus

@hotchemi
Copy link
Member

yea it's better I guess!

@shiraji
Copy link
Member Author

shiraji commented Jun 26, 2018

I will create new PR for these commits.

f745322
cb7d58b
edd66c4

@shiraji shiraji changed the title [WIP] android x support android x support Jun 26, 2018
@shiraji
Copy link
Member Author

shiraji commented Jun 26, 2018

Ah, one more thing, do you want me to send PR for non-master branch like version-4 or somthing?

@hotchemi
Copy link
Member

To master is ok! But to merge this PR we need to deal with bintray-release plugin.. 🤔

- echo "sdk.dir=$ANDROID_HOME" > local.properties
- echo "sdk.dir=$ANDROID_HOME" > local.properties
- mkdir "$ANDROID_HOME/licenses" || true
- cp ./android-sdk-licenses/* "$ANDROID_HOME/licenses/"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not need this change because of bintray-release plugin

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

MIN_SDK_VERSION = 14

# Gradle parameters
org.gradle.daemon = true
org.gradle.jvmargs = -XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m
android.useAndroidX=true
android.enableJetifier=true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting

@@ -9,6 +9,7 @@ import permissions.dispatcher.Utils.onNeedsPermission
import permissions.dispatcher.Utils.onRationaleAnnotation
import permissions.dispatcher.Utils.runtimePermission


Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this?

@shiraji
Copy link
Member Author

shiraji commented Jun 26, 2018

we need to deal with bintray-release plugin

3 options I came up:

  • Wait until bintray-release plugin support gradle 4.6
  • Manual upload 😉
  • Migrate to gradle-bintray-plugin

If bintray-release support gradle 4.6 is best however because they don't even support gradle 4.5, I would like to drop this plugin and migrate to official one.

@dharrigan
Copy link

Hi,

Any progress on getting a new release out that supports Android X? I have a new project that fails to compile because v4 compat (ActivityCompat) is no longer available on the generated Dispatcher.

Thank you.

@shiraji
Copy link
Member Author

shiraji commented Jul 5, 2018

I was working on replacing bintray-release with gradle-bintray-plugin. I'm not sure how I can test this fix at this moment.

@hotchemi
Copy link
Member

hotchemi commented Jul 5, 2018

Ah sorry I jus started working on from today @shiraji may be I'm a person to test🙇

@shiraji
Copy link
Member Author

shiraji commented Jul 5, 2018

I'll push my code asap which is what I think it should. Then, you can test it. I really don't know if it works or not, thou

@dharrigan
Copy link

Happy to test out the new artifact when deployed :-)

-=david=-

Copy link
Member

@hotchemi hotchemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@hotchemi hotchemi merged commit 5e50323 into master Jul 9, 2018
@hotchemi hotchemi deleted the shiraji/android_x_support branch July 9, 2018 02:21
@hotchemi
Copy link
Member

hotchemi commented Jul 9, 2018

Thank you for your great work @shiraji !
I'll release 4.0.0-alpha1 tonight with some tests just in case!

@codelishaohui
Copy link

where is the 4.0.0-alpha1 ? :)

@hotchemi
Copy link
Member

hotchemi commented Jul 9, 2018

Tonight!

@dharrigan
Copy link

dharrigan commented Jul 9, 2018

Hi,

Well, testing...and it doesn't appear to work!

Android Studio 3.2 Beta 2
Build #AI-181.5281.24.32.4860949, built on June 25, 2018
JRE: 1.8.0_152-release-1136-b04 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-20-generic
implementation("com.github.hotchemi:permissionsdispatcher:4.0.0-SNAPSHOT") {
    exclude module: "support-v13"
}
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:4.0.0-SNAPSHOT"
@RuntimePermissions
class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

    }

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
    }

    @NeedsPermission(ACCESS_FINE_LOCATION)
    fun scanForDevices() {

    }

    @OnShowRationale(ACCESS_FINE_LOCATION)
    fun showRationaleForAccessFineLocation(request: PermissionRequest) {
        showRationaleDialog(R.string.permission_access_fine_location_rationale, request)
    }

    @OnPermissionDenied(ACCESS_FINE_LOCATION)
    fun onAccessFineLocationDenied() {
        makeText(this, R.string.permission_access_fine_location_denied, LENGTH_SHORT).show()
    }

    @OnNeverAskAgain(ACCESS_FINE_LOCATION)
    fun onAccessFineLocationNeverAskAgain() {
        makeText(this, R.string.permission_access_fine_location_never_ask_again, LENGTH_SHORT).show()
    }

    private fun showRationaleDialog(@StringRes messageResId: Int, request: PermissionRequest) {
        AlertDialog.Builder(this)
                .setPositiveButton(R.string.button_allow) { _, _ -> request.proceed() }
                .setNegativeButton(R.string.button_deny) { _, _ -> request.cancel() }
                .setCancelable(false)
                .setMessage(messageResId)
                .show()
    }

}

When doing a full build, no generated classes seem to be created, i.e., no scanForDevicesWithPermissionCheck. The generatedJava directory is empty except for the dispatcher, R class.

In my app build.gradle

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    implementation 'si.inova:neatle:0.9.7'
    implementation 'commons-codec:commons-codec:1.11'

    implementation("com.github.hotchemi:permissionsdispatcher:4.0.0-SNAPSHOT") {
        exclude module: "support-v13"
    }

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'

    annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:4.0.0-SNAPSHOT"
}

-=david=-

@shiraji
Copy link
Member Author

shiraji commented Jul 9, 2018

@dharrigan Sorry if I confused you but it's not released, yet.

@dharrigan
Copy link

Hi,
Yup, I understand it's not released yet - but I was alerted that a snapshot was available for testing. That's what I'm doing - testing the snapshot and I've discovered it doesn't generate classes as it does in 3.3.1. Surely you would like this feedback?

-=david=-

@hotchemi
Copy link
Member

hotchemi commented Jul 9, 2018

@dharrigan thx for checking. are there any error log? I'm gonna test!

@dharrigan
Copy link

Hi,

No error logs - compilation succeeds normally.

@dharrigan
Copy link

Hi,

Actually, discovered the error.

I had annotationProcessor rather than kapt in my build.gradle - d'oh!

However, even with the snapshot 4.0 library (and the generated classes being generated), It's still complaining about Unresolved reference: ActivityCompat in MainActivityPermissionsDispatcher.

@hotchemi
Copy link
Member

hotchemi commented Jul 9, 2018

I'm testing but seems working? 👁

@dharrigan
Copy link

Hi,

Perhaps I'm missing something? I did a clean clone of the project, pulled down all the dependencies again, ensured I was using the 4.0.0-SNAPSHOT, did a build from the command line and I get the same error as in 3.3.1, i.e.,

Unresolved reference: ActivityCompat in MainActivityPermissionsDispatcher.kt

@zaclimon zaclimon mentioned this pull request Jul 10, 2018
3 tasks
@hotchemi
Copy link
Member

@dharrigan could you try 4.0.0-alpha? 👀 Seems we failed to release library module.

@dharrigan
Copy link

dharrigan commented Jul 11, 2018

Hi,

Seems like the dependency fails:

Inside the pom

<dependency>
<groupId>PermissionsDispatcher</groupId>
<artifactId>annotation</artifactId>
<version>unspecified</version>
<scope>compile</scope>
</dependency>

When added as a depdency in build.gradle:

Failed to resolve: PermissionsDispatcher:annotation:unspecified
Open File
Show in Project Structure dialog

@hotchemi
Copy link
Member

OMG sorry about that.

@hotchemi
Copy link
Member

Umm why it happens..

@hotchemi
Copy link
Member

@permissions-dispatcher/maintainers does anyone have an idea why this happens.. 🤔
#494 (comment)

@shiraji
Copy link
Member Author

shiraji commented Jul 11, 2018

How we can generate pom file for library module?

@hotchemi
Copy link
Member

@shiraji

./gradlew :library:bintrayUpload

I'll send needed info privately!

@hotchemi
Copy link
Member

@dharrigan we've fixed by #500, can you try again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants