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

Realtime Channel history #52

Merged
merged 20 commits into from
Feb 15, 2021

Conversation

tiholic
Copy link
Contributor

@tiholic tiholic commented Oct 9, 2020

Realtime#Channel#Channel#history will return PaginatedResult.

void getHistory([ably.RealtimeHistoryParams params]) async {
    var result = await channel.history(params);

    var messages = result.items; //get messages
    var hasNextPage = result.hasNext(); //tells whether there are more results
    if(hasNextPage){    
      result = await result.next();  //fetches next page results
      messages = result.items;
    }
    if(!hasNextPage){
      result = await result.first();  //fetches first page results
      messages = result.items;
    }
}

// history with default params
getHistory();

// sorted and filtered history
getHistory(
  ably.RealtimeHistoryParams(
    direction: 'forwards',
    limit: 10,
    start: DateTime.fromMillisecondsSinceEpoch(0),
    end: DateTime.now(),
    untilAttach: false
  )
);

@tiholic tiholic changed the title Realtime Channel history & Paginated Result API Realtime Channel history Oct 9, 2020
@tiholic tiholic self-assigned this Oct 14, 2020
@tiholic tiholic force-pushed the feature/realtime-history branch from de9f1ec to b0d7d5b Compare October 16, 2020 08:00
@tiholic tiholic added this to the Stage 2 milestone Oct 19, 2020
@tiholic tiholic force-pushed the feature/realtime-history branch from aa9e2b5 to ef4a0f9 Compare November 18, 2020 11:03
Base automatically changed from feature/lint-dart to feature/rest-channel-history November 23, 2020 09:50
@tiholic tiholic force-pushed the feature/rest-channel-history branch from b53a4dc to b3c6097 Compare November 24, 2020 09:55
@tiholic tiholic changed the base branch from feature/rest-channel-history to feature/lint-dart November 24, 2020 11:28
@tiholic tiholic changed the base branch from feature/lint-dart to feature/rest-history-integration-tests November 24, 2020 11:29
@tiholic tiholic force-pushed the feature/realtime-history branch from ef4a0f9 to 5b0caa9 Compare November 24, 2020 11:51
@tiholic tiholic force-pushed the feature/rest-history-integration-tests branch 2 times, most recently from 3007dea to 27f732f Compare November 24, 2020 15:10
@tiholic tiholic force-pushed the feature/realtime-history branch from 5b0caa9 to 368fe06 Compare November 24, 2020 15:21
@tiholic tiholic force-pushed the feature/rest-history-integration-tests branch from 27f732f to 000915a Compare November 24, 2020 16:16
@tiholic tiholic force-pushed the feature/realtime-history branch from 368fe06 to 6fafb3f Compare November 25, 2020 17:30
@tiholic tiholic marked this pull request as draft November 25, 2020 17:37
@tiholic tiholic force-pushed the feature/realtime-history branch from 5422182 to bc5b7ea Compare November 25, 2020 18:25
@tiholic tiholic marked this pull request as ready for review November 25, 2020 18:25
@tiholic tiholic requested review from QuintinWillison and removed request for QuintinWillison November 25, 2020 18:40
@tiholic tiholic force-pushed the feature/rest-history-integration-tests branch from 7fff784 to 1b994a9 Compare January 9, 2021 09:51
@tiholic tiholic force-pushed the feature/realtime-history branch from bc5b7ea to 8c17472 Compare January 9, 2021 10:31
@tiholic tiholic force-pushed the feature/rest-history-integration-tests branch from 1b994a9 to a8bc0a6 Compare January 12, 2021 08:44
@tiholic tiholic force-pushed the feature/realtime-history branch from 8c17472 to d90cc6a Compare January 12, 2021 09:35
Base automatically changed from feature/rest-history-integration-tests to integration/stage-2 February 15, 2021 15:46
print('failed to get history:: $e :: ${e.errorInfo}');
}
},
onLongPress: (_rest == null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. Is this behaviour obvious? Maybe I don't fully understand the context (I've not loaded the app in a while, least not for this branch), but I would usually expect a long-press to first present a menu or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@QuintinWillison long press is not intuitive, I had a plan to enhance this, but primary focus was not on example.

await Future.delayed(const Duration(seconds: 2));

final time1 = DateTime.now();
//TODO(tiholic) iOS fails without this delay
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#86

static const String realtimePublishWithAuthCallback =
'realtimePublishWithAuthCallback';
// TODO(tiholic) handle realtimeHistoryWithAuthCallback
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#87

@QuintinWillison QuintinWillison merged commit fea74be into integration/stage-2 Feb 15, 2021
@QuintinWillison QuintinWillison deleted the feature/realtime-history branch February 15, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants