Merge branch 'presence-enhance-calc-time' into 'master'
[Presence] Calculate time See merge request famedly/famedlysdk!236
This commit is contained in:
		
						commit
						518a245478
					
				|  | @ -39,6 +39,7 @@ class Presence { | ||||||
|   final int lastActiveAgo; |   final int lastActiveAgo; | ||||||
|   final PresenceType presence; |   final PresenceType presence; | ||||||
|   final String statusMsg; |   final String statusMsg; | ||||||
|  |   final DateTime time; | ||||||
| 
 | 
 | ||||||
|   Presence.fromJson(Map<String, dynamic> json) |   Presence.fromJson(Map<String, dynamic> json) | ||||||
|       : sender = json['sender'], |       : sender = json['sender'], | ||||||
|  | @ -46,6 +47,9 @@ class Presence { | ||||||
|         avatarUrl = MxContent(json['content']['avatar_url'] ?? ""), |         avatarUrl = MxContent(json['content']['avatar_url'] ?? ""), | ||||||
|         currentlyActive = json['content']['currently_active'], |         currentlyActive = json['content']['currently_active'], | ||||||
|         lastActiveAgo = json['content']['last_active_ago'], |         lastActiveAgo = json['content']['last_active_ago'], | ||||||
|  |         time = DateTime.fromMillisecondsSinceEpoch( | ||||||
|  |             DateTime.now().millisecondsSinceEpoch - | ||||||
|  |                 (json['content']['last_active_ago'] ?? 0)), | ||||||
|         presence = PresenceType.values.firstWhere( |         presence = PresenceType.values.firstWhere( | ||||||
|             (e) => |             (e) => | ||||||
|                 e.toString() == "PresenceType.${json['content']['presence']}", |                 e.toString() == "PresenceType.${json['content']['presence']}", | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue