firebase / firebase/functions-samples
Lines 94-100 in the LineLoginHelper in the Line-Auth sample seem to have been deprecated by Line SDK
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 3.8k
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 1
Description
LineSdkContext, LineAuthManager, and LineLoginFuture seem to have been deprecated in the latest Line SDK. Given that, what would be the best way to update an refactor the sample code in the line-auth sample function?
private Task getLineAccessCode(final Activity activity) {
final TaskCompletionSource source = new TaskCompletionSource<>();
// STEP 1: User logins with LINE and get their LINE access token
LineSdkContext sdkContext = LineSdkContextManager.getSdkContext();
LineAuthManager authManager = sdkContext.getAuthManager();
LineLoginFuture loginFuture = authManager.login(activity);
loginFuture.addFutureListener(new LineLoginFutureListener() {
@Override
public void loginComplete(LineLoginFuture future) {
switch(future.getProgress()) {
case SUCCESS: //Login successfully
String lineAccessToken = future.getAccessToken().accessToken;
Log.d(TAG, "LINE Access token = " + lineAccessToken);
source.setResult(lineAccessToken);
break;
case CANCELED: // Login canceled by user
Exception e = new Exception("User cancelled LINE Login.");
source.setException(e);
break;
default: // Error
Throwable cause = future.getCause();
if (cause instanceof LineSdkLoginException) {
LineSdkLoginException loginException = (LineSdkLoginException) cause;
Log.e(TAG, loginException.getMessage());
source.setException(loginException);
} else {
source.setException(new Exception("Unknown error occurred in LINE SDK."));
}
break;
}
}
});
return source.getTask();
}
### How to reproduce these conditions
**Sample name or URL where you found the bug**
**Failing Function code used (including require/import commands at the top)**
**Steps to set up and reproduce**
**Sample data pasted or attached as JSON (not an image)**
**Security rules used**
### Debug output
**Errors in the [console logs](https://console.firebase.google.com/project/_/functions/logs?search=&severity=DEBUG)**
**Screenshots**
### Expected behavior
### Actual behavior
Contributor guide
Assessment
This issue has not been assessed yet.