Skip to content

Commit 0986f9b

Browse files
committed
Removed experimental annotation for OAuth1. Updated Gradle version
1 parent f4f3500 commit 0986f9b

14 files changed

Lines changed: 17 additions & 60 deletions

File tree

app/src/main/java/com/tycz/android/twitter/api/v2/MainViewModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import com.tycz.tweedle.lib.dtos.tweet.rules.RuleResponse
1515
import com.tycz.tweedle.lib.dtos.user.Payload
1616
import com.tycz.tweedle.lib.dtos.user.UserPayload
1717
import com.tycz.tweedle.lib.tweets.lookup.TweetsLookup
18-
import com.tycz.tweedle.lib.user.UserLookup
18+
import com.tycz.tweedle.lib.user.UserEndpoints
1919
import com.tycz.tweedle.lib.tweets.stream.TweetsStream
2020
import kotlinx.coroutines.launch
2121

2222
@ExperimentalApi
2323
class MainViewModel: ViewModel() {
2424

2525
private lateinit var _tweetLookup:TweetsLookup
26-
private lateinit var _userLookup: UserLookup
26+
private lateinit var _userLookup: UserEndpoints
2727
private lateinit var _tweetStream:TweetsStream
2828
private lateinit var _authentication:Authentication1
2929
private lateinit var _authentication2: Authentication2
@@ -39,7 +39,7 @@ class MainViewModel: ViewModel() {
3939
set(value) {
4040
value?.let {
4141
_tweetLookup = TweetsLookup(value)
42-
_userLookup = UserLookup(value)
42+
_userLookup = UserEndpoints(value)
4343
}
4444
}
4545
var oAuth2: OAuth2Bearer? = null

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
maven { url "https://plugins.gradle.org/m2/" }
1111
}
1212
dependencies {
13-
classpath 'com.android.tools.build:gradle:4.2.2'
13+
classpath 'com.android.tools.build:gradle:7.1.2'
1414
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1515
classpath 'org.jetbrains.kotlin:kotlin-serialization:1.6.10'
1616
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
include ':tweedle'
22
include ':app'
33
rootProject.name = "tweedle"
4-
enableFeaturePreview('GRADLE_METADATA')
4+
//enableFeaturePreview('GRADLE_METADATA')

tweedle/build.gradle.kts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
id("kotlinx-serialization")
77
id("maven-publish")
88
id("signing")
9+
id("org.jetbrains.dokka") version "1.6.10"
910
}
1011

1112
repositories {
@@ -19,7 +20,7 @@ val javadocJar by tasks.registering(Jar::class) {
1920
}
2021

2122
group = "io.github.tyczj"
22-
version = "0.5.1"
23+
version = "0.5.2"
2324

2425
kotlin {
2526
android{
@@ -78,13 +79,11 @@ kotlin {
7879
}
7980

8081
android {
81-
compileSdkVersion(31)
82+
compileSdk = 31
8283
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
8384
defaultConfig {
84-
minSdkVersion(26)
85-
targetSdkVersion(31)
86-
versionCode = 1
87-
versionName = "1.0"
85+
minSdk = 26
86+
targetSdk = 31
8887
}
8988
buildTypes {
9089
getByName("release") {

tweedle/src/commonMain/kotlin/com.tycz.tweedle.lib/authentication/Authentication1.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import kotlinx.coroutines.withContext
1212
/**
1313
* Class for authenticating with twitter
1414
*/
15-
class Authentication1 @ExperimentalApi constructor(private val oAuth: OAuth1) {
15+
class Authentication1 constructor(private val oAuth: OAuth1) {
1616
private val _client = TwitterClient.instance
1717

1818
/**
@@ -22,7 +22,6 @@ class Authentication1 @ExperimentalApi constructor(private val oAuth: OAuth1) {
2222
* @param callbackUrl The value you specify here will be used as the URL a user is redirected to should they approve your application's access to their account.
2323
* callback URL used with this endpoint will have to be configured within the App’s settings on developer.twitter.com
2424
*/
25-
@ExperimentalApi
2625
suspend fun requestToken(callbackUrl: String):TokenResponse = withContext(Dispatchers.Default){
2726

2827
oAuth.callbackUrl = callbackUrl
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
package com.tycz.tweedle.lib.authentication.oauth
22

3-
import com.tycz.tweedle.lib.ExperimentalApi
4-
5-
@ExperimentalApi
63
data class AuthenticationOAuth(val apiKey: String, val secret: String): OAuth1(apiKey, secret, null, null)

tweedle/src/commonMain/kotlin/com.tycz.tweedle.lib/authentication/oauth/OAuth1.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.tycz.tweedle.lib.authentication.oauth
22

3-
import com.tycz.tweedle.lib.ExperimentalApi
43
import com.tycz.tweedle.lib.authentication.SignatureBuilder
54
import com.tycz.tweedle.lib.authentication.SignatureParams
65
import com.tycz.tweedle.lib.urlEncodeString
76
import io.ktor.client.request.*
87
import io.ktor.http.*
98
import io.ktor.http.auth.*
109

11-
@ExperimentalApi
1210
open class OAuth1(private val key: String, private val secret: String, private val oAuthToken: String?, private val oAuthSecret: String?): IOAuthBuilder {
1311

1412
private val _signatureBuilder = SignatureBuilder()

tweedle/src/commonMain/kotlin/com.tycz.tweedle.lib/tweets/likes/TweetLikes.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.tycz.tweedle.lib.tweets.likes
22

3-
import com.tycz.tweedle.lib.ExperimentalApi
43
import com.tycz.tweedle.lib.api.Response
54
import com.tycz.tweedle.lib.api.TwitterClient
65
import com.tycz.tweedle.lib.authentication.SignatureBuilder
@@ -19,7 +18,6 @@ class TweetLikes(private val oAuthBuilder: IOAuthBuilder) {
1918

2019
private val _client = TwitterClient.instance
2120

22-
@OptIn(ExperimentalApi::class)
2321
suspend fun getLikesForTweet(tweetId: Long, additionalParameters:Map<String,String> = mapOf()): Response<LikingUserPayload?> {
2422
return try{
2523
val urlBuilder = StringBuilder()
@@ -57,7 +55,6 @@ class TweetLikes(private val oAuthBuilder: IOAuthBuilder) {
5755
}
5856
}
5957

60-
@OptIn(ExperimentalApi::class)
6158
suspend fun getUserLikedTweets(userId: Long, additionalParameters:Map<String,String> = mapOf()):Response<MultipleTweetPayload?>{
6259
return try{
6360
val urlBuilder = StringBuilder()
@@ -95,7 +92,6 @@ class TweetLikes(private val oAuthBuilder: IOAuthBuilder) {
9592
}
9693
}
9794

98-
@OptIn(ExperimentalApi::class)
9995
suspend fun likeTweet(tweetId: Long, userId: Long):Response<LikesPayload?>{
10096
return try {
10197
val url = "${TwitterClient.BASE_URL}${TwitterClient.USERS_ENDPOINT}/$userId/likes"
@@ -114,7 +110,6 @@ class TweetLikes(private val oAuthBuilder: IOAuthBuilder) {
114110
}
115111
}
116112

117-
@OptIn(ExperimentalApi::class)
118113
suspend fun unlikeTweet(tweetId: Long, userId: Long):Response<LikesPayload?>{
119114
return try {
120115
val url = "${TwitterClient.BASE_URL}${TwitterClient.USERS_ENDPOINT}/$userId/likes/$tweetId"

tweedle/src/commonMain/kotlin/com.tycz.tweedle.lib/tweets/lookup/TweetsLookup.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.tycz.tweedle.lib.tweets.lookup
22

3-
import com.tycz.tweedle.lib.ExperimentalApi
43
import com.tycz.tweedle.lib.api.Response
54
import com.tycz.tweedle.lib.api.TwitterClient
65
import com.tycz.tweedle.lib.authentication.SignatureBuilder
@@ -29,7 +28,6 @@ class TweetsLookup(private val oAuthBuilder: IOAuthBuilder) {
2928
* @see com.tycz.tweedle.lib.dtos.tweet.SingleTweetPayload
3029
* @see com.tycz.tweedle.lib.api.Response
3130
*/
32-
@ExperimentalApi
3331
suspend fun getTweet(tweetId:Long): Response<SingleTweetPayload?>{
3432

3533
return try{
@@ -58,7 +56,6 @@ class TweetsLookup(private val oAuthBuilder: IOAuthBuilder) {
5856
* @see com.tycz.tweedle.lib.dtos.tweet.MultipleTweetPayload
5957
* @see com.tycz.tweedle.lib.api.Response
6058
*/
61-
@ExperimentalApi
6259
suspend fun getMultipleTweets(tweetIds:List<Long>): Response<MultipleTweetPayload?> {
6360

6461
return try{
@@ -102,7 +99,6 @@ class TweetsLookup(private val oAuthBuilder: IOAuthBuilder) {
10299
* @return
103100
*/
104101
@OptIn(ExperimentalSerializationApi::class)
105-
@ExperimentalApi
106102
suspend fun hideTweet(tweetId:Long):Response<HttpResponse?> {
107103
return try{
108104
val url = "${TwitterClient.BASE_URL}${TwitterClient.TWEETS_ENDPOINT}/$tweetId/hidden"
@@ -130,7 +126,6 @@ class TweetsLookup(private val oAuthBuilder: IOAuthBuilder) {
130126
* @return
131127
*/
132128
@OptIn(ExperimentalSerializationApi::class)
133-
@ExperimentalApi
134129
suspend fun unhideTweet(tweetId:Long):Response<HttpResponse?> {
135130
return try{
136131
val url = "${TwitterClient.BASE_URL}${TwitterClient.TWEETS_ENDPOINT}/$tweetId/hidden"
@@ -160,7 +155,6 @@ class TweetsLookup(private val oAuthBuilder: IOAuthBuilder) {
160155
* @see com.tycz.tweedle.lib.dtos.tweet.MultipleTweetPayload
161156
* @see com.tycz.tweedle.lib.api.Response
162157
*/
163-
@ExperimentalApi
164158
suspend fun getRecentTweets(query:String, additionalParameters:Map<String,String>):Response<MultipleTweetPayload?> {
165159

166160
return try{

0 commit comments

Comments
 (0)