chore: update repository to take in app url

pull/225/head
Jonathan Daniels 3 years ago committed by jonathandaniels-vgv
parent f0c7545422
commit 756f3d2352

@ -5,10 +5,11 @@ import 'package:share_repository/share_repository.dart';
/// {@endtemplate} /// {@endtemplate}
class ShareRepository { class ShareRepository {
/// {@macro share_repository} /// {@macro share_repository}
const ShareRepository(); const ShareRepository({
required String appUrl,
}) : _appUrl = appUrl;
// TODO(jonathandaniels-vgv): Change to prod url. final String _appUrl;
static const _shareUrl = 'https://ashehwkdkdjruejdnensjsjdne.web.app/#/';
/// Returns a url to share the [shareText] on the given [platform]. /// Returns a url to share the [shareText] on the given [platform].
/// ///
@ -19,7 +20,7 @@ class ShareRepository {
required String shareText, required String shareText,
required SharePlatform platform, required SharePlatform platform,
}) { }) {
final encodedUrl = Uri.encodeComponent(_shareUrl); final encodedUrl = Uri.encodeComponent(_appUrl);
final encodedShareText = Uri.encodeComponent(shareText); final encodedShareText = Uri.encodeComponent(shareText);
switch (platform) { switch (platform) {
case SharePlatform.twitter: case SharePlatform.twitter:

@ -4,14 +4,15 @@ import 'package:test/test.dart';
void main() { void main() {
group('ShareRepository', () { group('ShareRepository', () {
const appUrl = 'https://ashehwkdkdjruejdnensjsjdne.web.app/#/';
late ShareRepository shareRepository; late ShareRepository shareRepository;
setUp(() { setUp(() {
shareRepository = ShareRepository(); shareRepository = ShareRepository(appUrl: appUrl);
}); });
test('can be instantiated', () { test('can be instantiated', () {
expect(ShareRepository(), isNotNull); expect(ShareRepository(appUrl: appUrl), isNotNull);
}); });
group('shareScore', () { group('shareScore', () {

Loading…
Cancel
Save