小编Lak*_*tne的帖子

以角度4全局捕获请求,如果没有互联网则停止

我可以window.navigator.onLine使用HttpInterceptor 来获取连接状态,如下所述,我可以全局访问请求。但是,如何取消HttpInterceptor内部的请求?还是有更好的方法来解决这个问题?

import { Injectable } from '@angular/core';
import {
    HttpRequest,
    HttpHandler,
    HttpEvent,
    HttpInterceptor
} from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class InternetInterceptor implements HttpInterceptor {
    constructor() { }

    intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
        //check to see if there's internet
        if (!window.navigator.onLine) {
            return //cancel request
        }
        //else return the normal request
        return next.handle(request);
    }
}
Run Code Online (Sandbox Code Playgroud)

internet-connection angular-http-interceptors angular

4
推荐指数
1
解决办法
3772
查看次数

使用fastlane upload_to_play_store时如何设置发布名称?

在 Play 控制台中,当您创建版本时,可以提供版本名称。但是,当在 fastlane 中使用upload_to_play_store命令时,我在推送 apk 时看不到提供自定义版本名称的参数,而是将版本名称作为版本名称。怎么可能实现呢?

   lane :beta do
gradle(
    task: 'assemble',
    build_type: 'Release'
  )
  upload_to_play_store(track:'beta')
end
Run Code Online (Sandbox Code Playgroud)

android fastlane

2
推荐指数
1
解决办法
1808
查看次数