Skip to content

Commit

Permalink
[sync] 2024/01/01 (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Jan 30, 2024
2 parents 8e283c7 + 679fbc4 commit e2baf59
Show file tree
Hide file tree
Showing 325 changed files with 11,429 additions and 5,299 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
submodules: recursive
- name: Build site and check links
run: make build BUILD_CONFIGS=_config.yml,_config_stage.yml
# - name: Install Node for Firebase install
# uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
# with:
# node-version: ${{ env.NODE_VERSION }}
# - name: Install Firebase CLI
# run: npm install -g firebase-tools@12.9.1
# - name: Install Node for Firebase install
# uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
# with:
# node-version: ${{ env.NODE_VERSION }}
# - name: Install Firebase CLI
# run: npm install -g firebase-tools@13.0.2
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
with:
sdk: stable
Expand All @@ -77,18 +77,18 @@ jobs:
submodules: recursive
- name: Build site and check links
run: make build
# - name: Install Node for Firebase install
# uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
# with:
# node-version: ${{ env.NODE_VERSION }}
# - name: Install Firebase CLI
# run: npm install -g firebase-tools@12.9.1
# - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
# with:
# sdk: stable
# - run: tool/check-links.sh
# - name: Deploy to Firebase hosting
# run: make deploy # TODO(drewroengoogle) Run deploy on Cloud Build.
# - name: Install Node for Firebase install
# uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
# with:
# node-version: ${{ env.NODE_VERSION }}
# - name: Install Firebase CLI
# run: npm install -g firebase-tools@13.0.2
# - uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
# with:
# sdk: stable
# - run: tool/check-links.sh
# - name: Deploy to Firebase hosting
# run: make deploy # TODO(drewroengoogle) Run deploy on Cloud Build.
- name: Deploy CN
run: make deploy
env:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ but two of the primary repos are the
[Flutter SDK](https://github.com/flutter/flutter), and this repo, the
[Flutter website](https://github.com/flutter/website).
To contribute a fix to a repo, submit a [pull request
(PR)](https://services.github.com/on-demand/github-cli/open-pull-request-github).
(PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

For information on contributing code or API docs to the Flutter SDK, see
[Contributing to
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.2.2-slim-bookworm@sha256:02a091c83d1aa1070c0f6fefcbd2aff58ddd3430e2d5661c6ef2142b1383349b AS base
FROM ruby:3.3-slim-bookworm@sha256:763422273a15e307b044fcb3ad6b1ef6c290d2043ac73596842aba5659dc7318 as base

SHELL ["/usr/bin/bash", "-c"]

Expand Down Expand Up @@ -85,6 +85,7 @@ FROM node AS dev
#RUN bundle config mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems

ENV JEKYLL_ENV=development
ENV RUBY_YJIT_ENABLE=1
RUN gem install bundler
COPY Gemfile Gemfile.lock ./
RUN bundle config set force_ruby_platform true
Expand Down Expand Up @@ -116,6 +117,7 @@ RUN tool/move_docs.sh; tool/translator/build.sh
FROM node AS build

ENV JEKYLL_ENV=production
ENV RUBY_YJIT_ENABLE=1
RUN gem install bundler
COPY Gemfile Gemfile.lock ./
RUN bundle config set force_ruby_platform true
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'jekyll', '4.3.2'
gem 'jekyll', '4.3.3'
gem 'jekyll-sass-converter', '~> 3.0.0'
gem 'webrick'

Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bigdecimal (3.1.4)
bigdecimal (3.1.5)
colorator (1.1.0)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
Expand All @@ -28,11 +28,11 @@ GEM
forwardable-extended (~> 2.5)
ffi (1.16.3)
forwardable-extended (2.6.0)
google-protobuf (3.25.0)
google-protobuf (3.25.1)
http_parser.rb (0.8.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jekyll (4.3.2)
jekyll (4.3.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
Expand Down Expand Up @@ -72,12 +72,12 @@ GEM
mini_portile2 (2.8.5)
minitest (5.20.0)
mutex_m (0.2.0)
nokogiri (1.15.4)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.3)
public_suffix (5.0.4)
racc (1.7.3)
rake (13.1.0)
rb-fsevent (0.11.2)
Expand All @@ -102,12 +102,12 @@ PLATFORMS

DEPENDENCIES
activesupport (~> 7.1.2)
jekyll (= 4.3.2)
jekyll (= 4.3.3)
jekyll-include-cache (~> 0.2.1)
jekyll-sass-converter (~> 3.0.0)
jekyll-toc (~> 0.18.0)
liquid-tag-parser (~> 2.0.2)
webrick

BUNDLED WITH
2.4.21
2.5.3
41 changes: 41 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,44 @@ flutterfire: https://firebase.flutter.dev
dartpadx-dart: https://dartpad.cn/experimental/embed-new-dart.html ## Adding the exp version for dart here.
youtube-site: https://youtube.com

## Software minimum versions

appmin:
github_win: 2.4
github_mac: 2.4
vscode: 1.75
android_studio: '2022.3 (Giraffe) or later'
intellij_idea: '2022.3 or later'
android_sdk: 19
powershell: 5.0
devmin:
windows: '64-bit version of Microsoft Windows 10'
macos: '10.14 (Mojave)'
linux:
debian: 10
ubuntu: '18.04 LTS'
targetmin:
windows: 'Microsoft Windows 7'
macos: '10.13 (Ventura)'
linux:
debian: 9
ubuntu: '18.04 LTS'
ios: 11
android: 'Android API level 19'

## Software current versions

appnow:
flutter: '3.13.4'
github_win: 2.4
vscode: '1.81.1'
android_studio: '2022.3 (Giraffe) or later'
android_sdk: '33.0.0'
intellij: '2023.1'
powershell: 5.0
xcode: '15'
ios: '17'
cocoapods: '1.12'

########### Jekyll ###########

Expand Down Expand Up @@ -182,6 +220,9 @@ alert:
version-note: >-
<aside class="alert alert-info" role="alert" markdown="1">
<i class="material-icons" aria-hidden="true">merge_type</i> **版本提示:**
recommend: >-
<aside class="alert alert-success alert-icon" role="alert" markdown="1">
<i class="material-icons" aria-hidden="true">bolt</i>
secondary: >-
<aside class="alert alert-secondary" role="alert" markdown="1">
tip: >-
Expand Down
2 changes: 1 addition & 1 deletion examples/basics/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MyApp extends StatelessWidget {
appBar: AppBar(
title: const Text('Nullable Fields Demo'),
),
body: const Center(
body: Center(
child: Column(
children: [
Text('anInt is $anInt.'),
Expand Down
2 changes: 1 addition & 1 deletion examples/codelabs
Submodule codelabs updated 1613 files
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Take our settings from the example_utils analysis_options.yaml file.
# If necessary for a particular example, this file can also include
# overrides for individual lints.

include: package:example_utils/analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import 'dart:async';

import 'package:games_services/games_services.dart';
import 'package:logging/logging.dart';

/// Allows awarding achievements and leaderboard scores,
/// and also showing the platforms' UI overlays for achievements
/// and leaderboards.
///
/// A facade of `package:games_services`.
class GamesServicesController {
static final Logger _log = Logger('GamesServicesController');

final Completer<bool> _signedInCompleter = Completer();

Future<bool> get signedIn => _signedInCompleter.future;

/// Unlocks an achievement on Game Center / Play Games.
///
/// You must provide the achievement ids via the [iOS] and [android]
/// parameters.
///
/// Does nothing when the game isn't signed into the underlying
/// games service.
Future<void> awardAchievement(
{required String iOS, required String android}) async {
if (!await signedIn) {
_log.warning('Trying to award achievement when not logged in.');
return;
}

try {
await GamesServices.unlock(
achievement: Achievement(
androidID: android,
iOSID: iOS,
),
);
} catch (e) {
_log.severe('Cannot award achievement: $e');
}
}

/// Signs into the underlying games service.
Future<void> initialize() async {
try {
await GamesServices.signIn();
// The API is unclear so we're checking to be sure. The above call
// returns a String, not a boolean, and there's no documentation
// as to whether every non-error result means we're safely signed in.
final signedIn = await GamesServices.isSignedIn;
_signedInCompleter.complete(signedIn);
} catch (e) {
_log.severe('Cannot log into GamesServices: $e');
_signedInCompleter.complete(false);
}
}

/// Launches the platform's UI overlay with achievements.
Future<void> showAchievements() async {
if (!await signedIn) {
_log.severe('Trying to show achievements when not logged in.');
return;
}

try {
await GamesServices.showAchievements();
} catch (e) {
_log.severe('Cannot show achievements: $e');
}
}

/// Launches the platform's UI overlay with leaderboard(s).
Future<void> showLeaderboard() async {
if (!await signedIn) {
_log.severe('Trying to show leaderboard when not logged in.');
return;
}

try {
await GamesServices.showLeaderboards(
// TODO: When ready, change both these leaderboard IDs.
iOSLeaderboardID: 'some_id_from_app_store',
androidLeaderboardID: 'sOmE_iD_fRoM_gPlAy',
);
} catch (e) {
_log.severe('Cannot show leaderboard: $e');
}
}

/// Submits [score] to the leaderboard.
Future<void> submitLeaderboardScore(int score) async {
if (!await signedIn) {
_log.warning('Trying to submit leaderboard when not logged in.');
return;
}

_log.info('Submitting $score to leaderboard.');

try {
await GamesServices.submitScore(
score: Score(
// TODO: When ready, change these leaderboard IDs.
iOSLeaderboardID: 'some_id_from_app_store',
androidLeaderboardID: 'sOmE_iD_fRoM_gPlAy',
value: score,
),
);
} catch (e) {
_log.severe('Cannot submit leaderboard score: $e');
}
}
}
44 changes: 44 additions & 0 deletions examples/cookbook/games/achievements_leaderboards/lib/various.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// ignore_for_file: unused_catch_clause

import 'package:flutter/services.dart';
import 'package:games_services/games_services.dart';

void main() async {
// #docregion signIn
try {
await GamesServices.signIn();
} on PlatformException catch (e) {
// ... deal with failures ...
}
// #enddocregion signIn

// #docregion unlock
await GamesServices.unlock(
achievement: Achievement(
androidID: 'your android id',
iOSID: 'your ios id',
),
);
// #enddocregion unlock

// #docregion showAchievements
await GamesServices.showAchievements();
// #enddocregion showAchievements

// #docregion submitScore
await GamesServices.submitScore(
score: Score(
iOSLeaderboardID: 'some_id_from_app_store',
androidLeaderboardID: 'sOmE_iD_fRoM_gPlAy',
value: 100,
),
);
// #enddocregion submitScore

// #docregion showLeaderboards
await GamesServices.showLeaderboards(
iOSLeaderboardID: 'some_id_from_app_store',
androidLeaderboardID: 'sOmE_iD_fRoM_gPlAy',
);
// #enddocregion showLeaderboards
}
19 changes: 19 additions & 0 deletions examples/cookbook/games/achievements_leaderboards/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: games_services_example
description: Games services

environment:
sdk: ^3.2.0

dependencies:
flutter:
sdk: flutter

games_services: ^4.0.0
logging: ^1.2.0

dev_dependencies:
example_utils:
path: ../../../example_utils

flutter:
uses-material-design: true
Loading

0 comments on commit e2baf59

Please sign in to comment.