Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Sep 24, 2023
1 parent 0228eae commit dc60cbc
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 29 deletions.
Binary file modified packages/firebase-admob/platforms/android/firebase_admob.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/firebase-database/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ export class Database implements IDatabase {
this._persistenceCacheSizeBytes = bytes;
} catch (e) {}
}
_persistenceEnabled: boolean = false;
_persistenceEnabled = false;
get persistenceEnabled(): boolean {
return this._persistenceEnabled;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase-firestore/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function deserializeField(value) {
}

if (value instanceof java.util.Map) {
let dict = {};
const dict = {};
const keys = value.keySet().toArray();
const size = keys.length;
for (let i = 0, n = size; i < n; i++) {
Expand Down Expand Up @@ -1145,7 +1145,7 @@ export class FieldValue implements IFieldValue {
export class GeoPoint implements IGeoPoint {
_native: com.google.firebase.firestore.GeoPoint;

constructor(latitude: number, longitude: number, native: boolean = false) {
constructor(latitude: number, longitude: number, native = false) {
if (!native) {
this._native = new com.google.firebase.firestore.GeoPoint(latitude, longitude);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase-installations/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Installations implements IInstallations {
);
});
}
getToken(forceRefresh: boolean = false): Promise<string> {
getToken(forceRefresh = false): Promise<string> {
return new Promise((resolve, reject) => {
org.nativescript.firebase.installations.FirebaseInstallations.getToken(
this.native,
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase-messaging-core/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const onNotificationTapCallbacks: Set<(message: any) => void> = new Set();

let lastActivity: WeakRef<androidx.appcompat.app.AppCompatActivity>;
let requestPermissionLauncher: androidx.activity.result.ActivityResultLauncher<any>;
let _permissionQueue: { resolve: Function; reject: Function }[] = [];
const _permissionQueue: { resolve: Function; reject: Function }[] = [];

function register(args: any) {
if (!lastActivity) {
Expand Down
26 changes: 14 additions & 12 deletions packages/firebase-storage/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,6 @@ export class Metadata implements IMetadata {
return this.native.getBucket?.();
}

get cacheControl(): string {
return this.native.getCacheControl?.();
}

private _createBuilder() {
if (this._native) {
this._builder = new com.google.firebase.storage.StorageMetadata.Builder(this._native);
Expand All @@ -251,6 +247,10 @@ export class Metadata implements IMetadata {
}
}

get cacheControl(): string {
return this.native.getCacheControl?.();
}

set cacheControl(value) {
if (!this._builder) {
this._createBuilder();
Expand Down Expand Up @@ -510,16 +510,18 @@ export class Reference implements IReference {
putString(data: string, format: StringFormat = StringFormat.RAW, metadata?: Metadata): Task {
switch (format) {
case StringFormat.DATA_URL:
const base64 = b64WithoutPrefix(data);
const mime = getMIMEforBase64String(data);

const meta = metadata || new Metadata();
if (!metadata.contentType) {
meta.contentType = mime;
}
{
const base64 = b64WithoutPrefix(data);
const mime = getMIMEforBase64String(data);

org.nativescript.firebase.storage.FirebaseStorage.StorageReference.putString(this.native, base64, format, meta.native);
const meta = metadata || new Metadata();
if (!metadata.contentType) {
meta.contentType = mime;
}

org.nativescript.firebase.storage.FirebaseStorage.StorageReference.putString(this.native, base64, format, meta.native);
}
break;
default:
return Task.fromNative(org.nativescript.firebase.storage.FirebaseStorage.StorageReference.putString(this.native, data, format, metadata?.native || null));
}
Expand Down
16 changes: 10 additions & 6 deletions packages/firebase-storage/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,16 @@ export class Reference implements IReference {
nsData = NSData.alloc().initWithBase64EncodedStringOptions(data, 0);
break;
case StringFormat.BASE64URL:
let base64Encoded = data.replace(/-/g, '+').replace(/_/g, '/');
{
let base64Encoded = data.replace(/-/g, '+').replace(/_/g, '/');

while (base64Encoded.length % 4 != 0) {
base64Encoded = base64Encoded + '=';
while (base64Encoded.length % 4 != 0) {
base64Encoded = base64Encoded + '=';
}
nsData = NSData.alloc().initWithBase64EncodedStringOptions(data, 0);
}
nsData = NSData.alloc().initWithBase64EncodedStringOptions(data, 0);
break;
case StringFormat.DATA_URL:
case StringFormat.DATA_URL: {
const base64 = b64WithoutPrefix(data);
const mime = getMIMEforBase64String(data);

Expand All @@ -505,12 +507,14 @@ export class Reference implements IReference {
meta.contentType = mime;
}
return Task.fromNative(this.native.putDataMetadata(NSData.alloc().initWithBase64EncodedStringOptions(base64, 0), meta.native));
default:
}
default: {
const text = NSString.stringWithString(data);
const nativeData = text.dataUsingEncoding(NSUTF8StringEncoding);
const encodedString = nativeData.base64EncodedStringWithOptions(0);
nsData = NSData.alloc().initWithBase64EncodedStringOptions(encodedString, 0);
break;
}
}

if (metadata) {
Expand Down
13 changes: 7 additions & 6 deletions packages/firebase-ui/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ export class EmailProvider extends ProviderBase {

actionCodeSettings: ActionCodeSettings = null;

requireName: boolean = true;
requireName = true;

_forceSameDevice = false;

_forceSameDevice: boolean = false;
forceSameDevice() {
this._forceSameDevice = true;
return this;
Expand All @@ -199,9 +200,9 @@ export class EmailProvider extends ProviderBase {
return this;
}

defaultEmail: string = '';
defaultEmail = '';

allowNewAccounts: boolean = true;
allowNewAccounts = true;

getNative(ui: UI) {
if (this.requireName) {
Expand All @@ -216,9 +217,9 @@ export class PhoneProvider extends ProviderBase {
super();
}

defaultNumber: string = '';
defaultNumber = '';

defaultCountryIso: string = '';
defaultCountryIso = '';

blacklistedCountries: string[] = [];

Expand Down
Binary file modified packages/firebase-ui/platforms/android/firebase_ui.aar
Binary file not shown.

0 comments on commit dc60cbc

Please sign in to comment.