Skip to content

Commit

Permalink
ios: Splash screen loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
breautek committed Feb 18, 2025
1 parent 9758ed5 commit 46e1301
Show file tree
Hide file tree
Showing 33 changed files with 1,121 additions and 14 deletions.
112 changes: 111 additions & 1 deletion ios/BTFuse/BTFuse.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
14 changes: 14 additions & 0 deletions ios/BTFuse/BTFuse/BTFuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,19 @@ FOUNDATION_EXPORT const unsigned char BTFuseVersionString[];
#import <BTFuse/BTFuseContextDelegate.h>
#import <BTFuse/BTFuseStreamReader.h>

// Utilities
#import <BTFuse/BTFuseProgressProtocol.h>
#import <BTFuse/BTFuseProgressContextProtocol.h>
#import <BTFuse/BTFuseProgressListenerProtocol.h>
#import <BTFuse/BTFuseProgressContextListenerProtocol.h>
#import <BTFuse/BTFuseProgressResolutionStrategyProtocol.h>
#import <BTFuse/BTFuseProgress.h>
#import <BTFuse/BTFuseProgressContext.h>
#import <BTFuse/BTFuseWeightedResolutionStrategy.h>
#import <BTFuse/BTFuseNormalizedResolutionStrategy.h>

// Core Plugins
#import <BTFuse/BTFuseRuntime.h>

// Views
#import <BTFuse/BTFuseSplashLoaderView.h>
8 changes: 7 additions & 1 deletion ios/BTFuse/BTFuse/BTFuseContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ limitations under the License.
#import <WebKit/WebKit.h>
#import <BTFuse/BTFuseAPIResponseFactory.h>
#import <BTFuse/BTFuseContextDelegate.h>
#import <BTFuse/BTFuseProgressContextListenerProtocol.h>
#import <BTFuse/BTFuseProgressContext.h>

@class BTFuseViewController;
@class BTFusePlugin;
@class BTFuseAPIRouter;
@class BTFuseLogger;

@interface BTFuseContext: NSObject
@interface BTFuseContext: NSObject <BTFuseProgressContextListenerProtocol>

- (nonnull instancetype) init NS_UNAVAILABLE;
//- (nonnull instancetype) init NS_DESIGNATED_INITIALIZER;
Expand All @@ -51,6 +53,10 @@ limitations under the License.
- (nonnull BTFuseLogger*) getLogger;
- (nonnull id<WKNavigationDelegate>) createWebviewNavigationDelegate;
- (nonnull NSString*) getHost;
- (nonnull BTFuseProgressContext*) getProgressContext;

- (void) initAPIServer;
- (void) onWebviewReady;

@end

Expand Down
1 change: 1 addition & 0 deletions ios/BTFuse/BTFuse/BTFuseContextDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ limitations under the License.
- (void) dispatchToWebview:(nonnull NSString*) callbackID;
- (nonnull WKWebView*) getWebview;
- (nonnull UIView*) getLayout;
- (void) onFuseLoad;

@end

Expand Down
31 changes: 31 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseNormalizedResolutionStrategy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseNormalizedResolutionStrategy_h
#define BTFuseNormalizedResolutionStrategy_h

#import <BTFuse/BTFuseProgressResolutionStrategyProtocol.h>
#import <BTFuse/BTFuseProgressProtocol.h>

@interface BTFuseNormalizedResolutionStrategy: NSObject <BTFuseProgressResolutionStrategyProtocol>

- (float) execute:(NSArray<id<BTFuseProgressProtocol>>* _Nonnull) progresses;

@end


#endif
52 changes: 52 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseProgress.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseProgress_h
#define BTFuseProgress_h

#import <BTFuse/BTFuseProgressProtocol.h>
#import <BTFuse/BTFuseProgressListenerProtocol.h>

@interface BTFuseProgress: NSObject <BTFuseProgressProtocol>

- (instancetype _Nonnull) init;
- (instancetype _Nonnull) init:(NSInteger) value;
- (instancetype _Nonnull) init:(NSInteger) value min:(NSInteger) min max:(NSInteger) max;

- (void) setMin:(NSInteger) min;
- (void) setMax:(NSInteger) max;
- (void) setValue:(NSInteger) value;

- (NSInteger) getMin;
- (NSInteger) getMax;
- (NSInteger) getValue;

- (void) reset;

- (void) update:(NSInteger) value;
- (void) update:(NSInteger) value min:(nullable NSNumber*) min max:(nullable NSNumber*) max;

- (float) getNormalizedValue;

- (void) addListener:(_Nonnull id<BTFuseProgressListenerProtocol>) listener;
- (void) removeListener:(_Nonnull id<BTFuseProgressListenerProtocol>) listener;

- (bool) isComplete;

@end

#endif
54 changes: 54 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseProgressContext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseProgressContext_h
#define BTFuseProgressContext_h

#import <BTFuse/BTFuseProgressContextProtocol.h>
#import <BTFuse/BTFuseProgressContextListenerProtocol.h>
#import <BTFuse/BTFuseProgressResolutionStrategyProtocol.h>
#import <BTFuse/BTFuseProgressListenerProtocol.h>

@interface BTFuseProgressContext: NSObject <BTFuseProgressContextProtocol, BTFuseProgressListenerProtocol>

- (instancetype _Nonnull) init NS_DESIGNATED_INITIALIZER;
- (void) setResolutionStrategy:(id<BTFuseProgressResolutionStrategyProtocol> _Nonnull) strategy;
- (void) createProgress:(NSString* _Nonnull) ident;

- (NSInteger) getMax;
- (NSInteger) getValue;
- (void) set:(NSString* _Nonnull) ident max:(NSInteger) max;
- (void) set:(NSString* _Nonnull) ident value:(NSInteger) value;

- (bool) isComplete;
- (bool) isComplete:(NSString* _Nonnull) ident;

- (void) reset;

- (float) getNormalizedValue;

- (void) update:(NSString* _Nonnull) ident value:(NSInteger) value;
- (void) update:(NSString* _Nonnull) ident value:(NSInteger) value min:(nullable NSNumber*) min max:(nullable NSNumber*) max;

- (void) addListener:(_Nonnull id<BTFuseProgressContextListenerProtocol>) listener;
- (void) removeListener:(_Nonnull id<BTFuseProgressContextListenerProtocol>) listener;

- (void) onProgressUpdate:(_Nonnull id<BTFuseProgressProtocol>) progress;

@end

#endif
28 changes: 28 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseProgressContextListenerProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseProgressContextListenerProtocol_h
#define BTFuseProgressContextListenerProtocol_h

@protocol BTFuseProgressContextProtocol;
@protocol BTFuseProgressContextListenerProtocol <NSObject>

- (void) onProgressContextUpdate:(_Nonnull id<BTFuseProgressContextProtocol>) progress;

@end

#endif
46 changes: 46 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseProgressContextProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseProgressContextProtocol_h
#define BTFuseProgressContextProtocol_h

@protocol BTFuseProgressContextListenerProtocol;
@protocol BTFuseProgressContextProtocol <NSObject>

- (void) createProgress:(NSString* _Nonnull) ident;

- (NSInteger) getMax;
- (NSInteger) getValue;
- (void) set:(NSString* _Nonnull) ident max:(NSInteger) max;
- (void) set:(NSString* _Nonnull) ident value:(NSInteger) value;

- (bool) isComplete;
- (bool) isComplete:(NSString* _Nonnull) ident;

- (void) reset;

- (float) getNormalizedValue;

- (void) update:(NSString* _Nonnull) ident value:(NSInteger) value;
- (void) update:(NSString* _Nonnull) ident value:(NSInteger) value min:(nullable NSNumber*) min max:(nullable NSNumber*) max;

- (void) addListener:(_Nonnull id<BTFuseProgressContextListenerProtocol>) listener;
- (void) removeListener:(_Nonnull id<BTFuseProgressContextListenerProtocol>) listener;

@end

#endif
29 changes: 29 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseProgressListenerProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseProgressListenerProtocol_h
#define BTFuseProgressListenerProtocol_h

@protocol BTFuseProgressProtocol;

@protocol BTFuseProgressListenerProtocol

- (void) onProgressUpdate:(_Nonnull id<BTFuseProgressProtocol>) progress;

@end

#endif
46 changes: 46 additions & 0 deletions ios/BTFuse/BTFuse/utils/BTFuseProgressProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

/*
Copyright 2025 Breautek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#ifndef BTFuseProgressProtocol_h
#define BTFuseProgressProtocol_h

@protocol BTFuseProgressListenerProtocol;
@protocol BTFuseProgressProtocol

- (NSInteger) getMin;
- (NSInteger) getMax;
- (NSInteger) getValue;

- (void) setMin:(NSInteger) min;
- (void) setMax:(NSInteger) max;
- (void) setValue:(NSInteger) value;

- (bool) isComplete;

- (void) reset;

- (float) getNormalizedValue;

- (void) update:(NSInteger) value;
- (void) update:(NSInteger) value min:(nullable NSNumber*) min max:(nullable NSNumber*) max;

- (void) addListener:(_Nonnull id<BTFuseProgressListenerProtocol>) listener;
- (void) removeListener:(_Nonnull id<BTFuseProgressListenerProtocol>) listener;

@end

#endif
Loading

0 comments on commit 46e1301

Please sign in to comment.