Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 25.0.0

* Breaking: `avatars.getScreenshot` `theme` parameter now uses the `BrowserTheme` enum
* Breaking: Removed generic type parameters from `presences` service methods
* Added: `BrowserTheme` enum
* Updated: `Presence` model is now concrete and adds a `metadata` field

## 24.1.1

* Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
appwrite: ^24.2.0
appwrite: ^25.0.0
```

You can install packages from the command line:
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/avatars/get-screenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Uint8List bytes = await avatars.getScreenshot(
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: enums.Theme.dark, // optional
theme: enums.BrowserTheme.dark, // optional
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Unrelated timezone example change

The timezone example was changed from enums.Timezone.americaNewYork to enums.Timezone.africaAbidjan in both code blocks. This appears unrelated to the PR's stated changes and may confuse users following the example. Was this intentional?

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

fullpage: true, // optional
locale: 'en-US', // optional
timezone: enums.Timezone.americaNewYork, // optional
timezone: enums.Timezone.africaAbidjan, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
Expand All @@ -49,11 +49,11 @@ FutureBuilder(
viewportWidth:1920 , // optional
viewportHeight:1080 , // optional
scale:2 , // optional
theme: enums.Theme.dark, // optional
theme: enums.BrowserTheme.dark, // optional
userAgent:'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15' , // optional
fullpage:true , // optional
locale:'en-US' , // optional
timezone: enums.Timezone.americaNewYork, // optional
timezone: enums.Timezone.africaAbidjan, // optional
latitude:37.7749 , // optional
longitude:-122.4194 , // optional
accuracy:100 , // optional
Expand Down
2 changes: 1 addition & 1 deletion lib/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ part 'src/enums/o_auth_provider.dart';
part 'src/enums/browser.dart';
part 'src/enums/credit_card.dart';
part 'src/enums/flag.dart';
part 'src/enums/theme.dart';
part 'src/enums/browser_theme.dart';
part 'src/enums/timezone.dart';
part 'src/enums/browser_permission.dart';
part 'src/enums/image_format.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/services/avatars.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Avatars extends Service {
int? viewportWidth,
int? viewportHeight,
double? scale,
enums.Theme? theme,
enums.BrowserTheme? theme,
String? userAgent,
bool? fullpage,
String? locale,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '24.2.0',
'x-sdk-version': '25.0.0',
'X-Appwrite-Response-Format': '1.9.5',
};

Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin {
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '24.2.0',
'x-sdk-version': '25.0.0',
'X-Appwrite-Response-Format': '1.9.5',
};

Expand Down
4 changes: 2 additions & 2 deletions lib/src/enums/theme.dart → lib/src/enums/browser_theme.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
part of '../../enums.dart';

enum Theme {
enum BrowserTheme {
light(value: 'light'),
dark(value: 'dark');

const Theme({required this.value});
const BrowserTheme({required this.value});

final String value;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Document implements Model {
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
$permissions: List.from(map['\$permissions'] ?? []),
data: Map<String, dynamic>.from(map["data"] ?? {}),
data: map["data"] ?? map,
);
}

Expand Down
10 changes: 4 additions & 6 deletions lib/src/models/presence.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class Presence implements Model {
/// Presence expiry date in ISO 8601 format.
final String? expiresAt;

final Map<String, dynamic> metadata;
/// Presence metadata.
final Map<String, dynamic>? metadata;

Presence({
required this.$id,
Expand All @@ -37,7 +38,7 @@ class Presence implements Model {
this.status,
required this.source,
this.expiresAt,
required this.metadata,
this.metadata,
});

factory Presence.fromMap(Map<String, dynamic> map) {
Expand All @@ -50,7 +51,7 @@ class Presence implements Model {
status: map['status']?.toString(),
source: map['source'].toString(),
expiresAt: map['expiresAt']?.toString(),
metadata: Map<String, dynamic>.from(map["metadata"] ?? {}),
metadata: map['metadata'],
);
}

Expand All @@ -68,7 +69,4 @@ class Presence implements Model {
"metadata": metadata,
};
}

T convertTo<T>(T Function(Map<String, dynamic>) fromJson) =>
fromJson(metadata);
}
3 changes: 0 additions & 3 deletions lib/src/models/presence_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,4 @@ class PresenceList implements Model {
"presences": presences.map((p) => p.toMap()).toList(),
};
}

List<T> convertTo<T>(T Function(Map) fromJson) =>
presences.map((d) => d.convertTo<T>(fromJson)).toList();
}
2 changes: 1 addition & 1 deletion lib/src/models/row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Row implements Model {
$createdAt: map['\$createdAt'].toString(),
$updatedAt: map['\$updatedAt'].toString(),
$permissions: List.from(map['\$permissions'] ?? []),
data: Map<String, dynamic>.from(map["data"] ?? {}),
data: map["data"] ?? map,
);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: appwrite
version: 24.2.0
version: 25.0.0
description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-flutter
Expand Down
1 change: 0 additions & 1 deletion test/src/models/presence_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ void main() {
$permissions: [],
userId: '674af8f3e12a5f9ac0be',
source: 'HTTP',
metadata: {},
);

final map = model.toMap();
Expand Down