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

RWS branch initial store tab #239

Draft
wants to merge 9 commits into
base: rws
Choose a base branch
from
Draft
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
3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="custom-boot-config-url"
android:scheme="pebble" />
</intent-filter>

Expand Down Expand Up @@ -162,4 +161,4 @@
android:exported="true"
tools:ignore="ExportedContentProvider" />
</application>
</manifest>
</manifest>
5 changes: 5 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,10 @@
"get_apps": "Get watch apps",
"incompatible_faces": "Incompatible Watch Faces",
"incompatible_apps": "Incompatible Watch Apps"
},
"store_page": {
"faces": "Watchfaces",
"apps": "Apps",
"search_bar": "Search for something..."
}
}
2 changes: 1 addition & 1 deletion lib/background/actions/calendar_action_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class CalendarActionHandler implements ActionHandler {
final calendarList =
await (_calendarList.streamWithExistingValue.firstSuccessOrError() as FutureOr<AsyncValue<List<SelectableCalendar>>>);

final calendars = calendarList.data?.value;
final calendars = calendarList.value;
if (calendars == null) {
return TimelineActionResponse(false);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/background/main_background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class BackgroundReceiver implements TimelineCallbacks {
final asyncValue =
await container.readUntilFirstSuccessOrError(preferencesProvider);

return asyncValue.data!.value;
return asyncValue.value!;
});

TimelineCallbacks.setup(this);
Expand Down
4 changes: 2 additions & 2 deletions lib/domain/api/appstore/appstore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import 'package:cobble/infrastructure/datasources/web_services/appstore.dart';

final appstoreServiceProvider = FutureProvider<AppstoreService>((ref) async {
final boot = await (await ref.watch(bootServiceProvider.future)).config;
final token = await (await ref.watch(tokenProvider.last));
final token = await (await ref.watch(tokenProvider.future));
final oauth = await ref.watch(oauthClientProvider.future);
final prefs = await ref.watch(preferencesProvider.future);
if (token == null) {
throw NoTokenException("Service requires a token but none was found in storage");
}
return AppstoreService(boot.appstore.base, prefs, oauth, token);
});
});
2 changes: 1 addition & 1 deletion lib/domain/api/auth/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';

final authServiceProvider = FutureProvider<AuthService>((ref) async {
final boot = await (await ref.watch(bootServiceProvider.future)).config;
final token = await (await ref.watch(tokenProvider.last));
final token = await (await ref.watch(tokenProvider.future));
final oauth = await ref.watch(oauthClientProvider.future);
final prefs = await ref.watch(preferencesProvider.future);
if (token == null) {
Expand Down
4 changes: 2 additions & 2 deletions lib/domain/api/boot/boot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import 'package:cobble/infrastructure/datasources/web_services/boot.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

final bootServiceProvider = FutureProvider<BootService>(
(ref) async => BootService(await ref.watch(bootUrlProvider.last) ?? ""),
);
(ref) async => BootService(await ref.watch(bootUrlProvider.future) ?? ""),
);
4 changes: 2 additions & 2 deletions lib/domain/calendar/calendar_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CalendarList extends StateNotifier<AsyncValue<List<SelectableCalendar>>> {
await _permissionCheck.hasCalendarPermission();

if (hasCalendarPermission.value == false) {
return AsyncValue.error([ResultError(0, "No permission")]);
return AsyncValue.error([ResultError(0, "No permission")], StackTrace.current);
}

final preferences = await _preferencesFuture;
Expand All @@ -43,7 +43,7 @@ class CalendarList extends StateNotifier<AsyncValue<List<SelectableCalendar>>> {

final calendars = await _deviceCalendarPlugin.retrieveCalendars();
if (!calendars.isSuccess) {
return AsyncValue.error(calendars.errors);
return AsyncValue.error(calendars.errors, StackTrace.current);
} else {
return AsyncValue.data(calendars.data
?.map((c) => SelectableCalendar(
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/calendar/calendar_syncer.db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CalendarSyncer {
return false;
}

final allCalendars = allCalendarsResult.data!.value;
final allCalendars = allCalendarsResult.value!;

final now = _dateTimeProvider();
// 1 day is added since we need to get the start of the next day
Expand Down
2 changes: 1 addition & 1 deletion lib/domain/timeline/watch_timeline_syncer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class WatchTimelineSyncer {
return;
}

final plugin = pluginValue.data!.value;
final plugin = pluginValue.value!;

const AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails("WARNINGS", "Warnings",
Expand Down
4 changes: 2 additions & 2 deletions lib/infrastructure/backgroundcomm/BackgroundRpc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class BackgroundRpc {
} else if (receivedMessage.errorResult != null) {
result = AsyncValue.error(
receivedMessage.errorResult!,
stackTrace: receivedMessage.errorStacktrace,
receivedMessage.errorStacktrace ?? StackTrace.current,
);
} else {
result = AsyncValue.error("Received result without any data.");
result = AsyncValue.error("Received result without any data.", StackTrace.current);
}

waitingCompleter.complete(result);
Expand Down
4 changes: 4 additions & 0 deletions lib/infrastructure/datasources/web_services/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class AuthService extends Service {
}
}

OAuthToken get token {
return _token;
}

Future<void> signOut() async {
await _oauth.signOut();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/infrastructure/datasources/web_services/rest_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RESTClient {
..addAll(params ?? {}),
);

HttpClientRequest req = await _client.getUrl(requestUri);
HttpClientRequest req = await _client.openUrl(method, requestUri);
if (token != null) {
req.headers.add("Authorization", "Bearer $token");
}
Expand Down Expand Up @@ -58,4 +58,4 @@ class RESTClient {
}
return _completer.future;
}
}
}
2 changes: 1 addition & 1 deletion lib/infrastructure/datasources/workarounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final neededWorkaroundsProvider = StreamProvider<List<Workaround>>((ref) {
return Stream<List<Workaround>>.empty();
}

final preferences = preferencesData.data!.value;
final preferences = preferencesData.value!;

fetchControls() async {
final workaroundControl = WorkaroundsControl();
Expand Down
40 changes: 40 additions & 0 deletions lib/localization/model/model_generator.model.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 21 additions & 3 deletions lib/localization/model/model_generator.model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:cobble/infrastructure/datasources/preferences.dart';
import 'package:cobble/localization/localization.dart';
import 'package:cobble/localization/localization_delegate.dart';
import 'package:cobble/localization/model/model_generator.model.dart';
import 'package:cobble/ui/home/tabs/store_tab.dart';
import 'package:cobble/ui/splash/splash_page.dart';
import 'package:cobble/ui/theme/cobble_scheme.dart';
import 'package:cobble/ui/theme/cobble_theme.dart';
Expand Down Expand Up @@ -88,6 +89,9 @@ class MyApp extends HookConsumerWidget {
child: MaterialApp(
onGenerateTitle: (context) => tr.common.title,
theme: CobbleTheme.appTheme(brightness),
routes: {
'/appstore': (context) => StoreTab(),
},
home: SplashPage(),
// List all of the app's supported locales here
supportedLocales: supportedLocales,
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/devoptions/debug_options_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class DebugOptionsPage extends HookConsumerWidget implements CobbleScreen {
@override
Widget build(BuildContext context, WidgetRef ref) {
final preferences = ref.watch(preferencesProvider);
final bootUrl = ref.watch(bootUrlProvider).data?.value ?? "";
final bootUrl = ref.watch(bootUrlProvider).value ?? "";
final shouldOverrideBoot =
ref.watch(shouldOverrideBootProvider).data?.value ?? false;
ref.watch(shouldOverrideBootProvider).value ?? false;
final overrideBootUrl =
ref.watch(overrideBootValueProvider).data?.value ?? "";
ref.watch(overrideBootValueProvider).value ?? "";

final bootUrlController = useTextEditingController();
final bootOverrideUrlController = useTextEditingController();
Expand Down
Loading
Loading