Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sidhdhi-p committed Jan 15, 2025
1 parent 5dadbf5 commit b0dbf48
Show file tree
Hide file tree
Showing 15 changed files with 109 additions and 123 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ jobs:
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > android/app/google-services.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart
- name: Install dependencies
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ jobs:
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}

CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart
- name: Install Dependencies
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/android_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ jobs:
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}

CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart
- name: Install Dependencies
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/function_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ jobs:
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
ENVIRONMENT_VARIABLE_BASE64: ${{ secrets.ENVIRONMENT_VARIABLE_BASE64 }}
run: |
cd khelo
echo $GOOGLE_APPLICATION_CREDENTIALS | base64 --decode > google-application-credentials.json
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
echo $ENVIRONMENT_VARIABLE_BASE64 | base64 --decode > functions/.env
- name: Deploy Firebase functions
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ios_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ jobs:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
CONFIG_BASE64: ${{ secrets.CONFIG_BASE64 }}
API_KEYS_BASE64: ${{ secrets.API_KEYS_BASE64 }}
run: |
cd khelo
echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
echo $CONFIG_BASE64 | base64 --decode > ios/Config.xcconfig
echo $API_KEYS_BASE64 | base64 --decode > ../data/lib/utils/api_keys.dart
- name: Install Dependencies
run: |
cd data && flutter clean && flutter pub get
Expand Down
11 changes: 0 additions & 11 deletions data/lib/service/auth/auth_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,6 @@ class AuthService {
return false;
}

Future<void> unlinkGoogle() async {
try {
final User? user = _auth.currentUser;
if (user != null) {
await user.unlink('google.com');
}
} catch (error) {
debugPrint(error.toString());
}
}

Future<void> verifyOTP(
String countryCode,
String phoneNumber,
Expand Down
6 changes: 0 additions & 6 deletions khelo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1159,8 +1159,6 @@ PODS:
- BoringSSL-GRPC/Implementation (0.0.36):
- BoringSSL-GRPC/Interface (= 0.0.36)
- BoringSSL-GRPC/Interface (0.0.36)
- camera_avfoundation (0.0.1):
- Flutter
- cloud_firestore (5.5.1):
- Firebase/Firestore (= 11.4.0)
- firebase_core
Expand Down Expand Up @@ -1489,7 +1487,6 @@ PODS:

DEPENDENCIES:
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
- cloud_functions (from `.symlinks/plugins/cloud_functions/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
Expand Down Expand Up @@ -1559,8 +1556,6 @@ SPEC REPOS:
EXTERNAL SOURCES:
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios"
cloud_firestore:
:path: ".symlinks/plugins/cloud_firestore/ios"
cloud_functions:
Expand Down Expand Up @@ -1615,7 +1610,6 @@ SPEC CHECKSUMS:
AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
BoringSSL-GRPC: ca6a8e5d04812fce8ffd6437810c2d46f925eaeb
camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4
cloud_firestore: 3fafe78d755b01fe1fd267a87bb52e80b7dacacc
cloud_functions: ddb115d2d97e0f545fed35a14fb69771a744f1e1
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
Expand Down
2 changes: 1 addition & 1 deletion khelo/lib/domain/extensions/enum_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,4 @@ extension MediumOptionString on MediumOption {
return context.l10n.add_stream_info_your_yt_channel_text;
}
}
}
}
16 changes: 9 additions & 7 deletions khelo/lib/ui/app_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,15 @@ class AppRoute {
builder: (context) =>
LeaderboardScreen(selectedField: selectedField));

static AppRoute addStreamInfo({required String matchId}) => AppRoute(
pathAddStreamInfo,
builder: (context) => AddStreamInfoScreen(matchId: matchId));

static AppRoute streamCameraView({required LiveStreamModel stream}) => AppRoute(
pathStreamCamera,
builder: (context) => StreamCameraScreen(stream: stream,));
static AppRoute addStreamInfo({required String matchId}) =>
AppRoute(pathAddStreamInfo,
builder: (context) => AddStreamInfoScreen(matchId: matchId));

static AppRoute streamCameraView({required LiveStreamModel stream}) =>
AppRoute(pathStreamCamera,
builder: (context) => StreamCameraScreen(
stream: stream,
));

static AppRoute searchTeam({
List<String>? excludedIds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:khelo/components/action_bottom_sheet.dart';
import 'package:khelo/components/app_page.dart';
import 'package:khelo/domain/extensions/context_extensions.dart';
import 'package:khelo/domain/extensions/enum_extensions.dart';
Expand Down Expand Up @@ -68,28 +69,28 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {
}

return ListView(
padding: context.mediaQueryPadding + EdgeInsets.symmetric(horizontal: 16),
children: [
if (state.stream == null) ...[
_mediumOptionView(context),
] else ...[
Container(
padding: EdgeInsets.all(16),
margin: const EdgeInsets.all(16),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
border: Border.all(color: context.colorScheme.outline),
),
child: Column(
spacing: 16,
children: [
Text(
context.l10n.add_stream_info_all_set_title,
style: AppTextStyle.header4
.copyWith(color: context.colorScheme.textPrimary),
),
Text(context.l10n.add_stream_info_all_set_title,
textAlign: TextAlign.center,
style: AppTextStyle.header4
.copyWith(color: context.colorScheme.textPrimary)),
Text(context.l10n.add_stream_info_all_set_description,
textAlign: TextAlign.center,
style: AppTextStyle.subtitle2
.copyWith(color: context.colorScheme.textPrimary)),
.copyWith(color: context.colorScheme.textSecondary)),
PrimaryButton(
context.l10n.add_stream_info_go_live_title,
expanded: false,
Expand All @@ -107,7 +108,7 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {

Widget _mediumOptionView(BuildContext context) {
return Padding(
padding: context.mediaQueryPadding + const EdgeInsets.all(16),
padding: const EdgeInsets.symmetric(vertical: 16),
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
Expand All @@ -116,11 +117,9 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {
child: Column(
spacing: 16,
children: [
// TODO: remove unlink button
ElevatedButton(
onPressed: () => notifier.unlink(), child: Text("Unlink")),
Text(
context.l10n.add_stream_info_go_live_with_text,
textAlign: TextAlign.center,
style: AppTextStyle.header4
.copyWith(color: context.colorScheme.textPrimary),
),
Expand All @@ -145,21 +144,23 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {
children: [
SvgPicture.asset(
Assets.images.icYoutube,
height: 22,
colorFilter:
ColorFilter.mode(context.colorScheme.alert, BlendMode.srcIn),
height: 20,
),
SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(option.getString(context),
textAlign: TextAlign.center,
style: AppTextStyle.subtitle2
.copyWith(color: context.colorScheme.textPrimary)),
if (option.isLoginRequired)
Text(
context.l10n.add_stream_info_login_required_text,
textAlign: TextAlign.center,
style: AppTextStyle.caption
.copyWith(color: context.colorScheme.textSecondary),
)
Expand All @@ -181,10 +182,7 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {
});
}

void _observeYTChannels(
BuildContext context,
WidgetRef ref,
) {
void _observeYTChannels(BuildContext context, WidgetRef ref) {
ref.listen(addStreamInfoStateProvider.select((value) => value.ytChannels),
(previous, next) {
if (next.isNotEmpty) {
Expand All @@ -193,15 +191,22 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {
});
}

void _observeShowSelectResolutionSheet(
BuildContext context,
WidgetRef ref,
) {
void _observeShowSelectResolutionSheet(BuildContext context, WidgetRef ref) {
ref.listen(
addStreamInfoStateProvider.select(
(value) => value.showSelectResolutionSheet), (previous, next) {
if (next) {
chooseYTResolutionSheet(context);
showActionBottomSheet(
context: context,
items: YouTubeResolution.values
.map((e) => BottomSheetAction(
title: e.stringResolution,
onTap: () {
context.pop();
notifier.onResolutionSelect(e);
},
))
.toList());
}
});
}
Expand Down Expand Up @@ -244,49 +249,6 @@ class _AddStreamInfoScreenState extends ConsumerState<AddStreamInfoScreen> {
);
}

void chooseYTResolutionSheet(BuildContext context) {
HapticFeedback.mediumImpact();
showModalBottomSheet(
context: context,
showDragHandle: false,
enableDrag: false,
isScrollControlled: true,
useRootNavigator: true,
backgroundColor: context.colorScheme.surface,
builder: (context) {
return SizedBox(
height: context.mediaQuerySize.height * 0.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16),
child: Text(
context.l10n.add_stream_info_choose_resolution,
style: AppTextStyle.header4
.copyWith(color: context.colorScheme.textPrimary),
),
),
Expanded(
child: ListView.separated(
itemBuilder: (context, index) => OnTapScale(
onTap: () {
context.pop();
notifier.onResolutionSelect(
YouTubeResolution.values[index]);
},
child: Text(YouTubeResolution.values[index].name)),
separatorBuilder: (context, index) =>
Divider(color: context.colorScheme.outline),
itemCount: YouTubeResolution.values.length)),
],
),
);
},
);
}

Widget ytChannelCell(BuildContext context, {required YTChannel channel}) {
return OnTapScale(
onTap: () => notifier.onChannelSelect(channel.id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class AddStreamInfoViewNotifier extends StateNotifier<AddStreamInfoViewState> {
}

Future<void> onOptionSelected(MediumOption option) async {
state = state.copyWith(mediumOption: option, showSelectResolutionSheet: false);
state =
state.copyWith(mediumOption: option, showSelectResolutionSheet: false);
switch (option) {
case MediumOption.kheloYTChannel:
showResolutionSheet();
Expand All @@ -69,7 +70,8 @@ class AddStreamInfoViewNotifier extends StateNotifier<AddStreamInfoViewState> {

Future<void> fetchYTChannels() async {
try {
state = state.copyWith(loading: true, actionError: null, showSelectResolutionSheet: false);
state = state.copyWith(
loading: true, actionError: null, showSelectResolutionSheet: false);

await signInWithGoogleIfNeeded();

Expand All @@ -94,7 +96,8 @@ class AddStreamInfoViewNotifier extends StateNotifier<AddStreamInfoViewState> {
}

void onChannelSelect(String channelId) {
state = state.copyWith(channelId: channelId, showSelectResolutionSheet: false);
state =
state.copyWith(channelId: channelId, showSelectResolutionSheet: false);
showResolutionSheet();
}

Expand Down Expand Up @@ -148,10 +151,6 @@ class AddStreamInfoViewNotifier extends StateNotifier<AddStreamInfoViewState> {
"AddStreamInfoViewNotifier: error while creating yt stream -> $e");
}
}

void unlink() {
_authService.unlinkGoogle();
}
}

@freezed
Expand Down
Loading

0 comments on commit b0dbf48

Please sign in to comment.