-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from Countly/content-builder
WIP: Implemented content builder
- Loading branch information
Showing
7 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//indicates the content status | ||
enum ContentStatus { completed, closed} | ||
|
||
typedef ContentCallback = void Function(ContentStatus contentStatus, Map<String, dynamic> contentData); | ||
|
||
abstract class ContentBuilder { | ||
/// This is an experimental feature and it can have breaking changes | ||
// Opt in user for the content fetching and updates | ||
Future<void> enterContentZone(); | ||
|
||
/// This is an experimental feature and it can have breaking changes | ||
// Opt out user for the content fetching and updates | ||
Future<void> exitContentZone(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'content_builder.dart'; | ||
import 'countly_flutter.dart'; | ||
import 'countly_state.dart'; | ||
|
||
class ContentBuilderInternal implements ContentBuilder { | ||
ContentBuilderInternal(this._countlyState); | ||
|
||
final CountlyState _countlyState; | ||
|
||
@override | ||
Future<void> enterContentZone() async { | ||
if (!_countlyState.isInitialized) { | ||
Countly.log('enterContentZone, "initWithConfig" must be called before "clear"', logLevel: LogLevel.ERROR); | ||
return; | ||
} | ||
Countly.log('Calling "enterContentZone"'); | ||
await _countlyState.channel.invokeMethod('enterContentZone'); | ||
} | ||
|
||
@override | ||
Future<void> exitContentZone() async { | ||
if (!_countlyState.isInitialized) { | ||
Countly.log('exitContentZone, "initWithConfig" must be called before "clear"', logLevel: LogLevel.ERROR); | ||
return; | ||
} | ||
Countly.log('Calling "exitContentZone"'); | ||
await _countlyState.channel.invokeMethod('exitContentZone'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters