So here you can see
the onSignedOut function, and
it's pretty straightforward.
It just enables the sign in button,
and disables the sign out and
revoke buttons, and it just sets
a status text to be signed out.
That's it, you're done.
This app had many steps, but now you've
got something with a full sign in built.
Let's run it and see how it looks.
So here you can see
the application running.
I have my sign in button,
I have my sign out button and
I have my revoke access buttons,
the results are this little status text.
If I touch the sign in button,
what's going to happen first of all is
that the first error that came back,
came back because I hadn't
given the application consent.
So it's asking for my consent,
and then I'll say Ok.
Now you can see, it's signed in, and
it's signed in, and it actually got my
real name, my full name here, instead of
my email address, because all I provided
the application when I was
running it was my email address.
I now have my sign out and
my revoke access buttons enabled.
So if I touch Sign Out,
I'm actually signed out.
And if I touch Sign In,
I will sign in directly.
You might have seen a quick flash
as the intent was checking, but
now I'm signed in directly as myself.
If I revoke access now I've removed the
permission from the application to be
able to sign in.
So, the user has to
give permission again.
So, if I touch Sign In the intent will
come up, the arrow is triggered, and
it's saying, hey this wants
to look at my basic profile.
I'll say okay to that, and
then I'll continue, and get signed in.
So, now you have the full
sign in work flow going.
If you get stuck with any
of the code don't worry.
It's okay.
I've pasted
the entire code in the speaker notes.
You should be good to go.
تستطيع هنا مشاهدة
الدالة onSignedOut، و
هي مباشرة للغاية.
تقوم بتمكين زر sign in
وتعطيل الزرين sign out و
revoke،
وتقوم بتعيين نص الحالة إلى تسجيل الخروج.
وهكذا تكون قد انتهيت.
يتضمن هذا التطبيق عدة خطوات، ولكن الآن
تكون قد تعلمت شيئًا مع إنشاء تسجيل الدخول الكامل.
لنقم بتشغيله ونرى كيف يبدو.
يمكنك هنا مشاهدة
التطبيق قيد التشغيل.
لدي الأزرار sign in
وsign out و
وrevoke access
والنتائج هي نص الحالة البسيط هذا.
إذا قمت بلمس زر sign in،
فإن ما يحدث أولاً هو أن
الخطأ الأول يعود،
وذلك لأني لم أقدم
الموافقة على التطبيق.
إذًا هو يسأل عن الموافقة
وسوف أجيب باختيار Ok.
والآن تستطيع أن ترى أنه قد تم تسجيل دخوله
وقد حصل بالفعل على
اسمي الحقيقي، اسمي الكامل هنا بدلاً من
عنوان البريد الإلكتروني، لأن جميع ما قمت بتوفيره
للتطبيق عندما قمت بتشغيله
كان عنوان بريدي الإلكتروني.
الآن أصبح لدي الزران sign out وrevoke access
في وضع التمكين.
إذًا، إذَا قمتُ بلمس Sign Out،
فسيتم بالفعل تسجيل خروجي.
وإذا لمستُ Sign In،
فسيتم تسجيل دخولي مباشرةً.
ربما تكون قد شاهدت ومضة سريعة
حيث تقوم التعليمة الهدف بالتحقق، ولكن
الآن تم تسجيل دخولي مباشرةً باسمي.
إذا اخترت الزر revoke access الآن، فإنني أكون قد قمت بإزالة الإذن من التطبيق لكي
أتمكن من تسجيل الدخول.
يجب على المستخدم أن
يقدم الإذن مرة أخرى.
إذا قمتُ بلمس Sign In، فسوف تظهر التعليمة الهدف ويتم تشغيل السهم، و
الذي يفيد بأن هناك من يريد مشاهدة
ملف التعريف الأساسي الخاص بي.
إذا وافقتُ على ذلك،
فسوف أتابع ويتم تسجيل دخولي.
إذًا، الآن أصبح لديك
سير عمل تسجيل الدخول الكامل.
إذا شعرت بحيرة بشأن أي من
التعليمات البرمجية، فلا تقلق.
حسنًا،
لقد قمت بلصق
التعليمة البرمجية بالكامل في ملاحظات المعلق.
من الأفضل لك المتابعة.
Você vê, aqui,
a função onSignedOut,
e ela é muito clara e direta.
Ela habilita o botão "sign in"
e desabilita os botões "sign out"
e "revoke",
além de definir um texto de status
a ser exibido ao sair.
E, com isso, terminamos.
Este aplicativo tinha muitas etapas,
mas agora ele tem um
"sign in" completo integrado.
Vamos executá-lo e ver como ficou.
Veja aqui o aplicativo
sendo executado.
Tem um botão de "sign in",
tem um botão de "sign out"
e botões "revoke access"
; o resultado é este
pequeno texto de status.
Se eu tocar no botão "sign in",
a primeira coisa que acontecerá
é que o primeiro erro
que retornou
ocorreu porque eu não dei
consentimento ao aplicativo.
Por isso, estão pedindo meu consentimento,
e vou dar OK.
Veja agora que eu entrei
e ele trouxe meu nome real,
tem aqui meu nome completo,
em vez do meu endereço de email, porque ao executá-lo,
eu só forneci
meu endereço de email ao aplicativo.
Agora estão habilitados meus botões
"sign out" e "revoke access".
Por isso, se eu tocar em Sign Out,
serei desconectado.
E, se eu tocar em Sign In,
entro diretamente.
Talvez você perceba uma rápida intermitência
durante a verificação,
mas agora eu entrei
diretamente, e identificado.
Se eu revogar o acesso agora,
perderei a permissão
do aplicativo
para poder entrar.
Logo, o usuário terá que
dar permissão de novo.
Se eu tocar em Sign In, a intenção
aparecerá,
a seta será disparada,
e sou informado de que querem
visualizar meu perfil básico.
Vou concordar com isso
e, então, poderei continuar e entrar.
Bem, agora temos todo o fluxo de trabalho
de "sign in" funcionando.
Se você empacar em algum código,
não se preocupe.
Eu colei o código inteiro
nas anotações da apresentação.
Podemos continuar.
您现在所看到的
是 onSignedOut 函数。
这个函数非常简单。
它启用了登录按钮,
禁用了注销和撤销按钮,
并将状态文本
设置为已注销。
就这些,您已经学完了。
这个应用包括许多步骤,
但是您现在已经学完了创建登录的完整内容。
现在运行应用看看吧。
现在我们看到应用程序
已经运行了。
这里是登录按钮、
注销按钮以及撤销按钮,
结果是这个简短
的状态文本。
如果我触摸登录按钮,
首先出现的是
第一个返回错误,
之所以返回是因为
应用程序没有获得我的同意。
它请求我同意,
我选择“确定”。
现在您可以看到它已经登录,
登录后,它确实可以获得我的真实姓名,
这里显示的是我的全名,
而不是我的电子邮件地址,
因为我在运行应用程序时
只提供了电子邮件地址。
现在我启用注销
和撤销访问权按钮。
这样,如果我触摸“注销”,
我就会实际注销。
如果我触摸“登录”,
则会直接登录。
您可能注意到了屏幕快闪现象,
这是因为意图正在进行检查,
但现在我是以自己的身份直接登录。
如果我现在撤销访问权,
我就会从应用程序中删除权限,
而无法登录。
因此,用户必须
重新提供授权。
如果我触摸“登录”,
将会出现意图,触发箭头,
提示我此应用需要
查看我的基本个人资料。
我选择“确定”,然后继续,
最终完成登录。
现在,您已经了解了
完整的登录流程。
如果您在执行代码时遇到任何问题,
请不要担心。
没关系。
我在讲师注释中
附上了完整的代码。
您可以顺利执行所有操作。