我有两项活动。
我也有一个带有此设置的启动屏幕:
<activity android:name=".SplashScreen"
android:theme="@style/AppTheme.NoActionBar"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
然后,启动屏幕使用以下代码将用户转移到主屏幕:
Intent intent = new Intent(SplashScreen.this, HomeScreen.class);
Run Code Online (Sandbox Code Playgroud)
在主屏幕活动中,我检查用户是否已经登录。如果他没有登录,我将他转移到 LoginActivity:
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(FirebaseAuth firebaseAuth) {
if(firebaseAuth.getCurrentUser() == null)
{
Intent intent = new Intent(HomeScreen.this,LoginActivity.class);
Toast.makeText(HomeScreen.this,"H>L on no login",Toast.LENGTH_LONG).show(); //toast to show me why my app is in infinite loop
startActivity(intent);
}
}
};
Run Code Online (Sandbox Code Playgroud)
在 LoginActivity 上,我有一个简单的登录按钮,它使用 FireBase Google 身份验证。另外,我检查用户是否已经登录,如果是,则他已转移到 HomeScreen Activity:
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用自定义域部署 API 网关。(没有函数,只是其他堆栈可以导入和使用的通用 API 网关)
bin/api-app.ts
:
import { APIAppStack } from '../lib/api-app-stack';
export class MyAPIAppStack extends cdk.Stack {
constructor(parent: cdk.App, name: string, props: cdk.StackProps) {
super(parent, name, props);
new APIAppStack(this, 'APIApp', {
domainName: this.node.tryGetContext('domain'),
siteSubDomain: this.node.tryGetContext('subdomain'),
});
}
}
const app = new cdk.App();
new MyAPIAppStack(app, 'APIAppStack'+(((process.env.subdomain || "").length > 0)?"-"+process.env.subdomain:""), { env: {
region: process.env.AWS_DEFAULT_REGION,
account: process.env.CDK_DEFAULT_ACCOUNT
}});
app.synth();
Run Code Online (Sandbox Code Playgroud)
这是我的构造
lib/api-app-stack
::
export interface APIAppProps {
domainName: string;
siteSubDomain: string;
}
export class APIAppStack extends Construct {
constructor(parent: …
Run Code Online (Sandbox Code Playgroud)