diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3c92181..49d102d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,13 +7,6 @@ jobs: steps: - uses: actions/checkout@v2 with: - repository: chatsen/signingkeys - token: ${{secrets.GHKEY}} - path: signingkeys - - - uses: actions/checkout@v2 - with: - token: ${{secrets.GHKEY}} path: chatsen - uses: actions/setup-java@v1 @@ -72,96 +65,3 @@ jobs: files: ./release/Android.apk env: GITHUB_TOKEN: ${{secrets.GHKEY}} - - - name: Generate project files and cleanup - if: startsWith(github.ref, 'refs/tags/') - working-directory: ./chatsen - run: | - sed -i 's/kPlayStoreRelease = false/kPlayStoreRelease = true/' ./lib/Consts.dart - flutter build appbundle - - - name: Prepare release files - if: startsWith(github.ref, 'refs/tags/') - run: | - cp ./chatsen/build/app/outputs/bundle/release/app-release.aab ./release/PlayStore.aab - echo "Sync with Github repository." > whatsnew-en-US - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - name: PlayStore.aab - path: ./release/PlayStore.aab - - - uses: r0adkll/upload-google-play@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - packageName: com.chatsen.chatsen - serviceAccountJson: ./signingkeys/pc-api-7512701657656671844-671-a7a04005a195.json - track: production - releaseFiles: ./release/PlayStore.aab - whatsNewDirectory: . - - ios_build: - name: iOS Build - runs-on: macos-latest - steps: - - run: brew install gnu-sed - - - uses: actions/checkout@v2 - with: - token: ${{secrets.GHKEY}} - path: chatsen - - - uses: actions/setup-java@v1 - with: - java-version: "12.x" - - - name: Changing version number and build number to the Github Tag - if: startsWith(github.ref, 'refs/tags/') - working-directory: ./chatsen - run: | - sed -e "s/^version: .*$/version: ${GITHUB_REF/refs\/tags\//}/" ./pubspec.yaml > ./pubspec2.yaml - mv -f ./pubspec2.yaml ./pubspec.yaml - cat ./pubspec.yaml - - - uses: chatsen/flutter-action@master - with: - channel: "master" - - - name: Check for flutter updates - run: flutter upgrade - - - name: Patch a fix for gifs inside the Flutter framework - run: | - gsed -i '/_frameDuration = _nextFrame!.duration;/a \ \ \ \ \ \ if (_frameDuration!.inMilliseconds <= 10) _frameDuration = Duration(milliseconds: 100);' $(which flutter | head -n 1 | sed -e 's/\\/\//g' -e 's/\/bin\/flutter.*//')/packages/flutter/lib/src/painting/image_stream.dart - - - name: Generate project files and cleanup - working-directory: ./chatsen - run: | - flutter create --org com.chatsen . - rm -rf test - # sed -i 's/chatsen<\/string>/Chatsen<\/string>/' ./ios/Runner/Info.plist - sed -e 's/chatsen<\/string>/Chatsen<\/string>/' ./ios/Runner/Info.plist > ./ios/Runner/Info2.plist - mv -f ./ios/Runner/Info2.plist ./ios/Runner/Info.plist - flutter pub run flutter_launcher_icons:main - flutter build ios --no-codesign - - - name: Prepare release files and converting .app to .ipa - run: | - mkdir -p release/Payload - cp -rf ./chatsen/build/ios/iphoneos/Runner.app ./release/Payload/Runner.app - ditto -c -k --sequesterRsrc --keepParent ./release/Payload ./release/iOS.ipa - - - name: Upload Artifact - uses: actions/upload-artifact@v2 - with: - name: iOS.ipa - path: ./release/iOS.ipa - - - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: ./release/iOS.ipa - env: - GITHUB_TOKEN: ${{secrets.GHKEY}} diff --git a/lib/Components/HomeDrawer.dart b/lib/Components/HomeDrawer.dart index 8ec2d09c..cece333b 100644 --- a/lib/Components/HomeDrawer.dart +++ b/lib/Components/HomeDrawer.dart @@ -52,18 +52,18 @@ class HomeDrawer extends StatelessWidget { onPressed: () async => (BlocProvider.of(context).state is StreamOverlayClosed) ? BlocProvider.of(context).add(StreamOverlayOpen(channelName: channel!.name!.substring(1))) : BlocProvider.of(context).add(StreamOVerlayClose()), //launch('https://twitch.tv/${channel.name.substring(1)}'), tooltip: 'Open current channel\'s stream', ), - if (channel != null) - IconButton( - icon: Icon(Icons.search), - onPressed: () => Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => SearchPage( - channel: channel, - ), - ), - ), - tooltip: 'Search in the current channel', - ), + // if (channel != null) + // IconButton( + // icon: Icon(Icons.search), + // onPressed: () => Navigator.of(context).push( + // MaterialPageRoute( + // builder: (BuildContext context) => SearchPage( + // channel: channel, + // ), + // ), + // ), + // tooltip: 'Search in the current channel', + // ), if (channel != null) Container( width: 1.0, diff --git a/lib/Components/Modal/UpdateModal.dart b/lib/Components/Modal/UpdateModal.dart index e7b0fdae..a093619f 100644 --- a/lib/Components/Modal/UpdateModal.dart +++ b/lib/Components/Modal/UpdateModal.dart @@ -60,7 +60,7 @@ class UpdateModal extends StatelessWidget { static Future hasUpdate() async { if (kPlayStoreRelease) return false; - var releases = await GithubReleaseProvider('chatsen/chatsen').getReleases(); + var releases = await GithubReleaseProvider('stephanbruh/chatsen').getReleases(); releases.sort((a1, a2) => a1.version!.compareTo(a2.version)); var packageInfo = await PackageInfo.fromPlatform(); var currentReleaseVersion = Version.parse('${packageInfo.version}+${packageInfo.buildNumber}'); @@ -71,7 +71,7 @@ class UpdateModal extends StatelessWidget { static void searchForUpdate(BuildContext context) async { if (kPlayStoreRelease) return; - var releases = await GithubReleaseProvider('chatsen/chatsen').getReleases(); + var releases = await GithubReleaseProvider('stephanbruh/chatsen').getReleases(); releases.sort((a1, a2) => a1.version!.compareTo(a2.version)); var packageInfo = await PackageInfo.fromPlatform(); diff --git a/lib/Components/Modal/UploadModal.dart b/lib/Components/Modal/UploadModal.dart index f8e3b272..150d2ff9 100644 --- a/lib/Components/Modal/UploadModal.dart +++ b/lib/Components/Modal/UploadModal.dart @@ -25,7 +25,7 @@ class UploadModal extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'You are about to upload ${file.fileName} to https://catbox.moe and share the link in ${channel.name}', + 'You are about to upload ${file.fileName} to https://i.nuuls.com and share the link in ${channel.name}', style: Theme.of(context).textTheme.headline6, ), SizedBox(height: 16.0), @@ -33,7 +33,7 @@ class UploadModal extends StatelessWidget { Center( child: Image.memory( file.toUint8List(), - height: 300.0, + height: MediaQuery.of(context).size.height / 5, ), ), SizedBox(height: 16.0), @@ -43,7 +43,7 @@ class UploadModal extends StatelessWidget { child: ElevatedButton.icon( onPressed: () async { Navigator.of(context).pop(); - var request = http.MultipartRequest('POST', Uri.parse('https://catbox.moe/user/api.php')); + var request = http.MultipartRequest('POST', Uri.parse('https://i.nuuls.com/upload')); request.files.add( http.MultipartFile.fromBytes( 'fileToUpload', @@ -85,9 +85,9 @@ class UploadModal extends StatelessWidget { } static Future show( - BuildContext context, { - required twitch.Channel channel, - }) async { + BuildContext context, { + required twitch.Channel channel, + }) async { var selectedFile = await FilePickerCross.importFromStorage(type: FileTypeCross.any); await BlurModal.show( context: context, @@ -97,4 +97,4 @@ class UploadModal extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/lib/Pages/Home.dart b/lib/Pages/Home.dart index 89622fe4..6f286bb6 100644 --- a/lib/Pages/Home.dart +++ b/lib/Pages/Home.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:io'; +import 'package:better_player/better_player.dart'; import 'package:chatsen/Accounts/AccountsCubit.dart'; import 'package:chatsen/Components/HomeEndDrawer.dart'; import 'package:chatsen/Components/Modal/SetupModal.dart'; @@ -11,6 +12,7 @@ import 'package:chatsen/Settings/SettingsEvent.dart'; import 'package:chatsen/Settings/SettingsState.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '/Components/ChannelJoinModal.dart'; import '/Components/HomeDrawer.dart'; @@ -46,6 +48,10 @@ class _HomePageState extends State implements twitch.Listener { setState(() {}); } + late WebViewController _myController; + final Completer _controller = + Completer(); + @override void initState() { Future.delayed(Duration(seconds: 2)).then( @@ -114,12 +120,30 @@ class _HomePageState extends State implements twitch.Listener { builder: (context, state) { var horizontal = MediaQuery.of(context).size.aspectRatio > 1.0; // // var videoPlayer = Container(color: Theme.of(context).primaryColor); + + if (state is StreamOverlayOpened && horizontal) { + SystemChrome.setEnabledSystemUIOverlays([]); + } else { + SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values); + } + var videoPlayer = state is StreamOverlayOpened - ? WebView( + /*? WebView( initialUrl: 'https://player.twitch.tv/?channel=${state.channelName}&enableExtensions=true&muted=false&parent=pornhub.com', javascriptMode: JavascriptMode.unrestricted, allowsInlineMediaPlayback: true, - ) + onWebViewCreated: (WebViewController webViewController) { + webViewController.evaluateJavascript( + 'const script=document.createElement("script");script.type="text/javascript";script.src="https://i.stphn.cc/trihard.js?487216";document.head.appendChild(script);'); + } + )*/ + ? BetterPlayer.network( + "https://trihard.stphn.cc/${state.channelName}.m3u8", + betterPlayerConfiguration: BetterPlayerConfiguration( + aspectRatio: 16 / 9, + autoPlay: true + ), + ) : null; var scaffold = Scaffold( @@ -278,12 +302,12 @@ class _HomePageState extends State implements twitch.Listener { ? Row( children: [ Expanded( - child: SafeArea(child: videoPlayer!), + child: SafeArea(left: false, child: videoPlayer!), ), ClipRRect( borderRadius: BorderRadius.circular(0.0), child: SizedBox( - width: 340.0, + width: 245.0, child: scaffold, ), ), diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index c50bf913..75f7ed74 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -2,7 +2,6 @@ // Generated file. Do not edit. // -// ignore_for_file: directives_ordering // ignore_for_file: lines_longer_than_80_chars import 'package:device_info_plus_web/device_info_plus_web.dart'; @@ -11,6 +10,7 @@ import 'package:file_selector_web/file_selector_web.dart'; import 'package:package_info_plus_web/package_info_plus_web.dart'; import 'package:share_plus_web/share_plus_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart'; +import 'package:wakelock_web/wakelock_web.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; @@ -22,5 +22,6 @@ void registerPlugins(Registrar registrar) { PackageInfoPlugin.registerWith(registrar); SharePlusPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar); + WakelockWeb.registerWith(registrar); registrar.registerMessageHandler(); } diff --git a/pubspec.yaml b/pubspec.yaml index c5cfb82f..a590cb92 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,6 +3,8 @@ description: A new Flutter project. publish_to: "none" # Remove this line if you wish to publish to pub.dev using `pub publish` version: 1.0.38+33 +version: 1.0.41+36 + environment: sdk: ">=2.12.0 <3.0.0" @@ -27,7 +29,10 @@ dependencies: version: ^2.0.0 package_info: ^2.0.2 path_provider: ^2.0.2 + smart_select: ^4.3.2 open_file: ^3.2.1 + better_player: + git: https://github.com/StephanBruh/betterplayer-1 dart_downloader: git: https://github.com/williambulin/dart_downloader.git # path: ../dart_downloader