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

0.6.0 release #151

Merged
merged 1 commit into from Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,17 @@
Change Log
=================================

## Version 0.6.0 (2019/07/08)

### Breaking changes:
* `Reddit.restoreAuthenticatedInstance` now returns `Reddit` instead of `Future<Reddit>`.

### Other changes:
* `Reddit.restoreAuthenticatedInstance` no longer throws an exception when not provided a
`clientSecret`. A `clientSecret` is still required for most client types except for
installed applications.
* Updated dependencies.

## Version 0.5.2+1 (2019/05/31)
* Updated documentation.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -118,7 +118,7 @@ main() async {
await writeCredentials(reddit.auth.credentials.toJson());
} else {
// Create a new Reddit instance using previously cached credentials.
reddit = await Reddit.restoreAuthenticatedInstance(
reddit = Reddit.restoreAuthenticatedInstance(
userAgent: userAgent,
configUri: configUri,
credentialsJson: credentialsJson);
Expand Down
14 changes: 3 additions & 11 deletions lib/src/reddit.dart
Expand Up @@ -318,19 +318,19 @@ class Reddit {
///
/// [siteName] is the name of the configuration to use from draw.ini. Defaults
/// to 'default'.
static Future<Reddit> restoreAuthenticatedInstance(String credentialsJson,
static Reddit restoreAuthenticatedInstance(String credentialsJson,
{String clientId,
String clientSecret,
String userAgent,
Uri redirectUri,
Uri tokenEndpoint,
Uri authEndpoint,
Uri configUri,
String siteName = 'default'}) async {
String siteName = 'default'}) {
if (credentialsJson == null) {
throw DRAWArgumentError('credentialsJson cannot be null.');
}
final reddit = Reddit._webFlowInstanceRestore(
return Reddit._webFlowInstanceRestore(
clientId,
clientSecret,
userAgent,
Expand All @@ -340,11 +340,6 @@ class Reddit {
authEndpoint,
configUri,
siteName);
final initialized = await reddit._initializedCompleter.future;
if (initialized) {
return reddit;
}
throw DRAWAuthenticationError('Unable to authenticate with Reddit');
}

Reddit._readOnlyInstance(
Expand Down Expand Up @@ -514,9 +509,6 @@ class Reddit {
if (_config.clientId == null) {
throw DRAWAuthenticationError('clientId cannot be null.');
}
if (_config.clientSecret == null) {
throw DRAWAuthenticationError('clientSecret cannot be null.');
}
if (_config.userAgent == null) {
throw DRAWAuthenticationError('userAgent cannot be null.');
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: draw
version: 0.5.2+1
version: 0.6.0
description: 'A fully-featured Reddit API wrapper for Dart, inspired by PRAW.'
homepage: 'https://github.com/draw-dev/DRAW'
authors:
Expand Down
2 changes: 1 addition & 1 deletion test/auth/web_auth.dart
Expand Up @@ -123,7 +123,7 @@ Future<void> main() async {
final creds = reddit.auth.credentials.toJson();

// Attempt to create a new instance with the saved credentials.
final redditRestored = await Reddit.restoreAuthenticatedInstance(creds,
final redditRestored = Reddit.restoreAuthenticatedInstance(creds,
clientId: kWebClientID,
clientSecret: kWebClientSecret,
userAgent: userAgent);
Expand Down