Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

upgrade android twitterkit 3 experimental deps #20

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ matrix:
components:
- platform-tools
- tools
- build-tools-25.0.1
- build-tools-25.0.0
- build-tools-26.0.2
- android-21
- android-26
- sys-img-armeabi-v7a-android-21
- extra-android-m2repository
- extra-google-m2repository
- extra-google-google_play_services
- extra-android-support

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion .travis/before-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ init_new_example_project() {
}

$HOME/.nvm/nvm.sh
nvm install 8.4.0
nvm install 8.9.0
npm i npm@5 -g

case "${TRAVIS_OS_NAME}" in
Expand Down
57 changes: 28 additions & 29 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,17 @@
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}

repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}


apply plugin: 'com.android.library'
apply plugin: 'io.fabric'

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 26
buildToolsVersion '26.0.2'

defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

versionName '1.0'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -40,13 +22,30 @@ android {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.react:react-native:+'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile('com.twitter.sdk.android:twitter-core:3.1.1@aar') {
transitive = true
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.facebook.react:react-native:+'
compile('com.twitter.sdk.android:twitter:2.3.0@aar') {
transitive = true;
}
testCompile 'junit:junit:4.12'
}

buildscript {
repositories {
jcenter()
mavenCentral()
}
}

repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.twitter.sdk.android.Twitter;
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.DefaultLogger;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.Twitter;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.twitter.sdk.android.core.TwitterAuthToken;
import com.twitter.sdk.android.core.TwitterConfig;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.TwitterSession;
import com.twitter.sdk.android.core.identity.TwitterAuthClient;

import io.fabric.sdk.android.Fabric;

/**
* This is a {@link NativeModule} that allows JS to use LoginManager of Facebook Android SDK.
* This is a {@link NativeModule} that allows JS to use login feature of twitter-kit sdk.
*/
public class TPSTwitterModule extends ReactContextBaseJavaModule implements LifecycleEventListener {

Expand Down Expand Up @@ -110,7 +110,11 @@ public void onHostDestroy() {

private void initTwitter(final ReadableMap map) {
TwitterAuthConfig authConfig = new TwitterAuthConfig(map.getString("twitter_key"), map.getString("twitter_secret"));
Fabric.with(getCurrentActivity(), new Twitter(authConfig));
TwitterConfig config = new TwitterConfig.Builder(getReactApplicationContext())
.logger(new DefaultLogger(Log.DEBUG))
.twitterAuthConfig(authConfig)
.build();
Twitter.initialize(config);
}

private TwitterAuthClient getTwitterAuthClient() {
Expand Down
18 changes: 13 additions & 5 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,20 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 26
buildToolsVersion "26.0.2"

defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}

splits {
abi {
reset()
Expand Down Expand Up @@ -136,9 +137,9 @@ android {
}

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(':tipsi-twitter')
compile "com.android.support:appcompat-v7:23.0.1"
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:support-v4:26.1.0"
compile "com.facebook.react:react-native:+" // From node_modules
}

Expand All @@ -148,3 +149,10 @@ task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
10 changes: 8 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
Expand All @@ -14,8 +18,10 @@ buildscript {

allprojects {
repositories {
// Add fabric repository (added by tipsi-twitter)
maven { url "https://maven.fabric.io/public" }
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenLocal()
jcenter()
maven {
Expand Down